Harryxun/stf_run huggingface dataset:
def fact(x):
    if x<2:
        return 1
    else:
        return x*fact(x-2)
        
facto = str(fact(int(input())))
count=0
for x in range(len(facto)-1,-1,-1):
    if facto[x]=="0":
        count+=1 
    else:
        break
    
print(count)

### FIXED CODE ###

p=int(input())
n=p
if n%2 == 0:
    num=10
    c=0;
    while num <= n:
        c += (n//num)
        num *= 5
    print(c)
else:
    print(0)
x = list(map(int, input().split()))
x.sort()
print("{0} {1} {2}".format(x[0],x[1],x[2])

### FIXED CODE ###

x = list(map(int, input().split()))
x.sort()
print("{0} {1} {2}".format(x[0],x[1],x[2]))
S=input()
s1=int(S[0:2])
s2=int(S[3:5])

if 1<=s1<=12 and (s2>12 or S2==0):
    print("MMYY")
elif (s1>12 or s1==0) and 1<=s2<=12:
    print("YYMM")
elif 1<=s1<=12 and 1<=s2<=12:
    print("AMBIGUOUS")
else:
    print("NA")

### FIXED CODE ###

S=input()
s1=int(S[0:2])
s2=int(S[2:5])

if 1<=s1<=12:
    print("AMBIGUOUS" if 1<=s2<=12 else "MMYY")
else:
    print("YYMM" if 1<=s2<=12 else "NA")
import math

def lcm(a, b):
    return a * b // math.gcd (a, b)

sl, tl = map(int, input().split())
s = input()
t = input()

m = lcm(sl,tl)

mps = m // sl
mpt = m // tl

tmp = 0
width = max(mps,mpt)
ans = True

while tmp < m:
    if tmp % mps == 0 and tmp % mpt == 0:
        if s[tmp//mps] != t[tmp//mpt]:
            ans = False
            break
    tmp += width

if ans:
    print(m)
else:
    print(-1)

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

sl, tl = map(int, input().split())
s = input()
t = input()

m = lcm(sl,tl)

mps = m // sl
mpt = m // tl

tmp = 0
width = max(mps,mpt)
ans = True

while tmp < m:
    if tmp % mps == 0 and tmp % mpt == 0:
        if s[tmp//mps] != t[tmp//mpt]:
            ans = False
            break
    tmp += width

if ans:
    print(m)
else:
    print(-1)
if __name__ == "__main__":
    line = input()
    a = int(line.split(" ")[0])
    b = int(line.split(" ")[1])
    c = int(line.split(" ")[2])
    if (a*a+b*b==c*c) :
        print("YES")
    else :
        print("NO")

### FIXED CODE ###

# usr/bin/python
# coding: utf-8
################################################################################
# Is it a Right Triangle?
# Write a program which judges wheather given length of three side form a right triangle.
# Print "YES" if the given sides (integers) form a right triangle, "NO" if not so.
#
# Input
# Input consists of several data sets. In the first line, the number of data set,
# N is given. Then, N lines follow, each line corresponds to a data set.
# A data set consists of three integers separated by a single space.
#
# Constraints
# 1 ??? length of the side ??? 1,000
# N ??? 1,000
# Output
# For each data set, print "YES" or "NO".
#
# Sample Input
# 3
# 4 3 5
# 4 3 6
# 8 8 8
# Output for the Sample Input
# YES
# NO
# NO
#
################################################################################

if __name__ == "__main__":
    num = int(input())
    inputline = [""]*num
    for i in range(0,num):
        inputline[i] = input()
    for line in inputline:
        a = int(line.split(" ")[0])
        b = int(line.split(" ")[1])
        c = int(line.split(" ")[2])
        if (a*a+b*b == c*c or b*b+c*c == a*a or c*c+a*a == b*b):
            print("YES")
        else:
            print("NO")
inf = 10**9+5
n = int(input())
h = list( map(int,input().split()))

dp = [inf]*n
dp[0] = 0
for i in range(n):
    for j in range(i+1,i+3):
        if j<n:
            dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]))
            print(dp)
print(dp[-1])


### FIXED CODE ###

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

dp = [0, abs(h[1]-h[0])]
if n >2:
    for i in range(2,n):
        dp.append(min(abs(h[i]-h[i-2])+dp[-2], abs(h[i]-h[i-1])+dp[-1]))
else:
    print(dp[-1])
    exit()

print(dp[-1])
# ABCB - Digit Sums
n = int(input())
sn = 0
for i in range(len(str(n))):
    sn += n % 10
    s //= 10
print("Yes" if n % sn == 0 else "No")

### FIXED CODE ###

# ABCB - Digit Sums
n = int(input())
sn = sum(list(map(int, list(str(n)))))
print("Yes" if n % sn == 0 else "No")
import numpy as np
from copy import copy

def red(l, r, prefix):
    for index, i in enumerate(r):
        i = int(i)
        if i:
            if prefix == 0:
                l[index] = 'r'
            else:
                l[:, index] = 'r'

    return l

def main():
    h, w, k = map(int, input().split())
    cnt = 0
    list_ = []
    box = []
    for _ in range(h):
        l = list(input())
        list_.append(l)
    list_ = np.array(list_)
    x = copy(list_)
    for i in range(2**h):
        x1 = copy(x)

        r = format(i, f'0{h}b')
        x1 = red(x1, r, 0)
        for j in range(2**w):
            x2 = copy(x1)
            r = format(j, f'0{w}b')
            x2 = red(x2, r, 1)
            if np.count_nonzero(x2 == '#') == k:
                cnt += 1

    print(cnt)

if __name__ == "__main__":
    main()




### FIXED CODE ###

import numpy as np
from copy import copy

def red(l, r, prefix):
    for index, i in enumerate(r):
        i = int(i)
        if i:
            if prefix == 0:
                l[index] = 'r'
            else:
                l[:, index] = 'r'

    return l

def main():
    h, w, k = map(int, input().split())
    cnt = 0
    list_ = []
    box = []
    for _ in range(h):
        l = list(input())
        list_.append(l)
    list_ = np.array(list_)
    x = copy(list_)
    for i in range(2**h):
        x1 = copy(x)

        r = format(i, f'0{h}b')
        x1 = red(x1, r, 0)
        for j in range(2**w):
            x2 = copy(x1)
            r = format(j, f'0{w}b')
            x2 = red(x2, r, 1)
            if np.count_nonzero(x2 == '#') == k:
                cnt += 1

    print(cnt)

if __name__ == "__main__":
    main()
import numpy as np
from math import sqrt
from itertools import combinations

N = int(input())

P = [np.array(list(map(int,input().split())), dtype=np.int64) for _ in range(N)]

d2 = lambda v: v.dot(v)

def radius(A,B,C):
    a = d2(B-C)
    b = d2(C-A)
    c = d2(A-B)

    r = float('inf')
    if c > d2(A+B - 2*C):
        r = min(r, c)

    if a > d2(B+C - 2*A):
        r = min(r, a)

    if b > d2(C+A - 2*B):
        r = min(r, b)

    if r != float('inf'):
        return sqrt(float(r))/2

    U = a*(b+c-a)*A + b*(c+a-b)*B + c*(a+b-c)*C
    v = a*(b+c-a) + b*(c+a-b) + c*(a+b-c)
    return sqrt(float(d2(U-v*A)))/v

if N == 2:
    print(sqrt(float(d2(P[0]-P[1])))/2)
else:
    print(max(radius(a,b,c) for a,b,c in combinations(P,3)))


### FIXED CODE ###

import numpy as np
from itertools import combinations

N = int(input())

P = [np.array(list(map(int,input().split())), dtype=float) for _ in range(N)]

d2 = lambda v: np.sum(np.square(v))

def radius(A,B,C):
    a = d2(B-C)
    b = d2(C-A)
    c = d2(A-B)

    r = float('inf')
    if c > d2(A+B - 2*C):
        r = min(r, c)

    if a > d2(B+C - 2*A):
        r = min(r, a)

    if b > d2(C+A - 2*B):
        r = min(r, b)

    if r != float('inf'):
        return np.sqrt(r)/2

    U = a*(b+c-a)*A + b*(c+a-b)*B + c*(a+b-c)*C
    v = a*(b+c-a) + b*(c+a-b) + c*(a+b-c)
    U /= v
    r = np.linalg.norm(U-A)
    return r

if N == 2:
    print(np.linalg.norm(P[0]-P[1])/2)
else:
    print(max(radius(a,b,c) for a,b,c in combinations(P,3)))
n = input()
n_ = sum([int(x) for x in n])
print("Yes" if n%n_ == 0 else "No")

### FIXED CODE ###

n = input()
n_ = sum([int(x) for x in n])
print("Yes" if int(n)%n_ == 0 else "No")
n = int(input())
seq = list(map(int, input().split()))
q = int(input())
mlist = list(map(int, input().split()))
global mins
mins = min(seq)
sums = 0
for a in seq:
    sums += a

def check(i, m):
    if m == 0:
        return True
    elif i >= n or mins > m:
        return False
    res = check(i+1, m) + check(i+1, m - seq[i])
    return res

for m in mlist:
    if (mins > m or sums < m):
        print('no')
    elif(check(0,m)):
        print('yes')
    else:
        print('no')


### FIXED CODE ###

n = int(input())
seq = list(map(int, input().split()))
q = int(input())
mlist = list(map(int, input().split()))
mins = min(seq)
sums = 0
for a in seq:
    sums += a

def check(i, m):
    global mins
    if m == 0:
        return True
    elif i >= n or mins > m:
        return False
    res = check(i+1, m) or check(i+1, m - seq[i])
    return res

for m in mlist:
    if (mins > m or sums < m):
        print('no')
    elif(check(0,m)):
        print('yes')
    else:
        print('no')
n=int(input())
a=[int(x) for x in input().split()]
s=[0 for x in range(n)]
 
for i in range(n):
  a[i] -= i+1
 
a.sort()
 
if n%2:
　s=0
  for i in range(n):
    s += abs(a[i]-a[n//2])
  print(s)
else:
  m=10**14
  for i in range(a[n//2-1],a[n//2]+1):
    s = 0
    for j in range(n):
      s += abs(a[j]-i)
    m = min(m,s)
  print(s)


### FIXED CODE ###

n=int(input())
a=[int(x) for x in input().split()]
s=[0 for x in range(n)]
 
for i in range(n):
  a[i] -= i+1
 
a.sort()
 
s = 0
for j in range(n):
  s += abs(a[j]-a[n//2])
print(s)
n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]
fibo = [1,1]
r = [a[0]-1]

for i in range(m-1):
    r.append((a[i+1]-a[i])-2)
    if a[i+1] - a[i] == 1:
        print(0)
        exit()
else:
    r.append(n-a[-1]-1)

    for i in range(max(r)+2):
        fibo.append((fibo[-1]+fibo[-2])%1000000007)

    ans = 1

    for i in range(n):
        ans = (fibo[r[i]] * ans)%1000000007

    print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]
fibo = [1,1]
ans = 1

for i in range(n):
            fibo.append((fibo[-1]+fibo[-2])%1000000007)

if m:
    r = [a[0]-1]

    for i in range(m-1):
        r.append((a[i+1]-a[i])-2)
        if a[i+1]-a[i] == 1:
            print(0)
            exit()

    else:
        r.append(n-a[-1]-1)

        for i in range(len(r)):
            ans = (fibo[r[i]] * ans)%1000000007

        print(ans)
else:
    print(fibo[n])
a = input()
print(a * a)

### FIXED CODE ###

a = int(input())
print(a**2)
l=list(map(int,input().split()))
d=list(map(int,input().split()))
d_bar=[]
for m in range(10):
    if m not in d:
        d_bar.append(m) 
d_bar.sort()
a=''
for i in str(l[0]):
    for j in d_bar:
        if int(i)<=j:
            k=str(j)
            break
        else:
            pass
    a=a+k
print(int(a))

### FIXED CODE ###

l=list(map(int,input().split()))
d=list(map(int,input().split()))
u={i for i in range(10)}
d_bar=u-set(d)
d_bar={str(i) for i in d_bar}
n=l[0]
n_set=set(str(n))
while True:
    if n_set<=d_bar:
        print(n)
        break
    n=n+1
    n_set=set(str(n))
N = int(input())
alpha = ['z']
alpha.extend([chr(ord('a') + i) for i in range(25)])
# print(alpha)
q = N
mod = N
ans = ''
while q >= 27:
    q, mod = divmod(q, 26)
    # print(alpha[mod])
    ans = alpha[mod] + ans
if mod != 0:
    ans = alpha[q] + ans
print(ans)


### FIXED CODE ###

# 自力では解けなかった(2020.7.6)

alpha = ['Z']
alpha.extend([chr(ord('a') + i) for i in range(26)])
N = int(input())
q = N
ans = ''
while True:
    if q <= 26:
        ans += str(alpha[q])
        break
    else:
        q, mod = divmod(q, 26)
        if mod == 0:
            q -= 1
            mod = 26
        ans += str(alpha[mod])

print(ans[::-1])
N,M = list(map(int, input().split()))
a = [0]*N
b = [0]*N
c = [0]*M
d = [0]*M
for k in range(N):
     a[k],b[k] = list(map(int, input().split()))
for l in range(M):
     c[l],d[l] = list(map(int, input().split()))

for i in range(N):
    s=10**8+1
    for j in range(M):
        if  s>abs(a[i]-c[j])+abs(b[i]-d[j]):
             s=abs(a[i]-c[j])+abs(b[i]-d[j])
             e=j+1
    print(e)

### FIXED CODE ###

N,M = list(map(int, input().split()))
a = [0]*N
b = [0]*N
c = [0]*M
d = [0]*M
for k in range(N):
     a[k],b[k] = list(map(int, input().split()))
for l in range(M):
     c[l],d[l] = list(map(int, input().split()))

for i in range(N):
    s=10**9
    for j in range(M):
        if  s>abs(a[i]-c[j])+abs(b[i]-d[j]):
             s=abs(a[i]-c[j])+abs(b[i]-d[j])
             e=j+1
    print(e)
#coding : utf-8

if __name__ == "__main__":
    a,b = list(map(int,input().split()))
    if a =< 8 and b =< 8:
        print('Yay!')
    else:
        print(':(')

### FIXED CODE ###

#coding : utf-8

if __name__ == "__main__":
    a,b = list(map(int,input().split()))
    if a <= 8 and b <= 8:
        print('Yay!')
    else:
        print(':(')
from collections import Counter
n = int(input())
a= list(map(int,input().split()))
if n == 1:
  print(1)
  exit()

a.sort()
if a[0] == 1:
  print(1)
  exit()

c = Counter(a)
a = list(set(a))
dp = [0] * (10+1)

for x in a:
  t = x * 2
  while t <= 10:
    dp[t] = 1
    t += x

ans = 0
for x in a:
  if (c[x] == 1) & (dp[x] == 0):
    ans += 1

print(ans)

### FIXED CODE ###

from collections import Counter
n = int(input())
a= list(map(int,input().split()))
if n == 1:
  print(1)
  exit()

a.sort()

c = Counter(a)
a = list(set(a))
dp = [0] * (10**6 +1)

for x in a:
  t = x * 2
  while t <= 10**6:
    dp[t] = 1
    t += x

ans = 0
for x in a:
  if (c[x] == 1) & (dp[x] == 0):
    ans += 1

print(ans)
import sys

N = int(input())
H = input().split()
S = 0

for i in range(H.index(max(H))):
  if int(H[i]) - int(H[i + 1]) > 0:
    if int(H[i]) - int(H[i + 1]) > 1:
      print('No')
      exit()
    S.append(i)
for i in range(H.index(max(H)), N):
  if int(H[i]) - int(H[i + 1]) > 0:
    S += 1
    if int(H[i]) - int(H[i + 1]) > 1 or S == 2:
      print('No')
      exit()

### FIXED CODE ###

import sys
N = int(input())
H = input().split()
S = 0
for i in range(N):
  if int(H[i]) > S:
    S = int(H[i])
  elif S - int(H[i]) >= 2:
    print('No')
    exit()
print('Yes')
S = input()
# S.reverse()
S = S[::-1]
#dream, dreamer, erase, eraser
headers = ["resare","esare","remaerd","maerd"]

def solve(str):
    if str == "":
        return(True)
    else:
        for header in headers:
            if str.startswith(header):
                return(solve(str[len(header):]))
        return(False)

if solve(S):
    print('YES')
else:
    print('NO')

### FIXED CODE ###

S = input()
# S.reverse()
S = S[::-1]
#dream, dreamer, erase, eraser
headers = ["resare","esare","remaerd","maerd"]

result = True
while True:
    if S=="":
        result = True
        break
    result = False
    for header in headers:
        if S.startswith(header):
            S = S[len(header):]
            result = True
    if not result:
        break

if result:
    print('YES')
else:
    print('NO')
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools

N,MOD = map(int,readline().split())
m = map(int,read().split())
XY = zip(m,m)

mult = lambda x,y: x*y%MOD

graph = [[] for _ in range(N+1)]
for x,y in XY:
    graph[x].append(y)
    graph[y].append(x)

root = 1
parent = [0] * (N+1)
order = []
stack = [root]
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)

# 自身を黒く塗ったときの根側
dp1 = [0]*(N+1)

for v in order[::-1]:
    x = 1
    for w in graph[v]:
        x *= dp1[w]+1
        x %= MOD
    dp1[v] = x

# 親側
dp2 = [1]*(N+1)

for v in order:
    p = parent[v]
    arr = [dp1[c]+1 if c != p else dp2[v] for c in graph[v]]
    # 1元を除く積を取得
    from_left = [1] + list(itertools.accumulate(arr,mult))[:-1]
    from_right = list(itertools.accumulate(reversed(arr),mult))[-2::-1] + [1]
    prod = [x*y%MOD for x,y in zip(from_left,from_right)]
    for c,x in zip(graph[v],prod):
        if c != p:
            dp2[c] = 1+x

answer = '\n'.join(str(x*y%MOD) for x,y in zip(dp1[1:],dp2[1:]))
print(answer)


### FIXED CODE ###

import itertools
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,MOD = map(int,input().split())
if N == 1:
    print(1)
    exit()
graph = [set() for _ in range(N)]
for row in sys.stdin.readlines():
    x,y = map(int,row.split())
    graph[x-1].add(y-1)
    graph[y-1].add(x-1)

ldp = [None] * N
rdp = [None] * N

def dfs_1(v=0,parent=None):
    # 子ごとに、そこを黒くして適切 or 完全白
    graph[v].discard(parent)
    ldp[v] = [1] * (len(graph[v])+1)
    rdp[v] = [1] * (len(graph[v])+1)
    vals = [dfs_1(w,v)+1 for w in graph[v]]
    for i,x in enumerate(vals,1):
        ldp[v][i] = ldp[v][i-1] * x % MOD
    for i,x in enumerate(reversed(vals),1):
        rdp[v][-i-1] = rdp[v][-i] * x % MOD
    return ldp[v][-1]

dfs_1()

dp = [None] * N
q = [(0,1)]
while q:
    v,x = q.pop()
    dp[v] = x*ldp[v][-1]%MOD
    for w,L,R in zip(graph[v],ldp[v][:-1],rdp[v][1:]):
        q.append((w,x*L*R%MOD+1))

print('\n'.join(map(str,dp)))
var Takoyaki = [N,X,T]
N = 20 
X = 12
T = 6
N / X -- N % X = Z
Z*T = time
print(time)

### FIXED CODE ###

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

if A%B == 0:
	Z = A//B
else :
    Z = A//B + 1
time = Z*C

print(time)
x,y=map(int,input().split())
if x%y==0:
    print(-1)
else:
    print(a*(b-1))


### FIXED CODE ###

x,y=map(int,input().split())
if x%y==0:
    print(-1)
else:
    print(x*(y-1))
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N-1)]
c = list(map(int, input().split()))

if N == 1:
    print(0)
    print(c[0])
    exit()

c.sort(reverse = True)
edge = [[] for _ in range(N)]
for a, b in ab:
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

def dfs(v, p):
    global ans
    global count
    if p != -1:
        anse[v] = c[count+1]
        ans += min(anse[v], anse[p])
        count += 1
    for nv in edge[v]:
        if nv == p:
            continue
        dfs(nv, v)

#search = [i for i, e in enumerate(edge) if len(e) == 1]
search = [0]
res = 0
rese = [None for _ in range(N)]
for i in search:
    count = 0
    ans = 0
    anse = [None for _ in range(N)]
    anse[i] = c[0]
    dfs(i, -1)
    if res < ans:
        res = ans
        rese = anse
print(res)
print(" ".join(map(str, rese)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N-1)]
c = list(map(int, input().split()))

if N == 1:
    print(0)
    print(c[0])
    exit()

c.sort(reverse = True)
edge = [[] for _ in range(N)]
for a, b in ab:
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

def dfs(v, p):
    global ans
    global count
    if p != -1:
        anse[v] = c[count+1]
        ans += min(anse[v], anse[p])
        count += 1
    for nv in edge[v]:
        if nv == p:
            continue
        dfs(nv, v)

#search = [i for i, e in enumerate(edge) if len(e) == 1]
search = [0]
res = 0
rese = [None for _ in range(N)]
for i in search:
    count = 0
    ans = 0
    anse = [None for _ in range(N)]
    anse[i] = c[0]
    dfs(i, -1)
    if res < ans:
        res = ans
        rese = anse
print(res)
print(" ".join(map(str, rese)))
from fraction import gcd
n=int(input())
a=list(map(int,input().split()))
b=1
for i in a:
  b=gcd(b,i)
ans=0
for i in a:
  ans+=(b//i)
print(ans%(10**9+7))

### FIXED CODE ###

from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
b=1
for i in a:
  b=b//gcd(b,i)*i
ans=0
for i in a:
  ans+=(b//i)
print(ans%(10**9+7))
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))



n = int(input())
minsum = [None] * n # (min, sum)
for i in range(n):
    tmp = list(map(int, " ".join(input()).replace("(", "1").replace(")", "-1").split()))
    c = 0
    m = 0
    for item in tmp:
        c += item
        m = min(c, m)
    minsum[i] = (m, sum(tmp))
minsum.sort()
if sum(item[1] for item in minsum)!=0:
    print("No")
else:
    c = 0
    i = n-1
    while minsum:
        m, s = minsum[i]
        if m<0:
            break
        c += s
        i -= 1
        minsum.pop()
    if not minsum:
        print("Yes")
    else:
#         minsum.sort(key=lambda x: x[1])
    #     print(minsum, c)
        i = len(minsum)-1
        update = False
        done = [False] * len(minsum)
        for i in range(len(minsum)):
            m, s = minsum[i]
            if s<0:
                continue
            if c+m>=0:
                c += s
                done[i] = True
        for i in range(len(minsum), -1, -1):
            if done[i]:
                continue
            m, s = minsum[i]
            if c+m>=0:
                c += s
            else:
                print("No")
                break
        else:
            print("Yes")

### FIXED CODE ###

def main():
    import queue
    import sys
    input = lambda : sys.stdin.readline().rstrip()
    sys.setrecursionlimit(max(1000, 10**9))



    n = int(input())
    minsum = [None] * n # (min, sum)
    for i in range(n):
        tmp = list(map(int, " ".join(input()).replace("(", "1").replace(")", "-1").split()))
        c = 0
        m = 0
        for item in tmp:
            c += item
            m = min(c, m)
        minsum[i] = (m, sum(tmp))
    minsum.sort()

    if sum(item[1] for item in minsum)!=0:
        print("No")
    else:
        minsum1 = [item for item in minsum if item[1]>=0]
        minsum2 = [(item[0]-item[1], -item[1]) for item in minsum if item[1]<0]
        minsum2.sort()
        c = 0
        for m,s in minsum1[::-1]:
            if c+m>=0:
                c += s
            else:
                print("No")
                return
        c = 0
        for m,s in minsum2[::-1]:
            if c+m>=0:
                c+=s
            else:
                print("No")
                return
        print("Yes")
main()
n,m=map(int,input().split())
lst=[]
for i in range(m):
  p,y=map(int,input().split())
  lst.append([p,y])
lst.sort(lambda x:(x[0],x[1]))
j=1
for i in range(m):
  if lst[i][0]==lst[min(m-1,i+1)][0]:
    s=str(lst[i][0])
    t=str(j)
    s.zfill(6)
    t.zfill(6)
    u=s+t
    j+=1
    print(int(u))
  else:
    s=str(lst[i][0])
    t=str(j)
    s.zfill(6)
    t.zfill(6)
    u=s+t
    j-=j-1
    print(int(u))
    
  


### FIXED CODE ###

n,m=map(int,input().split())
lst=[]
for i in range(m):
  p,y=map(int,input().split())
  lst.append([i,p,y])
lst.sort(key=lambda x:(x[1],x[2]))
j=1
Lst=[]
for i in range(m):
  if lst[i][1]==lst[min(m-1,i+1)][1]:
    s=str(lst[i][1])
    t=str(j)
    u=s.zfill(6)+t.zfill(6)
    j+=1
    Lst.append([lst[i][0],u])
  else:
    s=str(lst[i][1])
    t=str(j)
    u=s.zfill(6)+t.zfill(6)
    j-=j-1
    Lst.append([lst[i][0],u])
Lst.sort(key=lambda x:x[0])
for k in range(m):
  print(Lst[k][1])
K,X=map(int, input().split())
if 500*K>X
	print("yes")
else print("no")

### FIXED CODE ###

K, X = map(int, input().split())
if (500*K>=X):
  print("Yes")
else:
  print("No")
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
l=[lnii() for i in range(n)]

if n==1:
  print(*l[0])
  exit()

ans_x=[]
ans_y=[]
ans_h=[]

for tx in range(101):
  for ty in range(101):
    t_h=-1
    for x,y,h in l:
      dist=abs(tx-x)+abs(ty-y)
      if t_h==-1:
        t_h=h+dist
      else:
        if t_h!=h+dist:
          break
    else:
      ans_x.append(tx)
      ans_y.append(ty)
      ans_h.append(t_h)

inx=ans_h.index(max(ans_h))
print(ans_x[inx],ans_y[inx],ans_h[inx])

### FIXED CODE ###

from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
l=[]
for i in range(n):
  x,y,h=nii()
  l.append([x,y,h])
  if h!=0:
    ini_x=x
    ini_y=y
    ini_h=h

for tx in range(101):
  for ty in range(101):
    n_h=abs(tx-ini_x)+abs(ty-ini_y)+ini_h
    for x,y,h in l:
      t_h=max(n_h-(abs(tx-x)+abs(ty-y)),0)
      if h!=t_h:
        break
    else:
      print(tx,ty,n_h)
      exit()
N, K = map(int,input().split())
A = sorted(map(int,input().split()))
start = 0
end = A[-1]
l = (start + end)/2
while int(end) - start >= 0:
   l = (start + end)/2
   count = 0
   for i in range(N):
      q = A[i]/l
      if q = int(q):
         q -= 1
      count += int(q)
   if count > K:
      start = l
   else:
      end = l
ans = (start + end)/2
print(int(end))

### FIXED CODE ###

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)