XOR Sum-I Problem

https://ide.codingblocks.com/s/39937

https://ide.codingblocks.com/s/39938

codes for https://hack.codingblocks.com/contests/c/512/562
I am unable to understand the problem statement clearly, coz both these codes are not passing.

Pls help.

Thanks

Yes, you have not interpreted the problem right.

You are using
a[n-1]+=n;
ie you are adding n (no of elements to last element)

But question says
Add an integer, x to Ai (where -Ai<=x<=Ai )

Try to attempt it again after reading the question carefully.

sir can you please send the correct code. my code is giving errors.