Harryxun/stf_run huggingface dataset:
import statistics
import math

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

B = []
C = []
D = []
E = []
ureshimi = []
k = 0
l = 0

for i in range(N-3):
    BC = A[0 : i + 2]
    s = 0
    for j in range(k, i + 2):
        s += BC[j]
        if s + BC[j + 1] > sum(BC) / 2:
            k = j
            if BC[j + 1] / 2 >= sum(BC) / 2 - s:
                B = BC[0 : j + 1]
                C = BC[j + 1 : i + 2]
            else:
                B = BC[0 : j + 2]
                C = BC[j + 2 : i + 2]
            break
    DE = A[i + 2 : N + 1]
    s = sum(DE[0:l - i + 1])
    for j in range(l - i + 1, N - i - 3):
        s += DE[j]
        if j == N - i - 4:
            l = j + i
            D = DE[0 : j + 1]
            E = DE[j + 1 : N - i]
            break
        elif s + DE[j + 1] > sum(DE) / 2:
            l = j + i
            if DE[j + 1] / 2 >= sum(DE) / 2 - s:
                D = DE[0 : j + 1]
                E = DE[j + 1 : N - i]
            else:
                D = DE[0 : j + 2]
                E = DE[j + 2 : N - i]
            break
    ureshimi.append(max(sum(B), sum(C), sum(D), sum(E)) - min(sum(B), sum(C), sum(D), sum(E)))



print(min(ureshimi))

### FIXED CODE ###

import statistics
import math

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


ureshimi = []
k = 0
l = 2

B = 0
C = 0
D = 0
E = 0

sumBC = sum(A[0:2])
sumDE = sum(A) - sumBC

for i in range(2, N - 1):
    for j in range(k, i):
        if j == i - 1:
            k = j
            C = sumBC - B
            break
        elif B + A[j] >= sumBC / 2:
            if sumBC / 2 - B  > A[j] / 2:
                B += A[j]
                k = j + 1
                C = sumBC - B
                break
            else:
                k = j
                C = sumBC - B
                break
        B += A[j]
    for j in range(l, N):
        if j == N - 1:
            l = j
            E = sumDE - D
            break
        elif D + A[j] >= sumDE / 2:
            if sumDE / 2 - D > A[j] / 2:
                D += A[j]
                l = j + 1
                E = sumDE - D
                break
            else:
                l = j
                E = sumDE - D
                break
        D += A[j]
    ureshimi.append(max([B, C, D, E]) - min([B, C, D, E]))
    sumBC += A[i]
    sumDE -= A[i]
    D -= A[i]
        

print(min(ureshimi))
N = int(input())

flag = True
t0 = x0 = y0 = 0
for i in range(N):
    t1, x1, y1 = map(int, input().split())
    t = t1 - t0
    x = x1 - x0
    y = y1 - y0
    if t % (abs(x) + abs(y)) != 0: flag = False
    t0 = t1
    x0 = x1
    y0 = y1

if flag: print('Yes')
else: print('No')

### FIXED CODE ###

N = int(input())

flag = True
t0 = x0 = y0 = 0
for i in range(N):
    t1, x1, y1 = map(int, input().split())
    t = t1 - t0
    x = x1 - x0
    y = y1 - y0
    if (abs(x) + abs(y)) == 0:
        if t % 2 == 0: pass
    elif t % (abs(x) + abs(y)) != 0:
        flag = False
    t0 = t1
    x0 = x1
    y0 = y1

if flag: print('Yes')
else: print('No')
from collections import Counter
N = int(input())
l = []
pql = []
for i in range(N):
        x, y = map(int, input().split())
        l.append((x,y))
l.sort()
for i in range(N-1):
        p = l[i+1][0] - l[i][0]
        q = l[i+1][1] - l[i][1]
        pql.append((p,q))
pq = Counter(pql)
cntl = pq.most_common(1)
cnt = cntl[0][1]
print(N - cnt)

### FIXED CODE ###

from collections import Counter
N = int(input())
l = []
pql = []
for i in range(N):
        x, y = map(int, input().split())
        l.append((x,y))
l.sort()
for i in range(N-1):
        for j in range(1, N-i):
                p = int(l[i+j][0] - l[i][0])
                q = int(l[i+j][1] - l[i][1])
                pql.append((p,q))
pq = Counter(pql)
cntl = pq.most_common(1)
if N == 1:
        print(1)
else:
        cnt = cntl[0][1]
        print(N - cnt)
from heapq import heapify, heappop

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

slice_L = [v[:i] for i in range(N + 1)]
sum_L = [0]
for vv in v:
    sum_L.append(sum_L[-1] + vv)

slice_R = [v[N - 1 - i:] for i in range(-1, N)]
sum_R = [0]
for vv in v[::-1]:
    sum_R.append(sum_R[-1] + vv)

ans = 0
for put, pick in enumerate(range(K, 0, -1), 0):
    if pick < put: break
    for left in range(pick + 1):
        m_put = put
        right = pick - left
        t = sum_L[left] + sum_R[right]
        q = slice_L[left] + slice_R[right]
        heapify(q)
        while m_put > 0 and q:
            t -= heappop(q)
            m_put -= 1
        if m_put > 0:
            continue
        ans = max(ans, t)
print(ans)


### FIXED CODE ###

from heapq import heapify, heappop

N, K = map(int, input().split())
vl = list(map(int, input().split()))
vr = list(reversed(vl))
sum_L = [0]
for vv in vl:
    sum_L.append(sum_L[-1] + vv)

sum_R = [0]
for vv in vr:
    sum_R.append(sum_R[-1] + vv)

ans = 0
for pick in range(min(K, N) + 1):
    for to_remove in range(K + 1):
        if pick + to_remove > K: break
        for left in range(pick + 1):
            right = pick - left

            t = sum_L[left] + sum_R[right]

            q = vl[:left] + vr[:right]
            heapify(q)

            cnt = 0
            while cnt < to_remove and q:
                t -= heappop(q)
                cnt += 1
            ans = max(ans, t)
print(ans)
*a=map(int,input().split())
print(max(a)-min(a))

### FIXED CODE ###

*a,=map(int,input().split())
print(max(a)-min(a))
K, S = map(int, input().split())

count = 0
for i in range(K+1):
  for j in range(K+1):
    if S - i - j <= K :
        count += 1
      else:
        pass
      
print(count)


### FIXED CODE ###

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

count = 0
for i in range(K+1):
  for j in range(K+1):
    if 0<= S - i - j <= K:
        count += 1
      
print(count)
from sys import stdin
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]


n = int(input())
row = False
cnt = 0
for _ in range(n):
    x,y = ip()
    if x == y: cnt += 1
    else:
        cnt += 1
    if cnt == 3:
    row = True

if row: print("Yes")
else: print("No")

### FIXED CODE ###

from sys import stdin
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]


n = int(input())
row = False
cnt = 0
for _ in range(n):
    x,y = ip()
    if x == y: cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        row = True

if row: print("Yes")
else: print("No")
a, b = map(int, input().split())
int c,d
c = a * b
d = c % 2
if d = 0:
    print('Even')
else:
    print('Odd')

### FIXED CODE ###

a, b = map(int, input().split())
c = a * b
d = c % 2
if d == 0:
    print('Even')
else:
    print('Odd')
a, b = map(int, input())
if a > b:
    print("a > b")
elif a == b:
    print("a == b")
else:
    print("a < b")

### FIXED CODE ###

a, b = map(int, input().split())
if a > b:
    print("a > b")
elif a == b:
    print("a == b")
else:
    print("a < b")
import functools import reduce
import math

N,X=map(int,input().split())
inputcities=list(map(int, input().split()))
cities=[inputcities[i]-X for i in range(N)]
D = functools.reduce(math.gcd, cities)
print(D)

### FIXED CODE ###

def gcd(a,b):
    if a < b:
        a,b = b,a
    if a % b == 0:
        return b
    else:
        return gcd(b,(a % b))
 
N,X=map(int,input().split())
inputcities=list(map(int, input().split()))
cities=[abs(inputcities[i]-X) for i in range(N)]
cities.sort()
D=cities[0]
for i in range(N):
  D=gcd(D,cities[i])
print(D)
N, M = map(int, input().split())

P = {}

for i in range(1, N + 1):
    P[i] = []

for _ in range(M):
    a, b = map(int, input().split())
    P[b].append(a)
    P[a].append(b)

ans = [0] * (N + 1)
checker = [0] * (N + 1)
checker[1] = 1

def search(number, level):
    level += 1
    for x in P[number]:
        if checker[x] == 0:
            checker[x] = level
            ans[x] = number
            search(x, level)
        elif checker[x] > level:
            checker[x] = level
            ans[x] = number
            search(x, level)


search(1, 0)

print('Yes')
for i in range(2, N + 1):
    print(ans[i])

### FIXED CODE ###

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

A = []
B = []

for _ in range(M):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

P = [[] for _ in range(N + 1)]

for a, b in zip(A, B):
    P[b].append(a)
    P[a].append(b)

ans = [0] * (N + 1)
ans[1] = 1
next_numbers = [1]

while next_numbers:
    check_number = next_numbers[:]
    next_numbers = []
    for number in check_number:
        for x in P[number]:
            if ans[x] == 0:
                ans[x] = number
                next_numbers.append(x)

print('Yes')
for i in range(2, N + 1):
    print(ans[i])
import collections
H,W = map(int,input().split())
Map = []
black_cnt = 0
for i in range(H):
    tmp = list(input())
    black_cnt += tmp.count('#')
    Map.append(tmp)

Counter = [[float('inf') for j in range(W)]for i in range(H)]
Visited = [[False for j in range(W)]for i in range(H)]
q = collections.deque()
q.append((0,0,0))
while q:
    y,x,cnt = q.popleft()
    if 0>y or H<=y or 0>x or W<=x:
        continue
    if Map[y][x] == '#':
        continue
    if cnt > Counter[y][x]:
        continue
    if Visited[y][x]:
        continue
    Visited[y][x]=True
    Map[y][x] = cnt
    cnt += 1
    q.append((y+1,x,cnt))
    q.append((y-1,x,cnt))
    q.append((y,x+1,cnt))
    q.append((y,x-1,cnt))
print(H*W-Map[H-1][W-1]-black_cnt-1)

### FIXED CODE ###

import collections
H,W = map(int,input().split())
Map = []
black_cnt = 0
for i in range(H):
    tmp = list(input())
    black_cnt += tmp.count('#')
    Map.append(tmp)

Counter = [[float('inf') for j in range(W)]for i in range(H)]
Visited = [[False for j in range(W)]for i in range(H)]
q = collections.deque()
q.append((0,0,0))
while q:
    y,x,cnt = q.popleft()
    if 0>y or H<=y or 0>x or W<=x:
        continue
    if Map[y][x] == '#':
        continue
    if cnt > Counter[y][x]:
        continue
    if Visited[y][x]:
        continue
    Visited[y][x]=True
    Map[y][x] = cnt
    cnt += 1
    q.append((y+1,x,cnt))
    q.append((y-1,x,cnt))
    q.append((y,x+1,cnt))
    q.append((y,x-1,cnt))
if Visited[H-1][W-1] == False:
    print('-1')
else:
    print(H*W-Map[H-1][W-1]-black_cnt-1)
n=int(input())
a=map(int,input().split())
for i in a:
    if i%2==0:
        if i%3!=0 or i%5!=0:
            result='DENIDE'
        else:
            result='APROVED'
print(result)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
result='APPROVED'
for i in a:
    if i%2==0:
        if i%3!=0 and i%5!=0:
            result='DENIED'
print(result)
K = input()
S = input()
count = len(S)
if (count <= K):
  print(S)
else:
  print('{:.Kg}.format(S)'+"...")


### FIXED CODE ###

k = int(input())
s = str(input())
if len(s) <= k:
    print(s)
else:
    print((s[:k]) + "...")
input_int_list = list(map(int, input().split()))


N = input_int_list[0]
M = input_int_list[1]

Q_ans_list = [0] * N

ans_correct = 0
ans_penalty = 0

for i in range(M):
	input_list_i = list( input().split())
	Q_num = int(input_list_i[0])
	if input_list_i[1] == "WA":
		if Q_ans_list[Q_num] != -1:
			Q_ans_list[Q_num] = Q_ans_list[Q_num] + 1
	elif input_list_i[1] == "AC":
		if Q_ans_list[Q_num] != -1:
			ans_correct = ans_correct + 1
			ans_penalty = ans_penalty + Q_ans_list[Q_num]
			Q_ans_list[Q_num] = -1





print(ans_correct,ans_penalty)



### FIXED CODE ###

input_int_list = list(map(int, input().split()))


N = input_int_list[0]
M = input_int_list[1]

Q_ans_list = [0] * (N+1)

ans_correct = 0
ans_penalty = 0

for i in range(M):
	input_list_i = list( input().split())
	Q_num = int(input_list_i[0])
	if input_list_i[1] == "WA":
		if Q_ans_list[Q_num] != -1:
			Q_ans_list[Q_num] = Q_ans_list[Q_num] + 1
	elif input_list_i[1] == "AC":
		if Q_ans_list[Q_num] != -1:
			ans_correct = ans_correct + 1
			ans_penalty = ans_penalty + Q_ans_list[Q_num]
			Q_ans_list[Q_num] = -1





print(ans_correct,ans_penalty)
n,p=map(int,input().split())
a=list(map(int,input().split()))
print(2**(N-1))

### FIXED CODE ###

n,p=map(int,input().split())
a=list(map(lambda x: x%2, map(int,input().split())))
e=a.count(0)

ans=2**(n-1)
if p==1 and e==n:
    ans=0
if p==0 and e==n:
    ans=2**n
print(ans)
if r-l>=3000: print(0)
else:
    min_mod=2018
    for i in range(l,r):
        for j in range(i+1,r+1):
            min_mod = min(min_mod, (i*j)%2019)
    print(min_mod)

### FIXED CODE ###

l,r=map(int,input().split())
mod=2019
if r-l>=2019: print(0)
else:
    res=2018 #2019の剰余なので最大でも2018
    for i in range(l,r):
        for j in range(i+1,r+1):
            res = min(res, (i*j)%mod)
    print(res)
a, b, c, x = map(int,[input() for i in range(4)])
count = 0
for i in range(a+1):
    for j in range(b+1):
        for n in range(c+1):
            if t = i*500 + j*100 + n*50 == x:
                count += 1
print(count)

### FIXED CODE ###

a, b, c, x = map(int, [input() for i in range(4)])
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*500 + j*100 + k*50 == x:
                count+=1
print(count)
def gcd(a,b):
    if b>a:
        a,b=b,a
    while b:
        a,b=b, a%b
    return a


def cul(n,a):
    l=len(a)
    b=[a[i] for i in range(l)]
    b.pop(n)
    tmp=b[0]
    for i in range(1,l-1):
        tmp=gcd(tmp,b[i])
    return tmp

import sys
import math
p=10
N=int(input())
a=list(map(int,input().split()))
if N<=p:
    ans=0
    
    for i in range(N):
        tmp=cul(i,a)        
        if tmp>ans: ans=tmp
    print(ans)
    sys.exit()
        
M=a[0]
for i in range(1,p):
    M=gcd(tmp,a[i])

ans=0
for i in range( math.ceil((M+1)**0.5) ):
    if M%i==0:
        
        for j in range(p,N):
            if a[i]%i!=0: break
            elif i==N-1 and i>ans: ans=i
        x=M//i
        for j in range(p,N):
            if a[i]%x!=0: break
            elif i==N-1 and x>ans: ans=i

r=a[N-1]
for i in range(N-1,p-1,-1):
    r=gcd(r,a[i])
if r>ans:
    for i in range(p):
        s=gcd(cul(i,a[:p]),r)
        if s>ans: ans=s

print(ans)


### FIXED CODE ###

def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return a

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

l=[0]*N
l[0]=a[0]

for i in range(1,N):
    l[i]=egcd(l[i-1],a[i])

r=[0]*N
r[N-1]=a[N-1]
for i in range(N-2,-1,-1):
    r[i]=egcd(r[i+1],a[i])

ans=0
for i in range(N):
    if i==0: tmp=r[1]
    elif i==N-1: tmp=l[N-2]
    else: tmp=egcd(l[i-1],r[i+1])
    ans=max(tmp,ans)

print(ans)
num = int(input())
if num == 1:
  print(1)
 else:
  print(0)


### FIXED CODE ###

num = int(input())
if num == 1:
  print(0)
else:
  print(1)
a = input()
b = input()
t = int(a.split(" ")[0])
lst = [int(x) for x in b.split(" ")]
x = len(lst)
if not x:
  print(t)
for i in range(x):
  if t - x not in lst:
    print(t - x)
    break
  if t + x not in lst:
    print(t + x)
    break


### FIXED CODE ###

a = input()

t, c = int(a.split(" ")[0]), int(a.split(" ")[1])

if not c:
    print(t)
else:
    b = input()
    lst = [int(x) for x in b.split(" ")]

    for i in range(c+2):
        if t - i not in lst:
            print(t - i)
            break
        if t + i not in lst:
            print(t + i)
            break
for i in range(1,10):
	for j in range(1,100):
		print(str(i)+"x"+str(j)+"="str(i*j))

### FIXED CODE ###

for i in range(1,10):
	for j in range(1,10):
		print(str(i)+"x"+str(j)+"="+str(i*j))
import sys

H, W = map(int, input().split())
s = []
nb = 0
for _ in range(H):
    s.append(list(input()))
    nb += s[-1].count("#")

nw = H * W - nb

sy, sx = 0, 0
gy, gx = H - 1, W - 1

# たどりつけない場合
if s[gy - 1][gx] == "#" and s[gy][gx - 1] == "#":
    print(-1)
    sys.exit()

q = [[sy, sx]]
visited = [[int(1e10)]*W for _ in range(H)]
visited[sy][sx] = 0
while q:
    ty, tx = q.pop(0)
    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        ny, nx = ty + dy, tx + dx
        if 0 <= ny < H and 0 <= nx < W and s[ny][nx] != "#":
            if visited[ny][nx] > visited[ty][tx] + 1:
                visited[ny][nx] = visited[ty][tx] + 1
                q.append([ny, nx])
    if [gy, gx] in q:
        temp = visited[gy][gx]
        break

print(nw - temp - 1)

### FIXED CODE ###

H, W = map(int, input().split())
s = []
nb = 0
for _ in range(H):
    s.append(list(input()))
    nb += s[-1].count("#")

nw = H * W - nb

sy, sx = 0, 0
gy, gx = H - 1, W - 1

q = [[sy, sx]]
visited = [[int(1e10)]*W for _ in range(H)]
visited[sy][sx] = 0
while q:
    ty, tx = q.pop(0)
    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        ny, nx = ty + dy, tx + dx
        if 0 <= ny < H and 0 <= nx < W and s[ny][nx] != "#":
            if visited[ny][nx] > visited[ty][tx] + 1:
                visited[ny][nx] = visited[ty][tx] + 1
                q.append([ny, nx])
    if [gy, gx] in q:
        temp = visited[gy][gx]
        break
if visited[gy][gx] == int(1e10):
    print(-1)
else: print(nw - temp - 1)
s = input()

num = 0
for i in range(len(s)):
  if s[i] == o:
    num +=100



print(700 + num)

### FIXED CODE ###

print( 700 + 100*input().count("o"))
if __name__ == '__main__':
    h, w = map(int, input().split())
    n = int(input())
    a = list(map(int, input().split()))

    c = [0] * (h*w)
    
    focus = 0
    for i in range(n):
        for j in range(a[i]):
            c[focus] = i+1
            focus += 1

    for i in range(h):
        for j in range(w):
            if(i%2 == 0):
                if(j + 1 != w):
                    print(c[i*w+j],end=" ")
                else:
                    print(c[i*w+j])
            else:
                if(j + 1 != w):
                    print(c[(i+1)*w-1-j],end=" ")
                else:
                    print(c[(i+1)*w-1-j])


### FIXED CODE ###

if __name__ == '__main__':
    n, m = map(int, input().split())
    print((n-1)*(m-1))
n, m = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
a.sort()
bc = []
for _ in range(m):
    bc.append([int(i) for i in input().split()])
bc = sorted(bc, key=lambda x: x[1], reverse=True)
idx = 0
for i in range(m):
    for j in range(idx, idx + bc[i][0]):
        if a[j] < bc[i][1]:
            a[j] = bc[i][1]
    idx += bc[i][0]
print(sum(a))


### FIXED CODE ###

n, m = map(int, input().split())
a = [int(i) for i in input().split()]
bc = []
for _ in range(m): bc.append([int(i) for i in input().split()])
a.sort()
bc.sort(key=lambda x:x[1])
bc = bc[::-1]
idx = 0
for b, c in bc:
    for bi in range(b):
        if idx + bi == n or a[idx+bi] >= c:
            idx = "e"
            break
        else: a[idx+bi] = c
    if idx == "e": break
    else: idx += b
print(sum(a))
a, b, x = map(int, input().split())
print(np.arctan(a*b*b/2/x)*180/np.pi)

### FIXED CODE ###

a, b, x = map(int, input().split())
import numpy as np
if b*a*a/2>x:
  print(np.arctan(a*b*b/2/x)*180/np.pi)
else:
  y=2*x/(a*a) - b
  z = b-y
  print(np.arctan(z/a)*180/np.pi)
N, K = map(int, input().split())
x = [int(i) for i in input().split()]

time = 10 ** 20
# 0以上の最小の整数
base = 0
index = 0

for i in range(N):
    if x[i] >= 0:
        base = x[i]
        index = i
        break

for i in range(base - K, base + 1):
    if x[i+K-1] < 0:
        time = min(abs(x[i]) * 2, time)
    elif x[i] < 0 and  x[i+K-1] >= 0:
        time = min(min(abs(x[i]), x[i+K-1]) * 2 + max(abs(x[i]), x[i+K-1]), time)
    else:
        time = min(x[i+K-1] * 2, time)

print(time)

### FIXED CODE ###

# 無駄なところも数えて良いっていう考え方もある。
# 常に最適化しないといけないわけではない

N, K = map(int, input().split())
x = [int(i) for i in input().split()]

time = 10 ** 20

for i in range(N - K + 1):
    x_min = x[i]
    x_max = x[i + K - 1]
    if x_min >= 0:
        this_time = x_max
    elif x_max <= 0:
        this_time = abs(x_min)
    else:
        this_time = x_max - x_min + min(x_max, abs(x_min))

    if time > this_time:
        time = this_time

print(time)
def main():
    S = input()
    if S[0] != 'k':
        return ('NO')
    elif S = 'keyence':
        return ('YES')

    ans = 'keyence'
    i = 0
    j = 0
    while True:
        i += 1
        j += 1
        if S[i] != ans[j]:
            break

    #残りの文字数
    num = 7-j
    cnt = 0
    while cnt < num:
        cnt += 1
        #print(ans[-cnt])
        if S[-cnt] != ans[-cnt]:
            return ('NO')
    return ('YES')
print(main())


### FIXED CODE ###

def main():
    S = input()
    if S[0] != 'k':
        return ('NO')
    elif S == 'keyence':
        return ('YES')

    ans = 'keyence'
    i = 0
    j = 0
    while True:
        i += 1
        j += 1
        if S[i] != ans[j]:
            break

    #残りの文字数
    num = 7-j
    cnt = 0
    while cnt < num:
        cnt += 1
        #print(ans[-cnt])
        if S[-cnt] != ans[-cnt]:
            return ('NO')
    return ('YES')
print(main())
n,k =  map(int,input().split())
A = list(map(int,input().split()))

l = min(A)//(k+1) 
r = max(A)
m = (l+r)//2+1

while 1:
    
    m = (l+r)//2
    
    #m以下の長さにできるか判定
    
    # A_long = A[A>m]
    n= sum( [A[i]//m - A[i]%m==0 for i in range(len(A)) ] )
    
    # print(l,m,r,n)
    
    if n<=k:
        if r==m:
            break
        r=m-1
    else:
        if l==m:
            m=m+1
            break
        l=m+1
        

        
print(m)
    

### FIXED CODE ###

n,k =  map(int,input().split())
A = list(map(int,input().split()))

l = min(A)//(k+1) 
r = max(A)
m = (l+r)//2+1

while 1:
    
    m = (l+r)//2
    if m==0:
        m=1
        break

    
    #m以下の長さにできるか判定
    
    # A_long = A[A>m]
    n= sum( [  int((A[i]-0.1)//(m)) for i in range(len(A)) ] )
    
    # print(l,m,r,n)
    
    if n<=k:
        if r==m:
            break
        r=m-1
    else:
        if l==m:
            m+=1
            break
        l=m+1
        

        
print(m)
from sys import stdin
N = int(stdin.readline().rstrip())
K = int(stdin.readline().rstrip())
X = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 0
for i in x:
    if i < K - i:
        ans += 2 * i
    else:
        ans += 2 * (K - i)
print(ans)

### FIXED CODE ###

from sys import stdin
n = int(stdin.readline().rstrip())
a = int(stdin.readline().rstrip())
print(n*n-a)
# a から bで　cでもdでも割り切れないものの数を調べる
import math

Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)

c_min = int(a/c) if a % c == 0 else int(a/c) + 1
c_max = int(b/c)
delta_c = c_max - c_min + 1

d_min = int(a/d) if a % c == 0 else int(a/d) + 1
d_max = int(b/d)
delta_d = d_max - d_min + 1

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

cd = lcm(c, d)
cd_min = int(a/cd) if a % c == 0 else int(a/cd) + 1
cd_max = int(b/cd)
delta_cd = cd_max -cd_min + 1

# cとdで割り切れる数
num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')

### FIXED CODE ###

from fractions import gcd
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
delta_c = b//c - (a-1)//c
delta_d = b//d - (a-1)//d
def lcm(x, y):
    return (x * y) // gcd(x, y)
cd = lcm(c, d)
delta_cd = b//cd - (a-1)//cd
num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')
x1, x2, x3, x4, x5 = int(input().split( ))
x = []
x.append(x1)
x.append(x2)
x.append(x3)
x.append(x4)
x.append(x5)
ans = 0
for i, j in enumerate(x):
  if i+1 != j:
  	ans = j
print(type(0 2 3 4 5),j)

### FIXED CODE ###

x1, x2, x3, x4, x5 = input().split()
x = list()
x.append(x1)
x.append(x2)
x.append(x3)
x.append(x4)
x.append(x5)
ans = 0
for i, j in enumerate(x):
  if int(j) == 0:
  	ans = i+1
print(int(ans))