Please tell me the problem in the code

only one testcase is passing.Showing tle for others. I have read the tutorial but haven’t explained it completely.Can you please help me in understanding the approach?

code link is :- https://ide.codingblocks.com/s/227123

While solving this question using trie.

  1. At each node of the trie, we will store the ith bit of the number for a query of type 0.
  2. To solve the query of type 1 we will store the indexes of the number that pass through that node.
  3. When we go down the tree during a query and maximizing the xor, we go in a direction that contains at least one index in range L to R, otherwise, we will go in the other direction.
  4. To search if at least one index is within the stored indexes we will use binary search.
    (Since the indices will always be positive, you can apply count sort on them. That will do your work in linear time.)

Now, keeping above in mind, try to correct your code.
updated code