Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

OK = 10**12
NG = -1

while OK-NG > 1:
    mid = (OK+NG)//2
    cnt = 0
    for a in A:
        cnt += (a-1)//mid
    if cnt <= K:
        OK = mid
    else:
        NG = mid
    # print('OK:{}, NG:{}, cnt:{}'.format(OK, NG, cnt))

print(OK)


Fixed submission:
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

OK = 10**12
NG = 0

while OK-NG > 1:
    mid = (OK+NG)//2
    cnt = 0
    for a in A:
        cnt += (a-1)//mid
    if cnt <= K:
        OK = mid
    else:
        NG = mid
    # print('OK:{}, NG:{}, cnt:{}'.format(OK, NG, cnt))

print(OK)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import heapq
N, K = map(int, input().split())
A = sorted([(-int(i), int(i), 1) for i in input().split()])
heapq.heapify(A)  # リストhqのheap化

for _ in range(K):
    _, L, T = heapq.heappop(A)  # heap化されたリストhqから最小値を削除＆その最小値を出力
    heapq.heappush(A, (-L/(T+1), L, T+1))  # heap化されたリストhqに要素xを追加
_, L, T = heapq.heappop(A)
print(math.ceil(L/T))


Fixed submission:
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

OK = 10**12
NG = 0

while OK-NG > 1:
    mid = (OK+NG)//2
    cnt = 0
    for a in A:
        cnt += (a-1)//mid
    if cnt <= K:
        OK = mid
    else:
        NG = mid
    # print('OK:{}, NG:{}, cnt:{}'.format(OK, NG, cnt))

print(OK)

Buggy python submission (verdict: Time Limit Exceeded):
import math
N, K = map(int, input().split())
A = sorted([(int(i), 1) for i in input().split()], key=lambda x: x[0])


for _ in range(K):
    L, T = A.pop(-1)
    A.append((L*T/(T+1), T+1))
    A.sort(key=lambda x: x[0])
print(math.ceil(A[-1][0]))


Fixed submission:
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

OK = 10**12
NG = 0

while OK-NG > 1:
    mid = (OK+NG)//2
    cnt = 0
    for a in A:
        cnt += (a-1)//mid
    if cnt <= K:
        OK = mid
    else:
        NG = mid
    # print('OK:{}, NG:{}, cnt:{}'.format(OK, NG, cnt))

print(OK)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import heapq
N, K = map(int, input().split())
A = sorted([(-int(i), 1) for i in input().split()])
heapq.heapify(A)  # リストhqのheap化

for _ in range(K):
    L, T = heapq.heappop(A)  # heap化されたリストhqから最小値を削除＆その最小値を出力
    heapq.heappush(A, (L*T/(T+1), T+1))  # heap化されたリストhqに要素xを追加
print(math.ceil(-heapq.heappop(A)[0]))


Fixed submission:
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

OK = 10**12
NG = 0

while OK-NG > 1:
    mid = (OK+NG)//2
    cnt = 0
    for a in A:
        cnt += (a-1)//mid
    if cnt <= K:
        OK = mid
    else:
        NG = mid
    # print('OK:{}, NG:{}, cnt:{}'.format(OK, NG, cnt))

print(OK)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import heapq
N, K = map(int, input().split())
A = sorted([(-int(i), 1) for i in input().split()])
heapq.heapify(A)  # リストhqのheap化

for _ in range(K):
    L, T = heapq.heappop(A)  # heap化されたリストhqから最小値を削除＆その最小値を出力
    heapq.heappush(A, (L*T/(T+1), T+1))  # heap化されたリストhqに要素xを追加
print(math.ceil(-heapq.heappop(A)[0]))


Fixed submission:
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

OK = 10**12
NG = 0

while OK-NG > 1:
    mid = (OK+NG)//2
    cnt = 0
    for a in A:
        cnt += (a-1)//mid
    if cnt <= K:
        OK = mid
    else:
        NG = mid
    # print('OK:{}, NG:{}, cnt:{}'.format(OK, NG, cnt))

print(OK)