Test case fail in divisible subarrays

Code is failing for one test case.
link-https://ide.codingblocks.com/s/83147

Change the size of input array and the prefixsum array to 10000000, rest code is fine

After changing the size now i am getting run-error in one test case?


I have corrected your code a little bit, try to submit it now

Still getting wrong answer for one input


Try to submit it now, I have simply used a function for this.