peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def i_input(): return int(input())


n = i_input()
cnt = 0

for i in range(1, n):
    q = n // i
    r = n % i
    if q != 0 and r != 0:
        cnt += q
    elif q != 0 and r == 0:
        cnt += q - 1

print(cnt)
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
b=[]
dp=[0]*(N+1)
ans=0
for i in range(N,0,-1):
  for j in range(1,N//i+1):
    dp[i]+=dp[j*i]
  if dp[i]%2!=a[i-1]:
    dp[i]+=1
    ans+=1
    b.append(i)
b.sort()
print(ans)
print(*b)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

count = 0
for i in range(0,N,1):
    tmp = min(A[i],B[i])
    count += tmp
    B[i] -= tmp
    A[i] -= tmp
    tmp = min(B[i],A[i+1])
    count += tmp
    A[i+1] -= tmp
    B[i] -= tmp

print(count)
# Judge status: Wrong Answer
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    a = list(map(int, rl().split()))
    
    n = a[0]
    for i in range(1, N):
        n ^= a[i]
    for i in range(N):
        a[i] ^= n
    print(a)


if __name__ == '__main__':
    solve()
# Judge status: Accepted
import sys
input = sys.stdin.readline

t = input()

t_update = ""
for i in t:
    if i == "?":
        i = "D"
    t_update += i
print(t_update)
# Judge status: Accepted
N = int(input())
conv = [0]*(N+1)
for i in range(1,N+1):
    for j in range(1,N//i+1):##その数の倍数をメモ
        conv[i*j-1] += 1
   
##print(conv)
print(sum([(i+1)*conv[i] for i in range(N)]))
# Judge status: Accepted
n,k=map(int, input().split(' '))
a=list(map(int, input().split(' ')))
ans,s=0,0
for i in a:
  if s<=k: ans+=1
  else: break
  s+=i

if s<=k: ans+=1
print(ans)
# Judge status: Wrong Answer
N, M = [int(n) for n in input().split()]
H = [int(n) for n in input().split()]
visited = [0] * N
for i in range(M):
    a, b = [int(n)-1 for n in input().split()]
    if visited[a]<0 and visited[b]<0:
        continue
    if H[a] > H[b]:
        visited[b] = -1
        visited[a] = 1
    elif H[a] < H[b]:
        visited[a] = -1
        visited[b] = 1
    else:
        visited[a] = -1
        visited[b] = -1
print(visited.count(0)+visited.count(1))
# Judge status: Wrong Answer
S=input()
T=input()
if(str.isalpha(S)==1 and len(S)>=1 and len(S)<=10 and len(T)==len(S)+1):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
a.sort()
N = a[-1]
ans = float('inf')
r = a[0]
for i in range(len(a)-1):
    if ans > abs(a[i]-N/2):
        ans = abs(a[i]-N/2)
        r = a[i]
print(str(N) +' '+ str(r))
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
maxi=max(a)
mini=min(a)
ans1=(maxi**2)*N
for i in range(mini,maxi+1):
    ans=0
    for j in a:
        ans+=abs(j-i)**2
    if ans<ans1:
        ans1=ans
print(ans1)
# Judge status: Wrong Answer
N, M = map(int, input().split())
L = 1
R = N
for i in range(M):
  l, r = map(int, input().split())
  if L < l:
    L = l
  if R > r:
    R = r
print(1+R-L)
# Judge status: Accepted
a,b = input().split()
num = int(a+b)

if int(num**0.5)**2 == num:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N,H=map(int,input().split())
a=[]
b=[]
for i in range(N):
    c,d=map(int,input().split())
    a.append(c)
    b.append(d)

num=0
at=a[0]
for i in range(N):
    tmp=a[i]
    if tmp>at:
        at=tmp
        num=i
ans=0
for i in range(N):
    if at<b[i]:
        H-=b[i]
        ans+=1
    if H<=0:
        break
if H<=0:
    print(ans)
    exit()
ans+=(H+at-1)//at 
print(max(ans,1))
# Judge status: Accepted
def main():
    A, B, C, X, Y = map(int, input().split())
    ans = 10 ** 10

    for k in range(10 ** 5 + 1):
        total = 2 * C * k + A * max(0, X - k) + B * max(0, Y - k)
        if total < ans:
            ans = total

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N, M = map(int, input().split())
def a(N, M):
  if N == M:
    print('Yse')
  else:
    print('No')

a(N, M)
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b=int(b)
c=input()
h,i,j=c[:(a-2)],c[a-2],c[a-1:]
if i=="A":
  i="a"
if i=="B":
  i=="b"
if i=="C":
  i=="c"
print(h+i+j)
# Judge status: Accepted

def main():
    H,A  = map(int, input().split()) 
    print(-(-H//A))



if __name__ == '__main__':
    main()
# Judge status: Accepted
s = str(input())
ans = 0
temp = 0
l = int(len(s)) // 2

for i in range(l):
    temp = abs(temp)+1
    #print(i,abs(temp)*-1,s[i],s[abs(temp)*-1])
    if s[i] != s[temp*-1]:
        ans += 1

print(ans)
# Judge status: Accepted
n, k = list(map(int, input().split()))
if n < k:
    print(min(n, k-n))
else:
    print(min(n%k, k-(n%k)))
# Judge status: Accepted
n,m=map(int,input().split())
A=set()
B=set()

for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    A.add(b)
  if b==n:
    B.add(a)
if len(A&B)==0:
  print("IMPOSSIBLE")
else:
  print("POSSIBLE")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

a.sort()
m = a[-1]
def near_abs_id(l,n): # リストlの中で絶対値がもっともnに近い要素のindex
    idx = 0
    m = 10**12
    for i in range(len(l)):
        if abs(l[i]-n) < m:
            m = abs(l[i]-n)
            idx= i
    return idx
j = near_abs_id(a,m/2)
if j==n-1:
    j-=1
print(m,a[j])
# Judge status: Wrong Answer
a,b,c=map(int,open(0));print(a*b*c/2)
# Judge status: Accepted
import sys
input = sys.stdin.readline
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
cnt = Counter(A)
l = []
ans = 0

for k in cnt.keys():
    if cnt[k]>=4:
        ans = max(ans, k*k)
    
    if cnt[k]>=2:
        l.append(k)

l.sort(reverse=True)

if len(l)>=2:
    ans = max(ans, l[0]*l[1])

print(ans)
# Judge status: Accepted
a,b=map(int, input().split())
c=[0]*a
d=[0]*a
e=0
for i in range(b):
    p, s=input().split()
    p=int(p)-1
    if c[p]==0 and s=='AC':
        c[p]=1
        e+=d[p]
    d[p]+=1
print(sum(c),e)
# Judge status: Accepted
s = input()

if s == 'AAA' or s == 'BBB':
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
N=int(input())
L=list(map(int,input().split()))
Lmax=L[0]
for y in range(1,N):
	if L[y-1] < L[y]:
		Lmax=L[y]
if Lmax < sum(L)-Lmax:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
def resolve():
    N, A, B = map(int, input().split())
    S = input()
    count = 1
    sabetu = 1
    for i in range(N):
        if S[i] == "a" and count <= A+B:
            count += 1
            print("Yes")
        elif S[i] == "b" and sabetu <= B and count <= A+B:
            sabetu += 1
            count += 1
            print("Yes")
        else:
            print("No")
resolve()
# Judge status: Accepted
from math import ceil
a,b = map(int,input().split())
print(ceil((b-1)/(a-1)))
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
ans=3
if a==b:
    ans-=1
    if b==c:
        ans-=1
if a==c:
    ans-=1
    if b==a:
        ans-=1
if c==b:
    ans-=1
    if a==c:
        ans-=1
print(ans)
# Judge status: Accepted
n = input()

ans = None
for i in n[1:]:
    if int(i) != 9:
        ans = int(n[0]) - 1 + sum([9]*(len(n)-1))
        break

if ans is None:
    ans = sum([ int(i) for i in list(n)  ])
       
print(ans)
# Judge status: Accepted
x = list(map(int, input().split()))

for i in range(len(x)):
    if x[i] == 0:
        print(i+1)
        break
    else:
        continue
# Judge status: Accepted
s=int(input())
s1=s/100
s2=s%100
if((1<=s1<=12)and(1<=s2<=12)):
    print('AMBIGUOUS')
elif(((s1<1) or (12<s1)) and(1<=s2<=12)):
    print('YYMM')
elif(((s2<1) or (12<s2)) and(1<=s1<=12)):
    print('MMYY')
else:
    print('NA')
# Judge status: Wrong Answer
S = input()

N = len(S)

be = []
af = []

for i in range(N//2):
    be.append(S[i])
    af.append(S[i+N//2+1])
    
re_be = list(reversed(be))
re_af = list(reversed(af))

count = 0
    
for i in range(N//2):
    if be[i] == re_be[i] and af[i] == re_af[i]:
        count+=1
        
if count == N//2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if 2 * (a + b) >= c:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
wee=["SUN","MON","TUE","WED","THU","FRI","SAT"]
print((7-wee.index(input())))
# Judge status: Wrong Answer
a,b,c,k = map(int, input().split())
over = 10**18
for i in range(k):
    x = b+c
    y = a+c
    z = a+b
    a = x
    b = y
    c = z
    if abs(a) > over or abs(b) > over  or abs(c) > over:
        print("unfair")
        exit()
print(a-b)
# Judge status: Accepted
a=input()
if a[0] is not a[2] or a[0] is not a[3]:
    if a[0] == a[1] and a[2] == a[3]:
        print('Yes')
    elif a[0] == a[3] and a[2] == a[1]:
        print('Yes')    
    elif a[0] == a[2] and a[3] == a[1]:
        print('Yes')
    else:
        print('No')

else:
    print('No')
# Judge status: Wrong Answer
import re
index = re.search(r'(hi)+(.*?)', input())
if index:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import math

K = int(input())

ans = 0

for a in range(K):
    for b in range(K):
        buff = math.gcd(a + 1, b + 1)
        for c in range(K):
            ans += math.gcd(buff, c + 1)

print(ans)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())

from collections import defaultdict
dic = defaultdict(int)
for a in As:
    dic[a] += 1
    dic[a-1] += 1
    dic[a+1] += 1

print(max(dic.values()))
# Judge status: Accepted
import collections
n=int(input())
a=list(map(int,input().split()))

b=[]
for i in range(n):
    b.append(a[i]-i)

c = collections.Counter(b)

m=0
for i in range(n):
    m+=c[-(i+a[i])]
    c[a[i]-i]-=1
print(m)
# Judge status: Accepted
def main():
    s = input()
    n = int(input())
    pre = ''
    suf = ''
    r = 1
    for _ in range(n):
        q = input().split()
        if len(q) == 1:
            r *= -1
            continue
        if r * int(q[1]) in (1, -2):
            pre = q[2] + pre
        else:
            suf += q[2]
    ans = pre + s + suf
    if r == -1:
        ans = ans[::-1]
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
a = int(input())
b = int(input())
h = int(input())
result = int((a + b) * h / 2)
print(result)
# Judge status: Wrong Answer
a,b=map(int,input().split())
c=[i for i in range(1,a+1) if a%i==0]
d=[i for i in range(1,b+1) if b%i==0]
e=[i for i in c if i in d]
e=list(set(e))
print(len(e)-1 if len(e)-1>0 else 1)
# Judge status: Wrong Answer
n=int(input())
l=list(map(int,input().split()))

d = [0]*n
ans=0
 
for a in l:
    d[a-1] += 1
  
for a in d:
  ans+=a*(a-1)//2
  
print(ans)
# Judge status: Wrong Answer
N, M, Q = map(int, input().split())

abcd = list()
for _ in range(Q):
  abcd.append(list(map(int, input().split())))

di = 0
A = [1] * N
sorted_abcd = sorted(abcd, key=lambda x:x[0], reverse=True)
sorted_abcd = sorted(sorted_abcd, key=lambda x:x[3], reverse=True)
amin = 1000
amax = 0

for a, b, c, d in sorted_abcd:
  leng = N - b +1
  A[b-1:] = [A[a-1]+c-1] * leng
  if a >= amin and a <= amax:
    break
  else:
    amin = min(a, amin)
    amax = max(a, amax)
  if A != sorted(A) or A[-1] > M:
    break
  di += d
print(di)
# Judge status: Wrong Answer
D = int(input().rstrip())
print('Christmas',*['EVE']*(25-D))
# Judge status: Wrong Answer
N = int(input())
S = input()
if N % 2 == 1:
  print("No")
  exit()

C = N // 2
D = N + 1
if S[0:C] == S[C:N]:
    print("Yes")
# Judge status: Wrong Answer
A = list(map(int,input().split()))
A.sort()
B = []
for i in A:
    B.append(i%2)

ans = 0

if B.count(1) == 1:
    for i in range(len(A)):
        if B[i] == 0:
            A[i] += 1
    ans += 1
elif B.count(0) == 1:
    for i in range(len(A)):
        if B[i] == 0:
            A[i] += 1
    ans += 1

ans += A[2] - A[1]
A[0] += A[2] - A[1]
ans += (A[2]-A[0])//2

print(ans)
# Judge status: Accepted
s=input()
if s[0]=='A' and s[2:-1].count('C')==1:
    for i in range(len(s)):
        if not (i==0 or i==s[2:-1].index('C')+2):
            if not s[i].islower():
                print('WA')
                exit()
    print('AC')
    exit()
print('WA')
# Judge status: Accepted
K = int(input())
if K % 2 == 0 or K % 5 == 0:
    print('-1')
else:
    cnt = 1
    cur = 7
    while True:
        if cur % K == 0:
            print(cnt)
            break
        if cnt > K:
            print('-1')
            break
        cur = (cur * 10 + 7) % K
        cnt += 1
# Judge status: Accepted
import math
def main():
    i = int(input())
    j = list(map(int, input().split()))
    res = 1

    if 0 in j:
        print(0)
        return

    for jj in j:
        res *= jj
        if math.pow(10, 18) < res:
            print(-1)
            return

    print(res)


if __name__ == "__main__":
    main()
# Judge status: Accepted
a, b = map(int, input().split())
if len(str(a)) == 1 and len(str(b)) == 1:
  print(a*b)
else:
  print(-1)
# Judge status: Accepted
a,b,c = map(int, input().split())

from decimal import Decimal
sqa=Decimal(a).sqrt()
sqb=Decimal(b).sqrt()
sqc=Decimal(c).sqrt()

if sqa+sqb<sqc:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  c = [0] * (max(a) + 3)
  for x in a:
    x += 1
    c[x-1] += 1
    c[x] += 1
    c[x+1] += 1
  ans = max(c)

  print(ans)
  return

if __name__ == "__main__":
  resolve()
# Judge status: Accepted
def resolve():
    S = input()
    for i in range(0, len(S), 2):
        if S[i:i+2] != 'hi':
            print("No")
            return

    print("Yes")
        

if __name__ == "__main__":
    resolve()
# Judge status: Accepted
a,b=map(int,input().split())
ans=-1
cont=0
for i in range(10,10000):
    if int(i*0.08)==a and int(i*0.1)==b:
        ans=i
        count=1
        break
print(ans)
# Judge status: Accepted
s = input()
t = input()
p = {}
q = {}
for i in range(len(s)):
    if s[i] in p and p[s[i]] != t[i]:
        print('No')
        exit(0)
    if t[i] in q and q[t[i]] != s[i]:
        print('No')
        exit(0)
    p[s[i]] = t[i]
    q[t[i]] = s[i]
print('Yes')
# Judge status: Wrong Answer
H,W = [int(i) for i in input().split()]

if H % 3 == 0 or W % 3 == 0:
    print(0)
else:
    s = []
    for i in range(1,H//2 +1):
        j = W//2
        a = [i*W,j*(H-i),(W-j)*(H-i)]
        b = max(a) - min(a)
        s.append(b)
    for i in range(1,W//2+1):
        j = H//2
        a = [H*i,(W-i)*j,(W-i)*(H-j)]
        b = max(a) - min(a)
        s.append(b)

    print(min(s))
# Judge status: Wrong Answer
import sys
import numpy as np
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
N, X, Y = [int(x) for x in input().strip().split()]
G = np.zeros((N, N), dtype=int)
for k in range(N):
    for k2 in range(k+1, N):
        G[k, k2] = min(k2 - k, G[min(k, X-1), max(k, X-1)]+1+abs(k2 - (Y - 1)))

for k in range(1, N):
    print(sum(sum(G == k)))
# Judge status: Accepted
n,m=map(int,input().split())
a=list(map(int,input().split()))
mm=sum(a)/4/m
s=0
for i in a:
    if i >=mm:
        s+=1
if s>=m:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = input()
ans = "No"
if s[0] == s[1] == s[2]:
  ans = "Yes"
elif s[1] == s[2] == s[3]:
  ans = "Yes"
print(ans)
# Judge status: Wrong Answer
k=int(input())
list=[1,2,3,4,5,6,7,8,9]
for i in range(k-1):
  m=list[i]
  n=m*10+m%10
  if m%10!=0:
    list.append(m-1)
  list.append(m)
  if m%10!=9:
    list.append(m+1)
print(list[k-1])
# Judge status: Accepted
S = input()
maxlen=count=0
isT = True
for i in range(len(S)):
  if S[i] == "T":
    isT = True
  if S[i] == "T" or S[i] == "G" or S[i] == "C" or S[i] == "A":
    count += 1
  else:
    if isT and maxlen < count:
      maxlen = count
    count = 0
    isT = False
    
if isT and maxlen < count:
  maxlen = count

print(maxlen)
# Judge status: Accepted
n,k = map(int,input().split())
x = tuple(map(int, input().split()))

for i,v in enumerate(x):
    if v == 1:
        r = i
a,b = divmod(r,k-1)
if b > 0:
    a += 1
r = a * (k-1)

l = n-r-1
if l > 0:
    c,d = divmod(l, k-1)
    if d > 0:
        c += 1
    a += c

print(a)
# Judge status: Wrong Answer
from math import ceil
a,b,c=map(int,input().split())
k=int(input())
if b<=a:
    bm = ceil((a + 1) / b)
    b *= bm
    k -= (bm+1)//2
if c<=b:
    cm = ceil((b + 1) / c)
    k -= (cm+1)//2
if k<0:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n=int(input())
print('ABC' if n <=999 else "ABD")
# Judge status: Accepted
def main3():
    N, A, B = map(int, input().split())
    
    d = B - A
    if d % 2 == 0:
        print(d // 2)
    else:
        print(min(((d + 1) // 2 + N - B ), ((d + 1) // 2 + A - 1)))
         
if __name__ == "__main__":
    main3()
# Judge status: Accepted
A,B,X=map(int,input().split())
print("YES" if A<=X<=A+B else "NO")
# Judge status: Wrong Answer
import re
a = input()
operations = 0
length_a = len(a)
if not re.search("01", a) and not re.search("01", a):
    print(0)
else:
    while re.search("01", a) or re.search("10", a):
        if re.search("01", a):
            a = a.replace("01", "", 1)
            operations += 2
        if re.search("10", a):
            a = a.replace("10", "", 1)
            operations += 2
    print(operations)
# Judge status: Accepted
n,q = map(int,input().split())
s = input()
ls = [0]
for i in range(n-1):
    if s[i] == 'A' and s[i+1] == 'C':
        ls.append(ls[i]+1)
    else:
        ls.append(ls[i])
for i in range(q):
    l,r = map(int,input().split())
    print(ls[r-1] - ls[l-1])
# Judge status: Accepted
n = int(input())
 
A = list(map(int, input().split()))
 
t = max(A)
 
from fractions import gcd
 
for i in A:
    t = gcd(t, i)
print(t)
# Judge status: Wrong Answer
s = input()
flag = 1
for i in range(len(s)-1) :
    for j in range(i+1,len(s)) :
        if s[i] == s[j] :
            flag = 0

if flag == 1 :
    print("Yes")
else :
    print("No")
# Judge status: Accepted
N = input()
len_N = len(N)
count = 0

for i in range(len_N):
  count += int(N[i])
if count%9 == 0:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import math
import numpy as np
A,B = list(map(int,input().split()))
if A == 1:
  print(B)
  exit()
if B == 1:
  print(A)
  exit()
C = A*B
D = []
for i in range(1,int(math.sqrt(C))):
  if A % i == 0 and B % i == 0:
    A = A // i
    B = B // i
    D.append(i)
    C = A*B
for j in range(1,int(math.sqrt(C))):
  if A % j == 0 and B % j == 0:
    A = A // j
    B = B // j
    D.append(j)
    C = A*B
p = np.prod(D)
if p != 0:
  C = C*p
print(C)
# Judge status: Wrong Answer
a,b=map(int,input().split())

s=max(a,b)

print(s*(s-1))
# Judge status: Accepted
N, M=map(int, input().split())
if N==1 or M==1:
  if N*M==1:
    print(1)
  else:
    print(max(N, M)-2)
else:
  print((N-2)*(M-2))
# Judge status: Accepted
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

dis = abs(A - B)
if V <= W:
  print('NO')
else:
  if (dis / (V - W)) <= T:
    print('YES')
  else:
    print('NO')
# Judge status: Accepted
n,m=map(int,input().split())
*a,=map(int,input().split())
a.sort()
d=[a[i+1]-a[i] for i in range(m-1)]
d=sorted(d,reverse=True)
if m<=n:
	print(0)
else:
	print(sum(d[(n-1):]))
# Judge status: Wrong Answer
n=int(input())
s=[]
for _ in range(n):
	s.append(str(input()))

counter={}
ans=0
for i in range(n):
	ss = sorted(s[i])
	ss=("").join(ss)
	if ss not in counter:
		counter[ss]=0
	else:
		counter[ss]+=counter[ss]+1
print(counter)
for k,v in counter.items():
	if v>0:
		ans+=v
print(ans)
# Judge status: Accepted
def main():
    n = int(input())
    d = {}
    ans = 0
    
    for _ in range(n):
        ss = ''.join(sorted(input()))
        d[ss] = d.get(ss, 0) + 1
        
    for v in d.values():
            ans += (v*(v-1)) // 2
         
    print(ans)
       
    
if __name__ == '__main__':
    main()
# Judge status: Accepted

def main():
	n, m =  map(int , input().split())
	ab = []
	for i in range(0 , n):
		ab.append(list(map(int , input().split())))
	ab.sort()
	ans = 0
	for i in range(0 , n):
		if (m-ab[i][1]>=0):
			m = m-ab[i][1]
			ans = ans+(ab[i][0]*ab[i][1])
		elif(m>0):
			ans = ans+(m*ab[i][0])
			m  = 0
	print(ans)
if __name__ =="__main__":
	main()
# Judge status: Wrong Answer
n = int(input())
if(n%9==0):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = [0]*(n-1)
ans = a[0]
for i in range(1,n):
  b[i-1] = a[0]^a[i]
  ans ^= b[i-1]
print(ans,end=' ')
for i in range(1,n):
  print(ans^b[i-1],end=' ')
# Judge status: Accepted
n, k = map(int,input().split())
x = list(map(int,input().split()))
ans = 10**10
for i in range(n-k+1):
    ans = min(ans, abs(x[i]) + abs(x[i]-x[i+k-1]), abs(x[i+k-1]) + abs(x[i]-x[i+k-1]))
print(ans)
# Judge status: Accepted
import sys
from collections import Counter

n, k, *a = map(int, sys.stdin.read().split())

def main():
    c = Counter(a)
    res = sum(sorted(c.values())[:-k])
    print(res)

if __name__ ==  '__main__':
    main()
# Judge status: Wrong Answer
import sys

sys.setrecursionlimit(10 ** 9)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = int(input())

    x3 = s % (10 ** 9)
    y3 = (s + x3) // (10 ** 9)

    print(0, 0, 10 ** 9, 1, x3, y3)


if __name__ == '__main__':
    resolve()
# Judge status: Accepted
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

best_err, best_place = None, None
for i, h in enumerate(H, start=1):
    t = T - 0.006 * h
    err = abs(t - A)
    if best_err is None or err < best_err:
        best_err, best_place = err, i
print(best_place)
# Judge status: Accepted
from collections import deque
n,m=map(int,input().split())
edge=[]
ans=[-1]*n
for i in range(n):
    edge.append([])
for i in range(m):
    x,y=map(int,input().split())
    edge[x-1].append(y-1)
    edge[y-1].append(x-1)
q=deque([0])
while q:
    x=q.popleft()
    for i in range(len(edge[x])):
        if ans[edge[x][i]]==-1:
            ans[edge[x][i]]=x+1
            q.append(edge[x][i])
print('Yes')
for i in range(len(ans)-1):
    print(ans[i+1])
# Judge status: Accepted
n = int(input())
for i in range(1,10):
  if i*111 >= n:
    print(i*111)
    break
# Judge status: Wrong Answer
n,m,x,y=map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
if max(X)+1 < min(Y):
  print("No War")
else:
  print("War")
# Judge status: Wrong Answer
A = []
for a in range(5):
  A.append(int(input()))

k = int(input())

for i in range(4, 0, -1):
  A[i] -= A[i-1]

if max(A) > k:
  print(':(')
else:
  print('Yay')
# Judge status: Wrong Answer
def main():
    a,b,t = map(int,input().split())
    ans = 0
    for i in range(t + 1):
        if i % a == 0:
            ans += b
    print(ans)
main()
# Judge status: Accepted
n,m=map(int,input().split())
a=[]
for i in range(m):
  a+=list(map(int,input().split()))

for i in range(n):
  dumy=a.count(i+1)
  print(dumy)
# Judge status: Wrong Answer
N, A, B = map(int, input().split())
if A == 0:
  print(0)
else:
  print(N) if A > N or B == 0 else print(A if N < (A + B) else N - B)
# Judge status: Accepted
N,L = map(int,input().split())

li = [L+i for i in range(N)]
if L>0:
  print(sum(li)-L)
elif N+L>0:
  print(sum(li))
else:
  print(sum(li)-li[N-1])
# Judge status: Accepted
import sys

a, b, c = map(int, input().split())

if a + b > c:
    print("No")
    sys.exit()

if 4*a*b < (c-a-b)**2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B, T = map(int, input().split())
    print(T // A * B)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
str_list = [list(input().split()) for _ in range(n)]
count = 0
u = 0
for n in str_list:
    if count == 0:
        m = n
        count +=1
        continue
    if abs(int(n[0])-int(m[0])) + abs(int(n[1])-int(m[1])) > u:
        u = abs(int(n[0])-int(m[0])) + abs(int(n[1])-int(m[1]))
    m = n
    count +=1
print(u)
# Judge status: Accepted
#!/usr/bin/env python3
n, *w = open(0).read().split()
s = set(w)
if len(s) != len(w):
    print("No")
    exit()
for i in range(1, int(n)):
    if w[i][0] != w[i - 1][-1]:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
x=int(input())
if x>=30:
	print("Yes")
else:
	print("No")