Skip to main content
2 of 4
added 10 characters in body
Dennis
  • 210.6k
  • 41
  • 370
  • 825

Python 2, 117 116 bytes

def f(n):r='',;exec"r=[s+c for s in r for c in')('[s.count(')')*2>=len(s):2-s.count('(')/n]];"*2*n;print'\n'.join(r)

With piped output and input n = 15, this takes roughly 39 seconds with CPython and 8.5 seconds with PyPy on my machine.

Test it on Ideone.

Dennis
  • 210.6k
  • 41
  • 370
  • 825