Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
def f(i):
  a_nex=sorted([p%(2*2**i) for p in a])
  b_nex=sorted([p%(2*2**i) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and b_nex[p]<2**i-k:
      p+=1
    while q<N and b_nex[q]<2*2**i-k:
      q+=1
    while r<N and b_nex[r]<3*2**i-k:
      r+=1
    l+=q-p+N-r
  return (l%2)<<i
for k in range(29):
  ans+=f(k)
print(ans)   
  


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
def f(i):
  res=0
  t=2**i
  a_nex=sorted([p%(2*t) for p in a])
  b_nex=sorted([p%(2*t) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and k+b_nex[p]<t:
      p+=1
    while q<N and k+b_nex[q]<2*t:
      q+=1
    while r<N and k+b_nex[r]<3*t:
      r+=1
    l+=q-p+N-r
  res=(l%2)<<i
  return res
for k in range(29):
  ans+=f(k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(29):
  a_nex=sorted([p%(2*2**i) for p in a])
  b_nex=sorted([p%(2*2**i) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and b_nex[p]<2**i-k:
      p+=1
    while q<N and b_nex[q]<2*2**i-k:
      q+=1
    while r<N and b_nex[r]<3*2**i-k:
      r+=1
    l+=q-p+N-r
  ans+=l%2<<i
print(ans)   
  


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
def f(i):
  res=0
  t=2**i
  a_nex=sorted([p%(2*t) for p in a])
  b_nex=sorted([p%(2*t) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and k+b_nex[p]<t:
      p+=1
    while q<N and k+b_nex[q]<2*t:
      q+=1
    while r<N and k+b_nex[r]<3*t:
      r+=1
    l+=q-p+N-r
  res=(l%2)<<i
  return res
for k in range(29):
  ans+=f(k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(29):
  a_nex=sorted(list(map(lambda x:x%2**(i+1),a)))
  b_nex=sorted(list(map(lambda x:x%2**(i+1),b)))
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and b_nex[p]<2**i-k:
      p+=1
    while q<N and b_nex[q]<2*2**i-k:
      q+=1
    while r<N and b_nex[r]<3*2**i-k:
      r+=1
    l+=q-p+N-r
  ans+=l%2<<i
print(ans)   
  


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
def f(i):
  res=0
  t=2**i
  a_nex=sorted([p%(2*t) for p in a])
  b_nex=sorted([p%(2*t) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and k+b_nex[p]<t:
      p+=1
    while q<N and k+b_nex[q]<2*t:
      q+=1
    while r<N and k+b_nex[r]<3*t:
      r+=1
    l+=q-p+N-r
  res=(l%2)<<i
  return res
for k in range(29):
  ans+=f(k)
print(ans)

Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left,bisect

N=int(input())
a=list(map(int,input.split()))
b=list(map(int,input.split()))
ans=0
for i in range(29):
  a_nex=sorted(list(map(lambda x:x%2**(i+1),a)))
  b_nex=sorted(list(map(lambda x:x%2**(i+1),b)))
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and b_nex[p]<2**i-k:
      p+=1
    while q<N and b_nex[q]<2*2**i-k:
      q+=1
    while r<N and b_nex[r]<3*2**i-k:
      r+=1
    l+=q-p+N-r
  ans+=l%2<<i
print(ans)   
  


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
def f(i):
  res=0
  t=2**i
  a_nex=sorted([p%(2*t) for p in a])
  b_nex=sorted([p%(2*t) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and k+b_nex[p]<t:
      p+=1
    while q<N and k+b_nex[q]<2*t:
      q+=1
    while r<N and k+b_nex[r]<3*t:
      r+=1
    l+=q-p+N-r
  res=(l%2)<<i
  return res
for k in range(29):
  ans+=f(k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left,bisect
import sys
 
N=int(sys.stdin.readline())
a=list(map(int,sys.stdin.readline().split()))
b=list(map(int,sys.stdin.readline().split()))
ans=0
for i in range(29):
  a_nex=sorted(list(map(lambda x:x%2**(i+1),a)))
  b_nex=sorted(list(map(lambda x:x%2**(i+1),b)))
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and b_nex[p]<2**i-k:
      p+=1
    while q<N and b_nex[q]<2*2**i-k:
      q+=1
    while r<N and b_nex[r]<3*2**i-k:
      r+=1
    l+=q-p+N-r
  ans+=l%2<<i
print(ans)   
  


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
def f(i):
  res=0
  t=2**i
  a_nex=sorted([p%(2*t) for p in a])
  b_nex=sorted([p%(2*t) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and k+b_nex[p]<t:
      p+=1
    while q<N and k+b_nex[q]<2*t:
      q+=1
    while r<N and k+b_nex[r]<3*t:
      r+=1
    l+=q-p+N-r
  res=(l%2)<<i
  return res
for k in range(29):
  ans+=f(k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left,bisect
import sys
 
N=int(sys.stdin.readline())
a=list(map(int,sys.stdin.readline().split()))
b=list(map(int,sys.stdin.readline().split()))
ans=0
for i in range(29):
  a_nex=list(map(lambda x:x%2**(i+1),a))
  b_nex=sorted(list(map(lambda x:x%2**(i+1),b)))
  l=0
  for k in a_nex:
    p=bisect_left(b_nex,2**i-k-0.1)
    q=bisect(b_nex,2*2**i-1-k)
    r=bisect_left(b_nex,3*2**i-k-0.1)
    l+=q-p+N-r
  if l%2==1:
    ans+=1<<i
print(ans)   
  


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
def f(i):
  res=0
  t=2**i
  a_nex=sorted([p%(2*t) for p in a])
  b_nex=sorted([p%(2*t) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and k+b_nex[p]<t:
      p+=1
    while q<N and k+b_nex[q]<2*t:
      q+=1
    while r<N and k+b_nex[r]<3*t:
      r+=1
    l+=q-p+N-r
  res=(l%2)<<i
  return res
for k in range(29):
  ans+=f(k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left,bisect
import sys
 
N=int(sys.stdin.readline())
a=list(map(int,sys.stdin.readline().split()))
b=list(map(int,sys.stdin.readline().split()))
ans=0
for i in range(29):
  a_nex=list(map(lambda x:x%2**(i+1),a))
  b_nex=sorted(list(map(lambda x:x%2**(i+1),b)))
  l=0
  for k in a_nex:
    p=bisect_left(b_nex,2**i-k-0.1)
    q=bisect(b_nex,2*2**i-1-k)
    r=bisect_left(b_nex,3*2**i-k-0.1)
    s=bisect(b_nex,4*2**i-1-k)
    l+=q-p+r-s
  if l%2==1:
    ans+=1<<i
print(ans)   
  


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
def f(i):
  res=0
  t=2**i
  a_nex=sorted([p%(2*t) for p in a])
  b_nex=sorted([p%(2*t) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and k+b_nex[p]<t:
      p+=1
    while q<N and k+b_nex[q]<2*t:
      q+=1
    while r<N and k+b_nex[r]<3*t:
      r+=1
    l+=q-p+N-r
  res=(l%2)<<i
  return res
for k in range(29):
  ans+=f(k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left,bisect
N=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
ans=0
for i in range(30):
  a_nex=list(map(lambda x:x%2**(i+1),a))
  b_nex=list(map(lambda x:x%2**(i+1),b))
  b_nex.sort()
  l=0
  for k in a_nex:
    p=bisect_left(b_nex,2**i-k-0.1)
    q=bisect(b_nex,2*2**i-1-k)
    r=bisect_left(b_nex,3*2**i-k-0.1)
    s=bisect(b_nex,4*2**i-1-k)
    l+=q-p+r-s
  if l%2==1:
    ans+=1<<i
print(ans)   
  


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
def f(i):
  res=0
  t=2**i
  a_nex=sorted([p%(2*t) for p in a])
  b_nex=sorted([p%(2*t) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and k+b_nex[p]<t:
      p+=1
    while q<N and k+b_nex[q]<2*t:
      q+=1
    while r<N and k+b_nex[r]<3*t:
      r+=1
    l+=q-p+N-r
  res=(l%2)<<i
  return res
for k in range(29):
  ans+=f(k)
print(ans)