Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
S = input()

col_lis = [0 if c == "R" else 1 if c == "G" else 2 for c in S]
col_lis = np.asarray(col_lis)

ans = 0

r_count = 0
g_count = 0
b_count = 0

color_table = []

for color in col_lis:
    if color == 0:
        r_count += 1
    elif color == 1:
        g_count += 1
    else:
        b_count += 1
    color_table.append([r_count, g_count, b_count])

ans = 0

for center in range(1, N - 1):
    for right in range(center + 1, N):
        if col_lis[right] == col_lis[center]:
            continue
        left = 3 - col_lis[right] - col_lis[center]
        ans += color_table[center - 1][left]
        if center * 2 - right >= 0 and col_lis[center * 2 - right] == left:
            ans -= 1


print(ans)

Fixed submission:
N = int(input())
S = input()

col_lis = [0 if c == "R" else 1 if c == "G" else 2 for c in S]

ans = 0

r_count = 0
g_count = 0
b_count = 0

color_table = []

for color in col_lis:
    if color == 0:
        r_count += 1
    elif color == 1:
        g_count += 1
    else:
        b_count += 1
    color_table.append([r_count, g_count, b_count])

ans = 0

for center in range(1, N - 1):
    for right in range(center + 1, N):
        if col_lis[right] == col_lis[center]:
            continue
        left = 3 - col_lis[right] - col_lis[center]
        ans += color_table[center - 1][left]
        if center * 2 - right >= 0 and col_lis[center * 2 - right] == left:
            ans -= 1


print(ans)
Buggy python submission (verdict: Runtime Error):
N_str = str(input())
K = int(input())

digit_length = len(N_str)
topmost_digit = int(N_str[0])

C_table = [[0, 0, 0] for _ in range(digit_length)]


def C(all, pick):
    if C_table[all][pick] == 0:
        count_child = 1
        count_parent = 1
        for i in range(pick):
            count_child *= all - i
            count_parent *= i + 1
        C_table[all][pick] = count_child // count_parent
    return C_table[all][pick]


def get_count(top_digit, digit_count, needed_nonzero):
    if needed_nonzero <= 0 or needed_nonzero > digit_count:
        return 0

    if digit_count == 1:
        if needed_nonzero == 1:
            return top_digit
        else:
            return 0

    if top_digit == 0:
        return get_count(int(N_str[digit_length - digit_count + 1]) ,digit_count - 1, needed_nonzero)

    if top_digit >= 1:
        count = C(digit_count - 1, needed_nonzero) * (9 ** needed_nonzero)
        if needed_nonzero == 1:
            count += 1

    if top_digit > 1:
        count += C(digit_count - 1, needed_nonzero - 1) * (9 ** (needed_nonzero - 1)) * (top_digit - 1)

    return count + get_count(int(N_str[digit_length - digit_count + 1]) ,digit_count - 1, needed_nonzero - 1)


print(get_count(topmost_digit, digit_length, K))

Fixed submission:
N_str = str(input())
K = int(input())

digit_length = len(N_str)
topmost_digit = int(N_str[0])

C_table = [[0, 0, 0, 0] for _ in range(digit_length+10)]


def C(all, pick):
    if C_table[all][pick] == 0:
        count_child = 1
        count_parent = 1
        for i in range(pick):
            count_child *= all - i
            count_parent *= i + 1
        C_table[all][pick] = count_child // count_parent
    return C_table[all][pick]


def get_count(top_digit, digit_count, needed_nonzero):
    if needed_nonzero <= 0 or needed_nonzero > digit_count:
        return 0

    if digit_count == 1:
        if needed_nonzero == 1:
            return top_digit
        else:
            return 0

    if top_digit == 0:
        return get_count(int(N_str[digit_length - digit_count + 1]) ,digit_count - 1, needed_nonzero)

    if top_digit >= 1:
        count = C(digit_count - 1, needed_nonzero) * (9 ** needed_nonzero)
        if needed_nonzero == 1:
            count += 1

    if top_digit > 1:
        count += C(digit_count - 1, needed_nonzero - 1) * (9 ** (needed_nonzero - 1)) * (top_digit - 1)

    return count + get_count(int(N_str[digit_length - digit_count + 1]) ,digit_count - 1, needed_nonzero - 1)


print(get_count(topmost_digit, digit_length, K))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

A.sort()

MOD = 10 ** 9 + 7

max_X = 0
min_X = 0

combinations = 1

count = K - 1

for i in range(N - K + 1):
    max_X += combinations * A[count + i]
    min_X += combinations * A[N - count - 1 - i]
    max_X %= MOD
    min_X %= MOD
    combinations = combinations * ( K - 1 + i + 1 ) // (K - 1 + i - K + 1 + 1)

ans = max_X - min_X

while ans < 0:
    ans += MOD

print(ans % MOD)

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 9)

N, K = map(int, input().split())
A = list(map(int, input().split()))

A.sort()

MOD = 10 ** 9 + 7


# aの-1乗をmで割ったときの商を求める
def mod_inv(a, m=10 ** 9 + 7):
    b = m
    u = 1
    v = 0
    while b > 0:
        t = a // b
        a -= t * b
        c = a
        a = b
        b = c

        u -= t * v
        c = u
        u = v
        v = c
    u %= m
    return u


max_X = 0
min_X = 0

combinations = 1

count = K - 1

for i in range(N - K + 1):
    max_X += combinations * A[count + i]
    min_X += combinations * A[N - count - 1 - i]
    max_X %= MOD
    min_X %= MOD
    combinations = (combinations * (K + i) * mod_inv(i + 1)) % MOD

ans = max_X - min_X

while ans < 0:
    ans += MOD

print(ans % MOD)
Buggy python submission (verdict: Runtime Error):
N = int(input())
C = list(map(int, input().split()))

C.sort()

ans = 0

mod = 10 ** 9 + 7

pattern = (2 ** (N - 2)) % mod

if N != 1:
    for i in range(N):
        c = C[i]
        ans += c * (N + 1 - i) * pattern
        ans %= mod
    ans *= 2 ** N
else:
    ans = C[0] * 2

ans %= mod

print(ans)

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

if K * 500 >= X:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

N = int(input())
C = list(map(int, input().split()))

ans = 0

if N != 1:
    heapq.heapify(C)
    for i in range(N):
        c = heapq.heappop(C)
        ans += c * (N + 1 - i) * (2 ** (N - 2))
        ans %= 10 ** 9 + 7
    ans *= 2 ** N
else:
    ans = C[0] * 2

ans %= 10 ** 9 + 7

print(ans)

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

C.sort()

ans = 0

mod = 10 ** 9 + 7

pattern = (2 ** (N - 2)) % mod

if N != 1:
    for i in range(N):
        c = C[i]
        ans += c * (N + 1 - i) * pattern
        ans %= mod
    ans *= 2 ** N
else:
    ans = C[0] * 2

ans %= mod

print(ans)

Buggy python submission (verdict: Runtime Error):
import heapq

N = int(input())
C = list(map(int, input().split()))

ans = 0

if N != 1:
    C = heapq.heapify(C)
    for i in range(N):
        c = heapq.heappop(C)
        ans += c * (N + 1 - i) * (2 ** (N - 2))
        ans %= 10 ** 9 + 7
    ans *= 2 ** N
else:
    ans = C[0] * 2

ans %= 10 ** 9 + 7

print(ans)

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

C.sort()

ans = 0

mod = 10 ** 9 + 7

pattern = (2 ** (N - 2)) % mod

if N != 1:
    for i in range(N):
        c = C[i]
        ans += c * (N + 1 - i) * pattern
        ans %= mod
    ans *= 2 ** N
else:
    ans = C[0] * 2

ans %= mod

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
C = list(map(int, input().split()))

C.sort()

ans = 0

if N != 1:
    for i in range(N):
        ans += C[i] * (N + 1 - i) * (2 ** (N - 2))
        ans %= 10 ** 9 + 7
    ans *= 2 ** N
else:
    ans = C[0] * 2

ans %= 10 ** 9 + 7

print(ans)

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

C.sort()

ans = 0

mod = 10 ** 9 + 7

pattern = (2 ** (N - 2)) % mod

if N != 1:
    for i in range(N):
        c = C[i]
        ans += c * (N + 1 - i) * pattern
        ans %= mod
    ans *= 2 ** N
else:
    ans = C[0] * 2

ans %= mod

print(ans)
Buggy python submission (verdict: Runtime Error):
S, T = input.split()
print(T + S)

Fixed submission:
S, T = input().split()
print(T + S)
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int,input().split())

if A > K:
  A -= K
else:
  A = 0
  B = max(0, A + B - K)

print(A + " " + B)

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

if A >= K:
  A -= K
else:
  B = max(0, A + B - K)
  A = 0

print(str(A) + " " + str(B))

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

if A > K:
  A -= K
else:
  A = 0
  B = max(0, A + B - K)

print(A + " " + B)

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

if A >= K:
  A -= K
else:
  B = max(0, A + B - K)
  A = 0

print(str(A) + " " + str(B))
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
Nloop = N + 1
A = np.zeros((Nloop, Nloop), dtype="int")
Acount = np.zeros(Nloop, dtype="int")

for i in range(1, Nloop):
    Acount[i] = int(input())
    for _ in range(Acount[i]):
        x, y = map(int, input().split())
        A[i, x] = 1 if y == 1 else -1

honest_loop = 2 ** N
honest_num = np.zeros(Nloop, dtype="int")

ans = 0

for i in range(1, honest_loop):
    for l in range(1, Nloop):
        honest_num[l] = 1 if i >> (l - 1) & 1 == 1 else -1

    check = np.dot(A, honest_num)

    honest_check = True
    for l in range(1, Nloop):
        # lの人が正直者のとき
        if honest_num[l] == 1 and Acount[l] != check[l]:
            honest_check = False

    if honest_check:
        ans = max(sum(honest_num == 1), ans)

print(ans)

Fixed submission:
A = list(map(int,input().split()))
if sum(A) <= 21:
  print("win")
else:
  print("bust")
Buggy python submission (verdict: Runtime Error):
A, B = map(int,input().split())
print(max(0, a - B * 2))

Fixed submission:
A, B = map(int,input().split())
print(max(0, A - B * 2))
Buggy python submission (verdict: Runtime Error):
a=int(input())
s=input()

if a >= 3200:
  print("red")
  else
  print(s)

Fixed submission:
a=int(input())
s=input()

if a < 3200:
  print("red")
else:
  print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
S = input()

aaaa = False

# K >= 14ぐらいでSは辞書順最小の文字で埋め尽くされる。

# あまり意味はないが計算結果が大きすぎてバグっても嫌なので上限を作っておく
if K >= 15:
    aaaa = True
elif 2 ** K >= N:
    aaaa = True

# 最小の文字だけで埋め尽くされる場合
if aaaa:
    print(min(S)*N)
    exit()


def get_reverce_dict(s_str):
    U = s_str + s_str[::-1]
    minindex = 0
    for p in range(1, N + 1):
        if check_reverce_dict(U, minindex, p):
            minindex = p
    return U[minindex:minindex+N]


def check_reverce_dict(u, pointer1, pointer2):
    for i in range(N - 1, -1, -1):
        if u[i + pointer1] < u[i + pointer2]:
            return False
        elif u[i + pointer1] > u[i + pointer2]:
            return True
    return False


for _ in range(K - 1):
    S = get_reverce_dict(S)


def get_last_dict(s_str):
    U = s_str + s_str[::-1]
    c = min(s_str)
    p = U.index(c)
    minindex = p
    p += 1
    while p <= N:
        if U[p] == c:
            if check_normal_dict(U, minindex, p):
                minindex = p
        p += 1
    return U[minindex:minindex+N]


def check_normal_dict(u, pointer1, pointer2):
    for i in range(N):
        if u[pointer1 + i] > u[pointer2 + i]:
            return True
        elif u[pointer1 + i] < u[pointer2 + i]:
            return False
    return False


S = get_last_dict(S)
print(S)

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

aaaa = False

# K >= 14ぐらいでSは辞書順最小の文字で埋め尽くされる。

# あまり意味はないが計算結果が大きすぎてバグっても嫌なので上限を作っておく
if K >= 15:
    aaaa = True
elif 2 ** K >= N:
    aaaa = True

# 最小の文字だけで埋め尽くされる場合
if aaaa:
    print(min(S)*N)
    exit()

def get_last_dict(s_str):
    U = s_str + s_str[::-1]
    c = min(s_str)
    p = U.index(c)
    minindex = p
    p += 1
    while p <= N:
        if U[p] == c:
            if check_normal_dict(U, minindex, p):
                minindex = p
        p += 1
    return U[minindex:minindex+N]


def check_normal_dict(u, pointer1, pointer2):
    for i in range(N):
        if u[pointer1 + i] > u[pointer2 + i]:
            return True
        elif u[pointer1 + i] < u[pointer2 + i]:
            return False
    return False

S = get_last_dict(S)

if K == 1:
    print(S)
else:
    count = 0
    for c in S:
        if c == S[0]:
            count += 1
        else:
            break
    if count * (2 ** (K - 1)) >= N:
        print(S[0] * N)
    else:
        S = S[0] * (count * ((2 ** (K - 1)) - 1)) + S
        print(S[0:N])
Buggy python submission (verdict: Runtime Error):
N, D = map(int,input())

watch = D * 2 + 1

ans = ( N + watch - 1 ) // watch

print(ans)

Fixed submission:
N, D = map(int,input().split())
 
watch = D * 2 + 1
 
ans = ( N + watch - 1 ) // watch
 
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())

w = list(map(int, input()))

anslight = 0
ansheavy = sum(w)

ans = ansheavy

for i in w:
    anslight += i
    ansheavy -= i
    ans = min(abs(ansheavy-anslight), ans)
    
print(ans)

Fixed submission:
N = int(input())

w = list(map(int, input().split()))

anslight = 0
ansheavy = sum(w)

ans = ansheavy

for i in w:
    anslight += i
    ansheavy -= i
    ans = min(abs(ansheavy-anslight), ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
def has_path(start, goal):
    for step in range(start, goal):
        if (not isRoad[step]) and (not isRoad[step-1]):
            return False
    return True


N, A, B, C, D = map(int, input().split())
S = input()
isRoad = [True if c == "." else False for c in S]

if C <= B:      # すぬけ・ふぬけの二人が独立になっているとき
    if has_path(A, C) and has_path(B, D):
        print("Yes")
    else:
        print("No")
    exit()
elif C < D:    # ふぬけを動かしてからすぬけを動かせば良いとき
    if has_path(A, C) and has_path(B, D):
        print("Yes")
    else:
        print("No")
    exit()
else:       # どこかでふぬけがすぬけを追い越さなければいけない場合
    for i in range(B - 1, D + 1):   # 追い抜く場所があるかどうかを探索
        if isRoad[i - 1] and isRoad[i] and isRoad[i + 1]:
            print("Yes")
            exit()
    print("No")

Fixed submission:
def has_path(start, goal):
    for step in range(start, goal):
        if (not isRoad[step]) and (not isRoad[step-1]):
            return False
    return True


N, A, B, C, D = map(int, input().split())
S = input()
isRoad = [True if c == "." else False for c in S]

if C <= B:      # すぬけ・ふぬけの二人が独立になっているとき
    if has_path(A, C) and has_path(B, D):
        print("Yes")
    else:
        print("No")
    exit()
elif C < D:    # ふぬけを動かしてからすぬけを動かせば良いとき
    if has_path(A, C) and has_path(B, D):
        print("Yes")
    else:
        print("No")
    exit()
else:       # どこかでふぬけがすぬけを追い越さなければいけない場合
    for i in range(B - 1, D):   # 追い抜く場所があるかどうかを探索
        if isRoad[i - 1] and isRoad[i] and isRoad[i + 1]:
            print("Yes")
            exit()
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
# 後ろからカウント、操作後にその周辺で書き換えるものがあるかどうかを探せばOK
s = input()

# 確か文字列は操作時に毎回文字列を作り直すはずだからTLE対策に数字の配列に直しておく
s_int = [1 if c == "A" else 2 if c == "B" else 3 for c in s ]

s_len = len(s_int)

s_pointer = s_len - 3

writecount = 0

# 配列の領域外を探すまで続ける
while s_pointer >= 0:
    if s_int[s_pointer] == 1 and s_int[s_pointer + 1] == 2 and s_int[s_pointer + 2] == 3:
        writecount += 1
        s_int[s_pointer] += 1
        s_int[s_pointer + 1] += 1
        s_int[s_pointer + 2] = 1
        if s_pointer + 2 + 3 <= s_len:   # ポインタを後ろに二つずらしてもはみ出ない
            s_pointer += 3
    s_pointer -= 1

print(writecount)

Fixed submission:
# 前からカウント
s = input()

# 確か文字列は操作時に毎回文字列を作り直すはずだからTLE対策に数字の配列に直しておく
s_int = [1 if c == "A" else 2 if c == "B" else 3 for c in s ]

s_len = len(s_int)

write_count = 0

s_pointer = 0

a_count = 0

while (s_pointer + 1 < s_len):
    # AAAAABC→5回変換可、BCを一番左にもっていった状態と等しい
    if s_int[s_pointer] == 1:
        a_count += 1
    elif s_int[s_pointer] == 2 and s_int[s_pointer + 1] == 3:
        # BCで変換個数を確定し、一個余分にポインタを動かす
        write_count += a_count
        s_pointer += 1
    else:
        # 連鎖が途切れた
        a_count = 0
    s_pointer += 1

print(write_count)

Buggy python submission (verdict: Time Limit Exceeded):
# 後ろからカウント、操作後にその周辺で書き換えるものがあるかどうかを探せばOK
s = input()

# 確か文字列は操作時に毎回文字列を作り直すはずだからTLE対策に数字の配列に直しておく
s_int = [1 if c == "A" else 2 if c == "B" else 3 for c in s ]

s_len = len(s_int)

s_pointer = s_len - 3

writecount = 0

# 配列の領域外を探すまで続ける
while s_pointer >= 0:
    if s_int[s_pointer] == 1 and s_int[s_pointer + 1] == 2 and s_int[s_pointer + 2] == 3:
        writecount += 1
        s_int[s_pointer] += 1
        s_int[s_pointer + 1] += 1
        s_int[s_pointer + 2] = 1
        if s_pointer + 2 + 3 <= s_len:   # ポインタを後ろに二つずらしてもはみ出ない
            s_pointer += 3
    s_pointer -= 1

print(writecount)

Fixed submission:
# 前からカウント
s = input()

# 確か文字列は操作時に毎回文字列を作り直すはずだからTLE対策に数字の配列に直しておく
s_int = [1 if c == "A" else 2 if c == "B" else 3 for c in s ]

s_len = len(s_int)

write_count = 0

s_pointer = 0

a_count = 0

while (s_pointer + 1 < s_len):
    # AAAAABC→5回変換可、BCを一番左にもっていった状態と等しい
    if s_int[s_pointer] == 1:
        a_count += 1
    elif s_int[s_pointer] == 2 and s_int[s_pointer + 1] == 3:
        # BCで変換個数を確定し、一個余分にポインタを動かす
        write_count += a_count
        s_pointer += 1
    else:
        # 連鎖が途切れた
        a_count = 0
    s_pointer += 1

print(write_count)
Buggy python submission (verdict: Runtime Error):
s=input()

win=0
lose=0

for c in s:
  if c = "o":
    win+=1
  else:
    lose+=1

if win + ( 15 - ( win + lose ) ) > 8:
  print("YES")
else:
  print("NO")

Fixed submission:
s = input()

win = 0
lose = 0

for c in s:
    if c == "o":
        win += 1
    else:
        lose += 1

days = 15 - (win + lose)

if win + days >= 8:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

ans = N

for i in range(N+1):
    whiteprint = S[0:i].count("#")
    blackprint = S[i:N].count(".")

    ans = min(ans,blackprint + whiteprint)

print(ans)

Fixed submission:
N = int(input())
S = input()

ans = S.count(".")

printnum = ans

for c in S:
    if c == ".":
        printnum -= 1
    else:
        printnum += 1
    ans = min(ans,printnum)

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())

S = [int(input())for _ in range(N)]
S.sort()

S_all = sum(S)

if S_all % 10 != 0:
    print(S_all)
    exit()

i = 0
while S[i] % 10 == 0:
    i += 1

print(S_all - S[i])

Fixed submission:
N = int(input())

S = [int(input())for _ in range(N)]
S.sort()

S_all = sum(S)

if S_all % 10 != 0:
    print(S_all)
    exit()

i = 0
while i < N and S[i] % 10 == 0:
    i += 1

if i != N:
    print(S_all - S[i])
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
s = input()

max_plus = len(s) - 1

numList = [int(c) for c in s]

sMax = (1 << max_plus) - 1

ans = 0

for plus_pos in range(sMax + 1):
    sum = 0

    num = numList[0]

    for i in range(max_plus):
        if ((plus_pos >> i) & 1) == 1:
            sum += num
            num = numList[i + 1]
        else:
            num = num * 10 + numList[i + 1]

    sum += num
    ans += sum

print(ans)s = input()

max_plus = len(s) - 1

numList = [int(c) for c in s]

sMax = (1 << max_plus) - 1

ans = 0

for plus_pos in range(sMax + 1):
    sum = 0

    num = numList[0]

    for i in range(max_plus):
        if ((plus_pos >> i) & 1) == 1:
            sum += num
            num = numList[i + 1]
        else:
            num = num * 10 + numList[i + 1]

    sum += num
    ans += sum

print(ans)

Fixed submission:
s = input()

max_plus = len(s) - 1

numList = [int(c) for c in s]

sMax = (1 << max_plus) - 1

ans = 0

for plus_pos in range(sMax + 1):
    sum = 0

    num = numList[0]

    for i in range(max_plus):
        if ((plus_pos >> i) & 1) == 1:
            sum += num
            num = numList[i + 1]
        else:
            num = num * 10 + numList[i + 1]

    sum += num
    ans += sum

print(ans)
Buggy python submission (verdict: Runtime Error):
temparr = input()
temparr = temparr.split()
n = int(temparr[0])
k = int(temparr[1])
temparr = input()
import math
temparr = temparr.split()
arr = []
for i in temparr:
    arr.append(int(i))
arr = sorted(arr)
#print(arr)

left = 1
right = arr[-1] + 1
ans = arr[-1]
while left <= right:
    mid = (left + right) // 2 
    count = 0 
    for i in arr :
        if i <= mid:
            continue 
        else:
            count += math.ceil(i / mid) - 1 
    if count <= k :
        right = mid - 1 
        if mid < ans:
            ans = mid 
    else:
        left = mid + 1 
print(ans)







Fixed submission:
n = int(input())
if n <30:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
temparr = input()
temparr = temparr.split()
n = int(temparr[0])
k = int(temparr[1])
temparr = input()
import math
temparr = temparr.split()
arr = []
for i in temparr:
    arr.append(int(i))
arr = sorted(arr)
#print(arr)

left = 0 
right = arr[-1] + 1
ans = arr[-1]
while left <= right:
    mid = (left + right) // 2 
    count = 0 
    for i in arr :
        if i <= mid:
            continue 
        else:
            count += math.ceil(i / mid) - 1 
    if count <= k :
        right = mid - 1 
        if mid < ans:
            ans = mid 
    else:
        left = mid + 1 
print(ans)







Fixed submission:
temparr = input()
temparr = temparr.split()
n = int(temparr[0])
k = int(temparr[1])
temparr = input()
import math
temparr = temparr.split()
arr = []
for i in temparr:
    arr.append(int(i))
arr = sorted(arr)
#print(arr)

left = 1
right = arr[-1] + 1
ans = arr[-1]
while left <= right:
    mid = (left + right) // 2 
    count = 0 
    for i in arr :
        if i <= mid:
            continue 
        else:
            count += math.ceil(i / mid) - 1 
    if count <= k :
        right = mid - 1 
        if mid < ans:
            ans = mid 
    else:
        left = mid + 1 
print(ans)
Buggy python submission (verdict: Runtime Error):
newarr = input()
newarr = newarr.split()
n = int(newarr[0])
m = int(newarr[1])
dicts = {}
ans = [0] * (n + 1)
for line in range(m):
    newarr = input()
    newarr = newarr.split()
    froom = int(newarr[0])
    sroom = int(newarr[1])
    if froom not in dicts:
        dicts[froom] = []
    if sroom not in dicts:
        dicts[sroom] = []
    dicts[froom].append(sroom)
    dicts[sroom].append(froom)
queue = []
if 1 not in dicts:
    print("No")
else:
    ans[1] = 1
    curarr = dicts[1]
    for i in curarr:
        queue.append(i)
        ans[i] = 1 
    while queue:
        curitem = queue.pop(0)
        if curitem not in dicts:
            continue 
        curarr = dicts[curitem]
        for i in curarr:
            if ans[i] == 0:
                ans[i] = curitem 
                queue.append(i)

    finalans = []
    flag = 0 
    for i in range(2, n + 1):
        if i == 0 :
            flag = 1 
            break 
        finalans.append(ans[i])
    if flag == 1:
        print("No")
    else:
        print("Yes")
        for i in finalans:
            print(i)




Fixed submission:
n = int(input())
ones = n % 10 

if ones == 2 or ones == 4 or ones == 5 or ones == 7 or ones == 9:
    print("hon")
elif ones == 0 or ones == 1 or ones == 6 or ones == 8:
    print("pon")
else:
    print("bon")