I was seeing a solution of a problem
in the solution an array is declared as
int vec[1000000]
when i copied the code and tried to run it on my system it gives me error but when i submitted the same code on codechef i got correct answer.
while searching for the cause i found out that i cant declare array of that size because stack memory is limited. i should declare it in heap using dynamic memory allocation but my question is that how i got correct answer on codechef ?