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

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

#累積和を前計算
sum_list = [0 for _ in range(300000)]
sum = 0

for i in range(len(p)):
    sum += p[i]
    sum_list[i] = sum

#答えを計算
mev = 0
idx = 0
for i in range(N-K+1):
    ev = sum_list[i+K]-sum_list[i]
    if ev > mev:
        idx = i
        mev = ev

mev = 0.0
if N != K:
    for i in range(idx+1,idx+1+K):
        mev += (p[i] + 1.0) / 2.0

else:
    for i in range(len(p)):
        mev += (p[i] + 1.0) / 2.0

print(mev)

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

#累積和を前計算
sum_list = [0 for _ in range(300000)]
sum = 0

for i in range(len(p)):
    sum += p[i]
    sum_list[i] = sum

#答えを計算
mev = 0
idx = 0
for i in range(N-K+1):
    ev = sum_list[i+K]-sum_list[i]
    if ev > mev:
        idx = i
        mev = ev

mev = 0
for i in range(idx+1,idx+1+K):
    mev += (p[i] + 1.0) / 2.0

print(mev)

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

#累積和を前計算
sum_list = [0 for _ in range(2000)]
sum = 0

for i in range(len(p)):
    sum += p[i]
    sum_list[i] = sum

#答えを計算
mev = 0
idx = 0
for i in range(N-K+1):
    ev = sum_list[i+K]-sum_list[i]
    if ev > mev:
        idx = i
        mev = ev

mev = 0
for i in range(idx+1,idx+1+K):
    mev += (p[i] + 1.0) / 2.0

print(mev)

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

#累積和を前計算
sum_list = [0 for _ in range(1001)]
sum = 0

for i in range(len(p)):
    sum += p[i]
    sum_list[i] = sum

#答えを計算
mev = 0
idx = 0
for i in range(N-K+1):
    ev = sum_list[i+K]-sum_list[i]
    if ev > mev:
        idx = i
        mev = ev

mev = 0
for i in range(idx+1,idx+1+K):
    mev += (p[i] + 1.0) / 2.0

print(mev)
Problem p02786 (python)

Fixed submission:
import math

H = int(input())

print(int(math.pow(2, int(math.log2(H)) +1) - 1))

Buggy submission (verdict: Runtime Error):
import math

H = int(input())

print(int(math.pow(2, int(math.log2(H)) +1) - 1))

Buggy submission (verdict: Runtime Error):
import math

H = int(input())

print(int(math.pow(2, int(math.log2(H)+1))-1))
Problem p03000 (python)

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

pos = 0
cnt = 1

for i in range(N):
    pos += l[i]

    if pos <= X:
        cnt += 1
    else:
        break

print(cnt)

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

pos = 0

for i in range(N+1):
    pos = pos + l[i]

    if pos > X:
        print(i+1)
        exit()

print(i+1)

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

pos = 0

for i in range(N+1):
    pos = pos + l[i]

    if pos > X:
        print(i+1)
        exit()

print(N+1)
Problem p03163 (python)

Fixed submission:
dp = [[0 for _ in range(10**5+10)] for _ in range(10**2+10)]

N, W = map(int,input().split())
w = []
v = []

for i in range(N):
    wi,vi = map(int,input().split())

    w.append(wi)
    v.append(vi)

for i in range(N):
    for capacity in range(W+1):
        if w[i] > capacity:
            dp[i+1][capacity] = dp[i][capacity]
        else:
            dp[i+1][capacity] = max(dp[i][capacity], dp[i][capacity-w[i]] + v[i])

print(dp[N][W])

Buggy submission (verdict: Runtime Error):
dp = [[0 for _ in range(10**2+10)] for _ in range(10**5+10)]

N, W = map(int,input().split())
w = []
v = []

for i in range(N):
    wi,vi = map(int,input().split())

    w.append(wi)
    v.append(vi)

for i in range(N):
    for capacity in range(W+1):
        if w[i] > capacity:
            dp[i+1][capacity] = dp[i][capacity]
        else:
            dp[i+1][capacity] = max(dp[i][capacity], dp[i][capacity-w[i]] + v[i])

print(dp[N][W])

Buggy submission (verdict: Runtime Error):
dp = [[0 for _ in range(10**2+10)] for _ in range(10**5+10)]

N, W = map(int,input().split())
w = []
v = []

for i in range(N):
    wi,vi = map(int,input().split())

    w.append(wi)
    v.append(vi)

for i in range(N):
    for capacity in range(W):
        if w[i] > capacity:
            dp[i+1][capacity] = dp[i][capacity]
        else:
            dp[i+1][capacity] = max(dp[i][capacity], dp[i][capacity-w[i]] + v[i])

print(dp[N-1][W-1])

Buggy submission (verdict: Runtime Error):
dp = [[0 for _ in range(10**2+10)] for _ in range(10**5+10)]

N, W = map(int,input().split())
w = []
v = []

for i in range(N):
    wi,vi = map(int,input().split())

    w.append(wi)
    v.append(vi)

for i in range(N):
    for capacity in range(W):
        if w[i] > capacity:
            dp[i+1][capacity] = dp[i][capacity]
        else:
            dp[i+1][capacity] = max(dp[i][capacity], dp[i][capacity-w[i]] + w[i])

print(dp[N-1][W-1])

Buggy submission (verdict: Runtime Error):
dp = [[-1 for _ in range(100+10)] for _ in range(10**5+10)]
w = []
v = []

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

for i in range(N):
    wi,vi = map(int,input().split())

    w.append(wi)
    v.append(vi)

#i番目の荷物を入れるときに、capacity以下になるようにする
def dfs(i, capacity):
    if dp[i][capacity] >= 0:
        return dp[i][capacity]
    
    res = 0

    if i == N:
        # 荷物がない
        res = 0
    elif w[i] > capacity:
        # 荷物が入らないから、そのまま次に進む
        dfs(i+1, capacity)
    else:
        # 荷物を入れないとき、荷物を入れるとき。入れるときは価値vが加算される。
        res = max(dfs(i+1,capacity), dfs(i+1, capacity - w[i]) + v[i])

    dp[i][capacity] = res

    return res 

print(dfs(0,W))
Problem p03220 (python)

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

pointID = -1
min_diff = 9999999999

for i in range (N):
    #地点i の温度 と 平均気温の差(絶対値)
    diff = abs(T - H[i] * 0.006 - A)

    if diff < min_diff:
        pointID = i+1
        min_diff = diff

print(pointID)

Buggy submission (verdict: Runtime Error):
import math

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

pointID = -1
min_diff = math.inf

for i in range (N):
    #地点i の温度 と 平均気温の差(絶対値)
    diff = abs(T - 1000 * H[i] - A)

    if diff < min_diff:
        pointID = i+1
        min_diff = diff

print(pointID)

Buggy submission (verdict: Runtime Error):
import math

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

pointID = -1
min_diff = math.inf

for i in range (N):
    #地点i の温度 と 平均気温の差(絶対値)
    diff = abs(T - 1000 * H[i] - A)

    if diff < min_diff:
        pointID = i+1
        min_diff = diff

print(pointID)
Problem p02783 (python)

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

count = 0;

while(H > 0):
  H -= A
  count += 1
  
print(count)

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

if(sum(A) > H):
  print("Yes")
else:
  print("No")
Problem p02945 (python)

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

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if(a >= -100 and b <= 100):
	l = [a+b,a-b,a*b]
	print(max(l))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

l = [a+b,a-b,a*b]

print(max(l))
Problem p02765 (python)

Fixed submission:
N, R = input().split(' ')
N = int(N)
R = int(R)
if N >= 10:
  I = R
else:
  I = R + 100 * (10 - N)
print(I)

Buggy submission (verdict: Runtime Error):
import numpy as np
def comb_mod(n, a, m):
  if a > n:
    return 0
  a = min(a, n-a+1)
  # tbl = [[0]*(a+1) for _ in range(2)]
  tbl = np.zeros((2, a+1), dtype=np.int64)
  tbl[0][0] = 1
  tbl[1][0] = 1
  # for i in tqdm(range(n)):
  for i in range(n):
    # tbl[i%2][0] = 1
    tbl[i%2][1:] = (tbl[(i+1)%2][1:] + tbl[(i+1)%2][:-1]) % m
    # for k in range(min(i+1, len(tbl[i%2]))):
    #   if i == k:
    #     tbl[i%2][k] = 1
    #   elif i < k:
    #     tbl[i%2][k] = 0
    #   elif k == 0:
    #     tbl[i%2][k] = 1
    #   else:
    #     tbl[i%2][k] = (tbl[(i-1)%2][k-1] + tbl[(i-1)%2][k]) % m
  return tbl[(n-1)%2][a]

n, a, b = map(int, input().split(' '))
c = 0
for i in range(1, n+1):
  if i == a or i == b:
    continue
  c += comb_mod(n, i, 1000000007)
print(c)
Problem p03059 (python)

Fixed submission:
I = list(map(int, input().split()))
A = I[0]
B = I[1]
T = I[2]

ans = (T // A) * B

print(ans)

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


N = int(input())
A = list(map(int, input().split()))
L = [0 for i in range(N)]
R = [0 for i in range(N)]
T = [0 for i in range(N)]

for i in range(N):
    if i == 0:
        L[i] = 0
    else:
        L[i] = gcd(L[i-1], A[i-1])
for i in range(N-1, 0, -1):
    if i == N-1:
        R[i] = 0
    else:
        R[i] = gcd(R[i+1], A[i+1])
for i in range(N):
    T[i] = gcd(L[i], R[i])

print(max(T))
Problem p03239 (python)

Fixed submission:
N, T = list(map(int, input().split(" ")))
c = []
t = []

for i in range(N):
    ci, ti = input().split(" ")
    c.append(int(ci))
    t.append(int(ti))
if min(t) > T:
    print("TLE\n")

else:
    cost = 10000
    for i in range(N):
        if cost > c[i] and T >= t[i]:
            cost = c[i]
    print(cost)

Buggy submission (verdict: Runtime Error):
N, T = list(map(int, input().split(" ")))
c = []
t = []

for i in range(N):
    ci, ti = input().split(" ")
    c.append(int(ci))
    t.append(int(ti))
if min(t) > T:
    print("TLE\n")

else:
    cost = 10000
    for i in range(N):
        if cost > c[i] and T >= t[i]:
            cost = c[i]
    print(
Problem p03292 (python)

Fixed submission:
a = list(map(int, input().split()))
a = sorted(a)
print(abs(a[2] - a[0]))

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
a = sorted(a)
print(abs(a[3] - a[1]))
Problem p03369 (python)

Fixed submission:
s = input()
a = 0
for i in range(3):
	if s[i:i+1] != 'x':
		a += 100
print(700 + a)

Buggy submission (verdict: Runtime Error):
s = input()
a = 0
for i in range(3):
	if s[i:i+1] != 'x':
      a += 100
print(700 + a)

Buggy submission (verdict: Runtime Error):
s = input()
a = 0
for char in s:
	if char != 'x':
    	a++
print(700+a*100)
Problem p03385 (python)

Fixed submission:
s = input()
c = ''.join(sorted(s))
print('Yes') if c == 'abc' else print('No')

Buggy submission (verdict: Runtime Error):
s = input()
s = sorted(s)
if s = ['a','b','c']:
    print('Yes')
else:
    print('No')
Problem p03399 (python)

Fixed submission:
a = [0, 0, 0, 0]
for i in range(4):
    a[i] = int(input())
print(min(a[0],a[1]) + min(a[2], a[3]))

Buggy submission (verdict: Runtime Error):
for i in range(4):
    a[i] = int(input())
print(min(a[0],a[1]) + min(a[2], a[3]))
Problem p03547 (python)

Fixed submission:
x,y = input().split()
print('<') if x < y else print('>') if x > y else print('=')

Buggy submission (verdict: Runtime Error):
x,y = input().split()
print('<') if x < y elif x > y print('>') else print('=')
Problem p02761 (python)

Fixed submission:
def f():
    N, M = map(int, input().split(" "))
    S = {}
    for _ in range(M):
        s, c = map(int, input().split(" "))
        if S.get(s) is not None and S.get(s) != c:
            return -1
        S[s] = min([S.get(s, 10000), c])

    l = []
    for i in range(1000):
        str_i = str(i)
        if len(str_i) != N:
            continue

        flag = all([
            int(str_i[k - 1]) == v
            for k, v in S.items()
        ])
    
        if flag:
            l.append(i)

    if not l:
        return -1
    
    return min(l)

print(f())

Buggy submission (verdict: Runtime Error):
def f():
    N, M = map(int, input().split(" "))
    S = {}
    for _ in range(M):
        s, c = map(int, input().split(" "))
        if S.get(s) is not None and S.get(s) != c:
            
            return -1
        S[s] = min([S.get(s, 10000), c])

    min_digit = min(S.keys())
    if S[min_digit] == 0:
        if min_digit == 0:
            return 0
        else:
            return -1

    l = []
    for i in range(N):
        if i < min_digit:
            default = 1
        else:
            default = 0
        l.append(str(S.get(i + 1, default)))

    return "".join(l)

print(f())

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

def f():
    S = {}
    for _ in range(M):
        s, c = map(int, input().split(" "))
        if S.get(s) is not None and S.get(s) != c:
            
            return -1
        S[s] = min([S.get(s, 10000), c])

    digit = max(S.keys())

    if S[digit] == 0:
        return -1

    N = []
    for i in range(digit):
        N.append(str(S.get(i + 1, 0)))

    return "".join(N)

print(f())
Problem p02767 (python)

Fixed submission:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split(" "))))

M = np.zeros((100, A.shape[0]))

for i in range(100):
    M[i, :] = A - (i + 1)

t = M * M


t1 = np.sum(t, axis=1)


print(int(np.min(t1)))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split(" "))))

M = np.zeros((100, A.shape[0]))

for i in range(100):
    M[i, :] = A - (i + 1)

t = M * M


t1 = np.sum(t, axis=1)


print(int(np.min(t1)))
Problem p02786 (python)

Fixed submission:
from math import log

H = int(input())

print(sum(
    2 ** i
    for i in range(int(log(H, 2)) + 1)
))

Buggy submission (verdict: Runtime Error):
from math import log2

H = int(input())

print(sum(
    2 ** i
    for i in range(int(log2(H)) + 1)
))
Problem p02813 (python)

Fixed submission:
import sys
from functools import reduce
import itertools


input = sys.stdin.readline

N = int(input())
P = tuple(map(int, input().split(" ")))
Q = tuple(map(int, input().split(" ")))

if (P == Q):
    print(0)
else:
    res = list(filter(lambda t: t[1] == P or t[1] == Q, enumerate(itertools.permutations(range(1, N + 1)))))

    print(abs(res[0][0] - res[1][0]))

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


input = sys.stdin.readline

N = int(input())
P = tuple(map(int, input().split(" ")))
Q = tuple(map(int, input().split(" ")))


res = list(filter(lambda t: t[1] == P or t[1] == Q, enumerate(itertools.permutations(range(1, N + 1)))))

print(abs(res[0][0] - res[1][0]))
Problem p02817 (python)

Fixed submission:
[s, t] = input().split(" ")
print(t + s)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
print(t + s)
Problem p02917 (python)

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

res = B[0]
for i in range(1,N-1):
	res += min(B[i],B[i-1])
res += B[N-2]

print(res)

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

res = B[0]
for i in range(1,N-1):
	res += min(B[i],B[i-1])
res += B[N-2]

print(res)
Problem p03264 (python)

Fixed submission:
k = int(input())
q = k // 2
m = k %  2

k_odd  = q + m
k_even = q

ans = k_odd * k_even
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = [int(i) for i in input().split()]

cnt = 0

for a in range(1,N+1):
    for b in range(1,N+1):
        if (a+b) % K !=0:
            continue
        else:
            for c in range(1,N+1):
                if (a+c) % K !=0 || (b+c) % K !=0:
                    continue
                cnt = cnt+1

print(cnt)
Problem p03696 (python)

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

d = S
while d.count('()')!=0:
	d = d.replace('()','')

l = d.count('(')
r = d.count(')')

z = '('*r + S + ')'*l

print(z)

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

d = S.replace('()','')

l = d.count('(')
r = d.count(')')

z = '('*l + d + ')'*r

print(z)
Problem p02780 (python)

Fixed submission:
import numpy as np
n, d = list(map(int, input().split()))
a = list(map(int, input().split()))
Max = 0
Sum = 0
a = np.array(a)
a = a*0.5 + 0.5
ans = []

if d == 1:
  print(max(a))
elif n == d:
  print(sum(a))
else:
  for i in range(n-d+1):
    left = a[i]
    right = a[i+d-1]

    if i == 0:
      Sum = sum(a[i:i+d])
      Max = sum(a[i:i+d])
      ans = a[i:i+d]
    else:
      Sum = Sum + right - a[i-1]

      if Sum >= Max:
        Max = Sum
        ans = a[i:i+d]
      else:
        pass

  print(sum(ans))

Buggy submission (verdict: Runtime Error):
import numpy as np
n, d = list(map(int, input().split()))
a = list(map(int, input().split()))
Max = 0
Sum = 0

for i in range(n-d+1):
  left = a[i]
  right = a[i+d-1]
  
  if i == 0:
    Sum = sum(a[i:i+d])
  else:
    Sum = Sum + right - left
    
  if Sum >= Max:
    Max = Sum
    ans = a[i:i+d]    
  else:
    pass

ans = np.array(ans)
ans = ans*0.5 + 0.5
print(sum(ans))

Buggy submission (verdict: Runtime Error):
import numpypy as np
n, d = list(map(int, input().split()))
a = list(map(int, input().split()))
a = np.array(a)

Max = 0

for i in range(n-d+1):
  Sum = a[i:i+d].sum()
 
  if Sum >= Max:
    Max = Sum
    ans = a[i:i+d]    
  else:
    pass
  
ans = ans*0.5 + 0.5
print(ans.sum())
Problem p02911 (python)

Fixed submission:
import numpy as np

N, K, Q = map(int, input().split())
A = np.array([int(input()) for i in range(Q)])
  
points = np.full(N, K-Q)

for i in range(0, Q):
  points[A[i]-1] += 1
 
for i in points:
  if i > 0:
    print("Yes")
  else:
    print("No")

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

N, K, Q = map(int, input().split())
A = np.array([int(input()) for i in range(Q)])
  
points = K - Q
for i in range(1, N+1):
  correct_num = len(np.where(A==i)[0])
  fin_point = points[i-1] + correct_num
  
  if fin_point > 0:
    print("Yes")
  else:
    print("No")
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))

pos = 0
steps = 0
max_step = 0
fin = False

if len(h) == 1:
  print(0)
else:
  while fin == False:
    if h[pos] >= h[pos+1]:
      steps += 1
    else:
      steps=0

    pos += 1
    if steps > max_step:
      max_step = steps

    if pos == n-1:
      fin = True

  print(max_step)

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

pos = 0
steps = 0
max_step = 0
fin = False

while fin == False:
  if h[pos] >= h[pos+1]:
    steps += 1
  else:
    steps=0
    
  pos += 1
  if steps > max_step:
    max_step = steps
   
  if pos == n-1:
    fin = True

print(max_step)
Problem p02755 (python)

Fixed submission:
cmin = lambda a,b : a if a<b else b
cmax = lambda a,b : a if a>b else b
iin = lambda : int(input())
lin = lambda : list(map(int,input().split()))
rin = lambda n : [int(input()) for _ in range(n)]

a,b = map(int,input().split())

at = []
for i in range(1,1500):
    if int(i*0.08)==a: at += [i]

bt = []
for i in range(1,1500):
    if int(i*0.1)==b: bt += [i]

ans = set(at) & set(bt)

print(min(ans) if ans else -1)

Buggy submission (verdict: Runtime Error):
cmin = lambda a,b : a if a<b else b
cmax = lambda a,b : a if a>b else b
iin = lambda : int(input())
lin = lambda : list(map(int,input().split()))
rin = lambda n : [int(input()) for _ in range(n)]

a,b = map(int,input().split())

ia = a//(0.08)
la = int(ia*0.08)
while la==a:
    ia += 1
    la = int(ia*0.08)
ia -= 1
lla =int(ia)

ia = a//0.08)
la = int(ia*0.08)
while la==a:
    ia -= 1
    la = int(ia*0.08)
ia = int(ia)+1

ib = b//(0.1)
lb = int(ib*0.1)
while lb==b:
    ib += 1
    lb = int(ib*0.1)
ib -= 1
llb = int(ib)

ib = b//(0.1)
lb = int(ib*0.1)
while lb==b:
    ib -= 1
    lb = int(ib*0.1)
ib = int(ib)+1

sa = set(range(ia,lla+1))
sb = set(range(ib,llb+1))
ans = sa & sb
print(min(ans) if ans else -1)
Problem p02843 (python)

Fixed submission:
X = int(input())
ans = 0
tmp = str(X)
if len(tmp) > 2:
    upper = int(tmp[:-2])
    under = int(tmp[-2:])
    if upper * 5 < under:
        ans = 0
    else:
        ans = 1
else:
    ans = 0

print(ans)

Buggy submission (verdict: Runtime Error):
X = int(input())
ans = 0
tmp = str(X)
if len(tmp) >= 2:
    upper = int(tmp[:-2])
    under = int(tmp[-2:])
    if upper * 5 < under:
        ans = 0
    else:
        ans = 1
else:
    ans = 0

print(ans)
Problem p02868 (python)

Fixed submission:
from heapq import heappop, heappush
N, M = map(int, input().split())
route_list = [[] for _ in range(N)]
for i in range(M):
    L, R, C = map(int, input().split())
    route_list[L-1].append((R-1, C))
for i in range(N-1):
    route_list[i+1].append((i, 0))

distance = [float("inf")] * N
distance[0] = 0  # 初期のノードの距離は0とする
q = [(0, 0)]

while q:
    _, u = heappop(q)
    for des, cost in route_list[u]:
        if distance[des] > distance[u] + cost:
            distance[des] = distance[u] + cost
            heappush(q, (distance[des], des))

print(distance[-1] if distance[-1] != float("inf") else -1)

Buggy submission (verdict: Runtime Error):
from heapq import heappop, heappush
N, M = map(int, input().split())
route_list = [[] for _ in range(N)]
for i in range(M):
    L, R, C = map(int, input().split())
    route_list[L-1].append((R-1, C))
for i in range(N-1):
    route_list[i+1].append((i, 0))

distance = [float("inf")] * node_num
distance[0] = 0  # 初期のノードの距離は0とする
q = [(0, 0)]

while q:
    _, u = heappop(q)
    for des, cost in route_list[u]:
        if distance[des] > distance[u] + cost:
            distance[des] = distance[u] + cost
            heappush(q, (distance[des], des))

print(distance[-1] if distance[-1] != float("inf") else -1)

Buggy submission (verdict: Runtime Error):
from heapq import heappop, heappush
N, M = map(int, input().split())
node_num = N
route_list = [[] for _ in range(N)]
for i in range(M):
    L, R, C = map(int, input().split())
    route_list[L-1].append((R-1, C))
for i in range(N-1):
    route_list[i+1].append(i)

distance = [10**9] * node_num
distance[0] = 0  # 初期のノードの距離は0とする
q = [(0, 0)]
 
while q:
    _, u = heappop(q)
    for des, cost in route_list[u]:
        if distance[des] > distance[u] + cost:
            distance[des] = distance[u] + cost
            heappush(q, (distance[des], des))
 
print(distance[-1] if distance[-1] != 10**9 else -1)
Problem p02882 (python)

Fixed submission:
import math
a, b, x = map(int, input().split())

if abs(((a**2) * b) / 2 - x) < 1e-2:
    print(45)
elif ((a**2) * b) == x:
    print(0)
elif ((a**2) * b) / 2 < x:
    atan = math.degrees(math.atan((a**3)/(2*b*(a**2) - 2*x)))
    print(90-atan)
else:
    atan = math.degrees(math.atan((2*x)/(a*(b**2))))
    print(90-atan)

Buggy submission (verdict: Runtime Error):
import math
a, b, x = map(int, input().split())

if abs(((a**2) * b) / 2 - x) < 1e-5:
    print(45)
elif ((a**2) * b) / 2 < x:
    atan = math.degrees(math.atan((a**3)/(2*b*(a**2) - 2*x)))
    print(90-atan)
else:
    atan = math.degrees(math.atan((2*x)/(a*(b**2))))
    print(90-atan)

Buggy submission (verdict: Runtime Error):
import math
a, b, x = map(int, input().split())
if ((a**2) * b) / 2 == x:
    print(45)
elif ((a**2) * b) / 2 < x:
    atan = math.degrees(math.atan((a**3)/(2*b*(a**2) - 2*x)))
    print(90-atan)
else:
    atan = math.degrees(math.atan((2*x)/(a*(b**2))))
    print(90-atan)
Problem p02924 (python)

Fixed submission:
n = int(input())
ans=0
ans = (n-1)*(n)//2
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans=0
ans = (n-1)*(n)//2
print(ians)
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

N,Q = map(int, input().split())
graph = [[] for _ in range(N)]
counter = [0]*N
for i in range(N-1):
    a,b = map(int, input().split()) 
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

for i in range(Q):
    p, x = map(int, input().split())
    counter[p-1] += x

def dfs(v, parent):
    for i in graph[v]:
        if i==parent:
            continue
        counter[i] += counter[v]
        dfs(i, v)
        
dfs(0, -1)
print(*counter)

Buggy submission (verdict: Runtime Error):
N,Q = map(int, input().split())
graph = [[] for _ in range(N)]
counter = [0]*N
for i in range(N-1):
    a,b = map(int, input().split()) 
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

for i in range(Q):
    p, x = map(int, input().split())
    counter[p-1] += x

def dfs(v, parent):
    for i in graph[v]:
        if i==parent:
            continue
        counter[i] += counter[v]
        dfs(i, v)
        
dfs(0, -1)
print(*counter)