Problem p02598 (python)

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

A = list(map(int, input().split()))
d = [0] * N

#二分探索
min1 = 0
max1 = max(A) + 1

while True:
    X = (min1 + max1)//2
    for i in range(N):
        if A[i] % X == 0:
            d[i] = A[i]//X - 1
        else:
            d[i] = A[i]//X
    if sum(d) <= K:
        max1 = X 
    else:
        min1 = X
    #print(min1, max1)

    if max1 - min1 <= 1:
        print(int(max1))
        break

Buggy submission (verdict: Runtime Error):
N ,K = map(int, input().split())

A = list(map(int, input().split()))
d = [0] * N

#二分探索
min1 = 0
max1 = max(A)

while True:
    X = (min1 + max1)//2
    for i in range(N):
        if A[i] % X == 0:
            d[i] = A[i]//X - 1
        else:
            d[i] = A[i]//X
    if sum(d) <= K:
        max1 = X 
    else:
        min1 = X
    print(min1, max1)

    if max1 - min1 <= 1:
        print(int(max1))
        break

Buggy submission (verdict: Runtime Error):
N ,K = map(int, input().split())

A = list(map(int, input().split()))
d = [0] * N

#二分探索
min = 1
max = max(A)

while True:
    X = (min + max)//2
    for i in range(N):
        if a[i] % X == 0:
            d[i] = A[i]//X - 1
        else:
            d[i] = A[i]//X
    if sum(d) <= K:
        max = X 
    else:
        min = X
    #print(min, max)

    if max - min <= 1:
        print(int(max))
        break

Buggy submission (verdict: Runtime Error):
N ,K = map(int, input().split())

import math

A = list(map(int, input().split()))
d = [0] * N

#二分探索
min = 1
max = max(A)

while True:
    X = (min + max)//2
    for i in range(N):
        if a[i] % X == 0:
            d[i] = A[i]//X - 1
        else:
            d[i] = A[i]//X
    if sum(d) <= K:
        max = X 
    else:
        min = X
    #print(min, max)
    
    if max - min <= 1:
        print(int(max))
        break

Buggy submission (verdict: Runtime Error):
N ,K = map(int, input().split())

import math

A = list(map(int, input().split()))
d = [0] * N

#二分探索
min = 1
max = max(A)

while True:
    X = (min + max)//2
    for i in range(N):
        if a[i] % X == 0:
            d[i] = A[i]//X - 1
        else:
            d[i] = A[i]//X
    if sum(d) <= K:
        max = X 
    else:
        min = X
    #print(min, max)
    
    if max - min <= 1:
        print(int(max))
        break

Buggy submission (verdict: Runtime Error):
N ,K = map(int, input().split())

import math

A = list(map(int, input().split()))
d = [0] * N

#二分探索
min = 1
max = max(A)

while True:
    X = (min + max)//2
    for i in range(N):
        d[i] = math.ceil(A[i]/X) - 1
    if sum(d) <= K:
        max = X - 1
    else:
        min = X + 1
    #print(min, max)
    
    if min == max:
        print(int(max))
        break

Buggy submission (verdict: Runtime Error):
N ,K = map(int, input().split())

A = list(map(int, input().split()))
d = [0] * N

#二分探索
min = 0
max = max(A)

while True:
    X = (min + max)//2
    for i in range(N):
        d[i] = A[i]//X
    if sum(d) <= K:
        max = X
    else:
        min = X
    #print(min, max)
    
    if min + 1 == max:
        print(int(max))
        break

Buggy submission (verdict: Runtime Error):
N ,K = map(int, input().split())

A = list(map(int, input().split()))
d = [0] * N

#二分探索
min = 0
max = max(A)

while True:
    X = (min + max)//2
    for i in range(N):
        d[i] = A[i]//X
    if sum(d) <= K:
        max = X
    else:
        min = X
    print(min, max)
    
    if min + 1 == max:
        print(int(max))
        break