Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect,bisect_left
import numpy as np
N = int(input())
A = np.int32(input().split())
B = np.int32(input().split())

ans = [0]*29

for k in range(29):
    a = np.sort(np.hstack((A%(2**(k+1)),A%(2**(k+1))-2**(k+1))))
    for b in B:
        b_k = b%(2**(k+1))
        ans[k] += bisect(a,2**(k+1)-1-b_k)-bisect_left(a,2**k-b_k)
        ans[k] %= 2

print(sum([ans[k]*2**k for k in range(29)]))

Fixed submission:
import numpy as np
N = int(input())
A = np.int32(input().split())
B = np.int32(input().split())

ans_arr = np.zeros(29,int)
for k in range(29):
    a = np.sort(A%(2**(k+1)))
    b = B%(2**(k+1))
    ans_arr[k] += np.sum(np.searchsorted(a,2**(k+1)-1-b,side='right')-np.searchsorted(a,2**k-b))
    ans_arr[k] += np.sum(N-np.searchsorted(a,3*2**k-b))
    ans_arr[k] %= 2

ans = 0
for k in range(29):
    ans += ans_arr[k]*2**k

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect,bisect_left
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

ans = [0]*29

for k in range(29):
    a = sorted([a%(2**(k+1)) for a in A]+[a%(2**(k+1))-2**(k+1) for a in A])
    for b in B:
        b_k = b%(2**(k+1))
        ans[k] += bisect(a,2**(k+1)-1-b_k)-bisect_left(a,2**k-b_k)
        ans[k] %= 2

print(sum([ans[k]*2**k for k in range(29)]))

Fixed submission:
import numpy as np
N = int(input())
A = np.int32(input().split())
B = np.int32(input().split())

ans_arr = np.zeros(29,int)
for k in range(29):
    a = np.sort(A%(2**(k+1)))
    b = B%(2**(k+1))
    ans_arr[k] += np.sum(np.searchsorted(a,2**(k+1)-1-b,side='right')-np.searchsorted(a,2**k-b))
    ans_arr[k] += np.sum(N-np.searchsorted(a,3*2**k-b))
    ans_arr[k] %= 2

ans = 0
for k in range(29):
    ans += ans_arr[k]*2**k

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect,bisect_left
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

ans = [0]*29

for k in range(29):
    a = sorted([a%(2**(k+1)) for a in A]+[a%(2**(k+1))-2**(k+1) for a in A])
    for b in B:
        b_k = b%(2**(k+1))
        ans[k] += bisect(a,2**(k+1)-1-b_k)-bisect_left(a,2**k-b_k)
        ans[k] %= 2

print(sum([ans[k]*2**k for k in range(29)]))

Fixed submission:
import numpy as np
N = int(input())
A = np.int32(input().split())
B = np.int32(input().split())

ans_arr = np.zeros(29,int)
for k in range(29):
    a = np.sort(A%(2**(k+1)))
    b = B%(2**(k+1))
    ans_arr[k] += np.sum(np.searchsorted(a,2**(k+1)-1-b,side='right')-np.searchsorted(a,2**k-b))
    ans_arr[k] += np.sum(N-np.searchsorted(a,3*2**k-b))
    ans_arr[k] %= 2

ans = 0
for k in range(29):
    ans += ans_arr[k]*2**k

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect,bisect_left
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

ans = [0]*29
for k in range(29):
    ans[k] = 0

for b in B:
    for k in range(29):
        b_k = b%(2**(k+1))
        a = sorted([a%(2**(k+1)) for a in A])
        ans[k] += bisect(a,2**(k+1)-1-b_k)-bisect_left(a,2**k-b_k)
        ans[k] += N-bisect_left(a,3*2**k-b_k)
        ans[k] %= 2

print(sum([ans[k]*2**k for k in range(29)]))

Fixed submission:
import numpy as np
N = int(input())
A = np.int32(input().split())
B = np.int32(input().split())

ans_arr = np.zeros(29,int)
for k in range(29):
    a = np.sort(A%(2**(k+1)))
    b = B%(2**(k+1))
    ans_arr[k] += np.sum(np.searchsorted(a,2**(k+1)-1-b,side='right')-np.searchsorted(a,2**k-b))
    ans_arr[k] += np.sum(N-np.searchsorted(a,3*2**k-b))
    ans_arr[k] %= 2

ans = 0
for k in range(29):
    ans += ans_arr[k]*2**k

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect,bisect_left
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

ans = [0]*29
for k in range(29):
    ans[k] = 0

for b in B:
    for k in range(29):
        b_k = b%(2**(k+1))
        a = sorted([a%(2**(k+1)) for a in A])
        ans[k] += bisect(a,2**(k+1)-1-b_k)-bisect_left(a,2**k-b_k)
        ans[k] += N-bisect_left(a,3*2**k-b_k)
        ans[k] %= 2

print(sum([ans[k]*2**k for k in range(29)]))

Fixed submission:
import numpy as np
N = int(input())
A = np.int32(input().split())
B = np.int32(input().split())

ans_arr = np.zeros(29,int)
for k in range(29):
    a = np.sort(A%(2**(k+1)))
    b = B%(2**(k+1))
    ans_arr[k] += np.sum(np.searchsorted(a,2**(k+1)-1-b,side='right')-np.searchsorted(a,2**k-b))
    ans_arr[k] += np.sum(N-np.searchsorted(a,3*2**k-b))
    ans_arr[k] %= 2

ans = 0
for k in range(29):
    ans += ans_arr[k]*2**k

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = list(map(lambda x:(29-len(bin(int(x))[2:]))*'0'+bin(int(x))[2:],input().split()))
B = list(map(lambda x:(29-len(bin(int(x))[2:]))*'0'+bin(int(x))[2:],input().split()))

a_arr = []
b_arr = []
for k in range(29):
    a_arr.append(sorted(list(map(lambda x:int(x[-k-1:],2),A))))
    b_arr.append(list(map(lambda x:int(x[-k-1:],2),B)))

a_arr = np.array(a_arr)
b_arr = np.array(b_arr)

ans_arr = np.zeros(29,int)

for k in range(29):
    ans_arr[k] += np.sum(np.searchsorted(a_arr[k],2**(k+1)-1-b_arr[k],side='right')-np.searchsorted(a_arr[k],2**k-b_arr[k]))
    ans_arr[k] += np.sum(N-np.searchsorted(a_arr[k],3*2**k-b_arr[k]))
    ans_arr[k] %= 2

ans = 0
for k in range(29):
    ans += ans_arr[k]*2**k

print(ans)

Fixed submission:
import numpy as np
N = int(input())
A = np.int32(input().split())
B = np.int32(input().split())

ans_arr = np.zeros(29,int)
for k in range(29):
    a = np.sort(A%(2**(k+1)))
    b = B%(2**(k+1))
    ans_arr[k] += np.sum(np.searchsorted(a,2**(k+1)-1-b,side='right')-np.searchsorted(a,2**k-b))
    ans_arr[k] += np.sum(N-np.searchsorted(a,3*2**k-b))
    ans_arr[k] %= 2

ans = 0
for k in range(29):
    ans += ans_arr[k]*2**k

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect,bisect_left
N = int(input())
A = list(map(lambda x:(29-len(bin(int(x))[2:]))*'0'+bin(int(x))[2:],input().split()))
B = list(map(lambda x:(29-len(bin(int(x))[2:]))*'0'+bin(int(x))[2:],input().split()))

a_d = {}
for k in range(29):
    a_d[k] = sorted(list(map(lambda x:int(x[-k-1:],2),A)))

ans_d = {}
for k in range(29):
    ans_d[k] = 0

for b in B:
    for k in range(29):
        b_k = int(b[-k-1:],2)
        ans_d[k] += bisect(a_d[k],2**(k+1)-1-b_k)-bisect_left(a_d[k],2**k-b_k)
        ans_d[k] += N-bisect_left(a_d[k],3*2**k-b_k)
        ans_d[k] %= 2

ans = 0
for k in range(29):
    ans += 2**k*ans_d[k]

print(ans)

Fixed submission:
import numpy as np
N = int(input())
A = np.int32(input().split())
B = np.int32(input().split())

ans_arr = np.zeros(29,int)
for k in range(29):
    a = np.sort(A%(2**(k+1)))
    b = B%(2**(k+1))
    ans_arr[k] += np.sum(np.searchsorted(a,2**(k+1)-1-b,side='right')-np.searchsorted(a,2**k-b))
    ans_arr[k] += np.sum(N-np.searchsorted(a,3*2**k-b))
    ans_arr[k] %= 2

ans = 0
for k in range(29):
    ans += ans_arr[k]*2**k

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
n = ""
for i in range(29):
    Atmp = list(map(lambda x:x%pow(2,i+1),A))
    Btmp = list(map(lambda x:x%pow(2,i+1),B))
    Btmp.sort()
    T = pow(2,i)
    nn = 0
    for a in Atmp:
        j = bisect.bisect_right(Btmp,T-a)
        k = bisect.bisect_right(Btmp,2*T-a)-1
        if j<=k:
            nn += k-j+1
        j = bisect.bisect_right(Btmp,3*T-a)
        k = bisect.bisect_right(Btmp,4*T-a)-1
        if j<=k:
            nn += k-j+1
    nn = nn%2
    n = str(nn)+n
nn = 0
for i in range(29):
    if n[-i-1] == "1":
        nn += pow(2,i)
print(nn)

Fixed submission:
import numpy as np
N = int(input())
A = np.int32(input().split())
B = np.int32(input().split())

ans_arr = np.zeros(29,int)
for k in range(29):
    a = np.sort(A%(2**(k+1)))
    b = B%(2**(k+1))
    ans_arr[k] += np.sum(np.searchsorted(a,2**(k+1)-1-b,side='right')-np.searchsorted(a,2**k-b))
    ans_arr[k] += np.sum(N-np.searchsorted(a,3*2**k-b))
    ans_arr[k] %= 2

ans = 0
for k in range(29):
    ans += ans_arr[k]*2**k

print(ans)