peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    a,b=map(int,input().split())
    if a<=b:
        print(a)
    else:
        print(a-1)

if __name__ == '__main__':
    main()
# Judge status: Accepted
from collections import Counter
s = input()
ct = {i : 0 for i in "abc"}
for _s in s:
    ct[_s] += 1
if max(ct.values()) - min(ct.values()) <= 1:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N,D=[int(x) for x in input().split(" ")]
count=0
for i in range(N):
    a,b=[int(x) for x in input().split(" ")]
    c=complex(a,b)
    if abs(c)<=D: count+=1
print(count)
# Judge status: Wrong Answer
x,k,d = map(int, input().split())
mx = x + d*k
mn = x - d*k

if (x < 0 and mx > 0) or (x > 0 and mn < 0):
  if k%2 == 0:
    b = abs(x%(2*d))
    c = abs(mn%(2*d))
    e = abs(mx%(2*d))
    b = min(b,c,e)
  else:
    b = abs(mn%(2*d))
    e = abs(mx%(2*d))
    b = min(b,e)
  ans = min(b,abs(mx),abs(mn))
else:
  ans = min(abs(mx),abs(mn))
print (ans)
# Judge status: Accepted
n = list(map(int, input().split()))
def ans(a, b, c):
    if a > b:
        return 0
    else:
        if int(b/a) < c:
            return int(b/a)
        else:
            return c
print(ans(n[0], n[1], n[2]))
# Judge status: Accepted
check = list(input())
if check[1] == check[2]:
    if check[0] == check[1] or check[2] == check[3]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Accepted
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
    i=str(i)
    if i[0]==i[4] and i[1]==i[3]:
        ans+=1
print(ans)
# Judge status: Accepted
n , m = map(int,input().split())
if m == 0:
    print(0,0)
    exit()
ps = [0] * m
ss = [0] * m
for i in range(m):
    p,s = map(str,input().split())
    ps[i],ss[i] = int(p),s

ac = [0] * (n + 1)
wa = [0] * (n + 1)

for i in range(m):
    if ac[ps[i]] == 1:
        continue
    if ss[i] == 'AC':
        ac[ps[i]] = 1
    else:
        wa[ps[i]] += 1

for i in range(n+1):
    if ac[i] == 0:
        wa[i] = 0

print(sum(ac),sum(wa))
# Judge status: Accepted
N, K = [int(i) for i in input().split(' ')]
h = [int(hi) for hi in input().split(' ')]

dp = [float('inf')] * N
dp[0] = 0

for i in range(N - 1):
    for k in range(i + 1, min(i + K + 1, N)):
        dp[k] = min(dp[k], dp[i] + abs(h[i] - h[k]))

print(dp[-1])
# Judge status: Accepted
import sys
input = sys.stdin.readline
N=int(input())
X=list(map(int,input().split()))
A=sorted(X)
mid1=A[N//2-1]
mid2=A[N//2]
for i in range(N):
    if X[i]<=mid1:
        print(mid2)
    else:
        print(mid1)
# Judge status: Accepted
(n,_),*t=[t.split()for t in open(0)]
n=int(n)
for i in range(10**(n-1)-(n<2),10**n):
  i=str(i)
  for s,c in t:
    if i[int(s)-1]!=c:
      break
  else:
    print(i)
    break
else:
  print(-1)
# Judge status: Accepted
#A
s=input()
if s[0]==s[1]==s[2]:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
n = int(input())
p = 1
for i in range(1, n + 1):
  p = p * i % (10 ** 9 + 7)
print(p)
# Judge status: Accepted
N=int(input())
p =list(map(int,input().split()))

flg=0
for i in range(N):
    if p[i]!=i+1:
        flg+=1

if flg==0 or flg==2:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
a,b = map(int,input().split())
li = []
for i in range(1,10):
    for j in range(1,10):
        if i*j == a*b:
            print(a*b)
            exit()
print(-1)
# Judge status: Accepted
N,X,T = map(int,input().split())
print((N+X-1)//X*T)
# Judge status: Accepted
A = int(input())
B = int(input())
lis = [1,2,3]
lis.remove(A)
lis.remove(B)
print(lis[0])
# Judge status: Accepted
def MI():
    return map(int, input().split())

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

P, Q, R = MI()

print(P + Q + R - max(P, Q, R))
# Judge status: Wrong Answer
a=list(map(int,input().split()))
k=int(input())
a.sort()
print(a[2]*k*2+a[1]+a[0])
# Judge status: Accepted
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tup(t=int):return tuple(pin(t))
#%%code
def resolve():
    N,K=pin()
    H=[int(input()) for i in range(N)]
    H.sort()
    #print(H)
    ans=1000000000
    for i in range(N-K+1):
        ans=min(H[i+K-1]-H[i],ans)
    print(ans)
#%%submit!
resolve()
# Judge status: Wrong Answer
import sys
import numpy as np

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

# ans = 1
ans = np.prod(A)

if ans > 10**18:
  print(-1)
else:
  print(ans)

# for i in range(N):
#   ans *= A[i]
#   if ans > 1e18:
#     print(-1)
#     sys.exit()
# print(ans)
# Judge status: Wrong Answer
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
count=0
if n<3:
  print(count)
else:
  for i in range(n):
    for j in range(i+1,n):
      for k in range(j+1,n):
        if l[i]==l[j] or l[j]==l[k] or l[k]==l[i]:
          continue
        elif l[i]<l[j]+l[k]:
          count+=1
print(count)
# Judge status: Accepted
x = list(map(int, (input() for i in range(5))))
y = sorted(x, key= lambda x:((x+9)//10)*10-x)

s = 0
for z in y[:-1]:
  s += ((10 + z -1)//10)*10
print(s+y[-1])
# Judge status: Accepted
a,b=map(int,input().split())
if abs(a-b)%2==0:
    k=max(a,b)-abs(a-b)//2
    print(k)
    #print(abs(a-k)==abs(b-k))
else:
    print('IMPOSSIBLE')
# Judge status: Wrong Answer
n = int(input())
h = list(map(int, input().split()))
dp = [10 ** 4] * 100010
dp[0] = 0
for i in range(n - 2):
    dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
print(dp[n - 1])
# Judge status: Wrong Answer
s = input().split()
N = int(s[0])
K = int(s[1])

s2 = input().split()
A = []
for i in range(N):
  A.append(int(s2[i]))
  
now = 1
root = []
root.append(now)

for k in range(N):
  new = A[now-1]
  if new in root:
    Ka = K - root.index(new)
    new_root = root[root.index(new):]
    print(new_root[Ka%len(new_root)])
    break
  else:
    now = new
    root.append(new)
# Judge status: Wrong Answer
n,k = map(int, input().split())
X = list(map(int, input().split()))
ans = 10**8


for i in range(n-k+1):
  l = X[i]
  r = X[i+k-1]
  
  ans = min(ans, (abs(r-l)+min(abs(l), abs(r))))
  
print(ans)
# Judge status: Accepted
n, k, s = map(int, input().split())

ans = []

for i in range(n):
    if i < k:
        ans.append(s)
    else:
        if s != 10**9:
            ans.append(s+1)
        else:
            ans.append(1)

print(*ans)
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))

from collections import Counter
c = Counter(l)
ans = 0
for dic in c:
    ans += min(abs(c[dic] - 0), abs(dic - c[dic]))

print(ans , flush=True)
# Judge status: Accepted
H,N=map(int,input().split())
L=[tuple(map(int,input().split())) for i in range(N)]
dp=[[-1]*(H+1) for i in range(N+1)]
for d in dp:
    d[0]=0
dp[0]=[10**9]*(H+1)
i=1
for a,b in L:
    for j in range(H+1):
        if j<a:
            dp[i][j]=min(dp[i-1][j],b)
        else:
            dp[i][j]=min(dp[i-1][j],dp[i][j-a]+b)
    i+=1
print(dp[N][H-1])
# Judge status: Accepted
n = int(input())
v = list(map(int, input().split()))

v.sort()
value = v[0]
for i in range(n-1):
    value = (value + v[i+1])/2

print(value)
# Judge status: Accepted
x = int(input())
ans = 10-x//200
print(ans)
# Judge status: Wrong Answer
time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
for point in jorney:
    time = point[0]
    x = point[1]
    y = point[2]
    if time %2 == (x+y)%2 and time>= x+y:
        continue
    else:
        flg=False
        break
if flg:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
S = input()
hitachi = [
    'hi',
    'hihi',
    'hihihi',
    'hihihihi',
    'hihihihihi',
]
if S in hitachi:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())

arms = []
for i in range(n):
  x, l = [int(i) for i in input().split(' ')]
  arms.append({"st": x-l, "ed": x+l})

arms.sort(key=lambda x: x["ed"])

n_arm = 1
tot_end = arms[0]["ed"]

for i in range(1, n):
  if tot_end <= arms[i]["st"]:
    n_arm += 1
    tot_end = arms[i]["ed"]

print(n_arm)
# Judge status: Accepted
import copy
s = input()
ss = list(s)
sss = copy.copy(ss)
n = len(ss)
ans = "yes"

for i in range(n):
  sss = copy.copy(ss)
  sss.remove(sss[i])
  if ss[i] in sss:
    ans = "no"
print(ans)
# Judge status: Wrong Answer
s = input()
q = int(input())
for i in range(q):
    t = input().split(' ')
    if t[0] == '1':
        s = s[-1] + s[1:-1] + s[0] if len(s) > 1 else s
    else:
        if t[1] == '1':
            s = t[2] + s
        else:
            s = s + t[2]
print(s)
# Judge status: Wrong Answer
A = ['a','i','u','e','o']
c = input()
if c in A:
    print("vowel")
else:
    print("consoant")
# Judge status: Accepted
n, m = map(int, input().split())

ans = (n * (n-1))/2 + (m * (m-1)) / 2
print(int(ans))
# Judge status: Wrong Answer
n,q = map(int,input().split())
s = list(input())
base = [0]*n
count = 0

for i in range(n-1):
  if (s[i] == "A") and (s[i+1] == "C"):
    count = count + 1
    base[i] = count
  else:
    base[i] = count

base[n-1] = base[n-2]
print(base)
for i in range(q):
  l,r = map(int,input().split())
  ans = base[r-1] - base[l-1]
  
  if s[r-1] == "A":
    ans = ans - 1
  
  if s[l-1] == "A":
    ans = ans + 1
    
  print(ans)
# Judge status: Accepted
a = int(input())
flag = 0
j = 0
while(flag != 1):
    count =0
    temp = a+j
    for i in range(2, temp):
        if(temp %i == 0):
            count +=1
    if(count == 0):
        flag =1
        print(temp)
    j+=1
# Judge status: Accepted
t = input()
a = int(t)
d = ['+','-']
for i in range(2**3):
	S = a//1000
	ans = t[0]
	for j in range(3):
		S += int(d[(i>>j&1)]+t[j+1])
		ans+= d[(i>>j&1)]+t[j+1]
	#print(S,ans)
	if S == 7:
		print(ans+'=7')
		exit()
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
ans = 'Yes' if a < c < b else 'No'
print(ans)
# Judge status: Accepted
tupni = [int(idx) for idx in input().split(" ")]
tupni.sort()
if tupni == [5,5,7]:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
w = input()
k=0

for i in range(len(w)):
	k += w.count(w[i])%2
       
if k%2 == 0:
	print('Yes')
else:
	print('No')
# Judge status: Wrong Answer
S = str(input())
for i,s in enumerate(S):
    if i % 2 == 1:
        if not s == "i":
            print("No")
            exit()
    else:
        if not s == "h":
            print("Ño")
            exit()
print("Yes")
# Judge status: Accepted
N = int(input())
mod = 1000000007
ans = 1
for i in range(1,N+1):
  ans = ans*i%mod
print(ans)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
u=0
for i in range(1,(N//2)+1):
  for j in range(i+1,N+1):
    t=abs(i-j)
    if t==A[i-1]+A[j-1]:
      u+=1
print(u)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

alice = 0
bob = 0

for i in range(N):
    if i % 2 == 0:
        alice += a[i]
    else:
        bob += a[i]

print(alice - bob)
# Judge status: Accepted
s = input()

if s[0] == s[1] and s[1] == s[2]:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
s = input()
t = input()

ans = len(t)
for i in range(len(s)-len(t)+1):
  tmp=0
  for j in range(len(t)):
    if t[j] == s[i+j]:
      tmp+=1
  ans = min(tmp,ans)
  
print(ans)
# Judge status: Accepted
n=int(input())
p=0
t=0
for i in range(1,n+1):
  p+=i
  if p>=n:
    t=i
    break
l=range(1,t+1)
if p==n:
  for i in l:
    print(i)
else:
  for i in l:
    if i==p-n:
      continue
    print(i)
# Judge status: Wrong Answer
n,m=map(int,input().split())
d={}
for _ in range(n):
    a,b=map(int,input().split())
    d[a]=b
def c(dic):
    s=0
    cost=0
    for x in sorted(d.keys()):
        for _ in range(d[x]):
            cost+=x
            s+=1
            if s==m:
                return cost
print(c(d))
# Judge status: Accepted
n, a, b = map(int, input().split())

if b-a < 0 or n == 1 and a != b:
    print(0)
elif a == b:
    print(1)
else:
    print((b-a)*(n-2)+1)
# Judge status: Accepted
import sys
n = int(input())
ans = 0
li=list(map(int,input().split()))
tmp = li[0]
cnt=0
for i in range(n-1):
    if (tmp >= li[i+1]):
        cnt += 1
    else:
        cnt=0
    tmp = li[i+1]
    if (ans < cnt):
        ans = cnt
print(ans)
# Judge status: Accepted
import math

def main():
    K = int(input())
    r = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            t = math.gcd(i, j)
            for k in range(1, K+1):
                r += math.gcd(t, k)
    print(r)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b,x = map(int, input().split())

from decimal import Decimal
 
a = Decimal(str(a))
b = Decimal(str(b))
x = Decimal(str(x)) 

if a == 0:
    print(int(b/x))
else:
    print(int(b/x) - int((a-1)/x))
# Judge status: Accepted
def main():
    L,R = [int(x) for x in input().split()]
    ans = 2019
    for i in range(L,min(R,L+2018)+1):
        for j in range(i+1,min(R,L+2018)+1):
            tmp = (i*j) % 2019
            if tmp < ans:
                ans = tmp
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a, b, k = map( int, input().split())
 
a_aft = max( 0, a - k)
b_aft = max( 0, b - ( k - a ))
print( a_aft, b_aft )
# Judge status: Accepted
def main():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    if n <= k:
        ans = n * x
    else:
        ans = k * x + (n-k) * y
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
x = int(input())

for i in range(1,10**9+1):
    if x - i - (i+1) >= 0:
        x -= i
    elif x - i == 0:
        print(i)
        break
# Judge status: Accepted
import sys,collections
input = sys.stdin.readline

N=input().rstrip()
A=list(map(int,input().split()))
Ac = collections.Counter(A)
Q = int(input())
for i in range(Q):
    B,C = list(map(int,input().split()))
    nb = Ac[B]
    Ac[C] += Ac[B]
    Ac[B] = 0

    if i==0:
        ans = 0
        for key,val in Ac.items():
            ans += key*val
    else:
        ans +=nb*C - nb*B
    
    print(ans)
# Judge status: Accepted
x, y = map(int, input().split())

print(x + y//2)
# Judge status: Wrong Answer
N = int(input())

c = [[0]*10 for _ in range(10)]

for k in range(N):
    c[int(str(k)[0])][int(str(k)[-1])]+=1

ans = 0

for k in range(81):
    i = k // 9 + 1
    j = k % 9 + 1
    ans += c[i][j] * c[j][i]

print(ans)
# Judge status: Wrong Answer
from math import sqrt
n,d = map(int,input().strip().split())
cnt = 0
for i in range(n):
	x,y = map(int,input().strip().split())
	if sqrt(x*x+y*y) >= d:
		cnt+=1
print(cnt)
# Judge status: Wrong Answer
S=list(input())

for i in range(len(S)):
    del S[-1]
    for j in range(len(S)):
        if S.count(S[j])%2!=0:
            break
    else:
        print(len(S))
        break
# Judge status: Wrong Answer
n = input()

n = int(n)

if n == 7:
  print("yes")
else:
    if n == 5:
        print("yes")
    else:
            if n == 3:
                print("yes")
            else:
                print("no")
# Judge status: Wrong Answer
N,x=map(int,input().split())
a=list(map(int,input().split()))

count=0
if a[0]>x:
    a[0]=x
    count+=x-a[0]
for i in range(1,N):
    if a[i]+a[i-1]>x:
        a[i]=x-a[i-1]
        count+=a[0]+a[i-1]-x
print(count)
# Judge status: Accepted
(h,n),*c=[[*map(int,i.split())]for i in open(0)]
d=[0]*20002
for i in range(h):d[i]=min(d[i-a]+b for a,b in c)
print(d[h-1])
# Judge status: Accepted
# AtCoder Regular Contest 099
# C - Minimization 
N,K =map(int,input().split())
A=list(map(int,input().split()))

ans=0

a=N-K
ans+=1

while a>0:
    a+=1
    ans+=1
    a=a-K
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
X = int(input())
if X == 7 or X == 5 or X == 3 :
    print("YES")
else :
    print("NO")
# Judge status: Wrong Answer
def main():
    n, x, *a = map(int, open(0).read().split())

    ans = 0
    tmp = 0
    for i, j in zip(a, a[1:]):
        i -= tmp
        if i + j > x:
            c = (i + j) - x
            ans += c
            tmp = c
        else:
            tmp = 0

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
k, a, b = map(int, input().split())
ans = 0

if b//a > 1:
    i = 0
    while ((1+k)-2*i-a*i)>0:
        bis = (1+k)-2*i-a*i + i*b
        ans = max(ans, bis)
        # print(i,bis, ans)
        i += 1
    print(ans)
else:
    print(k+1)
# Judge status: Wrong Answer
a, b = map(int, input().split())
list2 = set(map(int, input().split()))
list1=list(range(-100,101,1))
result = list(set(list1) - set(list2))
for i in range(110):
    if a-i in result:
        print(a-i)
        exit()
    elif a+i in result:
        print(a+i)
        exit()
# Judge status: Accepted
a, a1, a2 = map(int,input().split())

if a + a1 + a2 >= 22:
    print('bust')
else:
    print('win')
# Judge status: Accepted
s = input()
t = input()
o = t[:-1]
if ( o == s ):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
v = list(map(int, input().split()))
v.sort()
ans = v[0]
for i in v[1:]:
    ans = (i + ans)/2
print(ans)
# Judge status: Accepted
s = input()
t = input()
d = {}
for si, ti in zip(s, t):
    if si in d and d[si] != ti:
        print('No')
        exit()
    d[si] = ti
l = len(set(d.values()))
print('Yes' if len(d) == l else 'No')
# Judge status: Accepted
n = int(input())
a = []
d = []
for _ in range(n):
    a.append(list(map(int,input().split())))
    d.append([0,0,0])
d[0]=a[0]
for i in range(1,n):
    for j in range(3):
        d[i][j]=max(d[i-1][(j+1)%3],d[i-1][(j+2)%3])+a[i][j]
print(max(d[-1]))
# Judge status: Wrong Answer
x, k, d = map(int, input().split())

div = x // d
if k <= div:
    ans = x - k * d
else:
    if (k - div) % 2 == 1:
        ans = x - d * (div + 1)
    else:
        ans = x - d * div

print(abs(ans))
# Judge status: Accepted
def main():
    N = int(input())
    S = [input() for _ in range(N)]
    t = {}
    m = 0
    for s in S:
        t[s] = t.get(s, 0) + 1
        m = max(m, t[s])
    r = []
    for k, v in t.items():
        if v == m:
            r.append(k)
    r.sort()
    print('\n'.join(r))





main()
# Judge status: Accepted
S = input()
count = 0
max = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'G' or S[i] == 'T' or S[i] == 'C':
        count += 1
        if max < count:
            max = count
    else:
        count = 0
print(max)
# Judge status: Accepted
def main():
    N = int(input())
    T, A = map(int, input().split(" "))
    H = list(map(int, input().split(" ")))
    target = (T - A) / 0.006
    difference = 10 ** 6
    answer = 60
    for i in range(N):
        if abs(H[i] - target) < difference:
            difference = abs(H[i] - target)
            answer = i
    print(answer + 1)


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

print(a-1 if a > b else a)
# Judge status: Accepted
s=input()
if s=="Sunny":
    print("Cloudy")
if s=="Cloudy":
    print("Rainy")
if s=="Rainy":
    print("Sunny")
# Judge status: Accepted
n, m, x, y = map(int, input().split())
list_X = list(map(int, input().split()))
list_Y = list(map(int, input().split()))
ans = "War"
if min(min(list_Y),y) > max(max(list_X), x):
    ans = "No War"

print(ans)
# Judge status: Accepted
d,t,s=(int(a) for a in input().split())

if d/s<=t:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
S=input()
if N%2 !=0:
    print('No')
else:
    if S[:N//2]+S[:N//2] ==S:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
import math

a, b, c, k = map(int, input().split())
odd = math.ceil(k / 2)
even = math.floor(k / 2)
if k == 0:
    ans = a - b
else:
    ans = (a * even + (b + c) * odd) - (b * even + (c + a) * odd)
if ans > 10 ** 18:
    print('Unfair')
else:
    print(ans)
# Judge status: Accepted
n, a, b = map(int, input().split())
m = a*(n-1)+b
M = a+(n-1)*b
ans = max(M-m+1, 0)
print(ans)
# Judge status: Accepted
from collections import Counter
N=int(input())
A=[int(input()) for i in range(N)]

cnt=Counter(A)
ans=0
for k,v in cnt.items():
    if v%2==1:
        ans+=1

print(ans)
# Judge status: Accepted
n=int(input())

t=n/1.08

f=0
if int(t)*1.08 >= n:
  f=int(t)
else:
  f=int(t)+1

if int(f*1.08) == n:
  print(f)
else:
  print(":(")
# Judge status: Wrong Answer
def resolve():
    n=int(input())
    a = list(map(int, input().split()))
    c = [str(x) for x in a]
    L = " ".join(c)
    print(L)
resolve()
# Judge status: Accepted
n = int(input())
v = list(map(int, input().split()))
v.sort(reverse = True)
s = 0
for i in range(0, n):
  s += v[1+2*i]
print(s)
# Judge status: Accepted
N, A, B = map(int, input().split())
S = input()

nA = 0
nB = 0

for ch in S:
    if ch == 'a':
        if nA + nB < A + B:
            print("Yes")
            nA += 1
        else:
            print("No")
    elif ch == 'b':
        if nA + nB < A + B and nB < B:
            nB += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")
# Judge status: Accepted
a, b, c=map(int,input().split())
A,B,C = a,b,c
ans = 0
if(a%2 or b%2 or c%2):
  print(0)
  exit(0)
while(a%2==0 and b%2==0 and c%2==0):
  if(A==B==C):
    ans = -1
    break
  A,B,C = a,b,c
  a = B//2 + C//2
  b = A//2 + C//2
  c = A//2 + B//2
  ans += 1
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    A -= 2
    A %= 13
    B -= 2
    B %= 13
    print("Alice" if A > B else "Bob" if B > A else "Draw")


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)


if __name__ == '__main__':
    main()
# Judge status: Accepted
c=input()
c=int(c)
a=input()
b=0
if c%2==1:
  print("No")
else:
  for i in range(int(c/2)):
    if a[i]!=a[i+int(c/2)]:
      b=b+1
  if b==0:
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a%2==0 or b%2==0 or c%2==0:
    print(0)
else:
  print(a*b*c//min(a,b,c))
# Judge status: Wrong Answer
S = input()
print("A{}C".format(S[0]))
# Judge status: Accepted
S = input()
for i in range(3):
    if S[i] == S[i+1]:
        print('Bad')
        exit()
print('Good')
# Judge status: Accepted
N = int(input())
A = int(input())
print('Yes' if N % 500 <= A else 'No')
# Judge status: Accepted
s,(*t,_)=open(0)
print(min(sum(x!=y for x,y in zip(s[i:],t))for i in range(len(s)-len(t))))
# Judge status: Accepted
from collections import Counter

N = int(input())
D = list(map(int, input().split()))
c = Counter(D)

# 根は0である必要がある。
if D[0] != 0:
    print(0)
    exit(0)
# 0が1つでない場合の答えは0になる
if c[0] != 1:
    print(0)
    exit(0)

MOD = 998244353
cnt = 1
for i in range(1, max(D)+1):
    cnt *= pow(c[i-1], c[i], MOD)
print(cnt % MOD)
# Judge status: Wrong Answer
N=input()

if "9" in N:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = 10 ** 9 + 1
NIL = - 1


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

max_value = - INF
counter = 0
for i in range(1, N):
    if H[i] - H[i-1] <= 0:
        counter += 1
    else:
        max_value = max(max_value, counter)
        counter = 0

max_value = max(max_value, counter)
print(max_value)
# Judge status: Wrong Answer
N = int(input())

base = {chr(i): 0 for i in range(ord('a'), ord('a') + 26)}
S = input()
for s in S:
    base[s] += 1

for i in range(N - 1):
    cnt = {chr(i): 0 for i in range(ord('a'), ord('a') + 26)}
    S = input()
    for s in S:
        cnt[s] += 1
    for c in range(ord('a'), ord('a') + 26):
        base[chr(c)] = min(base[chr(c)], cnt[chr(c)])

base = [[c, v] for c, v in base.items() if v > 0]
ans = ""
for c, v in base:
    ans += c * v
print(ans)