Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
arr = list(map(int, input().split()))
num_arr = [1]*n
length_arr = []
for i in arr:
  length_arr += [i]

for i in range(k):
  max_idx = length_arr.index(max(length_arr))
  tmp = num_arr[max_idx] + 1
  num_arr[max_idx] = tmp
  length_arr[max_idx] = arr[max_idx] // tmp + 1

result_int = max(length_arr) - 0.0001
print(int(result_int//1 + 1))

Fixed submission:
import math
n, k = map(int, input().split())
arr = list(map(int, input().split()))

max_length = max(arr)
low = 1
high = max_length - 1

while low <= high:
  mid = (low + high) //2
  cnt = 0
  for i in range(n):
    cnt += math.ceil(arr[i]/mid) - 1
  if cnt > k:
    low = mid + 1
  else:
    high = mid -1
    max_length = mid

print(max_length)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
arr = list(map(int, input().split()))
num_arr = [1]*n
length_arr = []
for i in arr:
  length_arr += [i]

for i in range(k):
  max_idx = length_arr.index(max(length_arr))
  tmp = num_arr[max_idx] + 1
  num_arr[max_idx] = tmp
  length_arr[max_idx] = arr[max_idx] / tmp

result_int = max(length_arr) - 0.0001
print(int(result_int//1 + 1))

Fixed submission:
import math
n, k = map(int, input().split())
arr = list(map(int, input().split()))

max_length = max(arr)
low = 1
high = max_length - 1

while low <= high:
  mid = (low + high) //2
  cnt = 0
  for i in range(n):
    cnt += math.ceil(arr[i]/mid) - 1
  if cnt > k:
    low = mid + 1
  else:
    high = mid -1
    max_length = mid

print(max_length)

Buggy python submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())
arr = list(map(int, input().split()))

max_length = max(arr)
low = 0
high = max_length

while low <= high:
  mid = (low + high) //2
  cnt = 0
  for i in range(n):
    cnt += math.ceil(arr[i]/mid) - 1
  if cnt > k:
    low = mid + 1
  else:
    high = mid -1
    max_length = mid

print(max_length)


Fixed submission:
import math
n, k = map(int, input().split())
arr = list(map(int, input().split()))

max_length = max(arr)
low = 1
high = max_length - 1

while low <= high:
  mid = (low + high) //2
  cnt = 0
  for i in range(n):
    cnt += math.ceil(arr[i]/mid) - 1
  if cnt > k:
    low = mid + 1
  else:
    high = mid -1
    max_length = mid

print(max_length)

Buggy python submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())
arr = list(map(int, input().split()))

max_length = max(arr)
low = 0
high = max_length-1

while low <= high:
  mid = (low + high) //2
  cnt = 0
  for i in range(n):
    cnt += math.ceil(arr[i]/mid) - 1
    #if cnt > k:
      #break
  if cnt > k:
    low = mid + 1
  else:
    high = mid -1
    max_length = mid

print(max_length)


Fixed submission:
import math
n, k = map(int, input().split())
arr = list(map(int, input().split()))

max_length = max(arr)
low = 1
high = max_length - 1

while low <= high:
  mid = (low + high) //2
  cnt = 0
  for i in range(n):
    cnt += math.ceil(arr[i]/mid) - 1
  if cnt > k:
    low = mid + 1
  else:
    high = mid -1
    max_length = mid

print(max_length)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
arr = list(map(int, input().split()))
num_arr = [1]*n
length_arr = [l for l in arr]

for i in range(k):
  max_idx = length_arr.index(max(length_arr))
  tmp = num_arr[max_idx] + 1
  num_arr[max_idx] = tmp
  length_arr[max_idx] = arr[max_idx] / tmp

result_int = max(length_arr) - 0.0001
print(int(result_int//1 + 1))


  

Fixed submission:
import math
n, k = map(int, input().split())
arr = list(map(int, input().split()))

max_length = max(arr)
low = 1
high = max_length - 1

while low <= high:
  mid = (low + high) //2
  cnt = 0
  for i in range(n):
    cnt += math.ceil(arr[i]/mid) - 1
  if cnt > k:
    low = mid + 1
  else:
    high = mid -1
    max_length = mid

print(max_length)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import math

n, k = map(int, input().split())
arr = np.array(list(map(int, input().split())))
cut_num_arr = [1]*n
cut_length_arr = [l for l in arr]

for i in range(k):
  max_idx = np.argmax(cut_length_arr)
  tmp = cut_num_arr[max_idx] + 1
  cut_num_arr[max_idx] = tmp
  cut_length_arr[max_idx] = arr[max_idx] / tmp

print(math.ceil(max(cut_length_arr)))


  

Fixed submission:
import math
n, k = map(int, input().split())
arr = list(map(int, input().split()))

max_length = max(arr)
low = 1
high = max_length - 1

while low <= high:
  mid = (low + high) //2
  cnt = 0
  for i in range(n):
    cnt += math.ceil(arr[i]/mid) - 1
  if cnt > k:
    low = mid + 1
  else:
    high = mid -1
    max_length = mid

print(max_length)