fork download
  1. import re;from itertools import*;G=lambda f:{i for i in map(''.join,permutations("[()]*"*f,f))if re.fullmatch("(\**\[\**\]\**|\**\(\**\)\**)*|\**",i)}
  2. exec("print(G(int(input())));print();"*5)
Success #stdin #stdout 0.12s 9992KB
stdin
0
1
2
3
4
stdout
{''}

{'*'}

{'[]', '**', '()'}

{'(*)', '*()', '[*]', '[]*', '*[]', '()*', '***'}

{'**()', '*[]*', '*()*', '[]()', '****', '(**)', '[]**', '[**]', '[][]', '**[]', '()**', '*(*)', '(*)*', '[*]*', '*[*]', '()()', '()[]'}