So my idea is save all values in map with index array, the loop the original array, for each value, find the range[l, r] matches the xor < and (example 45, [32, 63]),

then get the lowest value(min) >= 32, largest value(max) <= 63 in treemap keys, and get the matched index array, find j > i, add to res.

Don’t know why continues TLE should be O(nlogn)

https://www.codechef.com/viewsolution/61191418

https://www.codechef.com/viewsolution/61193125