Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A =list(map(int, input().split(" ")))
 
r = N
asum = [0]
axor = [0]
 
for i in A:
    asum.append(asum[-1] + i)
    axor.append(axor[-1] ^ i)
 
for i in range(len(A)):
    for j in range(i+1, len(A)):
        if (asum[j+1] - asum[i]) == (axor[j+1] ^ axor[i]):
            r += 1
        else:
            break
 
print(r)

Fixed submission:
N = int(input())
A = list(map(int, input().split(" ")))

res = 0
asum = [0]
axor = [0]

for i in A:
    asum.append(asum[-1] + i)
    axor.append(axor[-1] ^ i)

for l in range(N):
    ok = l+1
    ng = N+1
    while(ng - ok > 1):
        r = (ok + ng) // 2
        s = (axor[r] ^ axor[l])
        t = (asum[r] - asum[l])
        if s == t:
            ok = r
        else:
            ng = r
    
    res += ok - l
         
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A =list(map(int, input().split(" ")))

res = 0
asum = [0]
axor = [0]

for i in A:
    asum.append(asum[-1] + i)
    axor.append(axor[-1] ^ i)

for l in range(N):
    ok = l+1
    ng = N+1
    while(ng - ok > 1):
        r = (ok + ng) // 2
        s = (axor[r] ^ axor[l])
        t = (asum[r] - asum[l])
        if s == t:
            ok = r
        else:
            ng = r
    
    res += ok - l
         
print(res)

Fixed submission:
N = int(input())
A = list(map(int, input().split(" ")))

res = 0
asum = [0]
axor = [0]

for i in A:
    asum.append(asum[-1] + i)
    axor.append(axor[-1] ^ i)

for l in range(N):
    ok = l+1
    ng = N+1
    while(ng - ok > 1):
        r = (ok + ng) // 2
        s = (axor[r] ^ axor[l])
        t = (asum[r] - asum[l])
        if s == t:
            ok = r
        else:
            ng = r
    
    res += ok - l
         
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A =list(map(int, input().split(" ")))

r = N
asum = [0]
axor = [0]

for i in A:
    asum.append(asum[-1] + i)
    axor.append(axor[-1] ^ i)

for i in range(len(A)):
    for j in range(i+1, len(A)):
        if (asum[j+1] - asum[i]) == (axor[j+1] ^ axor[i]):
            r += 1
        else:
            break

print(r)

Fixed submission:
N = int(input())
A = list(map(int, input().split(" ")))

res = 0
asum = [0]
axor = [0]

for i in A:
    asum.append(asum[-1] + i)
    axor.append(axor[-1] ^ i)

for l in range(N):
    ok = l+1
    ng = N+1
    while(ng - ok > 1):
        r = (ok + ng) // 2
        s = (axor[r] ^ axor[l])
        t = (asum[r] - asum[l])
        if s == t:
            ok = r
        else:
            ng = r
    
    res += ok - l
         
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A =list(map(int, input().split(" ")))

r = N
asum = [0]

for i in A:
    asum.append(asum[-1] + i)    

for i in range(len(A)):
    Axor = A[i]
    for j in range(i+1, len(A)):
        Axor = Axor ^ A[j]
        if (asum[j+1] - asum[i]) == Axor:
            r += 1
        else:
            break

print(r)

Fixed submission:
N = int(input())
A = list(map(int, input().split(" ")))

res = 0
asum = [0]
axor = [0]

for i in A:
    asum.append(asum[-1] + i)
    axor.append(axor[-1] ^ i)

for l in range(N):
    ok = l+1
    ng = N+1
    while(ng - ok > 1):
        r = (ok + ng) // 2
        s = (axor[r] ^ axor[l])
        t = (asum[r] - asum[l])
        if s == t:
            ok = r
        else:
            ng = r
    
    res += ok - l
         
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A =list(map(int, input().split(" ")))

r = 0
asum = [0]

for i in A:
    asum.append(asum[-1] + i)    

for i in range(len(A)):
    Axor = A[i]
    for j in range(i, len(A)):
        if ( i == j ):
            r += 1
        else:
            Axor = Axor ^ A[j]
            if (asum[j+1] - asum[i]) == Axor:
                r += 1
            else:
                break

print(r)

Fixed submission:
N = int(input())
A = list(map(int, input().split(" ")))

res = 0
asum = [0]
axor = [0]

for i in A:
    asum.append(asum[-1] + i)
    axor.append(axor[-1] ^ i)

for l in range(N):
    ok = l+1
    ng = N+1
    while(ng - ok > 1):
        r = (ok + ng) // 2
        s = (axor[r] ^ axor[l])
        t = (asum[r] - asum[l])
        if s == t:
            ok = r
        else:
            ng = r
    
    res += ok - l
         
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A =list(map(int, input().split(" ")))

r = 0
asum = [0]

for i in A:
    asum.append(asum[-1] + i)    

for i in range(len(A)):
    Axor = A[i]
    for j in range(i, len(A)):
        if ( i == j ):
            r += 1
        else:
            Axor = Axor ^ A[j]      
            if (asum[j+1] - asum[i]) == Axor:
                r += 1

print(r)

Fixed submission:
N = int(input())
A = list(map(int, input().split(" ")))

res = 0
asum = [0]
axor = [0]

for i in A:
    asum.append(asum[-1] + i)
    axor.append(axor[-1] ^ i)

for l in range(N):
    ok = l+1
    ng = N+1
    while(ng - ok > 1):
        r = (ok + ng) // 2
        s = (axor[r] ^ axor[l])
        t = (asum[r] - asum[l])
        if s == t:
            ok = r
        else:
            ng = r
    
    res += ok - l
         
print(res)