Given an array of n elements and q queries of 2 types:

type 1: Given two numbers p and x, the value at index p should be updated to x.

type 2: Given two numbers p and x, calculate total number of subarrays whose starting index is 0 and the last index is ≤ p and the xor of all elements in that subarray is equal to x.

Solution:

This problem can be solved using square root decomposition technique. I have wrote an editorial of this problem on my blog.

Hello, shahidul_brur I understood your editorial and tried to implement the solution. But I am getting WA on two test cases. Can you help me find out what is wrong.