what's wrong with my code?BINARY STRINGS in NOV18A

my solution is this…
https://www.codechef.com/viewsolution/21605893 in python 3
what’s wrong with my code when compared with this…
https://www.codechef.com/viewsolution/21610227 in java

both are simple brute force but mine was TLE and the other was partially executed

@admin@vijju please help

check this in pypy which was accepted …

I used trie data structure with segment tree which was correct for only one test case.
Although the good thing was that there were no TLE for any other test case.

Maximum Xor Query is same as the above problem.