getting runtime error ! please help!!

i have to generate all possible unique combination of integer partition!

my code :

it is working fine for n <= 27 but above this it was giving runtime error…i have tried by increasing array size but it didn’t work (:

i tested the same here

all the answers upto 27 are correct but i am unable to get the fault!!

please help me!!

You are getting runtime error even for input as small as 5. And reason is not far to see. Roughly, the sum of all array sizes you are declaring is 1.2 x 10^8, and it is just too big!!

Most sites like hackerrank barely allow an array size over 10^7 (at times not even that). Codechef has a lenient memory policy, but I dont think geeksforgeeks has that. You are taking too much memory and hence getting RE:SIGSEV before even taking the input.

Try to see if you can optimize it memory wise.

1 Like