peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n, k = map(int, input().split())
A = list(map(lambda x: int(x)-1, input().split()))

history = [-1]*n
cur = 0
for i in range(n):
    if history[cur] != -1:
        init_cnt = history[cur]
        loop_cnt = i - history[cur]
        break
    history[cur] = i
    cur = A[cur]

loop = k if k <= init_cnt else init_cnt+((k-init_cnt) % loop_cnt)
print(history.index(loop)+1)
# Judge status: Wrong Answer
#d
n = int(input())
a = list(map(int, input().split()))
ans = [0]*len(a)
for i in range(len(a),0,-1):
    if sum(ans[i-1::i])%2 != a[i-1]:
        ans[i-1] = 1
print(sum(ans))
if sum(ans) > 0:
    ans=[str(a) for a in ans]
    ans=" ".join(ans)
    print(ans)
# Judge status: Wrong Answer
h,n = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
if len(a) >=2:
    print("Yes") if a[0] + a[1] >= h else print("No")
else:
    print("Yes") if a[0] >= h else print("No")
# Judge status: Wrong Answer
n = int(input())


ans = 0
if n % 2 == 0:
    ans = n // 10
    n = n // 10
    while n // 5 > 0:
        ans += n // 5
        n = n // 5

else:
    if (n // 5) % 2 == 0:
        ans = n // 10
        n = n // 10

    else:
        ans = n // 10 + 1
        n = n // 10 + 1

    while n // 5 > 0:
        n = n // 5
        ans += n
print(ans)
# Judge status: Accepted
x= int(input())

if x==1:
    print(1)
    exit(0)

cnt=1
iterate=2
while cnt<x:
    cnt+=iterate

    if x<=cnt:
        break
    iterate+=1


print(iterate)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=10**10
c=[b]*n
c[0]=0
c[1]=abs(a[1]-a[0])
for i in range(n-2):
    for j in range(1,3):
        c[i+j]=min(c[i+j],c[i]+abs(a[i+j]-a[i]))
c[-1]=min(c[-1],c[-2]+abs(a[-2]-a[-1]))
print(c[-1])
# Judge status: Accepted
n = int(input())
print(n*800-int(n/15)*200)
# Judge status: Accepted
x,y=map(int,input().split())
print(x+y//2)
# Judge status: Accepted
X, Y = map(int, input().split())
cn = 1
for i in range(10**7):
    X = X *2
    if X <= Y:
        cn = cn + 1
    else:
        print(cn)
        break
# Judge status: Accepted
n = int(input())
res = [0]*n

for x in range(n-1):
  c,s,f = map(int,input().split())
  for y in range(x+1):
    if res[y] < s:
      res[y] = s + c
    else:
      res[y] = ((res[y]-1)//f +1)*f + c
  
for asldijfgherab in range(n):
  print(res[asldijfgherab])
# Judge status: Accepted
def main():
  s,w = map(int,input().split())
  if s <= w:
    print('unsafe')
  else:
    print('safe')

if __name__ == '__main__':
  main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
print('Yes' if max(a) < sum(a) - max(a) else 'No')
# Judge status: Accepted
a,b=map(int,input().split(" "))
print(max(a,b)+max(max(a,b)-1,min(a,b)))
# Judge status: Wrong Answer
a, b, t = map(int, input().split())
ans = 0
for i in range(a, t+1):
  ans += b
print(ans)
# Judge status: Accepted
a = int(input())
b = int(input())
if a != 1 and b != 1:
  print(1)
elif a != 2 and b!= 2:
  print(2)
else:
  print(3)
# Judge status: Accepted
N = int(input())

print(((N + 1) // 2) / N)
# Judge status: Wrong Answer
import math
N,K=map(int,input().split())
s=[]
t=1
for i in range(1,N+1):
  if i<K:
    while t<math.log2(K)-math.log2(i):
      t+=1
    else:
      s.append((1/N)*(1/2)**t)
      break
  else:
    s.append(1/N)
print(sum(s))
# Judge status: Wrong Answer
n, k = map(int, input().split())
s = input()

i = 0
m = 0
for i in range(n-1):
    if s[i] == 'R' and s[i+1] == 'L':
        m += 1
if m >= k:
    m -= k
    k = 0
else:
    m = 0
    k -= m
m *= 2
if s[0] == 'L':
    m += 1
if s[-1] == 'R':
    m += 1

m = max(m-k, 0)
print(n-m)
# Judge status: Accepted
a = int(input())
print(int(a**3+a**2+a))
# Judge status: Accepted
def main():
    n, k, s = map(int, input().split())
    if k == 0:
        if s != 10**9:
            ans = [10**9]*n
        else:
            ans = [1]*n
    else:
        if s == 10**9:
            ans = ([s]*k)+([1]*(n-k))
        else:
            ans = [s]*(k)+[10**9]*(n-k)
    print(*ans)


main()
# Judge status: Accepted
s=input()
c=0
for i in range(len(s)):
    if i%2==0:
        if s[i] not in "RUD":
            c+=1
            break
    else:
        if s[i] not in "LUD":
            c+=1
            break
print("Yes"if c==0 else"No")
# Judge status: Wrong Answer
N,X,Y=open(0).read().split()


N=int(N)

X=int(X)

Y=int(Y)

goukei=N+X*2

if goukei>=Y:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n=int(input())
a=[int(input()) for i in range(n)]
ans=0
for i in range(n):
  ans+=a[i]//2
  a[i]=a[i]%2
if n>=2:
  for i in range(n-1):
    if a[i]==1 and a[i+1]==1:
      ans+=1
      a[i]=0
      a[i+1]=0
print(ans)
# Judge status: Accepted
K = int(input())
S = input()
if len(S) <= K:
    print(S)
else:
    print(S[:K] + '...')
# Judge status: Accepted
s = input()

if (s == 'AAA') | (s == 'BBB'):
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
# A - Grouping
a=['1','3','5','7','8','10','12']
b=['4','6','9','11']
x,y=list(map(int,input().split()))
if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x,k,d = list(map(int, input().split()))

if x < 0:
  q = (x // d) * -1
  if k < q:
    x = x + d * k
  else:
    ak = (k - q) % 2
    x = x + d * q - d * ak
else:
  q = x // d
  if k < q:
    x = x - d * k
  else:
    ak = (k - q) % 2
    x = x - d * q - d * ak
print(abs(x))
# Judge status: Accepted
l = list(map(int, input().split()))
if (l[2]-l[1]) == (l[1]-l[0]):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n = input()
print("Yes" if len(set(n[:3])) == 1 or len(set(n[1:])) == 1 else "No")
# Judge status: Accepted

l = [int(x) for x in input().split(' ')]

if (5 not in l):
  print('NO')

if (7 not in l):
  print('NO')

if (sum(l) == 17):
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
from itertools import combinations

N, X, Y = (int(n) for n in input().split(' '))

shortests = [0]*(N - 1)

for i, j in combinations(list(range(1, N + 1)), 2):
  dist = j - i
  if i <= X <= Y <= j:
    dist -= Y - X - 1
  elif i <= X <= j < Y:
    dist = min(dist, X - i + 1 + Y - j)
  elif X <= i <= Y <= j:
    dist = min(dist, i - X + 1 + j - Y)
  shortests[dist - 1] += 1

for val in shortests:
  print(val)
# Judge status: Wrong Answer
NK = list(map(int, input().split()))
ans = [0]*NK[0]

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(0,NK[0]):
    if table.count(j) == 1:
      ans[j] = 0
print(NK[1]-sum(ans))
# Judge status: Wrong Answer
from fractions import gcd
from functools import reduce

mod = 10 ** 9 + 7

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

# print('input >>')
N = int(input())
A = list(map(int,(input().split())))

lcmn = lcm(A)

ans = 0
for i in range(len(A)):
    if i % 3 == 0:
        ans += (lcmn // A[i]) % mod

# print('-----output-----')
print(int(ans%mod))
# Judge status: Accepted
n = input()
ans = 0
for i in range(len(n)):
  if n[i] == '1':
    ans += 1
print(ans)
# Judge status: Accepted
import numpy as np

x,y,a,b,c=[int(x) for x in input().split()]
p=[int(x) for x in input().split()]
q=[int(x) for x in input().split()]
r=[int(x) for x in input().split()]

p=list(np.sort(p)[::-1][0:x])
q=list(np.sort(q)[::-1][0:y])

select=np.sort(p+q+r)[::-1][0:x+y]
print(sum(select))
# Judge status: Accepted
N = int(input())
Sum = sum(list(map(int, str(N))))
if Sum % 9 == 0:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
from itertools import product

N = int(input())

cnt = [0]*100000000

for x in range(1,81):
    for y in range(1,81):
        for z in range(1,81):
            cnt[x**2 + y**2 + z**2 + x*y + y*z + z*x -1] += 1

for i in range(N):
    print(cnt[i])
# Judge status: Accepted
from math import ceil

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

if N == K:
    print(1)
    exit()


print(ceil((N - K) / (K - 1)) + 1)
# Judge status: Wrong Answer
K,A,B = map(int,input().split())
if A+2 >= B:
    print(1+K)
else:
    beatC,m = divmod((K - (A-1)),2)
    print(beatC*(B-A)+(K - 2 * beatC))
# Judge status: Accepted
a,b=map(int,input().split())
sa=b-a
takai=(sa*(sa+1))//2
print(takai-b)
# Judge status: Accepted
# 079a

def atc_079a(input_value: str) -> str:
    n = 3
    for i in range(0, len(input_value) + 1 - n):
        for j in range(1, n):
            if input_value[i] != input_value[i + j]:
                break
            if j == n - 1:
                return "Yes"
    return "No"

input_value = input()
print(atc_079a(input_value))
# Judge status: Wrong Answer
x,y,z=list(map(int,input().split()))

ans=[]

ans.append(z)
ans.append(x)
ans.append(y)

print(ans)
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7
u, d, c = [1], [1], [1]
for i in range(1, b + 1):
    u.append(u[-1] * (n - i + 1) % mod)
    d.append(d[-1] * i % mod)
    c.append(u[i] * pow(d[i], -1) % mod)
    #print(u,d,c)
print((pow(2, n, mod) - 1 - int(c[a] + c[b])) % mod)
# Judge status: Accepted
if input().count('9') == 0:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
s = list(input())
s.sort()
if(len(set(s))==2 and s[0]==s[1] and s[2]==s[3]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort()
 
ans = 1
for x in a:
  if ans <= 10**18:
    ans = ans * x

print(-1 if ans > 10**18 else ans)
# Judge status: Accepted
s = input()
# 先頭が0, 1が決まれば次以降は確定してしまうのでは...
ans = int(1e5 + 1)
for i in range(2):
  b = i
  temp = 0
  for c in s:
    t = int(c)
    temp += (t != b)
    b = 0 if b else 1
  ans = min(ans, temp)
print(ans)
# Judge status: Accepted
import math
n =int(input())
print(math.factorial(n) % (10**9 + 7) )
# Judge status: Accepted
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.reverse()
    
    temp = 0
    a_sum = []

    for i in range(len(a)):
        temp += a[i]
        a_sum.append(temp)

    total = 0
    a_sum.reverse()
    a.reverse()

    for i in range(1, len(a_sum)):
        total += a[i-1]*a_sum[i]
    
    print(total % (10**9+7))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n, m = map(int, input().split())
ql = [tuple(map(int, input().split())) for i in range(2*m)]
a = ql[1::2]
print(n - len(set(a)))
# Judge status: Accepted
import numpy as np

a,b,x = input().split()
a = int(a)
b = int(b)
x = int(x)
ans = 0
if 2*x/(a**2) < b:
  l = 2*x/(a*b)
  ans = np.arctan(l/b)
else:
  l = 2 * (b - x/(a**2))
  if l == 0:
    ans = np.pi/2
  else:
    ans = np.arctan(a/l)

ans = 90 - np.rad2deg(ans)
print('{:.10f}'.format(ans))
# Judge status: Accepted
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, T = list(map(int, sys.stdin.readline().split()))

    ret = 1001
    for n in range(N):
        c, t = list(map(int, sys.stdin.readline().split()))
        if T >= t: ret = min(c, ret)

    print('TLE' if ret == 1001 else ret)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n =int(input())
a =list(map(int,input().split()))

#print(a)

cnt = 0

for i in range(n):
  #print(i)
  if (i+1)%2 ==1:
    if a[i]%2 ==1:
      cnt +=1
        
print(cnt)
# Judge status: Accepted
N=input()
if "7" in N:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
S = input()
dp = [False for _ in range(len(S)+1)]
char_list = ['dream', 'dreamer', 'erase', 'eraser']
dp[0] = True

for i in range(len(S)):
  if dp[i] == False:
    continue
  for char in char_list:
    if S[i:i+len(char)] == char:
      dp[i+len(char)] = True

if dp[len(S)]:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
N,M = map(int,input().split())
X = list(map(int,input().split()))
li = [0]*(M-1)
X.sort()
for i in range(M-1):
    li[i] = abs(X[i]-X[i+1])

li.sort()
print(sum(li[:M-(N//2)-N%2-1]))
# Judge status: Wrong Answer
p,q,r=map(int,input().split())
if p+q<=q+r and p+q<p+r:
    print(p+q)
if p+r<=p+q and p+r<q+r:
    print(p+r)
if q+r<=p+r and q+r<p+q:
    print(q+r)
if p+r<=q+r and p+r<p+q:
    print(p+r)
if p==q==r:
    print(p+q)
if r+p==q+r and r+p>p+q:
    print(r+p)
# Judge status: Wrong Answer
import sys
n = int(input())
f = []
for _ in range(n):
    a, b = map(int, input().split())
    f.append((a, b, b - a))
f.sort(key=lambda x: x[2], reverse=True)
t = f[0][1]
for a, b, c in f:
    if t < c:
        print('No')
        sys.exit()
    t -= a
print('Yes')
# Judge status: Accepted
x = int(input())
cnt = 0
if x>11:
    cnt += 2*(x//11)
    x %= 11

while True:
    if x<=0:
        break
    x -= 6
    cnt += 1
    if x <= 0:
        break
    x -= 5
    cnt += 1
    if x<=0:
        break
print(cnt)
# Judge status: Accepted
l=int(''.join(input().split()))%4
print("YES") if l==0 else print("NO")
# Judge status: Accepted
s=input();print("YNeos"['L'in s[0::2]or'R'in s[1::2]::2])
# Judge status: Accepted
n,m,k,*a=map(int,open(0).read().split())
s=sum(a[:n])
x=i=j=n
a+=k,
while~i:
 while s+a[j]<=k:s+=a[j];j+=1
 if s<=k:x=max(x,i+j)
 i-=1;s-=a[i]
print(x-n)
# Judge status: Accepted
a,b,n=map(int,input().split())
if n>=b-1:
    count=0
    for i in range(a):
        count+=(((b-1)/b)+(i/a))//1
    print(int(count))
else:
    count=0
    for j in range(a):
        count+=((n/b)+(j/a))//1
    print(int(count))
# Judge status: Accepted
s = input()
for i in range(2**3):
    ls = ['+','+','+']
    for j in range(len(ls)):
        if (i >> j) & 1:
            ls[j] = '-'
    if eval(s[0]+ls[0]+s[1]+ls[1]+s[2]+ls[2]+s[3]) == 7:
        print(s[0]+ls[0]+s[1]+ls[1]+s[2]+ls[2]+s[3]+"=7")
        break
# Judge status: Accepted
a, b = map(int, input().split())

if a == b:
    print('Draw')
elif a == 1 or (b != 1 and a > b):
    print('Alice')
else:
    print('Bob')
# Judge status: Accepted
a,b,c=map(int,input().split())

if a==b and b==c: print('No')
elif a==b or b==c or c==a: print('Yes')
else: print('No')
# Judge status: Accepted
# coding: utf-8
# Your code here!

N, K = map(int, input().split())
rem = N % K
mns = abs(rem - K)
print(min(rem, mns))
# Judge status: Accepted
a,b = map(int, input().split())
s = input()

if s[a] != '-':
  print('No')
  exit()
elif '-' in s[:a-1]:
  print('No')
  exit()
elif '-' in s[a+1:]:
  print('No')
  exit()
else:
  print('Yes')
# Judge status: Accepted
s=input()
acgt=['A','C','G','T']
m=0
cnt=0
for i in range(len(s)):
    if s[i] in acgt:
        cnt+=1
    else:
        m=max(cnt,m)
        cnt=0
print(max(cnt,m))
# Judge status: Accepted
n, k = map(int,input().split())
p = list(map(int, input().split()))
ans = 0
for _ in range(k):
  m = min(p)
  ans += m
  p.remove(m)
  
print(ans)
# Judge status: Wrong Answer
'''input
8 10
'''
import math

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

a_low = math.ceil((a + 0) * 12.5)
a_hig = math.floor((a + 1) * 12.5)

b_low = math.ceil((b + 0) * 10)
b_hig = math.floor((b + 1) * 10)

if b_low <= a_low and a_low <= b_hig:
    print(a_low)
    exit()

if a_low <= b_low and b_low <= a_hig:
    print(b_low)
    exit()

print(-1)
# Judge status: Accepted
N = int(input())
cnt = 0
now = 0
while True:
    now +=1
    cnt += now
    if cnt >=N:
        break
for i in range(1,now+1):
    if i == cnt-N:
        continue
    else:
        print(i)
# Judge status: Accepted
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if b-a<=k and c-b<=k and d-c<=k and e-d<=k and c-a<=k and d-a<=k and e-a<=k and d-b<=k and e-b<=k and e-c<=k:
    print("Yay!")
else:
    print(":(")
# Judge status: Wrong Answer
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if B-A > (V-W)*T:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
def main():
    n = int(input())
    P = list(map(int, input().split()))
    ans = 0
    for idx in range(1, n-1):
        if P[idx] == sorted([P[idx-1], P[idx], P[idx+1]])[1]:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
K, X=map(int,input().split())
if K*500>=X:
  print("Yes")
else : 
  print("No")
# Judge status: Accepted
n = int(input())
res = 0
while n:
    res += n % 10
    n //= 10
if res == 1:
    print(10)
else:
    print(res)
# Judge status: Accepted
H = int(input())
ans = 0
add = 1
while H > 0:
    ans += add
    H //= 2
    add *= 2

print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
import math

ans = 0

if N == 0 or N == 1:
  ans += 0
else:
  ans += N*(N-1)/2
  
if M == 0 or M == 1:
  ans += 0
else:
  ans += M*(M-1)/2  

print(math.floor(ans))
# Judge status: Accepted
n = int(input())
s = []
for i in range(n):
    s.append(list(input()))
ans = []
for i in range(len(s[0])):
    cnt = 0
    for j in range(n):
        if s[0][i] in s[j]:
            cnt += 1
    if cnt == n:
        ans.append(s[0][i])
        for j in range(1,n):
            s[j].remove(s[0][i])
ans.sort()
print(''.join(ans))
# Judge status: Accepted

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

if n == m:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
H = list(map(int,input().split()))
ans = 0
num = 0
for i in range(N-1):
    if H[i]>=H[i+1]:
        num += 1
    else:
        ans = max(ans,num)
        num = 0
    ans = max(ans,num)
print(ans)
# Judge status: Accepted
s=list(input())
flag=1
if s[0]!='A':
    flag=0
if 'C' not in s[2:-1]:
    flag=0
if s.count('C')!=1:
    flag=0
if 'A' in s:
    s.remove('A')
if 'C' in s:
    s.remove('C')
s=''.join(s)
if s.islower():
    pass
else:
    flag=0
if flag==1:
    print('AC')
else:
    print('WA')
# Judge status: Wrong Answer
N = int(input())
print(N*800-200*N//15)
# Judge status: Wrong Answer
n = int(input())+1
a = list(map(int, input().split()))
m_node = [1]*n
node = 0
total = 0

if n == 1:
    if a[0] != 1:
        print("-1", end="")
        exit()
    else:
        print("1", end="")
        exit()

for i in range(1, n):
    m_node[i] = (m_node[i-1] - a[i-1])*2
    if m_node[i] <= 0:
        print("-1", end="")
        exit()
for i in reversed(range(n)):
    node = min((node+a[i]), m_node[i])
    total += node

print(total, end="")
# Judge status: Wrong Answer
from math import sqrt
a, b = input().split()

integer = int(a + b)
sqr_int = sqrt(integer)

if sqr_int % 2 == 0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n=int(input())

temp=0
cnt=0


for _ in range(n):
    a=int(input())
    hoge=min(a,temp)
    cnt+=hoge

    if a>hoge:
        cnt+=(a-hoge)//2
        temp=(a-hoge)-((a-hoge)//2)*2
    else:
        temp=0

print(cnt)
# Judge status: Wrong Answer
l, count = [], 0
s = int(input())
l.append(s)
while(True):
    count += 1
    if (s%2):
        s = 3*s+1
    else:
        s//=2
    l.append(s)
    if count>10000:
        break
for i in range(1,len(l)):
    if l[i] in l[i+1:]:
        loc = l[i+1:].index(l[i])+1
        print(loc+i+1)
        break
# Judge status: Accepted
H = int(input())
W = int(input())
N = int(input())

if H > W:
    ans = (N + (H - 1)) // H
else:
    ans = (N + (W - 1)) // W

print(ans)
# Judge status: Accepted
w, h, n = map(int, input().split())
xl = 0
xr = w
yd = 0
yu = h
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1: xl = max(xl, x)
    if a == 2: xr = min(xr, x)
    if a == 3: yd = max(yd, y)
    if a == 4: yu = min(yu, y)
print(max(0, xr - xl) * max(0, yu - yd))
# Judge status: Accepted
k=float(input())
volume=(k/3)*(k/3)*(k/3)
print(volume)
# Judge status: Accepted
def main():
    N, *X = map(int, open(0).read().split())
    l, r = sorted(X)[N // 2 - 1:N // 2 + 1]
    print("\n".join([str(r) if x < r else str(l) for x in X]))
    return


main()
# Judge status: Wrong Answer
n, c, k = map(int, input().split())

lt = list()
for i in range(n):
    lt.append(int(input()))
lt.sort()

b = 1  #the number of buses
p = 0  #passengers
m = lt[0]

for i in range(n):
    if p < c-1 and lt[i]-m < k:
        p += 1
    else:
        p = 0
        b += 1
        m = lt[i]

print(b)
# Judge status: Accepted
# E - Red Scarf

N = int(input())
A = list(int(a) for a in input().split())

B = A[0]
for i in range(1, N):
    B ^= A[i]

C = []
for i in range(N):
    C.append(B^A[i])

print(' '.join(map(str, C)))
# Judge status: Accepted
import sys
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

A, B = map(int, input().split())
print(int(A*B))

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

ao = a // d + 1
taka = c // b + 1

if c % b == 0:
  taka -= 1
if a % d == 0:
  ao -= 1
  
if taka<=ao:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l1=list(map(int,input().split()))
    l2=list(map(int,input().split()))
    ans=0
    for i in range(n):
        cnt=sum(l1[:i+1])+sum(l2[i:])
        ans=max(ans,cnt)
    print(ans)
resolve()
# Judge status: Accepted
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())


c=abs(a-b)-v*t+w*t
if c<=0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import sys
input = sys.stdin.readline

S=input().strip()

N = len(S)//2
i = 0
while True:
    i += 1
    a = S[0:(N-i)]
    b = S[(N-i):(2*N-2*i)]
    if a == b:
        print(len(a)*2)
        exit()
# Judge status: Accepted
print('YES') if int(input()) in [3, 5, 7] else print('NO')
# Judge status: Accepted
N = int(input())
L_s = str(input()).split(" ")
L = []
for l in L_s:
    L.append(int(l))

max_v = int(max(L))
L.pop(L.index(max(L)))

sum = 0
for i in L:
    sum += int(i)

if max_v < sum:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def main():
    q, h, s, d = map(int, input().split())
    n = int(input())

    if n % 2 == 0:
        print(min(8 * q, 4 * h, 2 * s, d) * (n // 2))
    else:
        print(min(8 * q, 4 * h, 2 * s, d) * (n // 2) + min(4 * q, 2 * h, s))


if __name__ == "__main__":
    main()
# Judge status: Accepted
r, g, b = input().split()

if int(r+g+b) % 4 == 0:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
a,b,k=map(int,input().split())
print(max(a-k,0), max(b-max(k-a, 0), 0))
# Judge status: Wrong Answer
def resolve():
    '''
    code here
    '''
    A, B, C, K = [int(item) for item in input().split()]

    if K % 2 == 0:
        res = B - A
    else:
        res = A -B


    print(res)
if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

cnt=0
for i in range(len(a)):
    if (i+1)&1==a[i]==1:
        cnt+=1
print(cnt)
# Judge status: Wrong Answer
def main():
    N, M = map(int, input().split())
    l = []
    red = [1]
    for i in range(M):
        l.append(list(map(int, input().split())))
    for i in range(M):
        if l[i][0] in red:
            red.append(l[i][1])
            red.remove(l[i][0])
    print(len(set(red)))

main()
# Judge status: Accepted
N,A,B,C,D = map(int,input().split())
S = input()
A_start = True
if C < D:
  space1 = S[A-1:D]
  if ('##' in space1) != True:
    print('Yes')
  else:
    print('No')
else:
  space1 = S[A-1:C]
  space2 = S[B-2:D+1]
  if ('##' in space1) != True and ('...' in space2) == True:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,k = iim()
H = []
for _ in range(n):
    H.append(ii())
H.sort()

ans = 1000000000
for i in range(n-k+1):
    ans = min(H[i+k-1]-H[i],ans)
print(ans)
# Judge status: Accepted
from collections import deque
n = int(input())
a = [int(i) for i in input().split()]
b = deque()
if n % 2 == 0:
    for i, j in enumerate(a):
        if (i + 1) % 2 == 0:
            b.appendleft(j)
        else:
            b.append(j)
else:
    for i, j in enumerate(a):
        if (i +1) % 2 == 0:
            b.append(j)
        else:
            b.appendleft(j)
print(*b)