what is wrong with my code in chef and xor queries

solution link https://www.codechef.com/viewsolution/16552753
i am basically getting 20 points

Lets assume value of n to be 2000.

After reading every value, you’re updating the prefix and at the end of every block you’re updating blockxor.

For the 0th bucket, all the values from a[0] to a[1000] are xor’d and stored in blockxor[0].
This is 1001 values.
For the 1st bucket, the values from a[1001] to a[1999] are xor’d but not stored in blockxor[1] (because blockxor[1] gets updated only for i=2000 but loop stops at 1999) .
Also, this is only 999 values.

Now lets consider an update query on the index value 1000.(l=1000 after decrement)

You’re identifying the bucket index by l/bs.
So 1000/1000=1;

The values present in the 1st bucket are updated instead of the 0th bucket though initially you mapped the index 1000 to the 0th bucket.

Also, you aren’t updating the blockxor[bucket] after performing an update.