Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03220 (python)

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

D = 99999999
R = 0

for i, h in enumerate(H):
    d = abs(A - (T - h * 0.006))
    if D > d:
        D = d
        R = i + 1

print(R)

Buggy submission (verdict: Runtime Error):
import math


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

D = math.inf
R = 0

for i, h in enumerate(H):
    d = A - (T - h * 0.006)
    if D > d:
        D = d
        R = i + 1

print(R)
Problem p03239 (python)

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

R = 9999

for n in range(N):
    c, t = map(int, input().split())
    if t <= T and c < R:
        R = c

if R != 9999:
    print(R)
else:
    print('TLE')

Buggy submission (verdict: Runtime Error):
import math


N, T = map(int, input().split())

R = math.inf

for n in range(N):
    c, t = map(int, input().split())
    if t <= T and c < R:
        R = c

if R != math.inf:
    print(R)
else:
    print('TLE')
Problem p03240 (python)

Fixed submission:
N = int(input())

X = [None] * N
Y = [None] * N
H = [None] * N

x_max = 0
y_max = 0
h_max = 0
R = []

for n in range(N):
    X[n], Y[n], H[n] = map(int, input().split())
    if h_max <= H[n]:
        x_max, y_max, h_max = X[n], Y[n], H[n]

for cx in range(0, 101):
    for cy in range(0, 101):
        flag = True
        for n in range(N):
            if H[n] != 0:
                ch = H[n] + abs(X[n] - cx) + abs(Y[n] - cy)
        for n in range(N):
            if max(ch - abs(X[n] - cx) - abs(Y[n] - cy), 0) != H[n]:
                flag = False
                break
        if flag == True:
            R.append([cx, cy, ch])

print(R[0][0], R[0][1], R[0][2])

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

X = [None] * N
Y = [None] * N
H = [None] * N

R = []

for n in range(N):
    X[n], Y[n], H[n] = map(int, input().split())

for cx in range(0, 101):
    for cy in range(0, 101):
        flag = True
        for n in range(N):
            if n == 0:
                ch = H[n] + abs(X[n] - cx) + abs(Y[n] - cy)
            if max(ch - abs(X[n] - cx) - abs(Y[n] - cy), 0) != H[n]:
                flag = False
                break
        if flag == True:
            R.append([cx, cy, ch])

print(R[0][0], R[0][1], R[0][2])
Problem p03241 (python)

Fixed submission:
# Thanks for http://nihaoshijie.hatenadiary.jp/entry/2018/02/03/115759

N, M = map(int, input().split())


def factorize(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def divisorize(fct):
    b, e = fct.pop()
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a


try:
    fct = factorize(M)
    L   = []
    for div in divisorize(fct):
        L.append(num(div))
except:
    L = [1, M]

L.sort()
L.reverse()

for l in L:
    if l * N <= M and M % l == 0:
        print(l)
        break

Buggy submission (verdict: Runtime Error):
# Thanks for http://nihaoshijie.hatenadiary.jp/entry/2018/02/03/115759

N, M = map(int, input().split())


def factorize(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def divisorize(fct):
    b, e = fct.pop()
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a


fct = factorize(M)
L   = []
for div in divisorize(fct):
    L.append(num(div))

L.sort()
L.reverse()

for l in L:
    if l * N <= M and M % l == 0:
        print(l)
        break
Problem p03262 (python)

Fixed submission:
def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x


N, X = map(int, input().split())
x    = list(map(int, input().split()))

y = [abs(xi - X) for xi in x]
r = y[0]

for i in range(N-1):
    if y[i+1] != 0:
        r = gcd(r, y[i+1])

print(r)

Buggy submission (verdict: Runtime Error):
import math


N, X = map(int, input().split())
x    = list(map(int, input().split()))

y = [abs(xi - X) for xi in x]
r = y[0]

for i in range(N-1):
    if y[i+1] != 0:
        r = math.gcd(r, y[i+1])

print(r)

Buggy submission (verdict: Runtime Error):
import math


N, X = map(int, input().split())
x    = list(map(int, input().split()))

y = [abs(xi - X) for xi in x]
r = y[0]

for i in range(N-1):
    if y[i+1] != 0:
        r = math.gcd(r, y[i+1])

print(r)

Buggy submission (verdict: Runtime Error):
import math


N, X = map(int, input().split())
x    = list(map(int, input().split()))

y = [abs(xi - X) for xi in x]
r = y[0]

for i in range(N-1):
    r = math.gcd(r, y[i+1])

print(r)
Problem p03274 (python)

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

X_pos = [x for x in X if x >= 0]
X_neg = [x for x in X if x <  0]

X_neg.reverse()

l_pos = len(X_pos)
l_neg = len(X_neg)

R = []

if l_neg == 0:
    R.append(X_pos[K-1])
elif l_pos == 0:
    R.append(-1 * X_neg[K-1])
else:
    for k in range(K):
        if k < l_pos and K-k-2 < l_neg:
            R.append(2 * X_pos[k] - X_neg[K-k-2])
        elif k >= l_pos:
            break
    for k in range(K):
        if k < l_neg and K-k-2 < l_pos:
            R.append(-2 * X_neg[k] + X_pos[K-k-2])
        elif k >= l_neg:
            break

print(min(R))

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

X_pos = [x for x in X if x >= 0]
X_neg = [x for x in X if x <  0]

X_neg.reverse()

l_pos = len(X_pos)
l_neg = len(X_neg)

R = []

if l_neg == 0:
    R.append(X_pos[K-1])
elif l_pos == 0:
    R.append(-1 * X_neg[K-1])
else:
    for k in range(K):
        if k < l_pos and K-k-2 < l_neg:
            R.append(2 * X_pos[k] - X_neg[K-k-2])
        else:
            break
    for k in range(K):
        if k < l_neg and K-k-2 < l_pos:
            R.append(-2 * X_neg[k] + X_pos[K-k-2])
        else:
            break

print(min(R))

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

X_pos = [x for x in X if x >= 0]
X_neg = [x for x in X if x <  0]

X_neg.reverse()

l_pos = len(X_pos)
l_neg = len(X_neg)

R = []

if l_neg == 0:
    R.append(X_pos[K-1])
elif l_pos == 0:
    R.append(-1 * X_neg[K-1])
else:
    for k in range(K):
        if k < l_pos:
            R.append(2 * X_pos[k] - X_neg[K-k-2])
        else:
            break
    for k in range(K):
        if k < l_neg:
            R.append(-2 * X_neg[k] + X_pos[K-k-2])
        else:
            break

print(min(R))
Problem p03290 (python)

Fixed submission:
import itertools


D, G = map(int, input().split())

P     = [None] * D
C     = [None] * D
count = [None] * D
score = [None] * D

for i in range(D):
    p, c          = map(int, input().split())
    P[i]          = p
    C[i]          = c
    count[i]      = list(range(p+1))
    score[i]      = [100 * (i+1) * j for j in range(p+1)]
    score[i][-1] += c

answer = sum(P)

for is_complete in itertools.product([True, False], repeat=D):
    score_tmp  = 0
    count_tmp  = 0
    score_tmp += sum([score[i][-1] for i in range(D) if is_complete[i]])
    count_tmp += sum([count[i][-1] for i in range(D) if is_complete[i]])
    if score_tmp < G:
        for i in list(range(D))[::-1]:
            if is_complete[i] == False:
                if (G - score_tmp) % (100 * (i+1)) == 0:
                    count_add  = min((G - score_tmp) // (100 * (i+1)),     P[i] - 1)
                else:
                    count_add  = min((G - score_tmp) // (100 * (i+1)) + 1, P[i] - 1)
                score_add      = 100 * (i+1) * count_add
                count_tmp     += count_add
                score_tmp     += score_add
            if score_tmp >= G:
                break
    if score_tmp >= G:
        answer = min(answer, count_tmp)

print(answer)

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


D, G = map(int, input().split())

P     = [None] * D
C     = [None] * D
count = [None] * D
score = [None] * D

for i in range(D):
    p, c          = map(int, input().split())
    P[i]          = p
    C[i]          = c
    count[i]      = list(range(p+1))
    score[i]      = [100 * (i+1) * j for j in range(p+1)]
    score[i][-1] += c

answer = math.inf

for is_complete in itertools.product([True, False], repeat=D):
    score_tmp  = 0
    count_tmp  = 0
    score_tmp += sum([score[i][-1] for i in range(D) if is_complete[i]])
    count_tmp += sum([count[i][-1] for i in range(D) if is_complete[i]])
    while score_tmp < G:
        for i in list(range(D))[::-1]:
            if is_complete[i] == False:
                if (G - score_tmp) % (100 * (i+1)) == 0:
                    count_add  = min((G - score_tmp) // (100 * (i+1)),     P[i] - 1)
                else:
                    count_add  = min((G - score_tmp) // (100 * (i+1)) + 1, P[i] - 1)
                score_add      = 100 * (i+1) * count_add
                count_tmp     += count_add
                score_tmp     += score_add
            if score_tmp >= G:
                break
    if score_tmp >= G:
        answer = min(answer, count_tmp)

print(answer)
Problem p03294 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# 文字列入力
'''
S = input()
A, B = input().split()
'''

# 文字列分解（['A', 'B', 'C']）
'''
S = list(input())
'''

# 整数入力
'''
X, Y, Z = map(int, input().split())
X, Y, Z = list(map(int, input().split()))
'''

# リストのユニーク化（順破壊）
'''
L = ['a', 'a', 'b']
L = list(set(L))
'''

# 固定長リスト最速初期化
'''
L = [None] * N
'''

# 二進数でフラグパターンを全種作成
'''
import numpy as np

N = 3
f = []

for i in range(0, 2**N):
    string = str(bin(i))[2:]
    f.append(['0'] * (N - len(string)) + list(string))

F = np.array(f)
F = (F == '1')
'''

import fractions
from functools import reduce


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)


N = int(input())
A = list(map(int, input().split()))
L = lcm(A) - 1

result = 0

for a in A:
    result += (L % a)

print(result)

Buggy submission (verdict: Runtime Error):
import fraction
from functools import reduce


def lcm_base(x, y):
    return (x * y) // fraction.gcd(x, y)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)


N = int(input())
A = list(map(int, input().split()))
L = lcm(A) - 1

result = 0

for a in A:
    result += (L % a)

print(result)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce


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

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)


N = int(input())
A = list(map(int, input().split()))
L = lcm(A) - 1

result = 0

for a in A:
    result += (L % a)

print(result)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce


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

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)


N = int(input())
A = list(map(int, input().split()))
L = lcm(A) - 1

result = 0

for a in A:
    result += (L % a)

print(result)
Problem p03309 (python)

Fixed submission:
import statistics


N   = int(input())
A   = list(map(int, input().split()))
A_b = [a - (idx + 1) for idx, a in enumerate(A)]
med = int(statistics.median(A_b))

print(int(sum([abs(x - med) for x in A_b])))

Buggy submission (verdict: Runtime Error):
import statistics


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

A = [a - i for i, a in enumerate(A)]

M = int(statistics.median(A_b))
R = []

for m in [M-2, M-1, M, M+1, M+2]:
    R.append(sum([abs(a - m) for a in A]))

print(min(R))

Buggy submission (verdict: Runtime Error):
import statistics


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

A = [a - i for i, a in enumerate(A)]

M = int(statistics.median(A_b))
R = []

for m in [M-2. M-1, M, M+1, M+2]:
    R.append(sum([abs(a - m) for a in A]))

print(min(R))
Problem p03310 (python)

Fixed submission:
# 解説みて実装
import numpy as np


N = int(input())
A = list(map(int, input().split()))
C = np.cumsum(A).tolist()

LL = [np.inf] * N
LR = [np.inf] * N

l = 0

for m in range(N-1):
    if l < m:
        LL[m] = C[l]
        LR[m] = C[m] - C[l]
        while l < m:
            LL_tmp = C[l+1]
            LR_tmp = C[m] - C[l+1]
            if abs(LL[m] - LR[m]) >= abs(LL_tmp - LR_tmp):
                l    += 1
                LL[m] = C[l]
                LR[m] = C[m] - C[l]
            else:
                break

B = A[::-1]
D = np.cumsum(B).tolist()

RL = [np.inf] * N
RR = [np.inf] * N

r = 0

for m in range(N-1):
    if r < m:
        RR[m] = D[r]
        RL[m] = D[m] - D[r]
        while r < m:
            RR_tmp = D[r+1]
            RL_tmp = D[m] - D[r+1]
            if abs(RR[m] - RL[m]) >= abs(RR_tmp - RL_tmp):
                r    += 1
                RR[m] = D[r]
                RL[m] = D[m] - D[r]
            else:
                break

RR = RR[::-1]
RL = RL[::-1]

X = np.array([LL[:-1], LR[:-1], RL[1:], RR[1:]])[:, 1:-1]

print(int(np.min(np.abs(np.max(X, axis=0) - np.min(X, axis=0)))))

Buggy submission (verdict: Runtime Error):
# A の合計/4での区切り±2を探索

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

S = sum(A)
M = S // 4
C = A.copy()

k   = 1
XYZ = []

for n in range(N):
    if n == 0:
        pass
    else:
        C[n] = C[n] + C[n-1]
    if C[n] > k * M:
        XYZ.append(n)
        k += 1

XYZ = XYZ[:3]

X = [XYZ[0]] + [XYZ[0] + i for i in [-2, -1, 1, 2] if 0 <= XYZ[0] + i and XYZ[0] + i <= N-1]
Y = [XYZ[1]] + [XYZ[1] + i for i in [-2, -1, 1, 2] if 0 <= XYZ[1] + i and XYZ[1] + i <= N-1]
Z = [XYZ[2]] + [XYZ[2] + i for i in [-2, -1, 1, 2] if 0 <= XYZ[2] + i and XYZ[2] + i <= N-1]
R = []

for x in X:
    for y in Y:
        for z in Z:
            if x < y and y < z:
                PQRS = [C[x], C[y] - C[x], C[z] - C[y], S - C[z]]
                R.append(max(PQRS) - min(PQRS))
            else:
                pass

print(min(R))

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

S = sum(A)
M = S // 4
C = A.copy()

k   = 1
XYZ = []

for n in range(N):
    if n == 0:
        pass
    else:
        C[n] = C[n] + C[n-1]
    if C[n] > k * M:
        XYZ.append(n)
        k += 1

XYZ = XYZ[:3]

X = [XYZ[0] + i for i in list(range(-2, 2+1)) if 0 <= XYZ[0] + i and XYZ[0] + i <= N-1]
Y = [XYZ[1] + i for i in list(range(-2, 2+1)) if 0 <= XYZ[1] + i and XYZ[1] + i <= N-1]
Z = [XYZ[2] + i for i in list(range(-2, 2+1)) if 0 <= XYZ[2] + i and XYZ[2] + i <= N-1]
R = []

for x in X:
    for y in Y:
        for z in Z:
            if x < y and y < z:
                PQRS = [C[x], C[y] - C[x], C[z] - C[y], S - C[z]]
                R.append(max(PQRS) - min(PQRS))
            else:
                pass

print(min(R))
Problem p03353 (python)

Fixed submission:
import string


def make_string(string, flag_matched=False, N=5000):
    if string[-1] == 'z':
        string = string[:-1]
        flag_matched = False
    if flag_matched == False or len(string) == N:
        string = string[:-1] + chr(ord(string[-1] )+1)
    else:
        string += 'a'
    return(string)


S = input()
k = int(input())

N = len(S)
if N <= 50:

    A = []

    for i in range(N):
        for j in range(1, N+1-i):
            A.append(S[i:i+j])

    A = list(set(A))
    A.sort()

    print(A[k-1])

else:

    c = 0
    q = 'a'

    while True:
        if q in S:
            c += 1
            if c == k:
                break
            else:
                q  = make_string(q, True, N)
        else:
            q  = make_string(q, False, N)

    print(q)

Buggy submission (verdict: Runtime Error):
import string


def make_string(string, flag_matched=False, N=5000):
    if string[-1] == 'z':
        string = string[:-1]
        flag_matched = False
    if flag_matched == False or len(string) == N:
        string = string[:-1] + chr(ord(string[-1] )+1)
    else:
        string += 'a'
    return(string)


S = input()
k = int(input())

N = len(S)

c = 0
q = 'a'

while True:
    if q in S:
        c += 1
        if c == k:
            break
        else:
            q  = make_string(q, True, N)
    else:
        q  = make_string(q, False, N)

print(q)
Problem p03423 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


N = int(input())

print(N//3)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


N = int(input())
S = []
for i in range(N):
    S.append(input())

m = sum([name[0] == 'M' for name in S])
a = sum([name[0] == 'A' for name in S])
r = sum([name[0] == 'R' for name in S])
c = sum([name[0] == 'C' for name in S])
h = sum([name[0] == 'H' for name in S])

print(m * (a * (r + c + h) + r * (c + h) + c * h) + a * (r * c + c * h) + r * c * h)
Problem p03486 (python)

Fixed submission:
import string


S = list(input())
T = list(input())

L = list(string.ascii_lowercase)

S = [L.index(s) for s in S]
T = [L.index(t) for t in T]

S.sort()
T.sort()
T.reverse()

while True:
    if len(S) == 0:
        if len(T) > 0:
            print('Yes')
            break
        else:
            print('No')
            break
    if len(T) == 0:
        print('No')
        break
    s = S[0]
    t = T[0]
    if s < t:
        print('Yes')
        break
    elif s == t:
        del S[0]
        del T[0]
    else:
        print('No')
        break

Buggy submission (verdict: Runtime Error):
import string


S = list(input())
T = list(input())

L = list(string.ascii_lowercase)

S = [L.index(s) for s in S]
T = [L.index(t) for t in T]

S.sort()
T.sort()
T.reverse()

while True:
    if len(S) == 0:
        if len(T) > 0:
            print('Yes')
            break
        else:
            print('No')
            break
    s = S[0]
    t = T[0]
    if s < t:
        print('Yes')
        break
    elif s == t:
        del S[0]
        del T[0]
    else:
        print('No')
        break
Problem p03547 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


A, B = input().split()

if A < B:
    print('<')
elif A > B:
    print('>')
elif A == B:
    print('=')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


A B = input().split()

if A < B:
    print('<')
elif A > B:
    print('>')
elif A == B:
    print('=')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


A B = input().split()

if A < B:
    print('<')
elif A > B:
    print('>')
elif A == B:
    print('0')
Problem p03828 (python)

Fixed submission:
def get_prime_factorized(N):
    R = []
    b, e = 2, 0
    while b ** 2 <= N:
        while N % b == 0:
            N  = N // b
            e += 1
        if e > 0:
            R.append([b, e])
        b, e = b + 1, 0
    if N > 1:
        R.append([N, 1])
    return R


N = int(input())
H = {}
R = 1

for n in range(1, N+1):
    for l in get_prime_factorized(n):
        k, c = l
        if k in H.keys():
            H[k] += c
        else:
            H[k]  = c

for k in H.keys():
    R *= (H[k]+1)
    R %= 10**9+7

print(R)

Buggy submission (verdict: Runtime Error):
import math


def get_prime_factorized(N):
    R = []
    b, e = 2, 0
    while b ** 2 <= N:
        while N % b == 0:
            N  = N // b
            e += 1
        if e > 0:
            R.append([b, e])
        b, e = b + 1, 0
    if N > 1:
        R.append([N, 1])
    return R


N = int(input())

L = [l[1]+1 for l in get_prime_factorized(math.factorial(N))]

for i, l in enumerate(L):
    if i  == 0:
        R  = l
    else:
        R *= l

print(R % (10**9+7))
Problem p03845 (python)

Fixed submission:
N = int(input())
T = list(map(int, input().split()))
S = sum(T)

M  = int(input())

for m in range(M):
    P, X = map(int, input().split())
    print(S - T[P-1] + X)

Buggy submission (verdict: Runtime Error):
N = int(input())
T = list(map(int, input().split()))
S = sum(T)

M  = int(input())
PX = [int(input()) for _ in range(M)]

for px in PX:
    P, X = px
    print(S - T[P-1] + X)
Problem p02657 (python)

Fixed submission:
a,b=input().split()
print(int(a) * int(b))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(a * b)
Problem p02658 (python)

Fixed submission:
def main ():
  count = int(input())
  c = list(map(int,input().split()))

  if 0 in c:
    print(0)
    return

  result = 1
  for a in c:
    result *= a
    if result > 1000000000000000000:
      print(-1)
      return

  print(result)

main()

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def main ():
  count = int(input())
  c = list(map(int,input().split()))
  print(c)

  if 0 in list:
    print(0)

  a = reduce(mul, list)

  if a > 1000000000000000000:
    print('-1')
  else:
    print(a)

main()

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def main ():
  count = int(input())
  c = list(map(int,input().split()))
  print(c)

  if 0 in list:
    print(0)

  a = reduce(mul, list)

  if a > 1000000000000000000:
    print(-1)
  else:
    print(a)

main()
Problem p02657 (python)

Fixed submission:
a,b=(int(x) for x in input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
def main():
  n = int(input())
  a = list(input().split())

  if 0 in a :
    print(0)
    return
    
  prod = 1
  for i in a:
    prod *= int(i)
    if prod >1000000000000000000:
      print(-1)
      return

  print(prod)

main()

Buggy submission (verdict: Runtime Error):
print(A*B)

Buggy submission (verdict: Runtime Error):
A=int(input("A"))
B=int(input("B"))
print(A*B)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input.split())
print(a * b)
Problem p02658 (python)

Fixed submission:
import numpy as np
n = int(input())
a = list(map(int, input().split()))
if 0 in a:
  print(0)
  exit()
prod = 1
for i in range(n):
  prod *= a[i]
  if prod > 10 ** 18:
    print(-1)
    exit()
print(prod)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int, input().split()))
if 0 in a:
  print(0)
prod = 1
for i in range(n):
  prod *= a[i]
  if prod >= 10 ** 18:
    print(-1)
  	exit()
print(prod)
Problem p02677 (python)

Fixed submission:
import math
a, b, h, m = map(int, input().split())
diff_hm = abs(h*30 + m*0.5 - m*6)
print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(diff_hm))))

Buggy submission (verdict: Runtime Error):
import math as m
a, b, h, m = map(int, input().split())
diff_hm = abs(h*30 - m*60)
print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(diff_hm))))
Problem p02675 (python)

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

if ones == 3:
    print('bon')
elif ones in [0,1,6,8]:
    print('pon')
else:
    print('hon')

Buggy submission (verdict: Runtime Error):
n = int(input())
ones = n % 10

if n == 3:
    print('bon)
elif n in [0,1,6,8]:
    print('pon')
else:
    print('hon')
Problem p02865 (python)

Fixed submission:
#python 3.7.1

N=int(input())
if (N%2)==0:
  ans=N//2-1
else:
  ans=N//2
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
if (N%2)=0:
  ans=N//2-1
else:
  ans=N//2
print(ans)
Problem p02898 (python)

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

ans = 0

for item in h:
    if item>=K: ans+=1
print (ans)

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

ans = 0

for item in h:
    if h>=K: ans+=1
print (ans)