Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B = map(int, input().split())

print(lcm(A,B))


Fixed submission:
import fractions
A, B = map(int, input().split())
tmp = fractions.gcd(A,B)
print((A*B)//tmp)

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B = map(int, input().split())

print(lcm(A,B))


Fixed submission:
import fractions
A, B = map(int, input().split())
tmp = fractions.gcd(A,B)
print((A*B)//tmp)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)

cnt = 0

for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] < L[j] + L[k]:
                cnt += 1
            else:
                break

print(cnt)

Fixed submission:
import math
import itertools
import bisect
N = int(input())
L = list(map(int, input().split()))
L.sort()
cnt = 0
for i in range(N):
    for j in range(i+1, N):
        cnt += bisect.bisect_left(L[j+1:N], L[i]+L[j])
        
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
L = list(map(int, input().split()))
L.sort()

comb = itertools.combinations([i for i in range(N)], 2)
cnt = 0

for cmb in comb:
    a = L[cmb[0]]
    b = L[cmb[1]]
    for i in range(cmb[1]+1, N):
        if L[i] < a+b:
            cnt += 1
    

print(cnt)

Fixed submission:
import math
import itertools
import bisect
N = int(input())
L = list(map(int, input().split()))
L.sort()
cnt = 0
for i in range(N):
    for j in range(i+1, N):
        cnt += bisect.bisect_left(L[j+1:N], L[i]+L[j])
        
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N, M = map(int, input().split())
A = list(map(int, input().split()))

A.sort()

cnt = M
end_flag = True
while end_flag:
    max_num = A.pop(N-1)
    if len(A) > 0:
        while cnt > 0 and max_num >= A[N-2]:
                max_num = max_num // 2
                cnt -= 1
    else:
        while cnt > 0:
            max_num = max_num // 2
            cnt -= 1
    bisect.insort_left(A, max_num)
    if cnt == 0:
        end_flag = False
        
print(sum(A))

Fixed submission:
import heapq
N, M = map(int, input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)

for _ in range(M):
    tmp_min = heapq.heappop(A)
    heapq.heappush(A, (-1)*(-tmp_min//2))
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N, M = map(int, input().split())
A = list(map(int, input().split()))

A.sort()

cnt = M
end_flag = True
while end_flag:
    max_num = A.pop(N-1)
    if len(A) > 0:
        while cnt > 0 and max_num >= A[N-2]:
                max_num = max_num // 2
                cnt -= 1
    else:
        while cnt > 0:
            max_num = max_num // 2
            cnt -= 1
    bisect.insort_left(A, max_num)
    if cnt == 0:
        end_flag = False
        
print(sum(A))

Fixed submission:
import heapq
N, M = map(int, input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)

for _ in range(M):
    tmp_min = heapq.heappop(A)
    heapq.heappush(A, (-1)*(-tmp_min//2))
print(-sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())

mod = 2019
min_num = float("inf")

tmp_L = L

while tmp_L < R and tmp_L <= L + 2019:
    tmp_R = tmp_L + 1

    while tmp_R <= R and tmp_R <= tmp_L + 2019:
        min_num = min((tmp_L*tmp_R)%mod ,min_num)
        tmp_R += 1
    tmp_L = tmp_L + 1

print(min_num)

Fixed submission:
L, R = map(int, input().split())

mod = 2019
min_num = float("inf")

tmp_L = L

while tmp_L < R and tmp_L <= L + 2019:
    tmp_R = tmp_L + 1

    while tmp_R <= R and tmp_R <= tmp_L + 2019:
        min_num = min((tmp_L*tmp_R)%mod ,min_num)
        tmp_R += 1
    tmp_L = tmp_L + 1

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

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

tmp = [[0 for i in range(N)] for i in range(N)]
for i in range(N):
    tmp[i][i] = 1
    tmp[i][(i+1)%N] = 1

A = np.matrix(tmp)
Y = np.matrix(W).T

ans = np.linalg.solve(A, Y)*2

tmp = []
for a in ans:
    tmp.append(str(int(a)))

print(" ".join(tmp))

Fixed submission:
import numpy as np

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

ans = []

ans.append(str(sum(W) - 2 * sum([W[i] for i in range(N) if i % 2 == 1])))

for i in range(1, N):
    ans.append(str( 2*W[i-1] - int(ans[i-1])))

print(" ".join(ans))

Buggy python submission (verdict: Runtime Error):
import numpy as np

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

tmp = [[0 for i in range(N)] for i in range(N)]
for i in range(N):
    tmp[i][i] = 1
    tmp[i][(i+1)%N] = 1

A = np.matrix(tmp)
Y = np.matrix(W).T

ans = np.linalg.solve(A, Y)*2

tmp = []
for a in ans:
    tmp.append(str(int(a)))

print(" ".join(tmp))

Fixed submission:
import numpy as np

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

ans = []

ans.append(str(sum(W) - 2 * sum([W[i] for i in range(N) if i % 2 == 1])))

for i in range(1, N):
    ans.append(str( 2*W[i-1] - int(ans[i-1])))

print(" ".join(ans))
Buggy python submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())

lcm = C * D // math.gcd(C, D)

div_c = (B // C) - (A // C)
if A // C != 0 and A % C == 0:
    div_c += 1
div_d = (B // D) - (A // D)
if A // D != 0 and A % D == 0:
    div_d += 1
div_cd = (B // (lcm)) - (A // (lcm))
if A // (lcm) != 0 and A % lcm == 0:
    div_cd += 1

ans = (B - A + 1) - (div_c + div_d - div_cd)
print(ans)

Fixed submission:
import fractions

A, B, C, D = map(int, input().split())

lcm = C * D // fractions.gcd(C, D)

div_c = (B // C) - (A // C)
if A // C != 0 and A % C == 0:
    div_c += 1
div_d = (B // D) - (A // D)
if A // D != 0 and A % D == 0:
    div_d += 1
div_cd = (B // (lcm)) - (A // (lcm))
if A // (lcm) != 0 and A % lcm == 0:
    div_cd += 1

ans = (B - A + 1) - (div_c + div_d - div_cd)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = -10**18

for i in range(N):
    tmp_score = 0
    pos = i
    # ループになるまで移動
    for j in range(1, N+1):
        pos = P[pos]-1
        if K >= j:
            tmp_score += C[pos]
            ans = max(ans,tmp_score)
        if pos == i:
            break
    
    div = K // j
    mod = K % j

    if K >= j:
        tmp_score *= div
        ans = max(ans,tmp_score)
        # 端数ぶん移動
        # mod=0 のときは移動しない
        for _ in range(1, mod+1):
            pos = P[pos]-1
            tmp_score += C[pos]
            ans = max(ans,tmp_score)

print(ans)

Fixed submission:
S = input()
ans = 0
if "RRR" in S:
    ans = 3
elif "RR" in S:
    ans = 2
elif "R" in S:
    ans = 1
else:
    ans = 0
print(ans)

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

ans = -10**18

for i in range(N):
    tmp_score = 0
    pos = i
    # ループになるまで移動
    for j in range(1, N+1):
        pos = P[pos]-1
        if K >= j:
            tmp_score += C[pos]
            ans = max(ans,tmp_score)
        if pos == i:
            break
    
    div = K // j
    mod = K % j

        if K >= j:
        tmp_score *= div
        ans = max(ans,tmp_score)
        # 端数ぶん移動
        # mod=0 のときは移動しない
        for _ in range(1, mod+1):
            pos = P[pos]-1
            tmp_score += C[pos]
            ans = max(ans,tmp_score)

print(ans)

Fixed submission:
S = input()
ans = 0
if "RRR" in S:
    ans = 3
elif "RR" in S:
    ans = 2
elif "R" in S:
    ans = 1
else:
    ans = 0
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

prev = 1
for i in range(K):
    prev *= A[i]

idx = 0
for i in range(K, N):
    now = prev // A[idx] * A[i]
    if prev < now:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)

    prev = now
    idx += 1

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

idx = 0
for i in range(K, N):
    if A[idx] < A[i]:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)

    idx += 1

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

prev = 1
for i in range(K):
    prev *= A[i]

idx = 0
for i in range(K, N):
    if prev < prev // A[idx] * A[i]:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)

    prev = prev // A[idx] * A[i]
    idx += 1

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

idx = 0
for i in range(K, N):
    if A[idx] < A[i]:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)

    idx += 1
Buggy python submission (verdict: Runtime Error):
D = int(input())#D=365
c = list(map(int, input().split()))#0<=c<=100
s = [list(map(int, input().split())) for _ in range(D)]#0<=s<=20000

t = []
for d in range(D):
    t.append(s.index(max(s[d])) + 1)

for i in range(D):
    print(t[i])

Fixed submission:
n=int(input())
for i in range(n):
  print(1)
Buggy python submission (verdict: Runtime Error):
def xxx(n):
    ans = ""
    i = 1

    while True:
        if n <= 26 ** i:
            n -= 1
            for j in range(i):
                ans = char(ord("a") + n%26) + ans
                n //= 26
            return ans
        else:
            n -= 26 ** i
            i += 1


N = int(input())
print(xxx(N))

Fixed submission:
def xxx(n):
    alpha = "abcdefghijklmnopqrstuvwxyz"
    ans = ""
    i = 1

    while True:
        if n <= 26 ** i:
            n -= 1
            for j in range(i):
                ans = alpha[n%26] + ans
                n //= 26
            return ans
        else:
            n -= 26 ** i
            i += 1


N = int(input())
print(xxx(N))

Buggy python submission (verdict: Runtime Error):
def xxx(n):
    alpha = "abcdefghijklmnopqrstuvwxyz"
    ans = ""
    i = 0

    while True:
        if n <= 26 ** i:
            n -= 1
            while N > 0:
                ans = alpha[N%26-1] + ans
                N //= 26
            return ans
        else:
            n -= 26 ** i

            
N = int(input())
print(xxx(N))

Fixed submission:
def xxx(n):
    alpha = "abcdefghijklmnopqrstuvwxyz"
    ans = ""
    i = 1

    while True:
        if n <= 26 ** i:
            n -= 1
            for j in range(i):
                ans = alpha[n%26] + ans
                n //= 26
            return ans
        else:
            n -= 26 ** i
            i += 1


N = int(input())
print(xxx(N))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

K = min(K, 50)
for _ in range(K):
    B = [0 for _ in range(N)]
    for i in range(N):
        l = max(0, i - A[i])
        r = min(N - 1, i + A[i])
        B[l] += 1
        if r+1 < N:
            B[r+1] -= 1
    
    for i in range(1, N):
        B[i] += B[i-1]
    
    A = B.copy()

print(" ".join(map(str, A)))

Fixed submission:
S = input()
print(S[:3])
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
L = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    L[a].append(b)
    L[b].append(a)

ans = [0 for _ in range(N+1)]
now = [1]
next = []

while len(now):
    for x in now:
        for y in L[x]:
            if (ans[y] == 0):
                ans[y] = x
                next.append(y)
    now = next.copy()
    next = []

print("Yes")
for x in range(2, N+1):
    print(ans[x])


Fixed submission:
N = input()
ans = ""
if N[-1] in ("2", "4", "5", "7", "9"):
    ans = "hon"
elif N[-1] in ("0", "1", "6", "8"):
    ans = "pon"
elif N[-1] in ("3"):
    ans = "bon"

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    L[a].append(b)
    L[b].append(a)

ans = [0 for _ in range(N+1)]
now = [1]
next = []

while len(now):
    for x in now:
        for y in L[x]:
            if (y not in now) and (ans[y] == 0):
                ans[y] = x
                next.append(y)
    now = next.copy()
    next = []

print("Yes")
for x in range(2, N+1):
    print(ans[x])

Fixed submission:
N, M = map(int, input().split())
L = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    L[a].append(b)
    L[b].append(a)

ans = [0 for _ in range(N+1)]
now = [1]
next = []

while len(now):
    for x in now:
        for y in L[x]:
            if (ans[y] == 0) and (y not in now):
                ans[y] = x
                next.append(y)
    now = next.copy()
    next = []

print("Yes")
for x in range(2, N+1):
    print(ans[x])

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    L[a].append(b)
    L[b].append(a)

ans = [0 for _ in range(N+1)]
now = [1]
next = []

while len(now):
    for x in now:
        for y in L[x]:
            if (y not in now) and (ans[y] == 0):
                ans[y] = x
                next.append(y)
    now = next.copy()
    next = []

print("Yes")
for x in range(2, N+1):
    print(ans[x])

Fixed submission:
N, M = map(int, input().split())
L = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    L[a].append(b)
    L[b].append(a)

ans = [0 for _ in range(N+1)]
now = [1]
next = []

while len(now):
    for x in now:
        for y in L[x]:
            if (ans[y] == 0) and (y not in now):
                ans[y] = x
                next.append(y)
    now = next.copy()
    next = []

print("Yes")
for x in range(2, N+1):
    print(ans[x])

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
L = [[] for _ in range(N+1)]
for _ in range(N):
    a, b = map(int, input().split())
    L[a].append(b)
    L[b].append(a)

ans = [0] * (N+1)
now = [1]
next = []

while len(now):
    for x in now:
        for y in L[x]:
            if (y not in now) and (ans[y] == 0):
                ans[y] = x
                next.append(y)
    now = next.copy()
    next = []

print("Yes")
for x in range(2, N+1):
    print(ans[x])

Fixed submission:
N, M = map(int, input().split())
L = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    L[a].append(b)
    L[b].append(a)

ans = [0 for _ in range(N+1)]
now = [1]
next = []

while len(now):
    for x in now:
        for y in L[x]:
            if (ans[y] == 0) and (y not in now):
                ans[y] = x
                next.append(y)
    now = next.copy()
    next = []

print("Yes")
for x in range(2, N+1):
    print(ans[x])
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())

ans = 0
for _ in range(K):
    if A > 0:
        ans += 1
        A -= 1
    elif B > 0:
        B -= 1
    elif C > 0:
        ans -= 1
        C -= 1

print(ans)

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

ans = 0
if K >= A:
    ans += A
    K -= A
else:
    ans += K
    K = 0

if K > 0 and B > 0:
    if K >= B:
        K -= B
    else:
        K = 0

if K > 0 and C > 0:
    if K >= C:
        K -= C
        ans -= C
    else:
        ans -= K
        K = 0

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

L = [0] * (N+1)
now = 1
p = []

for i in range(K):
    if L[now] == 1:
        break
    p.append(now)
    L[now] = 1
    now = A[now-1]

for i in range(len(p)):
    if p[i] == now:
        ans = p[i + (K - i) % len(p[i:])]

print(ans)

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

L = [0] * (N+1)
now = 1
p = []
f = False

for i in range(K):
    if L[now] == 1:
        f = True
        break
    p.append(now)
    L[now] = 1
    now = A[now-1]

if f:
    for i in range(len(p)):
        if p[i] == now:
            ans = p[i + (K - i) % len(p[i:])]
            break
else:
    ans = now

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

for a in range(-300, 300):
    for b in range(-300, 300):
        if a ** 5 - b ** 5 == X:
            print(str(A) + " " + str(B))
            exit()

Fixed submission:
X = int(input())

for a in range(-300, 300):
    for b in range(-300, 300):
        if a ** 5 - b ** 5 == X:
            A = a
            B = b

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

Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())

B = 0
Bp = 0
Bm = 0
while True:
    A = (X + Bp ** 5) ** 0.2
    if not isinstance(A, complex):
        if A.is_integer():
            B = Bp
            break
    Bp += 1

    A = (X + Bm ** 5) ** 0.2
    if not isinstance(A, complex):
        if A.is_integer():
            B = Bm
            break
    Bm -= 1


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


Fixed submission:
X = int(input())

for a in range(-300, 300):
    for b in range(-300, 300):
        if a ** 5 - b ** 5 == X:
            A = a
            B = b

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

Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())

B = 0
while True:
    A = (X + B ** 5) ** 0.2
    if not isinstance(A, complex):
        if A.is_integer():
            break
    B -= 1

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

Fixed submission:
X = int(input())

for a in range(-300, 300):
    for b in range(-300, 300):
        if a ** 5 - b ** 5 == X:
            A = a
            B = b

print(str(A) + " " + str(B))
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


K = int(input())

L = [[[0] * K for _ in range(K)] for _ in range(K)]
ans = 0

for a in range(1, K+1):
    for b in range(1, K+1):
        d = gcd(a, b)
        for c in range(1, K+1):
            x, y, z = sorted([a, b, c])
            x -= 1
            y -= 1
            z -= 1
            if L[x][y][z] != 0:
                ans += L[x][y][z]
            else:
                t = gcd(d, c)
                ans += t
                L[x][y][z] = t

print(ans)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


K = int(input())

L = [[0] * (K+1) for _ in range(K+1)]
ans = 0

for a in range(1, K+1):
    for b in range(1, K+1):
        x, y = sorted([a, b])
        if L[x][y] == 0:
            d = gcd(a, b)
            L[x][y] = d
        else:
            d = L[x][y]
        for c in range(1, K+1):
            x, y = sorted([d, c])
            if L[x][y] == 0:
                t = gcd(d, c)
                L[x][y] = t
                ans += t
            else:
                ans += L[x][y]


print(ans)

Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


K = int(input())

ans = 0

for a in range(1, K+1):
    for b in range(1, K+1):
        gcd = gcd(a, b)
        for c in range(1, K+1):
            ans += gcd(gcd, c)

print(ans)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


K = int(input())

L = [[0] * (K+1) for _ in range(K+1)]
ans = 0

for a in range(1, K+1):
    for b in range(1, K+1):
        x, y = sorted([a, b])
        if L[x][y] == 0:
            d = gcd(a, b)
            L[x][y] = d
        else:
            d = L[x][y]
        for c in range(1, K+1):
            x, y = sorted([d, c])
            if L[x][y] == 0:
                t = gcd(d, c)
                L[x][y] = t
                ans += t
            else:
                ans += L[x][y]


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

n = len(S)
ans = "No"
if S[:n//2] == S[n//2+1:][::-1]:
    S1 = S[:(n-1)//2]
    n1 = len(S1)
    if n1 % 2 == 1:
        if S1[:n1//2] == S1[(n1+1)//2:][::-1]:
            S2 = S[(n+3)//2-1:]
            n2 = len(S2)
        if S2[:n2//2] == S2[(n2+1)//2:][::-1]:
            ans = "Yes"

print(ans)

Fixed submission:
S = input()

n = len(S)
ans = "No"
if S[:n//2] == S[n//2+1:][::-1]:
    S1 = S[:(n-1)//2]
    n1 = len(S1)
    if S1[:n1//2] == S1[(n1+1)//2:][::-1]:
        S2 = S[(n+3)//2-1:]
        n2 = len(S2)
        if S2[:n2//2] == S2[(n2+1)//2:][::-1]:
            ans = "Yes"

print(ans)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())

ans = 0
if H == 1 or W == 1:
    ans = 1
elif H % 2 == 0:
    ans = (W * H) // 2
else:
    ans = (W * (H - 1)) // 2 + (W + 1) // 2

print(ans)

Fixed submission:
a, b, c = map(int, input().split())

if c - a - b > 0:
    if 4 * a * b < (c - a - b) ** 2:
        ans = "Yes"
    else:
        ans = "No"
else:
    ans = "No"


print(ans)
Buggy python submission (verdict: Runtime Error):
S = list(input().split())
ans = "No"
if len(S) == 1:
    ans = "No"
else:
    for i in range(len(S)-1)
        if S[i] == "h":
            if S[i+1] == "i":
                ans = "Yes"

print(ans)

Fixed submission:
S = input()
ans = "No"
if len(S) % 2 == 0:
    if S == ("hi" * (len(S) // 2)):
        ans = "Yes"


print(ans)
Buggy python submission (verdict: Runtime Error):
N, R = map(int, input().split())

if N >= 10:
    ans = R
else:
    ans = R - 100 * (10 - K)

print(ans)

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

if N >= 10:
    ans = R
else:
    ans = R + 100 * (10 - N)

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

ans = 0
while True:
    N = N // K
    ans += 1
    if N == 0:
        break

print(ans)

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

ans = 0
while True:
    N //= K
    ans += 1
    if N == 0:
        break

print(ans)

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

ans = 0
while True:
    N //= K
    ans += 1
    if N == 0:
        break

print(ans)

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

ans = 0
while True:
    N //= K
    ans += 1
    if N == 0:
        break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))

L = [0] * N
for i in range(N):
    L[i] = (p[i] + 1) * p[i] / (2 * p[i])

x = 0
for i in range(N - K + 1):
    x = max(x, sum(L[i:i+K]))

print(x)

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

L = [0] * N
for i in range(N):
    L[i] = (p[i] + 1) * p[i] / (2 * p[i])

L2 = [0] * (N + 1)
for i in range(N):
    L2[i+1] = L2[i] + L[i]

x = 0
for i in range(N - K + 1):
    x = max(x, L2[i+K] - L2[i])

print(x)