Buggy python submission (verdict: Runtime Error):
import heapq
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

low = 1
high = 10**9

if n == 1:
    print((a[0]+k-1)//k)
    exit()

while low+1 < high:
    tmp = 0
    mid = (low + high) //2
    #print(mid)
    
    for i in range(n):
        tmp += ((a[i]+mid-1) // mid)-1
    
    if tmp <= k:
        high = mid
    else:
        low = mid
        
print(high)


Fixed submission:
import heapq
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

low = 0
high = 10**9

if k == 0:
    print(max(a))
    exit()

    
while low+1 < high:
    tmp = 0
    mid = (low + high) //2
    
    for i in range(n):
        tmp += ((a[i]+mid-1) // mid)-1
        
    if tmp <= k:
        high = mid
    else:
        low = mid
        
print(high)

Buggy python submission (verdict: Runtime Error):
import heapq
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

low = 1
high = 10**9

if n == 1:
    print((a[0]+k-1)//k)
    exit()

while low+1 < high:
    tmp = 0
    mid = (low + high) //2
    #print(mid)
    
    for i in range(n):
        tmp += ((a[i]+mid-1) // mid)-1
    print(tmp,mid)
    
    if tmp <= k:
        high = mid
    else:
        low = mid
        
print(high)


Fixed submission:
import heapq
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

low = 0
high = 10**9

if k == 0:
    print(max(a))
    exit()

    
while low+1 < high:
    tmp = 0
    mid = (low + high) //2
    
    for i in range(n):
        tmp += ((a[i]+mid-1) // mid)-1
        
    if tmp <= k:
        high = mid
    else:
        low = mid
        
print(high)

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

hq = []

for i in range(n):
    a[i] = -a[i]

for i in range(n):
    heapq.heappush(hq,[a[i],i,1])

for i in range(k):
    val,idx,waru = heapq.heappop(hq)
    heapq.heappush(hq, [a[idx]/(waru+1),idx,waru+1])
    #print(hq)
    
val,idx,waru = heapq.heappop(hq)

if val % 1 == 0:
    print(int(val)*(-1))
else:
    print(int(val)*(-1)+1)

Fixed submission:
import heapq
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

low = 0
high = 10**9

if k == 0:
    print(max(a))
    exit()

    
while low+1 < high:
    tmp = 0
    mid = (low + high) //2
    
    for i in range(n):
        tmp += ((a[i]+mid-1) // mid)-1
        
    if tmp <= k:
        high = mid
    else:
        low = mid
        
print(high)

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

hq = []

for i in range(n):
    a[i] = -a[i]

for i in range(n):
    heapq.heappush(hq,[a[i],i,1])

for i in range(k):
    val,idx,waru = heapq.heappop(hq)
    heapq.heappush(hq, [a[idx]/(waru+1),idx,waru+1])
    #print(hq)
    
val,idx,waru = heapq.heappop(hq)

if val % 1 == 0:
    print(int(val)*(-1))
else:
    print(int(val)*(-1)+1)

Fixed submission:
import heapq
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

low = 0
high = 10**9

if k == 0:
    print(max(a))
    exit()

    
while low+1 < high:
    tmp = 0
    mid = (low + high) //2
    
    for i in range(n):
        tmp += ((a[i]+mid-1) // mid)-1
        
    if tmp <= k:
        high = mid
    else:
        low = mid
        
print(high)