Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

from collections import defaultdict
import json
from copy import deepcopy

def dfs(graph, s, d, count=0):
  if len(graph[s]) == 0:
    d[s] = count
  for t in graph[s]:
    if s in graph[t]:
      graph[t].remove(s)
    dfs(graph, t, d, count+1)

if __name__=='__main__':
  graph = defaultdict(list)
  n, u, v = map(int, input().strip().split())
  for _ in range(n-1):
    ai, bi = map(int, input().strip().split())
    graph[ai].append(bi)
    graph[bi].append(ai)
  du, dv = dict(), dict()
  du[u], dv[v] = 0, 0
  dfs(deepcopy(graph), u, du)
  dfs(deepcopy(graph), v, dv)

  costv = []
  for k in dv.keys():
    if du[k] < dv[k]:
      costv.append(dv[k])
  print(max(costv) - 1)

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding:utf-8 -*-

from collections import defaultdict
import json
from copy import deepcopy
import sys
sys.setrecursionlimit(10**4)

def dfs(graph, s):
  dist = [-1 for _ in range(len(graph))]
  dist[s] = 0
  stack = [s]
  while len(stack) != 0:
    s = stack.pop()
    for t in graph[s]:
      dist[t] = dist[s]+1
      if s in graph[t]:
        graph[t].remove(s)
      stack.append(t)
  return dist

if __name__=='__main__':
  graph = defaultdict(list)
  n, u, v = map(int, input().strip().split())
  for _ in range(n-1):
    ai, bi = map(int, input().strip().split())
    graph[ai-1].append(bi-1)
    graph[bi-1].append(ai-1)
  du = dfs(deepcopy(graph), u-1)
  dv = dfs(deepcopy(graph), v-1)
  costv = [0]
  for duv, dvv in zip(du, dv):
    if duv < dvv:
      costv.append(dvv)
  print(max(costv) - 1)
N = int(input())
A = []
for i in range(N):
	l = list(map(int,input().split()))
	A.append([i-1 for i in l])
match_num = [0 for i in range(N)]
match_dict = {}
idx = 0
for i in range(N-1):
	for j in range(i+1, N):
		match_dict[(i,j)] = idx
		idx += 1
M = idx
edge = [[] for i in range(M)]
parent = [[] for i in range(M)]
for i in range(N):
	for j in range(N-2):
		a = A[i][j]
		a_nxt = A[i][j+1]
		x,y = min(i,a), max(i,a)
		z,w = min(i,a_nxt), max(i,a_nxt)
		edge[match_dict[(x,y)]].append(match_dict[(z,w)])
		parent[match_dict[(z,w)]].append(match_dict[(x,y)])
finish = [False for i in range(M)]
candidate = [i for i in range(M) if len(parent[i]) == 0]
day = 0
while len(candidate) > 0:
	new_candidate = []
	for c in candidate:
		if finish[c]:
			continue
		finish[c] = True
		for e in edge[c]:
			if finish[e]:
				continue
			if all([finish[p] for p in parent[e]])
				new_candidate.append(e)
	day += 1
	candidate = new_candidate

all_finished = sum([1 if f else 0 for f in finish]) == M
if all_finished:
	print(day)
else:
	print(-1)

### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
	l = list(map(int,input().split()))
	A.append([i-1 for i in l])
match_num = [0 for i in range(N)]
match_dict = {}
idx = 0
for i in range(N-1):
	for j in range(i+1, N):
		match_dict[(i,j)] = idx
		idx += 1
M = idx
edge = [[] for i in range(M)]
parent = [[] for i in range(M)]
for i in range(N):
	for j in range(N-2):
		a = A[i][j]
		a_nxt = A[i][j+1]
		x,y = min(i,a), max(i,a)
		z,w = min(i,a_nxt), max(i,a_nxt)
		m1 = match_dict[(x,y)]
		m2 = match_dict[(z,w)]
		edge[m1].append(m2)
		parent[m2].append(m1)
finish = [False for i in range(M)]
candidate = [i for i in range(M) if len(parent[i]) == 0]
depth = [-1 for i in range(M)]


day = 0
while len(candidate) > 0:
	new_candidate = []
	for c in candidate:
		finish[c] = True
		for e in edge[c]:
			parent[e].remove(c)
			if len(parent[e]) == 0:
				new_candidate.append(e)
		edge[c] = []
	candidate = new_candidate
	day += 1
print(day if all(finish) else -1)
N=list(input())

n=list(reversed(N))

if n[0]=="2" or n[0]=="4" or n[0]=="5" or n[0]=="7" or n[0]=="9":
    print(hon)
if n[0]=="0" or n[0]=="1" or n[0]=="6" or n[0]=="8":
    print(pon)
if n[0]=="3":
    print(bon)


### FIXED CODE ###

n=list(input())

n==n.reverse()

if (n[0]=="2" or n[0]=="4" or n[0]=="5" or n[0]=="7" or n[0]=="9"):
    print("hon")
elif (n[0]=="0" or n[0]=="1" or n[0]=="6" or n[0]=="8"):
    print("pon")
elif (n[0]=="3"):
    print("bon")
W, H, x, y, r = map(int, input().split()))
    if x + r >= 0 and y + r >= 0:
        if W <= x+r and H <= y+r:
            print("Yes")
        else:
            print("No")

### FIXED CODE ###

W,H,x,y,r = map(int,input().split(" "))
if x - r >= 0 and x + r <= W:
    if y - r >= 0 and y + r <= H:
        print("Yes")
    else:
        print("No")
else:
    print("No")
from math import ceil,floor
out = []

numA,numB = map(int,input().split())
for i in range(101):
  testA = floor(i * 0.08)
  testB = floor(i * 0.10)
  if testA == numA and testB == numB:
    out.append(i)

print(min(out))

### FIXED CODE ###

from math import ceil,floor

numA,numB = map(int,input().split())
for i in range(10000):
  testA = floor(i * 0.08)
  testB = floor(i * 0.10)
  if testA == numA and testB == numB:
    print(i)
    break
else:
  print("-1")
def main():
    n = int(input())
    mod = 10 ** 9 + 7 #素数
    
    def modpow(x, n, mod):
        res = 1
        while n:
            if n % 2:
                res *= x % mod
                res %= res
            x *= x % mod
            n >>= 1
        return res
 
    # 全パターン:10 ** n
    all_p = modpow(10, n, mod)
    # 0を含まないパタンーン:9 ** n
    not_0 = modpow(9, n, mod)
    # 9を含まないパターン:9 ** n
    not_9 = modpow(9, n, mod)
    # 0と９を含まないパターン:8 ** n
    not_0_9 = modpow(8, n, mod)
    # 条件のパターン
    ans = (all_p - not_0 - not_9 + not_0_9) % mod
    print(ans)
 
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    mod = 10 ** 9 + 7 #素数
    
    def modpow(x, n, mod):
        res = 1
        while n:
            if n % 2:
                res *= x % mod
                res %= mod
            x *= x % mod
            n >>= 1
        return res

    # 全パターン:10 ** n
    all_p = modpow(10, n, mod)
    # 0を含まないパタンーン:9 ** n
    not_0 = modpow(9, n, mod)
    # 9を含まないパターン:9 ** n
    not_9 = modpow(9, n, mod)
    # 0と９を含まないパターン:8 ** n
    not_0_9 = modpow(8, n, mod)
    # 条件のパターン
    ans = all_p - not_0 - not_9 + not_0_9
    print(ans%mod)

if __name__ == '__main__':
    main()
a,b,x=map(int,input().split())
print(b//x - a//x +(1 if a%x == 0))

### FIXED CODE ###

a,b,x=map(int,input().split())
ans = b//x - a//x
if a%x == 0:
  ans += 1
print(ans)
import math
n=int(input())

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

def lcm3(a,b,c):
	return lcm(lcm(a,b),c)

def lcm4(a,b,c,d):
	return lcm(lcm(a,b),lcm(c,d))

a=[0]*(n*n)
x=set([1])
s=2
for i in range(0,n*n):
	if (i//n+i%n)%2==0:
		a[i]=s
		x.add(s)
		s+=1
#print(a)
for i in range(0,n*n):
	if a[i]==0:
		j=i//n
		k=i%n
		if j==0 and k==n-1:
			m=lcm(a[i-1],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif j==n-1 and k==0:
			m=lcm(a[i+1],a[i-n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif j==0:
			m=lcm3(a[i-1],a[i+1],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif j==n-1:
			m=lcm3(a[i-1],a[i+1],a[i-n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif k==0:
			m=lcm3(a[i+1],a[i-n],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif k==n-1:
			m=lcm3(a[i-1],a[i-n],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		else:
			m=lcm4(a[i+1],a[i-1],a[i-n],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)

for i in range(n):
	print(' '.join(map(str,a[i*n:i*n+n])))


### FIXED CODE ###

z=int(input())
n=500

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

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

def lcm3(a,b,c):
	return lcm(lcm(a,b),c)

def lcm4(a,b,c,d):
	return lcm(lcm(a,b),lcm(c,d))

a=[0]*(n*n)
x=set([1])
for i in range(n*n//4)[::-1]:
	j=i//((n*n)//16)
	if j==0:
		y1=0
		y2=0
	elif j==1:
		y1=1
		y2=1
	elif j==2:
		y1=0
		y2=1
	else:
		y1=1
		y2=0
	k=i%((n*n)//16)
	m=i+2
	a[n*(4*(k//(n//4))+2*y1)+4*(k%(n//4))+2*y2]=m
	x.add(m)
	while m in x:
		m+=i+2
	a[n*(4*(k//(n//4))+2*y1+1)+4*(k%(n//4))+2*y2+1]=m
	x.add(m)
#print(a)
for i in range(0,n*n):
	if a[i]==0:
		j=i//n
		k=i%n
		if j==0 and k==n-1:
			m=lcm(a[i-1],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif j==n-1 and k==0:
			m=lcm(a[i+1],a[i-n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif j==0:
			m=lcm3(a[i-1],a[i+1],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif j==n-1:
			m=lcm3(a[i-1],a[i+1],a[i-n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif k==0:
			m=lcm3(a[i+1],a[i-n],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		elif k==n-1:
			m=lcm3(a[i-1],a[i-n],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)
		else:
			m=lcm4(a[i+1],a[i-1],a[i-n],a[i+n])
			l=m+1
			while l in x:
				l+=m
			a[i]=l
			x.add(l)

#print(max(x))

for i in range(z):
	print(' '.join(map(str,a[i*n:i*n+z])))
import math
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    a[i]=a[i]-i-1
a.sort()
if n%2==1:
    p=a[n//2]
    print(abs(sum(a[:n//2])-p*(n//2))+sum(a[n//2+1:])-p*(n//2))
else:
    l=a[n//2-1]+a[n//2]
    s=math.fllor(l/2)
    t=math.ceil(l/2)
    print(min(abs(sum(a[:n//2]))-s*n//2+sum(a[n//2:])-s*(n//2),abs(sum(a[:n//2]))-t*n//2+sum(a[n//2:])-t*(n//2)))

### FIXED CODE ###

import math
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    a[i]=a[i]-i-1
a.sort()
k=a[n//2]
c=0
for i in range(n):
    c+=abs(a[i]-k)
print(c)
N = int(input())
ans = 0
for i in range(1, N+1)
	return ans += i
print(ans)

### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1, N+1):
	ans += i
print(ans)
n, x = map(int, input().split())
l = list(map(int, input().split()))

count = 0
sum = 0

for i in range(len(l)):
  sum += l[i]
  if sum <= x
    count+=1
print(count + 1)

### FIXED CODE ###

n, x = map(int, input().split())
l = list(map(int, input().split()))

count = 0
sum = 0

for i in range(len(l)):
  sum += l[i]
  if sum <= x:
    count+=1
print(count + 1)
s = input()
for x in s:
  if x != '0':
    count = count + 1


### FIXED CODE ###

s = input()
count = 0
for x in s:
  if x != '0':
    count = count + 1
print(count)
a,b,c,d = map(int,input().split())
print('No' if max(abs(a - b),abs(b - c)) > d　 else 'Yes')

### FIXED CODE ###

a,b,c,d = map(int,input().split())
if abs(a-b) > d or abs(b-c)> d :
    if abs (a-c) >d:
        print('No')
    else:
        print('Yes')
else:
    print('Yes')
N = int(input())
G = {i:[] for i in range(N)}
for i in range(N-1):
  u, v, w = list(map(int, input().split()))
  u -= 1
  v -= 1
  w = w % 2
  G[u].append([v, w])
  G[v].append([u, w])
res = [0] * N

def dfs(u, p, c):
  res[u] = c
  for n in G[u]:
    if n[0] == p:
      continue
    if n[1]:
      dfs(n[0], u, 1-c)
    else:
      dfs(n[0], u, c)
  
def main():
  dfs(0, -1, 1)
  for i in res:
    print(i)
  
  
if __name__ == "__main__":
  main()

### FIXED CODE ###

N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
  u, v, w = list(map(int, input().split()))
  u -= 1
  v -= 1
  w = w % 2
  G[u].append([v, w])
  G[v].append([u, w])
  
res = [-1] * N
"""
def dfs(u, p, c):
  res[u] = c
  for n in G[u]:
    if n[0] == p or res[n[0]] != -1:
      continue
    if n[1] == 1:
      dfs(n[0], u, 1-c)
    else:
      dfs(n[0], u, c)
"""
from collections import deque
q = deque()
# 再帰はメモリ的に厳しい？？
def search(q):
  while q:
    u, p, c = q.popleft()
    if res[u] == -1:
      for n in G[u]:
        if n[0] == p or res[n[0]] != -1:
          continue
        if n[1] == 1:
          q.append((n[0], u, 1-c))
        else:
          q.append((n[0], u, c))
    res[u] = c
  
  
def main():
  q.append((0, -1, 1))
  search(q)
  for i in res:
    print(i)
  
  
if __name__ == "__main__":
  main()
num = input().split(' ')
num_data = [int(num[i]) for i in range(3)]
#N X Y
cost = [0 for i in range(num_data[0] - 1)] #start position has the lowest number
for i in range(num_data[0]):
    for l in range(num_data[0] - 1):
        result = min(abs(i - l),abs(i - num_data[1] - 1) + 1 + abs(l - num_data[2] - 1),abs(i - num_data[2] - 1) + 1 + abs(l - num_data[1] - 1))
        cost[num_data[0] - result] += 1
print(cost)


### FIXED CODE ###

def main():
    n,x,y = map(int,input().split(' '))
    cost = [0 for i in range(n - 1)]
    for i in range(n - 1):
        for l in range(i + 1, n):
            result = min(abs(i - l),abs(i - x + 1) + 1 + abs(l - y + 1),abs(i - y + 1) + 1 + abs(l - x + 1))
            cost[result - 1] += 1
    for per in cost:
        print(per)

if __name__ == '__main__':
    main()
N, K = map(int, input().split())

if N <= K or N == 2 or (N == 4 and K == 3):
    print(-1)
else:
    M = N * (N - 1) // 2 - K
    cnt = 0
    ans = []
    for i in range(N - 1):
        for j in range(i + 1, N):
            ans.append((i + 1, j + 1))
            cnt += 1
            if M == cnt:
                break
        else:
            continue
        break
    # print(M)
    # for edge in ans:
    #     print(*edge)


def wf(N):
    INF = 10 ** 6

    dp = [[INF] * N for _ in range(N)]
    for i in range(N):
        dp[i][i] = 0

    for i, j in ans:
        i -= 1
        j -= 1
        dp[i][j] = 1
        dp[j][i] = 1

    for k in range(N):
        for i in range(N):
            for j in range(N):
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])

    cnt = 0
    for i in range(N - 1):
        for j in range(i + 1, N):
            if dp[i][j] == 2:
                cnt += 1
    return cnt


if wf(N) == K:
    print(M)
    for edge in ans:
        print(*edge)
else:
    print(-1)


### FIXED CODE ###

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

if K > (N - 1) * (N - 2) // 2:
    print(-1)
else:
    M = N * (N - 1) // 2 - K
    cnt = 0
    ans = []
    for i in range(N - 1):
        for j in range(i + 1, N):
            ans.append((i + 1, j + 1))
            cnt += 1
            if M == cnt:
                break
        else:
            continue
        break
    print(M)
    for edge in ans:
        print(*edge)
N, X = map(int, input().split())
S = list(map(int, input().split()))

MOD = 1000000007
numbers = S[:]
numbers.sort()
#dp = [[0 for _ in range(X+1)] for _ in range(N+1)]

dp = [[0] * (X+1) for _ in range(N+1)]
#dp[0] = [x for x in range(X+1)]
#from collections import defaultdict
#dp = [defaultdict(int) for _ in range(N+1)]
dp[0] = [x for x in range(X+1)]

import array 
dp = [array.array('Q', l) for l in dp]

for i, n  in enumerate(numbers):
    for x in range(X+1):
        dp[i+1][x] += dp[i][x % n]
        dp[i+1][x] += dp[i][x] * i #% MOD

print(dp[N][X] % MOD)


### FIXED CODE ###

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

MOD = 1000000007
numbers = S[:]
numbers.sort(reverse=True)


dp = {X: 1}

for i, n in enumerate(numbers):
    tmp_dp = {}
    for k, v in dp.items():
        if k < n:
            tmp_dp[k] = (tmp_dp.get(k,0)+v*(N-i))
        else:
            tmp_dp[k]=(tmp_dp.get(k,0)+v*(N-i-1)) 
            tmp_dp[k%n]=(tmp_dp.get(k%n,0)+v) 
    dp = tmp_dp.copy()
        
ans = 0
for k, v in dp.items():
    ans += k *  v

print(ans % MOD)
N = int(input())

S = input()
T = input()

if(len(S) == len(T) == N):
  print("OK")

### FIXED CODE ###

N = int(input())

S, T = map(str, input().split())

#print(S)
#print(len(S))
#print(len(T))

moji = ""

if(len(S) == len(T) == N):
  for i in range(0, N):
    str = (S + T)[i::N]
    moji += str
print(moji)
import sys
input = sys.stdin.readline

from bisect import bisect_left, bisect_right

INF = 10**18 + 100
N,A,B = map(int,input().split())
S = [-INF] + [int(x) for x in sys.stdin.read().split()]

MOD = 10**9 + 7

dpX = [0] * (N+1) # 最後にYを選んだとして、直前に選んだXがどこにあるか
dpY = [0] * (N+1) # 最後にXを選んだとして、直前に選んだYがどこにあるか
dpX[0] = 1
dpY[0] = 1
dpX_cum = [1] * (N+1)
dpY_cum = [1] * (N+1)
dpX_left = 0
dpY_left = 0
for n,x in enumerate(S[2:],2):
    iA = bisect_right(S,x-A)
    iB = bisect_right(S,x-B)
    # ....XY
    xy = dpY_cum[iB-1] - dpY_cum[dpY_left-1]
    # ....YX
    yx = dpX_cum[iA-1] - dpX_cum[dpX_left-1]
    # ....XX が不可能なら捨てる。明示的に捨てるのではなく、生きている番号だけ持つ
    if iA != n:
        dpY_left = n-1
    if iB != n:
        dpX_left = n-1
    dpX[n-1] = xy
    dpX_cum[n-1] = (dpX_cum[n-2] + xy) % MOD
    dpX_cum[n] = dpX_cum[n-1]
    dpY[n-1] = yx
    dpY_cum[n-1] = (dpY_cum[n-2] + yx) % MOD
    dpY_cum[n] = dpY_cum[n-1]

answer = dpX_cum[n] - dpX_cum[dpX_left-1]
answer += dpY_cum[n] - dpY_cum[dpY_left-1]
answer %= MOD
print(answer)

### FIXED CODE ###

import sys
input = sys.stdin.readline

from bisect import bisect_left, bisect_right

INF = 10**18 + 100
N,A,B = map(int,input().split())
S = [-INF] + [int(x) for x in sys.stdin.read().split()]

MOD = 10**9 + 7

dpX = [0] * (N+1) # 最後にYを選んだとして、直前に選んだXがどこにあるか
dpY = [0] * (N+1) # 最後にXを選んだとして、直前に選んだYがどこにあるか
dpX[0] = 1
dpY[0] = 1
dpX_cum = [1] * (N+1) + [0] # -1
dpY_cum = [1] * (N+1) + [0] # -1
dpX_left = 0
dpY_left = 0
for n,x in enumerate(S[2:],2):
    iA = bisect_right(S,x-A)
    iB = bisect_right(S,x-B)
    # ....XY
    xy = dpY_cum[iB-1] - dpY_cum[dpY_left-1] if iB >= dpY_left else 0
    # ....YX
    yx = dpX_cum[iA-1] - dpX_cum[dpX_left-1] if iA >= dpX_left else 0
    # ....XX が不可能なら捨てる。明示的に捨てるのではなく、生きている番号だけ持つ
    if iA != n:
        dpY_left = n-1
    if iB != n:
        dpX_left = n-1
    dpX[n-1] = xy
    dpX_cum[n-1] = (dpX_cum[n-2] + xy) % MOD
    dpX_cum[n] = dpX_cum[n-1]
    dpY[n-1] = yx
    dpY_cum[n-1] = (dpY_cum[n-2] + yx) % MOD
    dpY_cum[n] = dpY_cum[n-1]

answer = dpX_cum[N-1] - dpX_cum[dpX_left-1]
answer += dpY_cum[N-1] - dpY_cum[dpY_left-1]
answer %= MOD
print(answer)
s = input()
count = 0

for i in s:
    if ord("A") <= ord(i) <= ord("Z"):
        count += 1
else:
    if s[0] == "A" and 2 <= s.index("C") <= len(s)-3 and count == 2:
        print("AC")
    else:
        print("WA")


### FIXED CODE ###

s = input()
count = 0

for i in s:
    if ord("A") <= ord(i) <= ord("Z"):
        count += 1
else:
    if s.count("C") == 0:
        print("WA")
        exit()
    if s[0] == "A" and 2 <= s.index("C") <= len(s)-2 and count == 2:
        print("AC")
    else:
        print("WA")
s = str(input())

if s == "AAA" or S == "BBB":
  print('No')
else:
  print('Yes')

### FIXED CODE ###

s = str(input())
 
if s == "AAA" or s == "BBB":
  print('No')
else:
  print('Yes')
import math
N, K = map(int, input().split())
A=list(map(int,input().split()))
maxA = max(A)
num = 0
right = maxA
left = 0
while(right-left>1):
    num = left+math.floor((right-left)*0.5)
    count = 0
    for i in range(len(A)):
        count += math.ceil(A[i]/num)-1
    if count > K:
        left = num
    elif count <= K:
        right = num
count = 0
num = right
for i in range(len(A)):
    count += math.ceil(A[i]/num)-1
if count!=K:
    num = left
    count = 0
    for i in range(len(A)):
        count += math.ceil(A[i]/num)-1
print(num)


### FIXED CODE ###

N, K = map(int, input().split())
A=list(map(int,input().split()))
A.sort()
right = A[-1]+1
left = 0
flag = True
mid = (left+right)//2
minN = right
result = mid
while right-left>1 and flag:
    mid = (left+right)//2
    count = 0
    for i in A:
        count += (i-1)//mid
    if count <= K:
        right = mid
        if minN>mid:
            minN = mid
            result = mid
    elif count > K:
        left = mid
print(result)
H,W,A,B=map(int,input().split())

if A==0 and B==0:
    for i in range(H):
        ans=["1"]*W
        print("".join(ans))
        exit()
elif A==0:
    ans = ["1"] * W
    for i in range(B):
        print("".join(ans))
    ans=["0"]*W
    for i in range(H-B):
        print("".join(ans))
elif B==0:
    ans1 = ["1"] * A
    ans2 = ["0"] * (W - A)
    for i in range(H):
        ans1.extend(ans2)
        print("".join(ans1))
elif W%A==0 and H%B==0 and W//A==H//B:
    for j in range(H//B):
        ans=[]
        for i in range(W//A):
            if i==j:
                temp=["1"]*A
                ans.extend(temp)
            else:
                temp=["0"]*A
                ans.extend(temp)
        for k in range(B):
            print("".join(ans))
else:
    print("No")

### FIXED CODE ###

H, W, A, B = map(int, input().split())

if A == 0 and B == 0:
    for i in range(H):
        ans = ["1"] * W
        print("".join(ans))
elif A == 0:
    for i in range(B):
        ans=[]
        temp = ["1"] * W
        ans.extend(temp)
        print("".join(ans))
    for i in range(H - B):
        ans=[]
        temp = ["0"] * W
        ans.extend(temp)
        print("".join(ans))
elif B == 0:
    for i in range(H):
        ans1=[]
        ans1 = ["1"] * A
        ans2 = ["0"] * (W - A)
        ans1.extend(ans2)
        print("".join(ans1))
else:
    for i in range(B):
        ans1 = ["1"]*A
        ans2=["0"]*(W-A)
        ans1.extend(ans2)
        print("".join(ans1))
    for i in range(H-B):
        ans1=["0"]*A
        ans2=["1"]*(W-A)
        ans1.extend(ans2)
        print("".join(ans1))
n = int(input())
p = list(input().split())
q = sorted(p)
for i in range(n):
  if p[i] != q[i]:
    ans += 1
if ans <= 2:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

n = int(input())
p = list(map(int,input().split()))
q = sorted(p)
ans = 0
for i in range(n):
  if p[i] != q[i]:
    ans += 1
if ans == 2:
  print('YES')
elif ans == 0:
  print('YES')
else:
  print('NO')
n = int(input())
count = 0
if len(n)%2 == 0:
  for i in range(len(n)//2):
    count += 9*(10**(2*i))
  print(count)
else:
  for i in range(len(n)//2):
    count += 9*(10**(2*i))
  count += n - 10**(len(n)-1)+1
  print(count)
  
    

### FIXED CODE ###

n = input()
count = 0
if len(n)%2 == 0:
  for i in range(len(n)//2):
    count += 9*(10**(2*i))
  print(count)
else:
  for i in range(len(n)//2):
    count += 9*(10**(2*i))
  count += int(n) - 10**(len(n)-1)+1
  print(count)
n = int(input())
ans = 0.0
for _ in range(n):
  x, u = input.split()
  if u == 'JPN':
    ans += int(x)
  else:
    ans += float(x) * 38000.0

print("{:.8f}".format(ans))


### FIXED CODE ###

n = int(input())
ans = 0.0
for _ in range(n):
    x, u = input().split()
    if u == 'JPY':
        ans += int(x)
    else:
        ans += float(x) * 380000.0

print("{:.11f}".format(ans))
import math
a,b= list(map(int, input().split()))
ma=math.gcd(a,b)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
ans=1
for i in make_divisors(ma):
    if is_prime(i):
        ans+=1
print(ans)

### FIXED CODE ###

import math
import fractions
import sys
sys.setrecursionlimit(2000000000)
a,b= list(map(int, input().split()))
ma=fractions.gcd(a,b)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
ans=1
for i in make_divisors(ma):
    if is_prime(i):
        ans+=1
print(ans)
N = int(input())
mydict = {}
for i in range(N):
  t = input()
  if t in mydict:
    mydict[t]+=1
  else:
    mydict[t] = 1
max_k_list = [kv[0] for kv in mydict.items() if kv[1] == max(mydict.values())]
max_k_list.sort()
for i in max_k_list:
  print(i)

### FIXED CODE ###

line = input().split(' ')
k = set(line)
if len(k) == 2:
  print("Yes")
else:
  print("No")
h,w=map(int,input().split())

if h != 1 and w != 1:
    if h*w % 2 == 1:
        print(str(int(h*w/2) + 1))
    else:
        print(str(int(h*w/2)))
elif:
    print(str(1))


### FIXED CODE ###

h,w=map(int,input().split())

if h != 1 and w != 1:
    if h*w % 2 == 1:
        print(str(int(h*w/2) + 1))
    else:
        print(str(int(h*w/2)))
else:
    print(str(1))