RE in COOK82C

https://www.codechef.com/viewsolution/62661567

Can someone tell whats wrong in the code ??

Thanks for sharing your doubt.

Your code gives segmentation fault. As the maximum size of ‘ans’ array is 10^6 but a[i] < 2^63. This means that at most an element can be divided 63 times before reaching 0. And, there are at maximum 10^6 elements in the array.
This means that size of ‘ans’ will be at max 63*(10^6).

So for some test cases, you are accessing ‘ans’ array out of bound.