Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    n = int(input())
    aa = list(map(int, input().split()))
    bb = list(map(int, input().split()))
    ans = 0
    for k in range(29):
        t = 1 << k
        t2 = t << 1
        am = list(map(lambda x: x % t2, aa))
        bm = list(map(lambda x: x % t2, bb))
        am.sort(reverse=True)
        bm.sort()
        #print(am)
        #print(bm)
        cnt = n % 2
        for tk in range(t, t * 4, t):
            j = 0
            for a in am:
                while j < n and a + bm[j] < tk:
                    j += 1
                cnt += j
        if cnt % 2:
            ans += t
    print(ans)

main()


Fixed submission:
import sys
import numpy as np

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    n = int(input())
    aa = np.array(list(map(int, input().split())), dtype="i8")
    bb = np.array(list(map(int, input().split())), dtype="i8")
    ans = 0
    for k in range(29):
        t = 1 << k
        t2 = t << 1
        am = aa % t2
        bm = bb % t2
        # am.sort(reverse=True)
        bm.sort()
        # print(am)
        # print(bm)
        cnt = n % 2
        for tk in range(t, t * 4, t):
            cnt += np.sum(np.searchsorted(bm, tk - am))
        if cnt % 2:
            ans += t
    print(ans)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    n = int(input())
    aa = list(map(int, input().split()))
    bb = list(map(int, input().split()))
    ans = 0
    for k in range(56):
        t = 1 << k
        t2 = t << 1
        am = list(map(lambda x: x % t2, aa))
        bm = list(map(lambda x: x % t2, bb))
        am.sort(reverse=True)
        bm.sort()
        #print(am)
        #print(bm)
        cnt = n % 2
        for tk in range(t, t * 4, t):
            j = 0
            for a in am:
                while j < n and a + bm[j] < tk:
                    j += 1
                cnt += j
        if cnt % 2:
            ans += t
    print(ans)

main()


Fixed submission:
import sys
import numpy as np

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    n = int(input())
    aa = np.array(list(map(int, input().split())), dtype="i8")
    bb = np.array(list(map(int, input().split())), dtype="i8")
    ans = 0
    for k in range(29):
        t = 1 << k
        t2 = t << 1
        am = aa % t2
        bm = bb % t2
        # am.sort(reverse=True)
        bm.sort()
        # print(am)
        # print(bm)
        cnt = n % 2
        for tk in range(t, t * 4, t):
            cnt += np.sum(np.searchsorted(bm, tk - am))
        if cnt % 2:
            ans += t
    print(ans)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    n = int(input())
    aa = list(map(int, input().split()))
    bb = list(map(int, input().split()))
    ans = 0
    for k in range(56):
        t = 1 << k
        am = list(map(lambda x: x % (t * 2), aa))
        bm = list(map(lambda x: x % (t * 2), bb))
        #am.sort()
        bm.sort()
        cnt = n ** 2
        for a in am:
            i = 0
            while i < n and a + bm[i] < t:
                i += 1
            cnt -= i
            while i < n and a + bm[i] < 2 * t:
                i += 1
            cnt += i
            while i < n and a + bm[i] < 3 * t:
                i += 1
            cnt -= i
        if cnt % 2:
            ans += t
    print(ans)

main()


Fixed submission:
import sys
import numpy as np

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    n = int(input())
    aa = np.array(list(map(int, input().split())), dtype="i8")
    bb = np.array(list(map(int, input().split())), dtype="i8")
    ans = 0
    for k in range(29):
        t = 1 << k
        t2 = t << 1
        am = aa % t2
        bm = bb % t2
        # am.sort(reverse=True)
        bm.sort()
        # print(am)
        # print(bm)
        cnt = n % 2
        for tk in range(t, t * 4, t):
            cnt += np.sum(np.searchsorted(bm, tk - am))
        if cnt % 2:
            ans += t
    print(ans)

main()