Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

m = 30
d = [1<<i for i in range(m+1)]

c = [[] for i in range(m)]
for bi in b:
    for i in range(m):
        c[i].append(bi&(d[i+1]-1))
for i in range(m):
    c[i].sort()

from bisect import bisect_left

keta = [0]*m
for ai in a:
    for i in range(m):
        aj = ai&(d[i+1]-1)
        one1 = bisect_left(c[i], d[i+1]-aj) - bisect_left(c[i],d[i]-aj)
        one2 = n - bisect_left(c[i], d[i+1]+d[i]-aj)
        keta[i] += one1+one2

ans = 0
for i in range(m):
    if keta[i]%2:
        ans += 1<<i

print(ans)

Fixed submission:
# 写経
# https://atcoder.jp/contests/arc092/submissions/5244389

from bisect import bisect_left

INF = float('inf')

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

def calc_bit(k):
    # これ以上の桁は不要
    mod = 1 << (k + 1)
    amod = [a & (mod - 1) for a in A]
    bmod = [b & (mod - 1) for b in B]
    amod.sort()
    bmod.sort()
    ret = 0

    # bmod + amod のうち k ビット目が 1 となる数
    # => (1 << k) 以上 (2 << k) 未満または (3 << k) 以上 (4 << k) 未満
    # しゃくとる
    b01 = bisect_left(bmod, (1 << k) - amod[0])
    b10 = bisect_left(bmod, (2 << k) - amod[0])
    b11 = bisect_left(bmod, (3 << k) - amod[0])
    for a in range(len(amod)):
        while b01 - 1 >= 0 and bmod[b01 - 1] >= (1 << k) - amod[a]:
            b01 -= 1
        while b10 - 1 >= 0 and bmod[b10 - 1] >= (2 << k) - amod[a]:
            b10 -= 1
        while b11 - 1 >= 0 and bmod[b11 - 1] >= (3 << k) - amod[a]:
            b11 -= 1
        # (1 << k) 以上 (2 << k) 未満
        ret += b10 - b01
        # (3 << k) 以上 (4 << k) 未満
        ret += N - b11

    return ret % 2


ans = 0
for i in range(30):
    ans += calc_bit(i) * (1<<i)
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

m = 30
d = [1<<i for i in range(m)]

c = [[] for i in range(m)]
for bi in b:
    for i in range(m):
        c[i].append(bi&(d[i+1]-1))
for i in range(m):
    c[i].sort()

from bisect import bisect_left

keta = [0]*m
for ai in a:
    for i in range(m):
        aj = ai&(d[i+1]-1)
        one1 = bisect_left(c[i], d[i+1]-aj) - bisect_left(c[i],d[i]-aj)
        one2 = n - bisect_left(c[i], d[i+1]+d[i]-aj)
        keta[i] += one1+one2

ans = 0
for i in range(m):
    if keta[i]%2:
        ans += 1<<i

print(ans)

Fixed submission:
# 写経
# https://atcoder.jp/contests/arc092/submissions/5244389

from bisect import bisect_left

INF = float('inf')

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

def calc_bit(k):
    # これ以上の桁は不要
    mod = 1 << (k + 1)
    amod = [a & (mod - 1) for a in A]
    bmod = [b & (mod - 1) for b in B]
    amod.sort()
    bmod.sort()
    ret = 0

    # bmod + amod のうち k ビット目が 1 となる数
    # => (1 << k) 以上 (2 << k) 未満または (3 << k) 以上 (4 << k) 未満
    # しゃくとる
    b01 = bisect_left(bmod, (1 << k) - amod[0])
    b10 = bisect_left(bmod, (2 << k) - amod[0])
    b11 = bisect_left(bmod, (3 << k) - amod[0])
    for a in range(len(amod)):
        while b01 - 1 >= 0 and bmod[b01 - 1] >= (1 << k) - amod[a]:
            b01 -= 1
        while b10 - 1 >= 0 and bmod[b10 - 1] >= (2 << k) - amod[a]:
            b10 -= 1
        while b11 - 1 >= 0 and bmod[b11 - 1] >= (3 << k) - amod[a]:
            b11 -= 1
        # (1 << k) 以上 (2 << k) 未満
        ret += b10 - b01
        # (3 << k) 以上 (4 << k) 未満
        ret += N - b11

    return ret % 2


ans = 0
for i in range(30):
    ans += calc_bit(i) * (1<<i)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for k in range(29):
    b_k = [i%2**(k+1) for i in b]
    b_k.sort()
    cnt_one_kbit = 0
    for ai in a:
        ai %= 2**(k+1)
        left = bisect_left(b_k, 2*2**k-ai) - bisect_left(b_k, 2**k - ai)
        right = bisect_left(b_k, 4*2**k - ai) - bisect_left(b_k, 3*2**k - ai)
        cnt_one_kbit += left+ right
    if cnt_one_kbit % 2:
        ans += 2**k
print(ans)

Fixed submission:
# 写経
# https://atcoder.jp/contests/arc092/submissions/5244389

from bisect import bisect_left

INF = float('inf')

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

def calc_bit(k):
    # これ以上の桁は不要
    mod = 1 << (k + 1)
    amod = [a & (mod - 1) for a in A]
    bmod = [b & (mod - 1) for b in B]
    amod.sort()
    bmod.sort()
    ret = 0

    # bmod + amod のうち k ビット目が 1 となる数
    # => (1 << k) 以上 (2 << k) 未満または (3 << k) 以上 (4 << k) 未満
    # しゃくとる
    b01 = bisect_left(bmod, (1 << k) - amod[0])
    b10 = bisect_left(bmod, (2 << k) - amod[0])
    b11 = bisect_left(bmod, (3 << k) - amod[0])
    for a in range(len(amod)):
        while b01 - 1 >= 0 and bmod[b01 - 1] >= (1 << k) - amod[a]:
            b01 -= 1
        while b10 - 1 >= 0 and bmod[b10 - 1] >= (2 << k) - amod[a]:
            b10 -= 1
        while b11 - 1 >= 0 and bmod[b11 - 1] >= (3 << k) - amod[a]:
            b11 -= 1
        # (1 << k) 以上 (2 << k) 未満
        ret += b10 - b01
        # (3 << k) 以上 (4 << k) 未満
        ret += N - b11

    return ret % 2


ans = 0
for i in range(30):
    ans += calc_bit(i) * (1<<i)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for k in range(29):
    b_k = [i%2**(k+1) for i in b]
    b_k.sort()
    cnt_one_kbit = 0
    for ai in a:
        ai %= 2**(k+1)
        left = bisect_left(b_k, 2*2**k-ai) - bisect_left(b_k, 2**k - ai)
        right = bisect_left(b_k, 4*2**k - ai) - bisect_left(b_k, 3*2**k - ai)
        cnt_one_kbit += left+ right
    if cnt_one_kbit % 2:
        ans += 2**k
print(ans)

Fixed submission:
# 写経
# https://atcoder.jp/contests/arc092/submissions/5244389

from bisect import bisect_left

INF = float('inf')

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

def calc_bit(k):
    # これ以上の桁は不要
    mod = 1 << (k + 1)
    amod = [a & (mod - 1) for a in A]
    bmod = [b & (mod - 1) for b in B]
    amod.sort()
    bmod.sort()
    ret = 0

    # bmod + amod のうち k ビット目が 1 となる数
    # => (1 << k) 以上 (2 << k) 未満または (3 << k) 以上 (4 << k) 未満
    # しゃくとる
    b01 = bisect_left(bmod, (1 << k) - amod[0])
    b10 = bisect_left(bmod, (2 << k) - amod[0])
    b11 = bisect_left(bmod, (3 << k) - amod[0])
    for a in range(len(amod)):
        while b01 - 1 >= 0 and bmod[b01 - 1] >= (1 << k) - amod[a]:
            b01 -= 1
        while b10 - 1 >= 0 and bmod[b10 - 1] >= (2 << k) - amod[a]:
            b10 -= 1
        while b11 - 1 >= 0 and bmod[b11 - 1] >= (3 << k) - amod[a]:
            b11 -= 1
        # (1 << k) 以上 (2 << k) 未満
        ret += b10 - b01
        # (3 << k) 以上 (4 << k) 未満
        ret += N - b11

    return ret % 2


ans = 0
for i in range(30):
    ans += calc_bit(i) * (1<<i)
print(ans)