Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import time
sys.setrecursionlimit(int(1e6))
if False:
    dprint = print
else:
    def dprint(*args):
        pass

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

lx = 0
rx = max(A)
ans = 0
while (int(lx) < int(rx)):
    x = (rx + lx) / 2
    dprint("lx, x, rx = ", lx, x, rx)
    n = 0
    for i in range(len(A)):
        n += math.ceil(A[i] / x) - 1
        if n > k: break
    dprint("n = ", n)
    if n <= k:
        dprint(" smaller x")
        rx = x
    else:
        dprint(" cut less, bigger x")
        lx = x

ans = math.ceil(rx)
print(ans)


Fixed submission:
import sys
import math
import time
sys.setrecursionlimit(int(1e6))
if False:
    dprint = print
else:
    def dprint(*args):
        pass

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

lx = int(0)   # NG
rx = int(1e9) # OK
#ans = 0
while ((rx-lx)>1):
    x = (rx + lx) // 2
    dprint("lx, x, rx = ", lx, x, rx)
    n = 0
    for i in range(len(A)):
        #n += math.ceil(A[i] / x) - 1
        n += (A[i]-1) // x
        if n > k: break
    dprint("n = ", n)
    if n <= k:
        dprint(" smaller x")
        rx = x
    else:
        dprint(" cut less, bigger x")
        lx = x

#ans = math.ceil(rx)
print(rx)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import time
sys.setrecursionlimit(int(1e6))
if False:
    dprint = print
else:
    def dprint(*args):
        pass

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

lx = 0
rx = max(A)
ans = 0
while (int(lx) < int(rx)):
    x = (rx + lx) / 2
    dprint("lx, x, rx = ", lx, x, rx)
    n = 0
    for i in range(len(A)):
        n += math.ceil(A[i] / x) - 1
    dprint("n = ", n)
    if n <= k:
        dprint(" smaller x")
        rx = x
        ans = x
    else:
        dprint(" cut less, bigger x")
        lx = x
        ans = rx

ans = math.ceil(ans)
print(ans)


Fixed submission:
import sys
import math
import time
sys.setrecursionlimit(int(1e6))
if False:
    dprint = print
else:
    def dprint(*args):
        pass

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

lx = int(0)   # NG
rx = int(1e9) # OK
#ans = 0
while ((rx-lx)>1):
    x = (rx + lx) // 2
    dprint("lx, x, rx = ", lx, x, rx)
    n = 0
    for i in range(len(A)):
        #n += math.ceil(A[i] / x) - 1
        n += (A[i]-1) // x
        if n > k: break
    dprint("n = ", n)
    if n <= k:
        dprint(" smaller x")
        rx = x
    else:
        dprint(" cut less, bigger x")
        lx = x

#ans = math.ceil(rx)
print(rx)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import time
sys.setrecursionlimit(int(1e6))
if False:
    dprint = print
else:
    def dprint(*args):
        pass

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

lx = 0
rx = max(A)
ans = 0
while (int(lx) < int(rx)):
    x = (rx + lx) / 2
    dprint("lx, x, rx = ", lx, x, rx)
    n = 0
    for i in range(len(A)):
        n += math.ceil(A[i] / x) - 1
    dprint("n = ", n)
    if n <= k:
        dprint(" smaller x")
        rx = x
        ans = x
    else:
        dprint(" cut less, bigger x")
        lx = x
        ans = rx

ans = math.ceil(ans)
print(ans)


Fixed submission:
import sys
import math
import time
sys.setrecursionlimit(int(1e6))
if False:
    dprint = print
else:
    def dprint(*args):
        pass

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

lx = int(0)   # NG
rx = int(1e9) # OK
#ans = 0
while ((rx-lx)>1):
    x = (rx + lx) // 2
    dprint("lx, x, rx = ", lx, x, rx)
    n = 0
    for i in range(len(A)):
        #n += math.ceil(A[i] / x) - 1
        n += (A[i]-1) // x
        if n > k: break
    dprint("n = ", n)
    if n <= k:
        dprint(" smaller x")
        rx = x
    else:
        dprint(" cut less, bigger x")
        lx = x

#ans = math.ceil(rx)
print(rx)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import time
sys.setrecursionlimit(int(1e6))
if False:
    dprint = print
else:
    def dprint(*args):
        pass

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

ki = [0] * len(A)
xv = A.copy()

def max_index(v):
    max_i = 0
    for i in range(len(v)):
        if (v[i]>v[max_i]):
            max_i = i
    return max_i

dprint("ki", ki)
dprint("xv", xv)
for i in range(k):
    max_i = max_index(xv)
    ki[max_i] += 1
    xv[max_i] = A[max_i] / (ki[max_i] + 1)
    dprint("max_i", max_i)
    dprint("ki", ki)
    dprint("xv", xv)
    
ans = math.ceil(max(xv))
print(ans)


Fixed submission:
import sys
import math
import time
sys.setrecursionlimit(int(1e6))
if False:
    dprint = print
else:
    def dprint(*args):
        pass

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

lx = int(0)   # NG
rx = int(1e9) # OK
#ans = 0
while ((rx-lx)>1):
    x = (rx + lx) // 2
    dprint("lx, x, rx = ", lx, x, rx)
    n = 0
    for i in range(len(A)):
        #n += math.ceil(A[i] / x) - 1
        n += (A[i]-1) // x
        if n > k: break
    dprint("n = ", n)
    if n <= k:
        dprint(" smaller x")
        rx = x
    else:
        dprint(" cut less, bigger x")
        lx = x

#ans = math.ceil(rx)
print(rx)