Help me in solving XOR1248 problem

My issue

What is wrong with this solution?

for _ in range(int(input())):
n= int(input())
l= list(map(int, input().split()))

cnt, a, b= [0 for _ in range(61)], 0, 0
for i in l:
    temp= bin(i)[2:][::-1]
    a, b= a | i, b ^ i
    for j in range(61):
        cnt[j] = cnt[j] + (1 if (j < len(temp) and temp[j] == '1') else 0)

found= False
a= bin(a)[2:][::-1] 
for i in range(60, 0, -1):
    if(found):
        b= b | pow(2, i)
    else:
        if(cnt[i] > 1):
            found, b= True, b | pow(2, i)
print(b) 

My code

for _ in range(int(input())):
    n= int(input())
    l= list(map(int, input().split()))
    
    cnt, a, b= [0 for _ in range(61)], 0, 0
    for i in l:
        temp= bin(i)[2:][::-1]
        a, b= a | i, b ^ i
        for j in range(61):
            cnt[j] = cnt[j] + (1 if (j < len(temp) and temp[j] == '1') else 0)
    
    found= False
    a= bin(a)[2:][::-1] 
    for i in range(60, 0, -1):
        if(found):
            b= b | pow(2, i)
        else:
            if(cnt[i] > 1):
                found, b= True, b | pow(2, i)
    print(b)

Problem Link: Split And Maximize Practice Coding Problem