Can anybody tell me where I went wrong in this code.Last test case is working correctly.
link to my ans is: https://www.codechef.com/viewsolution/15553550.
I think the issue is somewhere in the specifiers. Try switching to int and using %d instead of %ld, or just remove the unsigned and try again.
Side note, if you are doing 1 based indexing, declare array size of {10}^{5}+1=100001