Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = list(map(int, input().split()))

P = 10 ** 9 + 7


def conb(n, r):
    resp = n
    for i in range(1, r):
        resp = (resp * (n - i) * pow(i + 1, P - 2))%P
    return resp


def pow(x, n):
    ans = 1
    while (n > 0):
        if (bin(n & 1) == bin(1)):
            ans = (ans * x)%P
        x = (x * x) % P
        n = n >> 1  # ビットシフト
    return ans



print((pow(2, n) - conb(n, a) - conb(n, b)-1)%P)


Fixed submission:
n, a, b = list(map(int, input().split()))

P = 10 ** 9 + 7


def conb(n, r):
    P = 10 ** 9 + 7
    x = 1
    y = 1
    for i in range(n - r + 1, n + 1):
        x = (x * i % P)
    for i in range(1, r + 1):
        y = (y * i % P)
    y_inv = pow(y, P - 2)
    return x * y_inv


def pow(x, n):
    ans = 1
    while (n > 0):
        if (bin(n & 1) == bin(1)):
            ans = (ans * x) % P
        x = (x * x) % P
        n = n >> 1  # ビットシフト
    return ans


print((pow(2, n) - conb(n, a) - conb(n, b) - 1) % P)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
num_list = [0] * 100
P = 10 ** 9 + 7
for i in A:
    tmp = i
    for j in range(len(bin(i)) - 2):
        num_list[j] += (tmp & 1)
        tmp = tmp >> 1
ans = 0


def func(N, n):
    return (N - n) * n


for i in range(100):
    ans = (ans + func(N, num_list[i]) * 2 ** i) % P
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
num_list = [0] * 100
P = 10 ** 9 + 7
for i in A:
    tmp = i
    for j in range(len(bin(i)) - 2):
        num_list[j] += (tmp & 1)
        tmp = tmp >> 1
ans = 0


def func(N, n):
    return (N - n) * n


for i in range(100):
    ans = (ans + func(N, num_list[i]) * 2 ** i) % P
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
num_list = [0] * 100
P = 10 ** 9 + 7
for i in A:
    for j in range(len(bin(i)) - 2):
        num_list[j] += (i >> j) & 1
ans = 0


def func(N, n):
    return (N - n) * n


for i in range(100):
    ans = (ans + func(N, num_list[i]) * 2 ** i) % P
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
num_list = [0] * 100
P = 10 ** 9 + 7
for i in A:
    tmp = i
    for j in range(len(bin(i)) - 2):
        num_list[j] += (tmp & 1)
        tmp = tmp >> 1
ans = 0


def func(N, n):
    return (N - n) * n


for i in range(100):
    ans = (ans + func(N, num_list[i]) * 2 ** i) % P
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
div_list = [] * N
ans_list = np.zeros(N).astype(int)
N_2 = N // 2
for i in range(N):
    tmp = N - i - 1
    # print(tmp)
    if i < N_2:
        ans_list[tmp] = A[tmp]
    else:
        ans_list[tmp] = (np.sum(ans_list[tmp::i]) + A[tmp]) % 2

print(np.sum(ans_list))
for i in range(N):
    if ans_list[i] == 1:
        print(ans_list[i], end="")

Fixed submission:
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
ans_list = np.zeros(N).astype(int)
N_2 = N // 2
ans = 0
for i in range(N):
    tmp = N - i - 1
    # print(tmp)
    if i < N_2:
        ans_list[tmp] = A[tmp]
        if A[tmp] == 1:
            ans += 1
    else:
        add = (np.sum(ans_list[tmp::(tmp + 1)]) + A[tmp]) % 2
        ans_list[tmp] = add
        if add == 1:
            ans += 1

print(ans)
for i in range(N):
    if ans_list[i] == 1:
        if i == N - 1:
            print(i + 1, end="")
        else:
            print(i + 1, end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
s, r = divmod(M, N)
ans = 1
for i in range(1, s+1):
    if M%i == 0:
        ans = i

print(ans)



Fixed submission:
N, M = list(map(int, input().split()))
s, r = divmod(M, N)
ans = 1
for i in range(s, 0, -1):
    if M % i == 0:
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
s, r = divmod(M, N)
ans = 1
for i in range(1, s+1):
    if M%i == 0:
        ans = i

print(ans)



Fixed submission:
N, M = list(map(int, input().split()))
s, r = divmod(M, N)
ans = 1
for i in range(s, 0, -1):
    if M % i == 0:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
# スペース区切りの整数の入力
b, c = map(int, input().split())
# 文字列の入力
s = input()
# 出力
# print("{} {}".format(a+b+c, s))
print(f'{a+b+c} {s}')

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
# a = int(input())
# スペース区切りの整数の入力
# b, c = map(int, input().split())
# 文字列の入力
# s = input()
# 出力
# print("{} {}".format(a+b+c, s))
# print(f'{a+b+c} {s}')
a,b,c = map(int, input().split())
a,b = b,a
a,c = c,a
print("{} {} {}".format(a,b,c))
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
from random import randint
from time import time
input = lambda: stdin.readline().rstrip()
start = time()
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.reverse()
ok = 0
t = time() - start
while t < 1.9:
    cnt = 0
    for i in range(n):
        if a[i] == b[i]:
            rng = randint(0, n - 1)
            b[i], b[rng] = b[rng], b[i]
            cnt += 1
    if cnt == 0:
        ok = 1
        break
    t = time() - start
if ok == 1:
    print("Yes")
    print(*b)
else:
    print("No")


Fixed submission:
from sys import stdin
from random import randint
from time import time
input = lambda: stdin.readline().rstrip()
start = time()
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.reverse()
ok = 0
t = time() - start
while t < 1.8:
    cnt = 0
    for i in range(n):
        if a[i] == b[i]:
            rng = randint(0, n - 1)
            b[i], b[rng] = b[rng], b[i]
            cnt += 1
    if cnt == 0:
        ok = 1
        break
    t = time() - start
if ok == 1:
    print("Yes")
    print(*b)
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
from random import randint
from time import time
input = lambda: stdin.readline().rstrip()
start = time()
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.reverse()
ok = 0
t = time() - start
while t < 1.9:
    cnt = 0
    for i in range(n):
        if a[i] == b[i]:
            rng = randint(0, n - 1)
            b[i], b[rng] = b[rng], b[i]
            cnt += 1
    if cnt == 0:
        ok = 1
        break
    t = time() - start
if ok == 1:
    print("Yes")
    print(*b)
else:
    print("Yes")


Fixed submission:
from sys import stdin
from random import randint
from time import time
input = lambda: stdin.readline().rstrip()
start = time()
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.reverse()
ok = 0
t = time() - start
while t < 1.8:
    cnt = 0
    for i in range(n):
        if a[i] == b[i]:
            rng = randint(0, n - 1)
            b[i], b[rng] = b[rng], b[i]
            cnt += 1
    if cnt == 0:
        ok = 1
        break
    t = time() - start
if ok == 1:
    print("Yes")
    print(*b)
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from numpy import array
input = lambda: stdin.readline().rstrip()
na, nb, m = map(int, input().split())
a = array(list(map(int, input().split())))
b = array(list(map(int, input().split())))
ans = min(a) + min(b)
for i in range(m):
    x, y, c = map(int, input().split())
    x -= 1
    y -= 1
    ans = min(ans, a[x] + b[y] - c)
print(ans)

Fixed submission:
from sys import stdin
input = lambda: stdin.readline().rstrip()
na, nb, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
min_a = min_b = 10**9
for i in range(na):
    min_a = min(min_a, a[i])
for i in range(nb):
    min_b = min(min_b, b[i])
ans = min_a + min_b
for i in range(m):
    x, y, c = map(int, input().split())
    x -= 1
    y -= 1
    ans = min(ans, a[x] + b[y] - c)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, R = input().split()
if N>=10 :
  x = R
else:
  x = R - 100*(10-N)
print(x)


Fixed submission:
N, R = input().split()
N = int(N)
R = int(R)
if N>=10 :
  x = R
else:
  x = R + 100*(10-N)
print(x)
Buggy python submission (verdict: Runtime Error):
def Base_n_to_10(X,n):
    out = 0
    for i in range(1,len(str(X))+1):
        out += int(X[-i])*(n**(i-1))
    return out#int out

N, K = input().split()
N = int(N)
K = int(K)
x = str(len(Base_n_to_10(N,K)))
print(x)

Fixed submission:
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
x2 = 0
x10, n = input().split()
x10 = int(x10)
n = int(n)
x2 = Base_10_to_n(x10, n)
print(len(x2))
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = input()
x = input().split()
n = int(n)
x = list(map(int,x))
x = np.array(x)
maxed = np.max(x)
cand = []

for p in range(1,maxed):
    xp = (x - p) ** 2
    cand.append(np.sum(xp))
y = np.min(cand)
print(y)

Fixed submission:
import numpy as np
n = input()
x = input().split()
n = int(n)
x = list(map(int,x))
x = np.array(x)
maxed = np.max(x)
cand = []

for p in range(1,maxed+1):
    xp = (x - p) ** 2
    cand.append(np.sum(xp))
y = np.min(cand)
print(y)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
x = 1
if n==1:
	print(x)
else:
	if h[1] >= h[0]:
		x += 1
	
	for i in range(2, n):
		hh=h[0:i-1]
    	if h[i] >= max(hh):
        	x += 1
	print(x)

Fixed submission:
n = int(input())
h = [int(i) for i in input().split()]
x = 1
if n == 1:
    print(x)
else:
    if h[1] >= h[0]:
        x += 1

    for i in range(2, n):
            hh = h[0:i]
            if h[i] >= max(hh):
                x += 1
    print(x)

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
x = 1

if h[1] >= h[0]:
	x += 1

for i in range(2, n):
    hh=h[0:i-1]
    if h[i] >= max(hh):
        x += 1
print(x)

Fixed submission:
n = int(input())
h = [int(i) for i in input().split()]
x = 1
if n == 1:
    print(x)
else:
    if h[1] >= h[0]:
        x += 1

    for i in range(2, n):
            hh = h[0:i]
            if h[i] >= max(hh):
                x += 1
    print(x)
Buggy python submission (verdict: Runtime Error):
k=input()
print(k*"ACL")

Fixed submission:
k=int(input())
print(k*"ACL")
Buggy python submission (verdict: Runtime Error):
n = int(input())

x = n*(n-1)*2*(10**(n-2))

print(x%(10**9 + 7))


Fixed submission:
a, b, c, d = map(int, input().split())

n = [a*c, a*d, b*c, b*d]
print(max(n))
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = n*(n-1)*2(10**(n-2))

print(x%(10**9 + 7))

Fixed submission:
n = int(input())

x = 10**n - 2*(9**n) + 8**n
print(x%(10**9+7))
Buggy python submission (verdict: Runtime Error):
n = int(input())
u = [list(map(int, input().split())) for i in range(n)]
z = [u[i][0] + u[i][1] for i in range(n)]
w = [w[i][0] - w[i][1] for i in range(n)]
d = [max(z)-min(z), max(w)-min(w)]

print(max(d))
	


Fixed submission:
n = int(input())
u = [list(map(int, input().split())) for i in range(n)]
z = [u[i][0] + u[i][1] for i in range(n)]
w = [u[i][0] - u[i][1] for i in range(n)]
d = [max(z)-min(z), max(w)-min(w)]

print(max(d))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
z = [list(map(int, input().split())) for i in range(n)]
d = [max(z[i][0] - z[j][0], z[j][0] - z[i][0]) + max(z[i][1] - z[j][1], z[j][1] - z[i][1]) for i in range(n-1) for j in range(i+1, n)]
print(max(d))
	


Fixed submission:
n = int(input())
u = [list(map(int, input().split())) for i in range(n)]
z = [u[i][0] + u[i][1] for i in range(n)]
w = [u[i][0] - u[i][1] for i in range(n)]
d = [max(z)-min(z), max(w)-min(w)]

print(max(d))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
z = [list(map(int, input().split())) for i in range(n)]
m = 0
d = 0
for i in range(n-1):
  for j in range(i+1, n):
    d = 0
    d += max(z[i][0] - z[j][0], z[j][0] - z[i][0])
    d += max(z[i][1] - z[j][1], z[j][1] - z[i][1])
    if d>m:
      m = d
print(m)
	


Fixed submission:
n = int(input())
u = [list(map(int, input().split())) for i in range(n)]
z = [u[i][0] + u[i][1] for i in range(n)]
w = [u[i][0] - u[i][1] for i in range(n)]
d = [max(z)-min(z), max(w)-min(w)]

print(max(d))

Buggy python submission (verdict: Runtime Error):
n = int(input())
z = [[map(int, input().split())] for i in range(n)]
m = 0
d = 0
for i in range(n-1):
  for j in range(i+1, n):
    d = 0
    d += max(z[i][0] - z[j][0], z[j][0] - z[i][0])
    d += max(z[i][1] - z[j][1], z[j][1] - z[i][1])
    if d>m:
      m = d
print(m)
	

Fixed submission:
n = int(input())
u = [list(map(int, input().split())) for i in range(n)]
z = [u[i][0] + u[i][1] for i in range(n)]
w = [u[i][0] - u[i][1] for i in range(n)]
d = [max(z)-min(z), max(w)-min(w)]

print(max(d))
Buggy python submission (verdict: Runtime Error):
N,X,T = int(input().split())
t = 0
while(N>0):
  t += 1
  N -= X

print(T*t)

Fixed submission:
N,X,T = map(int, input().split())
t = 0
while(N>0):
  t += 1
  N -= X

print(T*t)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [int(input()) for i in range(n)]
 
print("AC x " +  str(s.count('AC')))
print("WA x " +  str(s.count('WA')))
print("TLE x " +  str(s.count('TLE')))
print("RE x " +  str(s.count('RE')))

Fixed submission:
n = int(input())
s = [input() for i in range(n)]
 
print("AC x " +  str(s.count('AC')))
print("WA x " +  str(s.count('WA')))
print("TLE x " +  str(s.count('TLE')))
print("RE x " +  str(s.count('RE')))

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [int(input()) for i in range(n)]

print("AC x " +  str(l.count('AC')))
print("WA x " +  str(l.count('WA')))
print("TLE x " +  str(l.count('TLE')))
print("RE x " +  str(l.count('RE')))

Fixed submission:
n = int(input())
s = [input() for i in range(n)]
 
print("AC x " +  str(s.count('AC')))
print("WA x " +  str(s.count('WA')))
print("TLE x " +  str(s.count('TLE')))
print("RE x " +  str(s.count('RE')))
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]

for i in range(N):
	a.append(a[i] + A[i])
for i in range(M):
	b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
	if a[i] > K:
	break
	while b[j] > K - a[i]:
		j -= 1
	ans = max(ans, i + j)
print(ans)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
 
for i in range(N):
	a.append(a[i] + A[i])
    
for i in range(M):
	b.append(b[i] + B[i])
    
ans, j = 0, M
for i in range(N + 1):
	if a[i] > K:
		break
	while b[j] > K - a[i]:
		j -= 1
	ans = max(ans, i + j)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()

print(sum(p[0:K])

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()

print(sum(p[0:K]))
Buggy python submission (verdict: Runtime Error):
import numpy as np
t = input()
a = [x for i in range(len(t)) if t[i]=='?' x=D else x=t[i]]
print(a)

Fixed submission:
t = input()
s = t.replace('?', 'D')
print(s)

Buggy python submission (verdict: Runtime Error):
t = input()
s = t.replace('?', 'D')
n = 0
for i in range(0, len(s)):
	if s[i:i+1]=='P' and s[i+1:i+2]=='D':
		n+=1
	else if s[i:i+1]:
		n+=1
print(n)

Fixed submission:
t = input()
s = t.replace('?', 'D')
print(s)
Buggy python submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1] * n

    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.par[x] > self.par[y]:
            x, y = y, x

        self.par[x] += self.par[y]
        self.par[y] = x

    def size(self, x):
        return -self.par[self.find(x)]

n, k = map(int, input().split())
uf = UnionFind(n)
for _ in range(k):
    a, b = map(int, input().split())
    uf.unite(a, b)

cnt = 0
for x in uf.par:
    if x < 0:
        cnt += 1
print(n - cnt)


Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1] * n

    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.par[x] > self.par[y]:
            x, y = y, x

        self.par[x] += self.par[y]
        self.par[y] = x

    def size(self, x):
        return -self.par[self.find(x)]


n, k = map(int, input().split())
uf = UnionFind(n)
for _ in range(k):
    a, b = map(int, input().split())
    uf.unite(a - 1, b - 1)

cnt = 0
for x in uf.par:
    if x < 0:
        cnt += 1
print(cnt - 1)
Buggy python submission (verdict: Time Limit Exceeded):
class BIT:
    def __init__(self, n, MOD):
        self.n = n
        self.data = [0] * (n + 1)
        self.MOD = MOD

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            s %= self.MOD
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            self.data[i] %= self.MOD
            i += i & -i


n, k = map(int, input().split())
mod = 998244353
bit = BIT(n + 2, mod)
ranges = []
for _ in range(k):
    l, r = map(int, input().split())
    ranges.append((l, r))

bit.add(1, 1)

for i in range(1, n):
    v = bit.sum(i)
    for l, r in ranges:
        bit.add(i + l, v)
        bit.add(min(n + 1, i + r + 1), -v)
print(bit.sum(n) - bit.sum(n - 1) % mod)


Fixed submission:
class BIT:
    def __init__(self, n, MOD):
        self.n = n
        self.data = [0] * (n + 1)
        self.MOD = MOD

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            s %= self.MOD
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            self.data[i] %= self.MOD
            i += i & -i


n, k = map(int, input().split())
mod = 998244353
bit = BIT(n + 2, mod)
ranges = []
for _ in range(k):
    l, r = map(int, input().split())
    ranges.append((l, r))

bit.add(1, 1)

for i in range(1, n):
    v = bit.sum(i)
    for l, r in ranges:
        bit.add(i + l, v)
        bit.add(min(n + 1, i + r + 1), -v)
print((bit.sum(n) - bit.sum(n - 1)) % mod)
Buggy python submission (verdict: Runtime Error):
from math import gcd
n = int(input())
s = list(map(int, input().split()))
s.sort()
dp = [0] * ((10 ** 6) + 100)

res = s[0]
for ss in s:
    dp[ss] += 1
    lf res != 1:
      continue
    else:
      res = gcd(res, ss)

A = max(s)
pairwise = True
setwise = (res == 1)

for i in range(2, A + 1):
    cnt = 0
    for j in range(i, A + 1, i):
        cnt += dp[j]
    if cnt > 1:
        pairwise = False
        break

if pairwise:
    print("pairwise coprime")
elif setwise:
    print("setwise coprime")
else:
    print("not coprime")


Fixed submission:
from math import gcd
n = int(input())
s = list(map(int, input().split()))
s.sort()
dp = [0] * ((10 ** 6) + 100)

for ss in s:
    dp[ss] += 1

A = max(s)
pairwise = True

for i in range(2, A + 1):
    cnt = 0
    for j in range(i, A + 1, i):
        cnt += dp[j]
    if cnt > 1:
        pairwise = False

if pairwise:
    print("pairwise coprime")
    exit()

res = s[0]
for ss in s:
    res = gcd(res, ss)
print("setwise coprime" if res == 1 else "not coprime")
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
h, w, m = map(int, input().split())
A = []
B = []
points = set()
for _ in range(m):
    a, b = map(int, input().split())
    A.append(a - 1)
    B.append(b - 1)
    points.add((a - 1,b - 1))
ac = Counter(A).most_common()
bc = Counter(B).most_common()
#print(ac, bc, points)
x = ac[0][1]
y = bc[0][1]
acm = [i for i, j in ac if j == x]
bcm = [i for i, j in bc if j == y]

ans = 0
for i in acm:
    for j in bcm:
        tmp = x + y
        if (i, j) in points:
            tmp -= 1
        ans = max(ans, tmp)
print(ans)


Fixed submission:
from collections import Counter
h, w, m = map(int, input().split())
A = []
B = []
points = set()
for _ in range(m):
    a, b = map(int, input().split())
    A.append(a - 1)
    B.append(b - 1)
    points.add((a - 1, b - 1))
ac = Counter(A).most_common()
bc = Counter(B).most_common()
#print(ac, bc, points)

x = ac[0][1]
y = bc[0][1]

acm = []
bcm = []

for i, j in ac:
    if j == x:
        acm.append(i)
    else:
        break

for i, j in bc:
    if j == y:
        bcm.append(i)
    else:
        break

ans = x + y - 1
for i in acm:
    for j in bcm:
        if (i, j) not in points:
            print(ans + 1)
            exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
def solve():
    n, k = map(int, input().split())
    s = list(map(int, input().split()))

    def is_ok(x):
        res = 0
        for ss in s:
            y = ss // x
            if ss % x == 0:
                y -= 1
            res += y
        return res

    ok = -1
    ng = 10 ** 10
    while ng - ok > 1:
        mid = (ok + ng) // 2
        if is_ok(mid) > k:
            ok = mid
        else:
            ng = mid

    print(ok + 1)


solve()


Fixed submission:
def solve():
    n, k = map(int, input().split())
    s = list(map(int, input().split()))

    def is_ok(x):
        res = 0
        for ss in s:
            y = ss // x
            if ss % x == 0:
                y -= 1
            res += y
        return res

    ng = 0
    ok = 10 ** 10
    while ok - ng > 1:
        mid = (ok + ng) // 2
        if is_ok(mid) <= k:
            ok = mid
        else:
            ng = mid

    print(ok)


solve()