You are kind of close to the memory limit. On CF, try that you dont exceed $4.5*{10}^{6}$ total size of arrays.
$3*{10}^{6}$ size arrays take $100MB$ there.

Now coming to your problem.

Your struct sqrts has 8 parameters, out of which 1 is string of length $N$ and other is another struct with ~$32$ more variables (counting the child[28] as 28 variables).

Thats around 40 variables and a string of size $N$ per sqrt thing. It seems you are making $\sqrt{N}$ such structures. That becomes $40N\sqrt{N}$ , and in my opinion the constant is a bit too high.

answered
**25 Jan '18, 19:13**

5★vijju123 ♦♦

15.5k●1●20●66

accept rate:
18%

please comment on this solution.

@vijju123 can you please comment on the space complexity. It is the same code that u had debugged.