Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n, m = map(int, input().split())
div = m//n
INF = 10**18
ans = -INF
for i in range(1, div+1):
    if m % i != 0:
        continue
    if ans < i:
        ans = i
print(ans)


### FIXED CODE ###

n, m = map(int, input().split())
div = m//n
INF = 10**18
ans = -INF
for i in reversed(range(1, div+1)):
    if m % i != 0:
        continue
    if ans < i:
        ans = i
        break
print(ans)
### BUGGY CODE ###

n = int(input())
S = input()
cnt=0
for i in range(1000):
    x = str(i).zfill(3)
    j=0
    for s in S:
        if x[j]==s:
            j+=1
            if j==3:
                cnt+=1
                break
print(cnt)

### FIXED CODE ###

n = int(input())
S = input()
cnt=0
for i in range(10):
    x=S.find(str(i),0,n-2)
    if x!=-1:
        for j in range(10):
            y=S.find(str(j),x+1,n-1)
            if y!=-1:
                for k in range(10):
                    z=S.find(str(k),y+1,n)
                    if z!=-1:
                        cnt+=1
print(cnt)
### BUGGY CODE ###

from operator import or_


class SegTree():
    def __init__(self, N, e=float("inf"), operator_func=min):
        self.e = e
        self.size = N
        self.node = [self.e] * (2*N)
        self.op = operator_func

    def set_list(self, l):
        for i in range(self.size):
            self.node[i+self.size-1] = l[i]
        for i in range(self.size-1)[::-1]:
            self.node[i] = self.op(self.node[2*i+1], self.node[2*i+2])
    
    def update(self, k, x):
        k += self.size - 1
        self.node[k] = x
        while k >= 0:
            k = (k - 1) // 2
            self.node[k] = self.op(self.node[2*k+1], self.node[2*k+2])

    def get(self, l, r):
        x = self.e
        l += self.size; r += self.size
        a, b = [], []

        while l<r:
            if l&1:
                a += [l-1]; l += 1
            if r&1:
                r -= 1; b += [r-1]
            l >>= 1; r >>= 1

        for i in a+(b[::-1]):
            x = self.op(x, self.node[i])
        return x


N, Q = map(int, input().split())
*c, = map(lambda x:{x}, input().split())
tree = SegTree(N, set(), or_)
tree.set_list(c)
for _ in range(Q):
    l, r = map(int, input().split())
    print(len(tree.get(l-1, r)))

### FIXED CODE ###

class FenwickTree:
    def __init__(self, size):
        self.size = size
        self.array = [0]*size
 
    def add(self, index, value):
        while index < self.size:
            self.array[index] += value
            index += index&(-index)
 
    def sum(self, index):
        answer = 0
        while index > 0:
            answer += self.array[index]
            index -= index&(-index)
        return answer
 
    def rangesum(self, start, end):
        return self.sum(end)-self.sum(start-1)


def solve():
    N, Q = map(int, input().split())
    *c, = map(int, input().split())
    tree2 = FenwickTree(N+1)
    m = [list(map(int, input().split())) for _ in range(Q)]
    idxs = sorted(list(range(Q)), key=lambda i: m[i][1])

    right = 0
    pos = [-1] * (N+1)
    ans = [-1] * (Q)

    for idx in idxs:
        l, r = m[idx]
        for i in range(right, r):
            x = pos[c[i]]
            if x != -1:
                tree2.add(x, -1)
            pos[c[i]] = i+1
            tree2.add(i+1, 1)
        ans[idx] = tree2.rangesum(l, r)
        right = r
    print(*ans, sep="\n")


if __name__ == '__main__':
    solve()
### BUGGY CODE ###

import math
n,a,b = map(int,input().split())
h = []
for _ in range(n):
    h.append(int(input()))
add = a - b
j = 0
while True: #n回爆発させる
    j += 1
    for i in range(n):
        h[i] -= b
        h[i] = max(h[i], 0)
    cnt = 0
    for i in range(n):
        cnt += math.ceil(h[i] / add)
    if cnt <= j:
        break
print(j)


### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n, a, b = MAP()
h = [INT() for _ in range(n)]
ad = a - b
l = 1
r = 10 ** 9
while r - l > 1:
    c = (r + l) // 2
    cnt = 0
    for i in range(n):
        cnt += (max(h[i] - b * c, 0) + ad - 1) // ad
    if c > cnt:
        r = c
    else:
        l = c
ans = inf
for i in range(l, r + 1):
    cnt = 0
    for j in range(n):
        cnt += (max(h[j] - b * i, 0) + ad - 1) // ad
    ans = min(ans, max(i, cnt))
print(ans)
### BUGGY CODE ###

N,K = map(int, input().strip().split(' '))
H = list(map(int, input().strip().split(' ')))

dp = [float('inf')]*N
dp[0] = 0
for i in range(N-1):
  for d in range(1, min(K+1, N-i)):
    dp[i+d] = min(dp[i+d], dp[i]+abs(H[i+d]-H[i]))

print(dp[N-1])

### FIXED CODE ###

N,K = map(int, input().strip().split(' '))
H = list(map(int, input().strip().split(' ')))

dp = [float('inf')]*N
dp[0] = 0
for i in range(N-1):
  for d in range(1, min(K+1, N-i)):
    dp[i+d] = min(dp[i+d], dp[i]+abs(H[i+d]-H[i]))

print(dp[N-1])
### BUGGY CODE ###

N,M = map(int,input().split())
d=[0]*M
res = []
for i in range(M):
    P,Y = map(int,input().split())
    res.append((P,Y,i))
c=1
for i in sorted(res):
    x = str(i[0])
    y = str(i[1])
    tmp = (6-len(x))*'0'+x+(6-len(str(c)))*'0'+str(c)
    if(tmp in d):
        c+=1
        d[i[2]] = (6-len(x))*'0'+x+(6-len(str(c)))*'0'+str(c)
    else:
        c = 1
        d[i[2]] = (6-len(x))*'0'+x+(6-len(str(c)))*'0'+str(c)

for i in d:
    print(i)

### FIXED CODE ###

N,M = map(int,input().split())
d=[0]*M
res = []
for i in range(M):
    P,Y = map(int,input().split())
    res.append((P,Y,i))
c=0
res.sort()
t = str(res[0][0])
for i in res:
    x = str(i[0])
    tmp = (6-len(x))*'0'+x+(6-len(str(c)))*'0'+str(c)
    if x == t:
        c+=1
    else:
        c=1
        t = x
    d[i[2]] = (6-len(x))*'0'+x+(6-len(str(c)))*'0'+str(c)

for i in d:
    print(i)
### BUGGY CODE ###

N, M = map(int, raw_input().split())
a = []
b = []
for i in range(M):
    temp = map(int, raw_input().split())
    if 1 == temp[0]:
        a.append(temp[1])
    elif N in temp:
        b.append(temp[0])

flag = False
for x in a:
    if x in b:
        print('POSSIBLE')
        flag = True
        break
if not flag:
    print('IMPOSSIBLE')

### FIXED CODE ###

N, M = map(int, raw_input().split())
a = []
b = []
for i in range(M):
    temp = map(int, raw_input().split())
    if 1 == temp[0]:
        a.append(temp[1])
    elif N == temp[1]:
        b.append(temp[0])

if any(list(set(a) & set(b))):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
### BUGGY CODE ###

N,M=map(int,input().split())
list1=list(map(int,input().split()))
list2=[]
for i in range(M):
  B,C=map(int,input().split())
  list2+=[C]*B
list3=list1+list2
list4=sorted(list3,reverse=True)
list5=list4[:N]
SUM=sum(list5)
print(SUM)

### FIXED CODE ###

N,M = map(int, input().split())
listA = list(map(int, input().split()))
listA.sort()
 
listBC = [list(map(int, input().split())) for i in range(M)]
listBC = sorted(listBC, key=lambda x: x[1], reverse=True)
countB = 0
 
for i in range(M):
  B, C = listBC[i][0], listBC[i][1]
  listA += [C]*B
  countB += B
  if countB >= N:
    break

listA.sort(reverse=True)
print(sum(listA[:N]))
### BUGGY CODE ###

s = str(input())
q = int(input())
query = [0]
w = True
for i in range(q):
    query = list(map(str,input().split()))
    if(query[0] == "1"):
        w = not(w)
    else:
        mem = query[2]
        if(query[1] == "1"):
            if(w):
                s = mem + s
            else:
                s = s + mem
        else:
            if(w):
                s = s + mem
            else:
                s = mem + s
if(w):
    print(s)
else:
    print(s[::-1])

### FIXED CODE ###

from collections import deque
s = str(input())
q = int(input())
s = deque(s)
query = []
w = True
for i in range(q):
    query = list(map(str,input().split()))
    if(query[0] == "1"):
        w = not(w)
    else:
        mem = query[2]
        if(query[1] == "1"):
            if(w):
                s.appendleft(mem)
            else:
                s.append(mem)
        else:
            if(w):
                s.append(mem)
            else:
                s.appendleft(mem)
if(w):
    print("".join(s))
else:
    s.reverse()
    print("".join(s))
### BUGGY CODE ###

import numpy as np
import queue
H, W = map(int, input().split())
S = [input() for _ in range(H)]
reach = [[False] * W for i in range(H)]
step = np.ones((H, W)) * (-1)
m = 0


def dfs(x, y, s):
    if x < 0 or W <= x or y < 0 or H <= y:
        return None
    if reach[y][x]:
        return None
    if S[y][x] == '#':
        return None

    reach[y][x] = True
    step[y, x] = min(s, step[y, x])

    dfs(x+1, y, s+1)
    dfs(x-1, y, s+1)
    dfs(x, y-1, s+1)
    dfs(x, y+1, s+1)


q = queue.Queue()

for sh in range(H):
    for sw in range(W):
        reach = [[False] * W for i in range(H)]
        step = np.ones((H, W)) * (-1)
        #dfs(sw, sh, 0)
        q.put((sw, sh, 0))
        while not q.empty():
            x, y, s = q.get()
            if x < 0 or W <= x or y < 0 or H <= y:
                pass
            elif reach[y][x]:
                pass
            elif S[y][x] == '#':
                pass
            else:
                reach[y][x] = True
                step[y, x] = min(s, step[y, x]) if step[y, x] != -1 else s

                q.put((x+1, y, s+1))
                q.put((x-1, y, s+1))
                q.put((x, y-1, s+1))
                q.put((x, y+1, s+1))

        m = max(m, np.max(step))

print(int(m))


### FIXED CODE ###

import numpy as np
import queue
H, W = map(int, input().split())
S = [input() for _ in range(H)]
reach = [[False] * W for i in range(H)]
step = np.ones((H, W)) * (-1)
m = 0
q = queue.Queue()

for sh in range(H):
    for sw in range(W):
        if False and S[sh][sw] == '#':
            pass
        elif ((sh - 1 >= 0 and S[sh -1][sw] != '#') and  (sh + 1 < H and S[sh +1][sw] != '#')) and ((sw - 1 >= 0 and S[sh][sw-1] != '#') and  (sw + 1 < W and S[sh][sw + 1] != '#')):
            pass
        else:
            reach = [[False] * W for i in range(H)]
            step = np.ones((H, W)) * (-1)
            q.put((sw, sh, 0))
            while not q.empty():
                x, y, s = q.get()
                if x < 0 or W <= x or y < 0 or H <= y:
                    pass
                elif reach[y][x]:
                    pass
                elif S[y][x] == '#':
                    pass
                else:
                    reach[y][x] = True
                    step[y, x] = min(s, step[y, x]) if step[y, x] != -1 else s

                    q.put((x+1, y, s+1))
                    q.put((x-1, y, s+1))
                    q.put((x, y-1, s+1))
                    q.put((x, y+1, s+1))

            m = max(m, np.max(step))

print(int(m))
### BUGGY CODE ###

# coding = SJIS

n = int(input())
pap = []
for i in range(n):
    p = int(input())
    if p not in pap:
        pap.append(p)
    else:
        pap.remove(p)

print(len(pap))

### FIXED CODE ###

# coding = SJIS

n = int(input())
a = [int(input()) for i in range(n)]
ans = 0

a.sort()

i = 0

while i < n:
    ko = 1
    while (i + ko) < n and a[i] == a[i + ko]:
        ko += 1
    if ko % 2 == 1:
        ans += 1
    i += ko

print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000) 
N=int(input())
Branch=[[] for i in range(N)]
for i in range(N-1):
  a,b,c=map(int,input().split())
  Branch[a-1].append([b-1,c])
  Branch[b-1].append([a-1,c])
Q,K=map(int,input().split())
DistK=[float("Inf") for i in range(N)]
flag = [0 for i in range(N)]

def dfs(s,dist):
  DistK[s]=dist
  flag[s]=1
  
  for i in range(len(Branch[s])):
    if flag[Branch[s][i][0]]==0:
      dfs(Branch[s][i][0],dist+Branch[s][i][1])
      
  return 1
dfs(K-1,0)
for i in range(Q):
  x,y = map(int,input().split())
  print(DistK[x-1]+DistK[y-1])
  

### FIXED CODE ###

import collections
N=int(input())
Branch=[[] for i in range(N)]
for i in range(N-1):
  a,b,c=map(int,input().split())
  Branch[a-1].append([b-1,c])
  Branch[b-1].append([a-1,c])
Q,K=map(int,input().split())
Dist=[float("Inf") for i in range(N)]
flag = [0 for i in range(N)]

que=collections.deque()
que.append(K-1)
Dist[K-1]=0
while len(que):
  u=que.pop()
  for i,j in Branch[u]:
    if Dist[i]==float("Inf"):
      Dist[i]=Dist[u]+j
      que.append(i)

  
for i in range(Q):
  x,y = map(int,input().split())
  print(Dist[x-1]+Dist[y-1])
### BUGGY CODE ###

n,k=map(int,input().split())
A=list(map(int,input().split()))
B=[]
C=[]
for i in range(n-k+1):
  Sum=0
  for j in range(k):
    Sum+=A[i+j]
  B.append(Sum)
  C.append((Sum+k)/2)
print(C[B.index(max(B))])

### FIXED CODE ###

n,k=map(int,input().split())
p = [(int(s)+1)/2 for s in input().split()]
l = [sum(p[:k])]
for i in range(n-k):
  l.append(l[i]-p[i]+p[i+k])
print(max(l))
### BUGGY CODE ###

X, K, D = map(int, input().split())
if X == D:
    if K % 2 != 0:
        print('0')
    else:
        print(D)
else:
    if K * D < X:
        print(X - K * D)
    else:
        for i in range(K):
            if X >= 0:
                X = X - D
            else:
                X = X + D
        print(abs(X))

### FIXED CODE ###

X, K, D = map(int, input().split())
X = abs(X)
if X == D:
    if K % 2 != 0:
        print('0')
    else:
        print(D)
else:
    span = X // D
    if span < K:
        if (K - span) % 2 == 0:
            print(X % D)
        else:
            print(abs(X % D - D))
    else:
        print(X - K * D)
### BUGGY CODE ###

N, M = map(int, input().split())
p = []
S = []

for i in range(M) :
  tmp = input().split()
  p.append(int(tmp[0]))
  S.append(tmp[1])

s = set(p)
dict = {}
for i in s :
  dict[i] = 0
# print(dict)
w_cnt = 0
a_cnt = 0
skip = []
for i in range(M) :
  if p[i] not in skip :
    if S[i] == 'WA' :
      dict[p[i]] += 1
      continue
    else :
      a_cnt += 1
      w_cnt += dict[p[i]]
      skip.append(p[i])
      continue

print(a_cnt, w_cnt)

### FIXED CODE ###

n, m = map(int, input().split())

p = [0]*(n+1)
q = [False]*(n+1)

for _ in range(m) :
  v,s = input().split()
  v = int(v)
  if q[v] : continue
  if s[0] == 'A' : q[v] = True
  else : p[v] += 1

print(sum(q), sum(p[i] for i in range(n+1) if q[i]))
### BUGGY CODE ###

import math
import itertools
from functools import reduce
N=int(input())
def A(i):
    def gcd(*numbers):
        return reduce(math.gcd, numbers)

    GCD=[]
    GCD1=[]
    for i in range (1,N+1):
        GCD.append(i)

    for i in itertools.product(GCD,repeat=3):
   
        GCD1.append(gcd(i[0],i[1],i[2]))
    
    return sum(GCD1) 

print(A(N))


### FIXED CODE ###

import math
import itertools
GCD_over_150=[4548003,4616104,4718640,4812789,4918561,5003286,5131848,5205481,5299011,5392008,5521384,5610705,5739009,5818390,5930196,6052893,6156139,6239472,6402720,6493681,6623853,6741078,6864016,6953457,7094451,7215016,7359936,7475145,7593865,7689630,7886244,7984165,8130747,8253888,8403448,8523897,8684853,8802826,8949612,9105537,9267595,9376656,9574704,9686065,9827097,9997134,10174780,10290813,10493367,10611772,10813692]
 
N=int(input())
if N<150:
	GCD=[]
	GCD1=[]
	for i in range (1,N+1):
		GCD.append(i)
	for i in itertools.product(GCD,repeat=3):
		GCD1.append(math.gcd(math.gcd(i[0],i[1]),i[2]))
	print(sum(GCD1))    
else:
    print(GCD_over_150[N-150])
### BUGGY CODE ###

from itertools import combinations


def is_prime(n):
    if n < 2:
        return False
    elif n == 2:
        return True
    else:
        for p in range(2, n):
            if n % p == 0:
                return False
        else:
            return True


# input
N = int(input())

# check
prime_nums = [n for n in range(2, 55555) if is_prime(n)]
for case in combinations(prime_nums, N):
    fl = True
    for check_case in combinations(case, 5):
        if is_prime(sum(check_case)):
            fl = False
            break
    if fl:
        res = " ".join([str(num) for num in case])
        print(res)
        exit(0)


### FIXED CODE ###

def is_prime(n):
    if n < 2:
        return False
    else:
        for p in range(2, n):
            if n % p == 0:
                return False
        else:
            return True


# input
N = int(input())

# check
prime_nums = []
append = prime_nums.append
for n in range(2, 55555):
    if is_prime(n) and n % 5 == 1:
        append(n)
        if len(prime_nums) == N:
            break

res = " ".join([str(num) for num in prime_nums])
print(res)
exit(0)
### BUGGY CODE ###

s = input()
q = int(input())
query = []
lead = ''
end = ''
inversion_flg = False

for j in range(q):
    i = input().split()
    if int(i[0]) == 1:
        if inversion_flg:
            inversion_flg = False 
        else:
            inversion_flg = True
    else:
        if inversion_flg:
            if int(i[1]) == 1:
                i[1] = 2
            else:
                i[1] = 1
        if int(i[1]) == 1:
            lead+=i[2]
        else:
            end+=i[2]

lead = lead[::-1]
s = lead+s+end
if inversion_flg:
    s = s[::-1]
print(s)

### FIXED CODE ###

s = input()
q = int(input())
query = []
lead = ''
end = ''
inversion_flg = False
 
for j in range(q):
    i = input().split()
    if i[0] == "1":
        if inversion_flg:
            inversion_flg = False 
        else:
            inversion_flg = True
    else:
        if inversion_flg:
            if i[1] == "1":
                i[1] = "2"
            else:
                i[1] = "1"
        if i[1] == "1":
            lead+=i[2]
        else:
            end+=i[2]
 
lead = lead[::-1]
s = lead+s+end
if inversion_flg:
    s = s[::-1]
print(s)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
H, W, K = map(int, input().split())
x, y, u, v = map(int, input().split())
x -= 1
y -= 1
u -= 1
v -= 1
a = [list(input())[: -1] for _ in range(H)]
Q = [x * W + y]
inf = H * W + 1
dp = [inf] * (H * W)
dp[x * W + y] = 0
while len(Q):
  t = Q.pop()
  p = t // W
  q = t % W
  for i in range(1, K + 1):
    pp = p + i
    if pp in range(H):
      if a[pp][q] == "@": break
      if dp[pp * W + q] <= dp[t]: break
      dp[pp * W + q] = dp[t] + 1
      Q.append(pp * W + q)
  for i in range(1, K + 1):
    pp = p - i
    if pp in range(H):
      if a[pp][q] == "@": break
      if dp[pp * W + q] <= dp[t]: break
      dp[pp * W + q] = dp[t] + 1
      Q.append(pp * W + q)

  for i in range(1, K + 1):
    qq = q + i
    if qq in range(W):
      if a[p][qq] == "@": break
      if dp[p * W + qq] <= dp[t]: break
      dp[p * W + qq] = dp[t] + 1
      Q.append(p * W + qq)

  for i in range(1, K + 1):
    qq = q - i
    if qq in range(W):
      if a[p][qq] == "@": break
      if dp[p * W + qq] <= dp[t]: break
      dp[p * W + qq] = dp[t] + 1
      Q.append(p * W + qq)
if dp[u * W + v] != inf: print(dp[u * W + v])
else: print(-1)


### FIXED CODE ###

import sys
from collections import deque as dq
input = sys.stdin.readline
H, W, K = map(int, input().split())
x, y, u, v = map(int, input().split())
x -= 1
y -= 1
u -= 1
v -= 1
a = [list(input())[: -1] for _ in range(H)]
Q = dq([(0, x * W + y)])
inf = H * W + 1
dp = [inf] * (H * W)
dp[x * W + y] = 0
while len(Q):
  cost, t = Q.popleft()
  dp[t] = cost
  p = t // W
  q = t % W
  if (p, q) == (u, v):
    print(cost)
    exit(0)
  for i in range(1, K + 1):
    pp = p + i
    if pp in range(H):
      if a[pp][q] == "@": break
      if dp[pp * W + q] <= dp[t]: break
      if dp[pp * W + q] != inf: continue
      dp[pp * W + q] = dp[t] + 1
      Q.append((dp[t] + 1, pp * W + q))
  for i in range(1, K + 1):
    pp = p - i
    if pp in range(H):
      if a[pp][q] == "@": break
      if dp[pp * W + q] <= dp[t]: break
      if dp[pp * W + q] != inf: continue
      dp[pp * W + q] = dp[t] + 1
      Q.append((dp[t] + 1, pp * W + q))

  for i in range(1, K + 1):
    qq = q + i
    if qq in range(W):
      if a[p][qq] == "@": break
      if dp[p * W + qq] <= dp[t]: break
      if dp[p * W + qq] != inf: continue
      dp[p * W + qq] = dp[t] + 1
      Q.append((dp[t] + 1, p * W + qq))

  for i in range(1, K + 1):
    qq = q - i
    if qq in range(W):
      if a[p][qq] == "@": break
      if dp[p * W + qq] <= dp[t]: break
      if dp[p * W + qq] != inf: continue
      dp[p * W + qq] = dp[t] + 1
      Q.append((dp[t] + 1, p * W + qq))
print(-1)
### BUGGY CODE ###

N,Q = map(int, input().split())
D=[10**10]*N
D[0]=0
A=[[0]*3 for i in range(N-1)]
Ans=[0]*N
P=[[0]*2 for i in range(Q)]

for i in range(N-1):
    A[i][0],A[i][1] = map(int, input().split())
    if(A[i][0]==1):
        D[A[i][1]-1]=1
    else:
        D[A[i][1]-1]=D[A[i][0]-1]+1
    A[i][2]=D[A[i][1]-1]
while(max(D)>(10**10)):
    for i in range(N-1):
        if(D[i]>(10**10)):
            D[A[i][1]-1]=D[A[i][0]-1]+1
        A[i][2]=D[A[i][1]-1]

for i in range(Q):
    P[i][0],P[i][1] = map(int, input().split())
    Ans[P[i][0]-1]+=P[i][1]
A=sorted(A,key=lambda x: x[2])

for i in range (N-1):
    Ans[A[i][1]-1]+=Ans[A[i][0]-1]
print(*Ans)


### FIXED CODE ###

import sys

n, q = [int(i) for i in sys.stdin.readline().split()]
graph = {i: [] for i in range(n)}
ct = [0 for i in range(n)]
for i in range(n - 1):
    a, b = [int(i) for i in sys.stdin.readline().split()]
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

for i in range(q):
    p, x = [int(i) for i in sys.stdin.readline().split()]
    p -= 1
    ct[p] += x
already = {0}
stack = [(0, ct[0], -1)]
res = [0 for i in range(n)]
while len(stack) > 0:
    cur, cost, _from = stack.pop(-1)
    res[cur] = cost
    for _next in graph[cur]:
        if _next == _from:
            continue
        next_cost = ct[_next]
        stack.append((_next, cost + next_cost, cur))
        already.add(cur)
print(" ".join([str(r) for r in res]))
### BUGGY CODE ###

S = input()
stalen = len(S)
beflen = 0
while beflen != len(S):
    beflen = len(S)
    S = S.replace('10', '')
    S = S.replace('01', '')

print(stalen - len(S))


### FIXED CODE ###

S = input()


print( min(S.count('0'), S.count('1')) * 2)
### BUGGY CODE ###

import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
import bisect
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	A = getlist()
	B = getlist()
	ans = 0
	for i in range(30):
		Aex = [A[j] % (2 ** (i + 1)) for j in range(N)]
		Bex = [B[j] % (2 ** (i + 1)) for j in range(N)]
		Bex.sort()
		cnt = 0
		for j in range(N):
			var = Aex[j]
			if var <= 2 ** i:
				cnt += bisect.bisect_left(Bex, 2 ** (i + 1) - var) - (bisect.bisect_left(Bex, 2 ** i - var))
			else:
				cnt += bisect.bisect_left(Bex, 2 ** (i + 1) - var)
				cnt += N - bisect.bisect_left(Bex, 2 ** (i + 1) + 2 ** i - var)
		# print(Aex)
		# print(Bex)
		# print(cnt)
		if cnt % 2 != 0:
			ans += 2 ** i

	print(ans)

if __name__ == '__main__':
	main()

### FIXED CODE ###

import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
import bisect
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	A = getlist()
	B = getlist()
	ans = 0
	for i in range(29):
		mul = 2 ** (i + 1)
		mul2 = 2 ** i
		Aex = [A[j] % mul for j in range(N)]
		Bex = [B[j] % mul for j in range(N)]
		Aex.sort()
		Bex.sort()
		cnt = 0
		p, q, r = N - 1, N - 1, N - 1
		for j in range(N):
			var = Aex[j]
			while p >= 0 and mul2 - var <= Bex[p]:
				p -= 1
			while q >= 0 and mul - var <= Bex[q]:
				q -= 1
			while r != 0 and mul + mul2 - var <= Bex[r]:
				r -= 1
			cnt += q - p
			cnt += N - 1 - r
			
			# if var <= 2 ** i:
			# 	cnt += bisect.bisect_left(Bex, mul - var) - (bisect.bisect_left(Bex, mul2 - var))
			# else:
			# 	cnt += bisect.bisect_left(Bex, mul - var)
			# 	cnt += N - bisect.bisect_left(Bex, mul + mul2 - var)
		# print(Aex)
		# print(Bex)
		# print(cnt)
		if cnt % 2 != 0:
			ans += 2 ** i

	print(ans)

if __name__ == '__main__':
	main()