peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
Lists = [list(input().split())+[i+1] for i in range(n)]
SP = [[s, -int(p), i] for s, p, i in Lists]
SP.sort(key=lambda x: (x[0], x[1]))
for p, q, r in SP:
  print(r)
# Judge status: Wrong Answer
s = input()
n = len(s)
ans = 0
for i in range(n-2):
  if abs(753-ans) > abs(753-int(s[i:i+3])):
    ans = int(s[i:i+3])
print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
d = c
c = b
b = a
a = d
print(a,b,c)
# Judge status: Wrong Answer
from math import ceil

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

A2B = ceil(N / A)
B2C = 1 + max(A2B, ceil(N / B))
C2D = 1 + max(B2C, ceil(N / C))
D2E = 1 + max(C2D, ceil(N / D))
E2G = 1 + max(D2E, ceil(N / E))

print(E2G)
# Judge status: Wrong Answer
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
mod = 10**9+7

N,K = I()
A = l()
i = A.index(1)
print(math.ceil(i/(K-1))+math.ceil((N-i-1)/(K-1)))
# Judge status: Wrong Answer
a = int(input())
b = int(a + a^2 + a^3)
print(b)
# Judge status: Wrong Answer
N=int(input())
num=0
ans=[]
for i in range(1,N+1):
  num+=i
  if num==N:
    ans.append(i)
    break
  elif num+i+1>N:
    num-=i
    continue
  ans.append(i)
    

for a in ans:
  print(a)
# Judge status: Accepted
n,m=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
s=sum(a)
if s>n:
    print(-1)
else:
    print(n-s)
# Judge status: Wrong Answer
n=int(input())
elements= input().split()
q=int(input())
actions=[]
for i in range(q):
    actions.append(input().split())
 
dict={}
for e in elements:
    count=dict.get(e,0)
    count+=1
    dict[e]=count
 
sum=0
for key in dict.keys():
    sum+=int(key)* dict[key]

for act in actions:
    count=dict.get(act[0],0)
    sum+=(int(act[1])-int(act[0]))*count
    count+=dict.get(act[1],0)
    dict[act[1]]=count
 
    print(str(sum))
# Judge status: Accepted
N = int(input())
ListP = []
for i in range (N):
  ListP.append(input())
M = int(input())
ListN = []
for i in range (M):
  ListN.append(input())
res = 0
mid = 0
for i in range(N):
  mid += ListP.count(ListP[i])
  mid += -ListN.count(ListP[i])
  res = max(res,mid)
  mid = 0
print(res)
# Judge status: Accepted
def resolve():
    '''
    code here
    '''
    s = int(input())
    is_not_found = True
    cnt = 1
    memo = [False for _ in range(10**7+1)]

    while memo[s] == False:
        cnt += 1
        memo[s] = True
        if s % 2 == 0:
            s //= 2
        else:
            s = 3*s + 1    

    print(cnt)


if __name__ == "__main__":
    resolve()
# Judge status: Accepted
from itertools import product

A, B, C, D = map(int, input())

for p in product((1, -1), repeat=3):
    cnt = A
    for s, i in zip(p, (B, C, D)):
        cnt += s * i
    if cnt == 7:
        ans = str(A)
        for s, i in zip(p, (B, C, D)):
            ans += ('+' if s > 0 else '-') + str(i)
        ans += '=7'
        print(ans)
        exit()

print('-1')
# Judge status: Accepted
import bisect

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

data = [[] for _ in range(n)]
query = []

for i in range(m):
    array = list(map(int, input().split()))
    query.append(array)
    a = array[0] - 1
    b = array[1]
    data[a].append(b)

cnt = 0
for i in data:
    i.sort()
    data[cnt] = i
    cnt += 1
    
for i, j in query:
    num = bisect.bisect_left(data[i-1], j) + 1
    x = str(i).zfill(6)
    y = str(num).zfill(6)
    z = str(x) + str(y)
    print(z)
# Judge status: Accepted
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])

print(a+b+c)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
ans = float('inf')
l = 0
r = sum(a)

for i in range(N - 1):
    l += a[i]
    r -= a[i]
    ans = min(ans, abs(r - l))
    
print(ans)
# Judge status: Wrong Answer
n, a, b, c, d = map(lambda x: int(x)-1, input().split())
s = input()


def can_reach(x, y):
    return 0 == s[x:y+1].count('##')


def can_reach_cross(x, y):
    return 0 == s[x:y+1].count('##') and 1 <= s[x:y+1].count('...')


if c < d:
    # parallel
    if can_reach(a, c) and can_reach(b, d):
        print('Yes')
    else:
        print('No')
else:
    # cross
    if can_reach(b, d) and can_reach_cross(a, c):
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
n = int(input())
now = 0
ans = []
for i in range(1, n):
    now += i
    ans.append(i)
    if now >= n:
        break

amari = now - n

for i in ans:
    if i == amari:
        continue
    else:
        print(i)
# Judge status: Accepted
import itertools

N, M, Q = map(int, input().split())
A, B, C, D = [[] for _ in range(4)]

for _ in range(Q):
    a, b, c, d = map(int, input().split())
    A.append(a - 1)
    B.append(b - 1)
    C.append(c)
    D.append(d)

res = 0
for lst in itertools.combinations_with_replacement(range(0, M), N):
    res = max(res, sum([D[i] for i in range(Q) if lst[B[i]] - lst[A[i]] == C[i]]))

print(res)
# Judge status: Accepted
def main():
    n, a, b = map(int, input().split())
    ans = 0
    for i in range(1, n+1):
        s = sum([int(j) for j in str(i)])
        if s >= a and s <= b:
           ans += i
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
N=int(input())

if N%2==1:
    print(0)
    exit()
ans=0
tmp=10
while(N>=tmp):
    a=N//tmp
    ans+=a
    tmp=tmp*5
print(ans)
# Judge status: Accepted
a,b = map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
  print('Possible')
else:
  print('Impossible')
# Judge status: Accepted
from operator import itemgetter
N = int(input())
A = [None] * N
for i in range(N):
  A[i] = list(map(int,input().split()))

#s = sorted(A, key=itemgetter(0),reverse=True)
t = sorted(A, key=itemgetter(1))

time = 0
for i in range(N):
  if t[i][0] + time <= t[i][1]:
    time += t[i][0]
  else:
    print('No')
    exit()
print('Yes')
# Judge status: Wrong Answer
import sys
n=int(input())
l= input().split()
leng=len(l)
flag="NO"

for i in range(leng):
  #print(i)
  for ii in range(i+1, leng):
    #print(l[i],l[ii])
    if l[i] == l[ii]:
      flag="NO"
      sys.exit()
    else:
      flag = "YES"

print(flag)
# Judge status: Wrong Answer
n = int(input())
s = list(input())
cnt = 0
ans_list = []

for _ in range(n):
    if s[_] == "E":
        cnt -= 1
    else:
        cnt += 1
    ans_list.append(cnt)

print(min(ans_list) + (ans_list[n-1]-n)//(-2))
# Judge status: Accepted
l,r = map(int,input().split())
dl = l % 2019
dr = r % 2019
lis = []
if r - l >= 2019 - dl or dl == 0:
    print(0)
else:
    for i in range(dl,dr):
        for j in range(i+1,dr+1):
            lis.append((i*j)%2019)
    print(min(lis))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
a.sort()
print(sum(a[::2]))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
for i in range(n-1):
    if a[i]+1==a[i+1]:
        ans+=c[a[i]-1]
print(sum(b)+ans)
# Judge status: Wrong Answer
s=input().split()
i=int(s[0])
j=int(s[1])
k=int(s[2])
a=[]
for l in range(k):
  if i+l<=j:
    a.append(str(i+l))
  else:
    break
b=int(a[-1])
if b>=i-k and b<i:
  for l in range(1,i-b+1):
    a.append(str(b+l))
elif b<i-k:
  for l in range(k-1,-1,-1):
    a.append(str(j-l))
print(*a)
# Judge status: Wrong Answer
N = int(input())
import collections
A = list(map(int,input().split()))
C = collections.Counter(A)
use = []
for i,val in C.items():
  if val > 4:
    use.append(i)
  if val > 2:
    use.append(i)
 
use = sorted(use,reverse= True)
if len(use)<2:
  print(0)
else:
  print(use[0]*use[1])
# Judge status: Accepted
import sys
n,x = map(int, sys.stdin.readline().rstrip("\n").split())
a = [int(s) for s in sys.stdin.readline().rstrip("\n").split()]
a.sort()
ans = 0
for i in range(n):
    if i == n-1:
        if x - a[i] == 0:
            ans += 1
    else:
        if x-a[i] >= 0:
            x = x-a[i]
            ans += 1
print(ans)
# Judge status: Accepted
s = input()
a = 0
b = 0
for i in s:
    if i == '0':
        a += 1
    else:
        b += 1
print(min(a,b)*2)
# Judge status: Wrong Answer
a = list(input())
b = list(input())
c = list(input())

l = a.pop()
while a and b and c:
	if l == 'a':
		l = a.pop()
		continue
	if l == 'b':
		l = b.pop()
		continue
	if l == 'c':
		l = c.pop()
		continue

if not a: print('A')
elif not b: print('B')
else: print('C')
# Judge status: Wrong Answer
A=int(input())
B=int(input())

ans=0

if A==1 and B==2:
  ans=3
elif A==1 and B==3:
  ans=2
else:
  ans=1
  
print(ans)
# Judge status: Accepted
N, Y = map(int, input().split())
Y2 = Y // 1000
mod5 = Y2 % 5
div5 = Y2 // 5
for c_div5 in range(div5 + 1):
    c = c_div5 * 5 + mod5
    a = (Y2 - c) // 5 - (N - c)
    b = N - a - c
    if a >= 0 and b >= 0: break
    if c_div5 == div5: a=-1;b=-1;c=-1
print(a, b, c)
# Judge status: Accepted
X, Y = map(int, input().split())
cnt = 0
while True:
    if X > Y:
        break
    X*=2
    cnt += 1
print(cnt)
# Judge status: Wrong Answer
N = int(input())
arr = [list(map(int, input().split())) for _ in range(N)][::-1]
ans = 0
tmp = 0
add = 0
for i in range(N):
    if arr[i][1] == 1:
        continue
    add += tmp
    tmp = arr[i][1] - ((arr[i][0]+add) % arr[i][1])
    ans += tmp
print(ans)
# Judge status: Wrong Answer
s=input()
for i in s[::2]:
  if i=='L':
    print('No')
    exit()
for i in s[1::2]:
  if i=='R':
    print('No')
    exit()
print('Yes')
# Judge status: Accepted
from collections import defaultdict

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

d = defaultdict(int)

for i in li:
  d[i] += 1

newLi = []  
  
if len(d) <= K:
  print(0)
else:
  a = len(d) - K
  
  for i in d:
    newLi.append(d[i])

  newList = sorted(newLi)
  ans = 0
  
  for s in range(a):
    ans += newList[s]
  
  print(ans)
# Judge status: Accepted
n = int(input())
array = []
array.append(1)
for i in range(2,32):
  cnt = 2
  num = i**cnt
  while num<=1000:
    array.append(num)
    cnt += 1
    num = i**cnt 

array.sort()
ans = 0
l = len(array)
for i in range(l):
  if array[i]<=n:
    ans = array[i]
print(ans)
# Judge status: Accepted
H,W =map(int,input().split())
if H==1 or W==1:
  print(1)
elif H%2==0:
  print(W*H//2)
else:
  if W%2==1:
    print(W*(H//2)+W//2+1)
  else:
    print(W*(H//2)+W//2)
# Judge status: Wrong Answer
N, M = map(int,input().split())
MOD = 10**9 + 7
if abs(N - M) > 1: ans = 0
else:
    if N == M:
        ans = 2
    else: ans = 1
    for i in range(1, M+1):
        ans *= i**2
        ans %= MOD
    if M > N: ans //= M
    if M < N: ans *= N
print(ans)
# Judge status: Accepted
import bisect
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
sum = 0
for i in b:
    sum += bisect.bisect_left(a, i)*(n-bisect.bisect_right(c, i))

print(sum)
# Judge status: Accepted
S = input()
if len(S) % 2 != 0:
  print("No")
else:
  N = len(S)
  p = 0
  for i in range(0, N, 2):
    if S[i:i+2] != 'hi':
      p += 1
  if p == 0:
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer
from fractions import gcd


def lcm(c, d):
    return (c * d) // gcd(c, d)


def main():
    a, b, c, d = map(int, input().split())
    c_num = (b//c-(a-1)//c)
    d_num = (b//d-(a-1)//d)
    cd_num = (b//lcm(c, d)-a//lcm(c, d))
    ans = b-a+1-c_num-d_num+cd_num
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
cards = [list(input().replace("a", "0").replace("b","1").replace("c","2")) for _ in range(3)]
next = 0
while True:
  if len(cards[next]) == 0:
    print("A" if next == 0 else ("B" if next == 0 else "C"))
    exit()
  next = int(cards[next].pop(0))
# Judge status: Accepted
n=int(input())
s=[]
for i in range(n):
    S = str(input())
    s.append(S)
al=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
cnt=[51]*26
for i in range(26):
    for j in range(n):
        cnt[i]=min(cnt[i],s[j].count(al[i]))
ans=""
for i in range(26):
    ans+=al[i]*cnt[i]
print(ans)
# Judge status: Accepted
import math
s = int(input())
x1 = y1 = 0
x2 = y3 = math.ceil(s**0.5)
x3 = y2 = 0
diff = x2*y3 - s
for i in range(int(diff**0.5), 0, -1):
    if diff % i == 0:
        x3 = i
        y2 = diff // i
print(x1,y1,x2,y2,x3,y3)
# Judge status: Accepted
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
l = LI()
if sum(l) - max(l) > max(l):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

data = {"r": P, "s": R, "p": S}
ans = 0

for i in range(1, K + 1):
    score = data[T[N - i]]
    ans += score

    for j in range(i + K, N + 1, K):
        if data[T[N - j]] == score:
            score = 0
        else:
            score = data[T[N - j]]
            ans += score

print(ans)
# Judge status: Accepted
import math
A, B = map(int, input().split())
 
min_8 = math.ceil(A  * 12.5)
max_8 = math.ceil((A + 1) * 12.5) -1
min_10 = math.ceil(B * 10)
max_10 = math.ceil((B  + 1) * 10)  -1
 
if (max_10 < min_8 or max_8 < min_10):
    print(-1)
else:
    print(max(min_8,min_10))
# Judge status: Accepted
n,m=map(int,input().split())
a=list(map(int,input().split()))

d=[]
for x in a:
  s=[1,x]
  d.append(s)
  
for _  in range(m):
  b=list(map(int,input().split()))
  d.append(b)
  
d.sort(key=lambda x:x[1],reverse=True)
  
ch=0
ans=0
for f in d:
  p,q=f[0],f[1]
  if ch==n:
    break
  else:
    if ch+p>=n:
      ans+=q*(n-ch)
      break
    else:
      ans+=p*q
      ch+=p
      
print(ans)
# Judge status: Accepted
N,L=map(int,input().split())

slist=[]
for _ in range(N):
  slist.append(input())
slist.sort()
print("".join(slist))
# Judge status: Wrong Answer
def main():
    high = 0
    snow = 0
    a,b= map(int, input().split())
    for i in range(1,b+1):
        high += i
        if a < high < b:
            snow =  high - a
            break
    print(snow)




if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
li = list(map(int, input().split()))
f = 1
for i in li:
    if i & 1 == 0:
        if i%3 != 0 and i%5 != 0:
            f = 0
            break
print('APPROVED') if f else print('DENIED')
# Judge status: Accepted
import collections
n,k = map(int,input().split())
a = list(map(int,input().split()))
a = collections.Counter(a)
a = list(a.values())
a.sort()
if len(a) <= k:
    print(0)
else:
    print(sum(a[0:len(a)-k]))
# Judge status: Accepted
K = int(input())
ans = len(range(1, K+1, 2)) * len(range(2, K+1, 2))
print(ans)
# Judge status: Accepted
k = int(input())
s = input()
if k >= len(s):
    print(s)
else:
    print(s[:k] + '...')
# Judge status: Accepted
l = list(input())
l=set(l)

if len(l)==4: print('Yes')
elif len(l)==2 and 'N' in l and 'S' in l: print('Yes')
elif len(l)==2 and 'E' in l and 'W' in l: print('Yes')
else: print('No')
# Judge status: Accepted
# https://atcoder.jp/contests/abc123/tasks/abc123_b

dish = []
for _ in range(5):
    dish.append(int(input()))

ans = float('inf')
for i in range(5):
    t = dish[i]
    for j in range(5):
        if i == j:
            continue
        if dish[j] % 10 == 0:
            t += dish[j]
        else:
            t += 10 * (dish[j] // 10 + 1)
    ans = min(ans, t)
print(ans)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().strip().split()))[:n]
counter=0
for i in range (1,n,2):
    if(a[i]%2!=0):
        counter+=1

print(counter)
# Judge status: Wrong Answer
''' Hey stalker :) '''
INF = 10**10
def main():
    print = out.append
    ''' Cook your dish here! '''
    h, n = get_list()
    li = get_list()
    if sum(li)>=h:
        print("YES")
    else: print("NO")



''' Pythonista fLite 1.1 '''
import sys
#from collections import defaultdict, Counter
#from bisect import bisect_left, bisect_right
#from functools import reduce
#import math
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()
#[main() for _ in range(int(input()))]
print(*out, sep='\n')
# Judge status: Accepted
import math
H = int(input())
W = int(input())
N = int(input())

ans = 0
a = max(H,W)
print(math.ceil(N / a))
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

for a_n in a:
    if a_n % 2 == 0:
        if a_n % 3 == 0 or a_n % 5 == 0:
            continue
        else:
            print('DENIED')
            break
else:
    print('APPROVED')
# Judge status: Accepted
from itertools import combinations_with_replacement

N, M, Q = map(int, input().split())
L = []
for i in range(Q):
    ai, bi, ci, di = map(int, input().split())
    ai -= 1
    bi -= 1
    L.append((ai, bi, ci, di))

ans = 0
for A in combinations_with_replacement(range(M), N):
    r = 0
    for Li in L:
        if A[Li[1]] - A[Li[0]] == Li[2]:
            r += Li[3]
    ans = max(ans, r)

print(ans)
# Judge status: Accepted
def gcd(a, b):
  if a < b:
    a, b = b, a
  while a % b:
    a, b = b, a % b
  return b
A, B, C = map(int, input().split())
if C % gcd(A, B) == 0:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
N,M=map(int,input().split())
dp=[0]*(N+1)
dp[0]=1
for _ in range(M):
    a=int(input())
    dp[a]=-1

for i in range(1,N+1):
    if dp[i]==-1:
        continue
    if dp[i-1]!=-1:
        dp[i]+=dp[i-1]
    if dp[i-2]!=-1:
        dp[i]+=dp[i-2]

#print(dp)
print(dp[-1]%(10**9+7))
# Judge status: Wrong Answer
l,r,d = map(int,input().split())
if l % d == 0:
         print(((r - l) // d) + 1)
else:
         print((r - l) // d)
# Judge status: Wrong Answer
a = int(input())

if a==0:
    print(0)
else:
    print(1)
# Judge status: Accepted
def smallk(n , k , ab):
    count = 0
    for i in range(n):
        if count + int(ab[i][1]) >= k:
            return int(ab[i][0])
        else:
            count += int(ab[i][1])

def main():
    n , k = map(int , input().split())
    ab = [list(map(int,input().split())) for i in range(n)]
    ab.sort()
    print(smallk(n , k , ab))

if __name__ == '__main__':
    main()
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i + 100*j + 50*k == x:
                ans +=1


print(ans)
# Judge status: Accepted
N=int(input())
S=input()
R=S.count('R')
G=S.count('G')
B=S.count('B')
ans=R*G*B
for d in range(N):
    if 2*d>=N:
        break
    for i in range(N):
        if i+2*d>=N:
            break
        if S[i]!=S[i+d] and S[i+d]!=S[i+2*d] and S[i]!=S[i+2*d]:
            ans-=1
print(ans)
# Judge status: Accepted
n=int(input())
li=list(map(int, input().split()))
ans="Yes"
h=li[0]
for i in range(1,n):
    if h-li[i]>=2:
        ans="No"
        break
    h=max(h,li[i])
print(ans)
# Judge status: Wrong Answer
n = int(input())
sn = list(map(int, input().split()))

p = 1
for i in sn:
  p *= i
  if p > 1000000000000000000:
    p = -1
    print(-1)
    break

if p != -1:
  print(p)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = [int(x) for x in readline().split()]
ans = float('inf')
for x in a:
    ans = min(ans, len(bin(x)) - bin(x).rfind('1') - 1)
print(ans)
# Judge status: Wrong Answer
n = input()

if n[-1] == "3":
    print("bon")
elif n[-1] == "0" or "1" or "6" or "8":
    print("pon")
else:
    print("hon")
# Judge status: Accepted
n= input()
if n[3]==n[2] and n[4]==n[5]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v<=w:
    print('NO')
    sys.exit()
else:
    d=abs(a-b)
    s=v-w
    if d<=t*s:
        print('YES')
        sys.exit()
print('NO')
# Judge status: Accepted
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
c=Counter(s)
t=[]
u=c.most_common()
v=u[0][1]
t.append(u[0][0])
for i in range(1,len(c)):
  a=u[i][1]
  if v>a:
    break
  else:
    t.append(u[i][0])
t.sort()
for i in t:
  print(i)
# Judge status: Wrong Answer
N,M=map(int,input().split())
ans=0
if(N>=M*2):
  print(M*2)
else:
  print(N+(M-N*2)//4)
# Judge status: Wrong Answer
a=input()
if a[0] == 9 or a[1] == 9:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    for _ in range(K):
        B = [0] * (N + 1)
        for i in range(N):
            B[max(i - A[i], 0)] += 1
            B[min(i + A[i] + 1, N)] -= 1
        for i in range(1, N):
            B[i] += B[i-1]
        A = B
        if sum(A[:-1]) == N * N:
            break
    print(' '.join(str(i) for i in A[:-1]))
main()
# Judge status: Accepted
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""
s=ip()
a=s.count('1')
b=s.count('0')
print(min(a,b)*2)
# Judge status: Accepted
A, B ,C = map(int,input().split())
ans = (C - (A - B))
if (ans > 0): print(ans)
else: print("0")
# Judge status: Accepted
S = input()
N = len(S)

ans  = -1
for i in range(1, N):
    T = S[:i]
    if len(T)%2 != 0: continue
    if T[:i//2] == T[i//2:]:
        ans = i
print(ans)
# Judge status: Accepted
s = list(input())
n = len(s)

ans = 'Yes'
for i in range((n-1)//2):
    if s[i] != s[n-i-1]:
        ans = 'No'
for i in range((n-1)//2):
    if s[i] != s[(n-1)//2-i-1]:
        ans = 'No'
s_inv = s[::-1]
for i in range((n-1)//2):
    if s_inv[i] != s_inv[(n-1)//2-i-1]:
        ans = 'No'
print(ans)
# Judge status: Accepted
a = input()
if a == 'ABC':
  print('ARC')
else:
  print('ABC')
# Judge status: Wrong Answer
import itertools
n,m=map(int,input().split())
s=list(input().split() for i in range(n))
l=[]
c=0
for j in range(n):
    l.append(s[j][1:])
l=list(itertools.chain.from_iterable(l))    

for i in range(1,m+1):
    if l.count('i')==n:
        c+=1
print(c)
# Judge status: Accepted
def resolve():
    n = int(input())
    next_button = list()

    for i in range(n):
        a = int(input())
        next_button.append(a)
    
    now_button = 1
    ans = 0
    for i in range(n):
        now_button = next_button[now_button-1]
        #print(f"{i} times now button is {now_button}")
        if now_button == 2:
            ans += 1
            break
        ans += 1

    if ans == n:
        print(-1)
    else:
        print(ans)
resolve()
# Judge status: Wrong Answer
temp=list(map(int, input().split()))
X=temp[0]
Y=temp[1]

import math

print(int(math.log2(Y//X))+1)
# Judge status: Wrong Answer
n = int(input())
l = [input().split() for _ in range(n)]
for i in range(n):
    l[i][1] = str(100 - int(l[i][1]))
m = sorted(l, reverse = True)
for i in range(n):
    for j in range(n):
        if m[n - i - 1] == l[j]:
            print(j + 1)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
k = int(input())
print(a+b+c+max(a,b,c)*(2*k-1))
# Judge status: Wrong Answer
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if a+b>=c:
  if a<=c:
    print("YES")
else:
  if a>c:
    print("NO")
# Judge status: Accepted
a,b,c,d=map(int,input().split())
if abs(a-c)<=d:
    print("Yes")
elif (abs(a-b))<=d and (abs(b-c))<=d:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x = 1
for a in input().split():
  x *= int(a)
if x == 175:
  print('YES')
else:
  print('NO')