peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
ken, city = map(int,input().split())
grid = []
for i in range(city):
    array = list(map(int, input().strip().split()))
    grid.append(array)

grid.sort()

for i in range(city):
    print(str(grid[i][0]).zfill(6),str(grid[i][1]).zfill(6),sep="")
# Judge status: Accepted
a,b,c=map(int,input().split())
e=(a-b)|(b-c)
print((e!=0|b%2)*(e^~-e).bit_length()-1)
# Judge status: Accepted
N=int(input());t={0:0}
for i in range(1,N+1):
 x,j=N,0
 while 6**j<=i:x=min(x,t[i-6**j],t.get(i-9**j,N));j+=1
 t[i]=x+1
print(t[N])
# Judge status: Accepted
W,H,N = map(int,input().split())
grid = []
for i in range(N):
	array = list(map(int,input().split()))
	grid.append(array)
x1 = 0
xW = W
y1 = 0
yH = H
for i in grid:
	if i[2] == 1 and x1 < i[0]:
		x1 = i[0]
	elif i[2] == 2 and xW > i[0]:
		xW = i[0]
	elif i[2] == 3 and y1 < i[1]:
		y1 = i[1]
	elif i[2] == 4 and yH > i[1]:
		yH = i[1]
print(max(0,xW-x1)*max(0,yH-y1))
# Judge status: Accepted
C = [list(map(int, input().split())) for _ in range(3)]

for i in range(3):
    minint = min(C[i])
    for j in range(3):
        C[i][j] -= minint

ans = True

for j in range(3):
    t = C[0][j]
    for i in range(3):
        if t != C[i][j]:
            ans = False
            break

if ans:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
import fractions
input = sys.stdin.readline

MOD = pow(10, 9) + 7
n = int(input())
a = list(map(int, input().split()))

lcm = a[0]
for i in range(n):
    lcm = lcm * a[i] // fractions.gcd(lcm, a[i])

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

print(sum(b) % MOD)
# Judge status: Accepted
a,b = map(int, input().split())

if a*b % 3 ==0:
    print("Possible")

elif (a+b) %3 ==0:
    print("Possible")

else:
    print("Impossible")
# Judge status: Accepted
N, H = map(int, input().split())
A, B = [0 for _ in range(N)], [0 for _ in range(N)]
for i in range(N):
  A[i], B[i] = map(int, input().split())
m = max(A)
B.sort(reverse=True)
cnt = N - 1
while B[cnt] < m:
  cnt -= 1
ccnt = 0
for i in range(cnt+1):
  H -= B[i]
  ccnt += 1
  if H <= 0:
    break
if H > 0:
  ccnt += -(-H//m)
print(ccnt)
# Judge status: Accepted
import heapq

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = list(map(lambda x: x*(-1), a))
heapq.heapify(a)
for i in range(m):
    p = heapq.heappop(a) * -1 // 2 * -1
    heapq.heappush(a, p)
print(sum(a)* -1)
# Judge status: Wrong Answer
N = int(input())
li = [list(map(int, input().split())) for i in range(N - 1)]

for n in range(N):
  if n == N - 1:
    print(0)
    break
  
  ans = 0
  for index, i in enumerate(li):
    if index < n:
      continue

    if ans < i[1]:
      ans = i[1]
    else:
      if (ans - i[1]) % i[2] != 0:
        ans += i[2] - (ans % i[1])

    ans += i[0]
  print(ans)
# Judge status: Wrong Answer
s=int(input())
cnt = 1
l = []
while True:
    cnt +=1
    if s%2 == 0:
        s = s//2
    else:
        s = 3*s+1
    if s in l:
        print(cnt)
        exit()
    else:
        l.append(s)
# Judge status: Wrong Answer
s = input()
s = set(s)

if len(s)%2==0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
if int(input()) >= 30:
    print('yes')
else:
    print('no')
# Judge status: Accepted
n, k, *a = map(int, open(0).read().split())
now = 0
st = set()
ls = []
while not now in st:
    st.add(now)
    ls.append(now)
    now = a[now]-1
bi = ls.index(now)
lp = len(ls) - bi
if k<=bi: print(ls[k]+1)
else:
    k -= bi
    k %= lp
    print(ls[bi+k]+1)
# Judge status: Accepted
from itertools import product
inpl = lambda: list(map(int,input().split()))
N, M, X = inpl()
A = []
C = []
for _ in range(N):
    H = inpl()
    C.append(H[0])
    A.append(H[1:])

ans = -1
for s in product(range(2), repeat=N):
    U = [ sum( A[n][m] for n in range(N) if s[n]) for m in range(M)]
    for m in range(M):
        if U[m] < X:
            break
    else:
        P = sum(C[n] for n in range(N) if s[n])
        if ans < 0 or P < ans:
            ans = P
print(ans)
# Judge status: Accepted
s = input()
n = len(s)
a = s[:(n-1)//2]
b = s[((n+3)//2)-1:]
if a == b:
    a_rev = a[::-1]
    b_rev = b[::-1]
    if a == a_rev and b == b_rev:
        print('Yes')
    else:
        print('No')
else:
    print('No')
# Judge status: Accepted
n,a,b,c,d = map(int,input().split())
s = "s" + input()

for i in range(a,max(c,d)-1):
        if s[i] == s[i+1] == "#":
            print("No")
            exit()
if c < d:
    print("Yes")
else:
    for i in range(b,d+1):
        if s[i+1] == s[i-1] == s[i] == ".":
            print("Yes")
            exit()
    print("No")
# Judge status: Accepted
[(a,b,c),(d,e,f),(g,h,i)]=[map(int,input().split()) for _ in range(3)]
print("Yes" if a-b==d-e==g-h and b-c==e-f==h-i else "No")
# Judge status: Accepted
n = int(input())
a = [int(x) for x in input().split()]
d = {}

for i in range(len(a)):
    if a[i] - 1 not in d:
        d[a[i]-1] = 1
    else:
        d[a[i]-1] += 1
    if a[i] not in d:
        d[a[i]] = 1
    else:
        d[a[i]] += 1
    if a[i] + 1 not in d:
        d[a[i] + 1] = 1
    else:
        d[a[i] + 1] += 1

ans = sorted(d.values(),reverse = True)
print(ans[0])
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
ans=0
l=1
for i in a:
  if i!=l:
    ans+=1
  else:
    l+=1
if ans==N:
  print("-1")
else:
  print(ans)
# Judge status: Accepted
A,B = input().split()

A = int(A)
B1,B2 = B.split(".")
answer = A * (int(B1) * 100 + int(B2))

print(answer // 100)
# Judge status: Accepted
a,b,c = map(int, input().split())
if b-a==c-b:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
from itertools import permutations
n=int(input())
p=tuple([int(i) for i in input().split()])
q=tuple([int(i) for i in input().split()])
pr=[i for i in permutations(range(1,n+1))]
for i,j in enumerate(permutations(range(1,n+1))):
  if j==p:
    a=i
  if j==q:
    b=i
print(abs(a-b))
# Judge status: Accepted
n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
c=[list(map(int,input().split())) for _ in range(m)]
ans=[[] for _ in range(n)]
for i in range(n):
  p,q=a[i]
  for j in range(m):
    r,s=c[j]
    d=abs(p-r)+abs(q-s)
    ans[i].append((d,j+1))
  ans[i]=sorted(ans[i])
for i in ans:
  print(i[0][1])
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a>=b:
    print(round(b/a))
elif a<b:
    x=round(b/a)+1
    print(x)
# Judge status: Accepted
K=int(input())
if K%2==0:
	print((K//2)**2)
else:
	print(K//2*((K//2)+1))
# Judge status: Wrong Answer
from collections import deque

n = int(input())
task_dict = {}
a_l = []
b_l = []

for i in range(n):
	a,b = map(int,input().split())
	if b in task_dict.keys():
		task_dict[b].append(a)
	else:
		task_dict[b] = [a]

deque = deque()
dl_set = set(task_dict.keys())
t = max(dl_set)

for i in range(t+1)[::-1]:
	if i in dl_set:
		deque.extend(task_dict[i])
	if i <= t:
		if deque:
			nes_time = deque.pop()
			t -= nes_time

if t >= 0 and len(deque) == 0:
	print('Yes')
else:
	print('No')
# Judge status: Accepted
a,b,m = map(int,input().split())
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
disc = [[]]*m
for i in range(m):
  disc[i] = list(map(int,input().split()))
mina = 100000
minb = 100000
for i in range(a):
  mina = min(mina,al[i])
for i in range(b):
  minb = min(minb,bl[i])
total = mina+minb
for i in range(m):
  total = min(total,al[disc[i][0]-1]+bl[disc[i][1]-1]-disc[i][2])
print(total)
# Judge status: Wrong Answer
N = int(input())
a = [int(input()) for i in range(N)]
isFound = False
a1 = a[1 - 1]
ai = a[a1 - 1]
for i in range(2, N + 1):
    if (ai == 2):
        print(i)
        isFound = True
        break
    ai = a[ai - 1]
if (isFound is not True):
    print(-1)
# Judge status: Wrong Answer
N,D = map(int,input().split())
a = 0
for num in range(1,N+1) :
  X,Y = map(int,input().split())
  if X*X + Y*Y <= D*D :
    a = 1
print(a)
# Judge status: Wrong Answer
N = int(input())

count = 0
for i in range(1, N+1):
    yakusu_count = 0

    if i % 2 == 0:
        break

    for j in range(1, N+1):
        if N % j == 0:
            yakusu_count += 1

    if yakusu_count == 8:
        count += 1

print(count)
# Judge status: Accepted
def fac(a):
    result = 1
    for i in range(1, a+1):
        result = result * i % (10**9+7)
    return result

n, m = map(int, input().split())
if abs(n-m) >= 2:
    print(0)
else:
    dog = fac(n)
    monkey = fac(m)
    if abs(n-m) == 1:
        print(dog*monkey%(10**9+7))
    else:
        print(2*dog*monkey%(10**9+7))
# Judge status: Accepted
Q, H, S, D = list(map(int, input().split()))
N = int(input())

ans1 = 4 * Q * N
ans2 = 2 * H * N
ans3 = S * N

if N < 2:
    ans4 = float('INF')
elif N % 2 == 0:
    ans4 = (N // 2) * D
else:
    t = (N // 2) * D
    ans4 = t + min(4 * Q, 2 * H, 1 * S)

# print(ans1, ans2, ans3, ans4)
ans = min(ans1, ans2, ans3, ans4)
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(lambda x:int(x)-1, input().split()))

cnts = [None] * N

pos = 0
cnt = 0

while cnt < K:
    if cnts[pos] != None:
        loop_size = cnt - cnts[pos]
        cnt += ((K-cnt-1) // loop_size) * loop_size
        cnts = [None] * N
    cnts[pos] = cnt
    pos = A[pos]
    cnt += 1

print(pos+1)
# Judge status: Accepted
N, K = map(int, input().split())
H = list(map(int, input().split()))

dp = [10 ** 9] * N
dp[0] = 0

for i in range(1, N):
	for j in range(min(i, K) + 1):
		dp[i] = min(dp[i], dp[i - j] + abs(H[i] - H[i - j]))
print(dp[-1])
# Judge status: Accepted
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
import math

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def main():
	n = int(rl())
	S = 0
	A = list(rli())
	for x in A:
		S ^= x
	ans = []
	for i in range(n):
		ans.append(S ^ A[i])
	print(" ".join(str(x) for x in ans))
	stdout.close()

if __name__ == "__main__":
	main()
# Judge status: Accepted
n,m=map(int,input().split())
if n==m==1:
  print(1)
  exit()
if n>=3 and m>=3:
  print((n-2)*(m-2))
elif n==1 or m==1:
  print(n*m-2)
else:
  print(0)
# Judge status: Accepted
x = list(map(int, input().split()))
l = []
for i in range(1, 101):
  if (x[0]%i) == 0 and (x[1]%i) == 0:
    l.append(i)
l.sort(reverse=True)
print(l[x[2]-1])
# Judge status: Accepted
from collections import defaultdict
n = int(input())
a = [0]
a.extend(map(int, input().split()))
mp = defaultdict(int)
ans = 0
for i in range(1, n+1):
    ans += mp[i-a[i]]
    mp[i+a[i]] += 1
print(ans)
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    N = int(input())

    num = str(N)
    ans = "No"
    if num[0] == num[1] == num[2]:
        ans = "Yes"
    if num[1] == num[2] == num[3]:
        ans = "Yes"

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
x, k, d = map(int, input().split())
if x < 0:
    x = -x
t = x // d
if k <= t:
    print(x - k*d)
    exit()
x -= t * d
k -= t
if k%2 == 1:
    print(abs(x - d))
else:
    print(x)
# Judge status: Accepted
N = input()

if "7" in N:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
N = list(str(N))
for i in range(len(N)):
  N[i] = int(N[i])
print(N[0]-1 + 9*(len(N)-1))
# Judge status: Wrong Answer
#A問題

S = input()
if S == "RRR":
    print(3)
if S == "RRS"or S == "SRR" :
    print(2)
if S == "SSS":
    print(0)
else:
    print(1)
# Judge status: Accepted
N = int(input())

if N in (1, 2):
    print(N)
    exit()

for i in range(2, 10 ** 4):
    x = i * (i + 1) / 2
    if x - (i - 1) <= N <= x:
        a = i
        break

ans = [i for i in range(1, a + 1)]
b = a*(a+1)/2 - N

for i in range(1, a+1):
    if i != b:
        print(i)
# Judge status: Accepted
import heapq
n,m = map(int,input().split())
b_list = [[] for _ in range(10**5+10)]

for i in range(n):
    a,b = map(int,input().split())
    b_list[a].append(-b)

candy = []
heapq.heapify(candy)
ans = 0
for i in range(1,m+1):
    for j in b_list[i]:
        heapq.heappush(candy,j)
    if candy: 
        ans += (-1*heapq.heappop(candy))

print(ans)
# Judge status: Wrong Answer
x = input()
alist = list(map(int,x))
result = sum(alist)
if result%9 == 0 :
    print("yes")
else:
    print("no")
# Judge status: Wrong Answer
import sys
R=list(input())
L=list(input())
L=sorted(L,reverse=True)
R=sorted(R,reverse=True)
N=len(L)
M=len(R)
if L==R:
  print("No")
  sys.exit()
for i in range(N):
  if i>=M:
    print("Yes")
    sys.exit()
  if L[i]>R[i]:
    print("Yes")
    sys.exit()
  elif L[i]<R[i]:
    print("No")
    sys.exit()
# Judge status: Accepted
from fractions import gcd


def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = a[0]
    for aa in a:
        ans = gcd(ans, aa)
        
    print(ans)
    
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
n,m = list(map(int, input().split()))

problems = [0]*n
accurate = 0
penalty = 0

for i in range(m):
    p,s = input().split()
    p = int(p)

    if s == "AC" and problems[p-1] != -1:
         #初めて正解
         penalty += problems[p-1]
         accurate += 1
         problems[p-1] = -1
    elif s == "WA" and problems[p-1] != -1:
        #正解してない問題を不正解
        problems[p-1] += 1

print(accurate,penalty)
# Judge status: Accepted
n,m = map(int,input().split())
if n == 1 and m == 1:
    print(1)
elif n == 1:
    print(m-2)
elif m == 1:
    print(n-2)
else:
    ans = n*m
    ans = ans - 2*n - (2*(m-2))
    print(ans)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
from itertools import permutations

def main():
    N = int(input())
    p = tuple(map(int,input().split()))
    q = tuple(map(int,input().split()))
    p_i = 0
    q_i = 0
    perm = list(permutations(list(range(1,N+1))))
    for i in range(len(perm)):
        print(perm[i])
        if perm[i] == p:
            p_i = i
        if perm[i] == q:
            q_i = i
    print(abs(p_i-q_i))
    return


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,m=map(int,input().split())
if n*2>=m:
  print(m//2)
else:
  (((n*2)+m)//4)
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))
x_sort = sorted(x)
med_minus = x_sort[n//2-1]
med_plus = x_sort[n//2]
for i in range(n):
    if x[i] <= med_minus:
        print(med_plus)
    elif x[i] >= med_plus:
        print(med_minus)
# Judge status: Accepted
N = int(input())
R = list(map(int, input().split()))
ans = []

for j in range (1, 100):
    diff = 0
    sum = 0
    
    for i in range (N):
        diff = pow(R[i] - j, 2)
        sum += diff
    
    ans.append(sum)

print(min(ans))
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

cnt = 1
top = True
    
for i in range(1,N):
    if A[i] == A[i-1]:
        continue
    if top == True:
        inc = (A[i]>A[i-1])
        top = False
        continue
    
    flag = (A[i]>A[i-1])
    if inc != flag:
        cnt += 1
        top = True
        
print(cnt)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 20:53:51 2020

@author: naoki
"""

X = int(input())
a = (X-400)//200

print(8-a)
# Judge status: Accepted
a, b = list(map(int, input().split()))

print(a * b)
# Judge status: Wrong Answer
N = int(input())
for i in range(0,26):
  for k in range(0,15):
    if N == 4*i + 7*k:
      print('Yes, i=',i,', k=',k)
      exit()
print('No')
# Judge status: Accepted
n = int(input())
S = [input() for i in range(n)]
print(len(set(S)))
# Judge status: Accepted
s3=s=input()[::-1]
l=["maerd","remaerd","esare","resare"]
s2=""
for i in range(len(s)):
 s2+=s[i]
 if s2 in l:
  s3=s3[len(s2):]
  s2=""
print("YES"if s2==""else "NO")
# Judge status: Wrong Answer
def main():
    n, x = map(int, input().split())
    l = list(map(int, input().split()))
    sum = 0
    for idx, i in enumerate(l):
        sum += i
        if sum > x:
            print(idx + 1)
            break

if __name__ == '__main__':
    main()
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[8]:


N = int(input())
mylist = []
for _ in range(N):
    x,l = map(int, input().split())
    a = x-l
    b = x+l
    mylist.append([a,b])


# In[12]:


mylist = sorted(mylist,key=lambda x:x[1])
cnt = 1
p = mylist[0][1]
for i in range(1,N):
    if mylist[i][0] < p:
        continue
    else:
        cnt += 1
        p = mylist[i][1]
print(cnt)


# In[ ]:
# Judge status: Accepted
f=lambda:map(int,input().split())
N,K=f()
r,s,p=f()
T=list(input())
F=[0]*N
res=0
for i in range(N):
    if F[i]==1:
        continue
    if i+K<N:
        if T[i]==T[i+K]:
            F[i+K]=1
    if T[i]=='s':
        res+=r
    elif T[i]=='p':
        res+=s
    else:
        res+=p
print(res)
# Judge status: Accepted
N = int(input())
xy = [tuple(map(int, input().split())) for _ in range(N)]
z = []; w = []
for x, y in xy:
    z.append(x + y)
    w.append(x - y)

print(max(max(z)-min(z), max(w)-min(w)))
# Judge status: Accepted
from collections import Counter

n = int(input())
a = Counter(list(map(int,input().split())))

m1 = 0

key = sorted(a.keys(), reverse = True)

for i in key:

    if a[i]>1 and m1==0:
        m1 = i
        if a[i]>3:
            print(i**2)
            exit()

    elif m1!=0 and a[i]>1:
        print(m1*i)
        exit()

print(0)
# Judge status: Wrong Answer
N = int(input())
items = []
count = 0
for x in range(N):
  thing = input()
  if not x in items:
    count += 1
  items.append(thing)
print(count)
# Judge status: Accepted
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if V <= W:
  print("NO")
  exit()

dist = abs(A - B)
vel = abs(V - W)

if T * vel >= dist:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
a, b, c, d = map(int, input().split())

p, q = c, d
while q:
  p, q = q, p % q
e = c * d // p

div_c = b // c - (a-1) // c
div_d = b // d - (a-1) // d
div_e = b // e - (a-1) // e

print(b - a + 1 - div_c - div_d + div_e)
# Judge status: Wrong Answer
A, B = map(int, input().split())
if A>B or (A==1 and B==2):
    print('Alice')
elif A==B:
    print('Draw')
elif A<B or (A==2 and B==1):
    print('Bob')
# Judge status: Accepted
#153_D
h = int(input())

def attack(x):
    if x == 1:
        return 1
    else:
        return 2 * attack(x // 2) + 1
    
print(attack(h))
# Judge status: Accepted
N, K = map(int,input().split())
A = list(map(int,input().split()))
start = 0
end = 10**9
while end - start > 1:
   l = (start + end)/2
   l = int(l)
   count = 0
   for i in range(N):
      q = A[i]/l
      if q == int(q):
         q -= 1
      count += int(q)
   if count <= K:
      end = l
   else:
      start = l
print(end)
# Judge status: Accepted
D = input ()
if D == 25:
    print "Christmas"
elif D == 24:
    print"Christmas Eve"
elif D == 23:
    print"Christmas Eve Eve"
elif D == 22:
    print"Christmas Eve Eve Eve"
# Judge status: Accepted
n=int(input())
i=0
while i<n:
  i+=111
print(i)
# Judge status: Accepted
import itertools

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

list_range = list(range(1,n+1))
pattern_list = list(itertools.permutations(list_range, n))
pattern_list.sort()
ans = [0] * 2
for i in range(len(pattern_list)):
  if p == q:
    break
  elif p == list(pattern_list[i]):
    ans[0] = i + 1
  elif q == list(pattern_list[i]):
    ans[1] = i + 1
print(abs(ans[0] - ans[1]))
# Judge status: Accepted
a,b,x=map(int,input().split())
if a==0:
    print(b//x+1)
else:
    print(b//x-(a-1)//x)
# Judge status: Accepted

from math import gcd
from functools import reduce

N = int(input())
X = list(map(int, input().split()))

print(reduce(gcd, X))
# Judge status: Wrong Answer
x = int(input())
a = x-x//100*100
print(1) if a//5+1 <= x//100 else print(0)
# Judge status: Accepted
import math

N = int(input())
ans = [0] *(N+1)
a = int(math.sqrt(N)) + 1

for i in range(1,a) :
    for j in range(1,a) :
        for k in range(1,a) :
            n = i**2 + j**2 + k**2 + i*j + i*k + j*k
            if n <= N :
                ans[n] += 1

for m in range(N) :
    print(ans[m+1])
# Judge status: Accepted
a = input()
if a.count('9') >= 1:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n, k = map(int,input().split())
n_list = [0 for i in range(10**5)]

for i in range(n):
    a, b = map(int,input().split())
    n_list[a-1] += b

temp = 0

for i in range(len(n_list)):
    temp += n_list[i]
    if temp >= k:
        print(i+1)
        break
# Judge status: Accepted
def main():
    candy = [int(cn) for cn in input().split()]
    candy.sort()
    print('Yes' if candy[0] + candy[1] == candy[2] else 'No')


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
li = list(map(int,input().split()))
li.sort(reverse=True)
ans=0
for i in range(1,n+2,2):
    ans += li[i]

print(ans)
# Judge status: Accepted
import math
a,b = list(map(int,input().split()))


if round(math.sqrt(int(str(a)+str(b))))*round(math.sqrt(int(str(a)+str(b))))==int(str(a)+str(b)):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
input = sys.stdin.readline
N = int(input())
mn = 10 ** 10
mx = -10 ** 10
mn2 = 10 ** 10
mx2 = -10 ** 10
qs = [tuple(map(int, input().split())) for _ in range(N)]
qs.sort()
for i in range(N):
  x, y = qs[i]
  mn = min(mn, x + y)
  mx = max(mx, x + y)
  mn2 = min(mn2, x - y)
  mx2 = max(mx2, x - y)
print(max(abs(mx2 - mn2), abs(mx - mn)))
# Judge status: Wrong Answer
s=input()
t=sorted(s)
if t=='abc':
  print('Yes')
else:
  print('No')
# Judge status: Accepted
def gcd(a, b):
    r = a % b
    return b if r == 0 else gcd(b, r)

def divisors(n):
    DIVISORS = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            DIVISORS.append(i)
            if i != n**0.5:
                DIVISORS.append(n // i)
    DIVISORS.sort()
    return DIVISORS


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

print(divisors(gcd(a, b))[-k])
# Judge status: Wrong Answer
N = int(input())

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

d = dict(zip(A, B))
ans = d[A[0]]

for i in range(1, N):
    if A[i] - A[i-1] == 1:
        ans += d[A[i]] + C[i-1]
    else:
        ans += d[A[i]]

print(ans)
# Judge status: Wrong Answer
li=list(map(int,input().split()))
sum=0
for i in range(1,li[0]+1):
    a=i//1000%10
    b=i//100%10
    c=i//10%10
    d=i%10
    s=a+b+c+d
    if li[1]<=s<=li[2]:
        sum+=i
print(sum)
# Judge status: Wrong Answer
n = int(input())
a = int(input())

z = int(n%500)

if a == z:
  print('Yes')
  
else:
  print('No')
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt=0
if a[0]<b[0]:
  cnt+=a[0]
  a[0]=0
  a[1]-=b[0]-a[0]
else:
  cnt+=b[0]
  a[0]-=b[0]
for i in range(1,n-1):
  if a[i]<b[i]:
    cnt+=a[i]
    a[i]=0
    a[i+1]-=b[i]-a[i]
  else:
    cnt+=b[i]
    a[i]-=b[i]
cnt+=min(a[n],b[n-1])
print(cnt)
# Judge status: Accepted
def f(x):
    return (sum(list(map(int, list(str(x))))))

ans = 0
n , a, b = map(int, input().split())
for i in range(1, n+1):
    if a <= f(i) <= b:
        ans += i
print(ans)
# Judge status: Wrong Answer
k = int(input())

if k%2 == 0:
  print((k/2)*(k/2))
else:
  print(int(k/2)*(int(k/2)+1))
# Judge status: Accepted
n = int(input())
As = list(map(str, input().split()))

from collections import deque
b = []
b = deque(b)

for i, a in enumerate(As):
    if i%2==0:
        b.append(a)
    else:
        b.appendleft(a)

if n%2==0:
    print(' '.join(b))
else:
    print(' '.join(reversed(b)))
# Judge status: Wrong Answer
a,b = map(int, input().split())

def lcm(n, m):
  bigger = n if n > m else m
  while bigger % n != 0 and bigger % m != 0:
    bigger += 1

print(lcm(a,b))
# Judge status: Wrong Answer
S = input()
n = len(S)
shift_max = [0]*(n+1)

big_run = 0
for i in range(n):
    if S[i] == '<':
        big_run += 1
    else:
        big_run = 0
    shift_max[i+1] = big_run
small_run = 0
for i in reversed(range(n)):
    if S[i] == '>':
        small_run += 1
    else:
        small_run = 0
    shift_max[i] = max(shift_max[i],small_run)

print(shift_max)
print(sum(shift_max))