Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#標準入力
N,Q = list(map(int,input().split()))
tree = []
for i in range(N-1):
  tmp = [int(i) for i in input().split()]
  tree.append(tmp)

x_list = []
for i in range(Q):
  tmp = [int(i) for i in input().split()]
  x_list.append(tmp)

#print(N)
#print(Q)
#print(tree)
#print(x_list)
#関数

#l:リスト　x:加算値
def saiki(result, chil_list, pos, l, x):
  #print(result)
  if not l:
    result[pos] += x
  else:
    result[pos] += x
    for j in l:
      #print(j)
      saiki(result, chil_list, j, chil_list[j], x)
    

#子リストの作成
children=[]
for i in range(N+1):
  children.append([])
for i in range(N-1):
  children[tree[i][0]].append(tree[i][1])

#print(children)
#結果リストの初期化
result = [0] * (N+1)

for i in range(Q):
  kasan_root = x_list[i][0]
  kasan = x_list[i][1]
  
  if not children[kasan_root]:
    result[kasan_root] += kasan
  else:
    saiki(result, children, kasan_root, children[kasan_root], kasan)
    #result[kasan_root] += kasan
  
result.pop(0)
print(*result)

Fixed submission:
n,q = map(int,input().split())
rl = [0] * n
al = [0] * n
for i in range(n-1):
    a,b = map(int,input().split())
    rl[b-1] = a -1
for j in range(q):
    p,x = map(int,input().split())
    al[p-1] += x
for k in range(n):
    if k == 0:
        pass
    else:
        al[k] += al[rl[k]]
print(*al)

Buggy python submission (verdict: Runtime Error):
#標準入力
N,Q = list(map(int,input().split()))
tree = []
for i in range(N-1):
  tmp = [int(i) for i in input().split()]
  tree.append(tmp)

x_list = []
for i in range(Q):
  tmp = [int(i) for i in input().split()]
  x_list.append(tmp)

#print(N)
#print(Q)
#print(tree)
#print(x_list)
#関数
  
def subtree(subtree, x):
  for node in subtree:
    result[node] += x

#l:リスト　x:加算値
def saiki(result, chil_list, pos, l, x):
  #print(result)
  if not l:
    result[pos] += x
  else:
    result[pos] += x
    for j in l:
      #print(j)
      saiki(result, chil_list, j, chil_list[j], x)
    

#子リストの作成
children=[]
for i in range(N+1):
  children.append([])
for i in range(N-1):
  children[tree[i][0]].append(tree[i][1])

#print(children)
#結果リストの初期化
result = [0] * (N+1)

for i in range(Q):
  kasan_root = x_list[i][0]
  kasan = x_list[i][1]
  
  if not children[kasan_root]:
    result[kasan_root] += kasan
  else:
    saiki(result, children, kasan_root, children[kasan_root], kasan)
    #result[kasan_root] += kasan
  
result.pop(0)
print(*result)

Fixed submission:
n,q = map(int,input().split())
rl = [0] * n
al = [0] * n
for i in range(n-1):
    a,b = map(int,input().split())
    rl[b-1] = a -1
for j in range(q):
    p,x = map(int,input().split())
    al[p-1] += x
for k in range(n):
    if k == 0:
        pass
    else:
        al[k] += al[rl[k]]
print(*al)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

power = 0
monster = 0
if A[0] > B[0]:
  reslut = B[0]
  kurikoshi = 0
else:
  reslut = A[0]
  kurikoshi = B[0] - A[0]  

for i in range(1, N):
  if A[i] - kurikoshi > 0:
    nokori = A[i] - kurikoshi
    result += kurikoshi
    if nokori > B[i]:
      result += B[i]
      kurikoshi = 0
    else:
      result += nokori
      kurikoshi = B[i] - nokori
  elif A[i] - kurikoshi <= 0:
    result += A[i]
    kurikoshi = B[i]
if A[N] > kurikoshi:
  result += kurikoshi
  print(result)
else:
  result += A[N]
  print(result)
  

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

if A[0] > B[0]:
  result = B[0]
  kurikoshi = 0
else:
  result = A[0]
  kurikoshi = B[0] - A[0]  

for i in range(1, N):
  if A[i] - kurikoshi > 0:
    nokori = A[i] - kurikoshi
    result += kurikoshi
    if nokori > B[i]:
      result += B[i]
      kurikoshi = 0
    else:
      result += nokori
      kurikoshi = B[i] - nokori
  elif A[i] - kurikoshi <= 0:
    result += A[i]
    kurikoshi = B[i]
if A[N] > kurikoshi:
  result += kurikoshi
  print(result)
else:
  result += A[N]
  print(result)
Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())

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

A_set = set(A)
if len(A_set)==1:
  val = max(A_set)
  for i in range(N):
    print(val)
  sys.exit()

second_max = sorted(A_set)[-2]
#print(A_set)
#print(second_max)
#print('--')

tmp_max = max(set(A))
tmp_max_list = [i for i, x in enumerate(A) if x == tmp_max]
#print(tmp_max_list)
if tmp_max_list > 1:
  for i in range(N):
    print(tmp_max)
  sys.exit()

tmp_list = [tmp_max] * N
tmp_list[A.index(tmp_max)]=tmp_max
#[式 for 任意の変数名 in イテラブルオブジェクト if 条件式]
#l_odd = [i for i in l if not i % 2 == 0]
for i in range(N):
  print(tmp_list[i])


Fixed submission:
n=int(input())
l=[int(input()) for i in range(n)]
a=sorted(l)
b=a[-1]
c=a[-2]
for i in l:
  if i!=b:
    print(b)
  else:
    print(c)

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

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

A_set = set(A)
if len(A_set)==1:
  val = A[0]
  for i in range(N):
    print(val)
  sys.exit()

else:
  second_max = sorted(A_set)[-2]

tmp_max = max(set(A))
tmp_max_list = [i for i, x in enumerate(A) if x == tmp_max]

tmp_list = [tmp_max] * N
#[式 for 任意の変数名 in イテラブルオブジェクト if 条件式]
#l_odd = [i for i in l if not i % 2 == 0]
for i in len(tmp_max_list):
  tmp_list[tmp_max_list[i]]=second_max

for i in range(N):
  print(tmp_list[i])


Fixed submission:
n=int(input())
l=[int(input()) for i in range(n)]
a=sorted(l)
b=a[-1]
c=a[-2]
for i in l:
  if i!=b:
    print(b)
  else:
    print(c)

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

A = []
for i in range(N):
  tmp = int(input())
  A.append(tmp)
  
for i in range(N):
  tmp_list = A[:]
  tmp_list.pop(i)
  #print(tmp_list)
  tmp_set = set(tmp_list)
  print(max(tmp_set))

Fixed submission:
n=int(input())
l=[int(input()) for i in range(n)]
a=sorted(l)
b=a[-1]
c=a[-2]
for i in l:
  if i!=b:
    print(b)
  else:
    print(c)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = [int(i) for i in input().split()]

count = 0
for i in range(n-2):
  a = p[i]
  b = p[i+1]
  c = p[i+2]
  if b > a and b < c:
    count+=1
  else b > c and b < a:
    count+=1
print(count)

Fixed submission:
n = int(input())
p = [int(i) for i in input().split()]

count = 0
for i in range(n-2):
  a = p[i]
  b = p[i+1]
  c = p[i+2]
  if b > a and b < c:
    count+=1
  elif b > c and b < a:
    count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
X, N = map(int, input().split(" "))

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

# p = list(map(int, input().split(" ")))

go = True
absolute = 1
plus = True

if X not in p:
  print(X)
else:
  while go:
    if plus:
      target = X - absolute
      if target not in p:
        print(target)
        go = False
      plus = False
    else:
      target = X + absolute
      if target not in p:
        print(target)
        go = False
      absolute += 1
      plus = True

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

if N > 0:
  p = list(map(int, input().split(" ")))
else:
  p = []

go = True
absolute = 1
plus = True

if X not in p:
  print(X)
else:
  while go:
    if plus:
      target = X - absolute
      if target not in p:
        print(target)
        go = False
      plus = False
    else:
      target = X + absolute
      if target not in p:
        print(target)
        go = False
      absolute += 1
      plus = True
Buggy python submission (verdict: Time Limit Exceeded):
T = input()
result = ""

for number, letter in zip(range(len(T)) ,T):
  if letter == "?":
    """
    # 最初の文字が?の時.
    if number == 0:
      result += "P"
    elif number == len(T) - 1:
      result += "D"
    # 一つ前の文字が"D"の時.
    elif result[number - 1] == "D":
      result += "P"
    # 一つ前の文字が"P"の時.
    elif result[number - 1] == "P":
      result += "D"
    """
    result += "D"
  else:
    result += letter

print(result)

Fixed submission:
T = input()
print(T.replace("?", "D"))
Buggy python submission (verdict: Runtime Error):
import math
 
R = int(input())
 
print(2*math.pi*R)

Fixed submission:
nm = input().split(' ')

N, M = int(nm[0]), int(nm[1])

A = input().split()

A_sum = 0

for i in A:
    A_sum += int(i)

if A_sum - N <= 0:
    print( N - A_sum )
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
l = int(input())
A = input().split(" ")
unique = set(A)
def combination(number):
  if number <= 1:
    return 0
  else:
    return int(number * (number - 1) / 2)
def caluculate(string):
  data = memo[string]
  if data <= 1:
    return(0)
  else:
    return(data - 1) 
total = 0
memo = {}
for i in unique:
  times = A.count(i)
  memo[i] = times
  total += combination(times)
for i in A:
  print(total - caluculate(i))

Fixed submission:
inp = input().split(" ")
N, M = int(inp[0]), int(inp[1])
# print(N, M)

def count(number):
  if number == 1 or number == 0:
    return 0
  else:
    return number * (number - 1) / 2

print(int(count(N) + count(M)))
Buggy python submission (verdict: Runtime Error):
A = []
for i in range(0, 3):
  a = input().split(' ')
  for j in a:
    A.append(int(j))

# print(A)
N = int(input())

for i in range(0, N):
  data = int(input())
  if data in A:
    A[A.index(data)] = 0

# horizonal
if sum(A[0:3]) == 0 \
or sum(A[3:6]) == 0 \
or sum(A[6:9]) == 0 \
# diagonal
or A[0] + A[4] + A[8] == 0 \
or A[2] + A[4] + A[6] == 0 \
# Virtical
or A[0] + A[3] + A[6] == 0 \
or A[1] + A[4] + A[7] == 0 \
or A[2] + A[5] + A[8] == 0: 
  print("Yes")
else:
  print("No")

Fixed submission:
A = []
for i in range(0, 3):
  a = input().split(' ')
  for j in a:
    A.append(int(j))

# print(A)
N = int(input())

for i in range(0, N):
  data = int(input())
  if data in A:
    A[A.index(data)] = 0

if sum(A[0:3]) == 0 \
or sum(A[3:6]) == 0 \
or sum(A[6:9]) == 0 \
or A[0] + A[4] + A[8] == 0 \
or A[2] + A[4] + A[6] == 0 \
or A[0] + A[3] + A[6] == 0 \
or A[1] + A[4] + A[7] == 0 \
or A[2] + A[5] + A[8] == 0: 
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
if inp.startswith("A") and inp[2:len(inp)-1].count("C") ==  1 and inp[1:inp.find("C", 0, len(inp) - 1)] == inp[1:inp.find("C", 0, len(inp) - 1)].lower() and inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)] == inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)].lower():
  print("AC")
else:
  print("WA")

Fixed submission:
inp = input()

#print(inp.startswith("A"))
#print(inp[2:len(inp)-1].count("C") ==  1)
#print(inp[1:inp.find("C", 0, len(inp) - 1)] == inp[1:inp.find("C", 0, len(inp) - 1)].lower())
#print(inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)] == inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)].lower())

if inp.startswith("A") and inp[2:len(inp)-1].count("C") ==  1 and inp[1:inp.find("C", 0, len(inp) - 1)] == inp[1:inp.find("C", 0, len(inp) - 1)].lower() and inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)] == inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)].lower():
  print("AC")
else:
  print("WA")
Buggy python submission (verdict: Time Limit Exceeded):
import copy

def get_diff(value, array):
  diff = 0
  for i in array:
    diff += abs(value - i)
  return diff

length = int(input())
inp = input().split(' ')
A = []
for i in range(0, length):
  A.append(int(inp[i]) - i - 1)

initial = int(sum(A)/len(A))
initial_diff = int(get_diff(initial, A))

end_flag = 1
initial_plus = copy.copy(initial)
max_diff = copy.copy(initial_diff)
# print(A)
# print(initial)
# print(initial_diff)

while end_flag == 1:
  initial_plus += 1
  if get_diff(initial_plus, A) < max_diff:
    max_diff = get_diff(initial_plus, A)
    print(max_diff)
  else:
    end_flag = 0

plus_max_diff = max_diff

end_flag = 1
initial_plus = copy.copy(initial)
max_diff = copy.copy(initial_diff)

while end_flag == 1:
  initial_plus -= 1
  if get_diff(initial_plus, A) < max_diff:
    max_diff = get_diff(initial_plus, A)
  else:
    end_flag = 0
    
minus_max_diff = max_diff

print(min(plus_max_diff, initial_diff, minus_max_diff))

Fixed submission:
"""
中央値を求めれば良い.
"""
def get_diff(value, array):
  diff = 0
  for i in array:
    diff += abs(value - i)
  return diff

length = int(input())
inp = input().split(' ')
A = []
for i in range(0, length):
  A.append(int(inp[i]) - i - 1)

A.sort()

# print(A)

# odd numbers
if len(A) % 2 == 1:
  center_number = A[len(A) // 2]
else:
  center_number = int(A[len(A) // 2 ] + A[len(A) // 2]) / 2

# print(center_number)
print(int(get_diff(center_number, A)))
Buggy python submission (verdict: Runtime Error):
n, k = input().split()

q, mod = divmod(int(n) - 1, int(k) - 1)

if mod == 0:
  print(q)
else:
  print(q + 1)

Fixed submission:
inp = input()
print(list(inp).count("+") - list(inp).count("-"))
Buggy python submission (verdict: Runtime Error):
X, N = map(int, input().split())
p_list = list(map(int, input().split()))
all_list = range(1, 101)

not_p_list = list(set(all_list)-set(p_list))
ans_list = []

for i in not_p_list:
    j = abs(i - X)
    ans_list.append(j)

# print(ans_list)

ans = min(ans_list)
minus_ans = -1 * ans

#print(ans, minus_ans)

if (minus_ans + X) in not_p_list:
    print(minus_ans + X)
else:
    print(ans + X)


Fixed submission:
X, N = map(int, input().split())
p_list = list(map(int, input().split()))
all_list = range(0, 151)

not_p_list = list(set(all_list)-set(p_list))
ans_list = []

if N == 0:
    print(X)
else:
    for i in not_p_list:
        j = abs(i - X)
        ans_list.append(j)

    # print(ans_list)

    ans = min(ans_list)
    minus_ans = -1 * ans

    #print(ans, minus_ans)

    if (minus_ans + X) in not_p_list:
        print(minus_ans + X)
    else:
        print(ans + X)

Buggy python submission (verdict: Runtime Error):
X, N = map(int, input().split())
p_list = list(map(int, input().split()))
all_list = range(1, 101)

not_p_list = list(set(all_list)-set(p_list))
ans_list = []

for i in not_p_list:
    j = abs(i - X)
    ans_list.append(j)

# print(ans_list)

ans = min(ans_list)
minus_ans = -1 * ans

print(ans, minus_ans)

if (minus_ans + X) in not_p_list:
    print(minus_ans + X)
else:
    print(ans + X)


Fixed submission:
X, N = map(int, input().split())
p_list = list(map(int, input().split()))
all_list = range(0, 151)

not_p_list = list(set(all_list)-set(p_list))
ans_list = []

if N == 0:
    print(X)
else:
    for i in not_p_list:
        j = abs(i - X)
        ans_list.append(j)

    # print(ans_list)

    ans = min(ans_list)
    minus_ans = -1 * ans

    #print(ans, minus_ans)

    if (minus_ans + X) in not_p_list:
        print(minus_ans + X)
    else:
        print(ans + X)
Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator

# ĺĽĺ
n = int(input())
a_list = list(map(int, input().split()))

ans = functools.reduce(operator.mul, a_list)

if ans > 10 ** 18:
    ans = -1
else:
    pass
print(ans)


Fixed submission:
import functools
import operator

n = int(input())
a_list = list(map(int, input().split()))

if 0 in a_list:
    ans = 0
else:
    k = len(a_list) - a_list.count(1)
    # print(k)
    if k > 60:
        ans = -1
    else:
        ans = functools.reduce(operator.mul, a_list)
        if ans > 10 ** 18:
            ans = -1
        else:
            pass
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
import math


def gcd(*numbers):
    return reduce(math.gcd, numbers)


K = int(input())
gcdsum = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            #print(gcd(a, b, c))
            gcdsum += int(gcd(a, b, c))
print(gcdsum)


Fixed submission:
from functools import reduce
import math


def gcd(*numbers):
    return reduce(math.gcd, numbers)


K = int(input())
gcdsum = K*K*K
gcd_ab = []
ab_list = []
for a in range(1, K + 1):
    for b in range(1, K + 1):
        #print(str(gcd(a, b))+', a:'+str(a)+', b:'+str(b))
        if gcd(a, b) != 1:
            ab_list.append(a)
            ab_list.append(b)
            gcd_ab.append(ab_list)
            ab_list = []
for ab in gcd_ab:
    ab = gcd(ab[0], ab[1])
    for c in range(1, K+1):
        if gcd(ab, c) != 1:
            #print(gcd(ab, c))
            gcdsum += gcd(ab, c)-1

print(gcdsum)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
ans = int(N)
k_range = N // K
# print(k_range)

if k_range == 0:
    N = N - K
else:
    N_1 = N - (K * k_range)
    N_2 = N - (K * (k_range + 1))
    print(N_1)
    print(N_2)

if abs(N_1) < abs(N_2):
    if ans > abs(N_1):
        ans = abs(N_1)
    else:
        pass
else:
    if ans > abs(N_2):
        ans = abs(N_2)
    else:
        pass
print(ans)


Fixed submission:
N, K = map(int, input().split())
ans = int(N)
N_1 = N
N_2 = N
k_range = N // K
# print(k_range)

if k_range == 0:
    N = N - K
    if ans > abs(N):
        ans = abs(N)
else:
    N_1 = N - (K * k_range)
    N_2 = N - (K * (k_range + 1))

if abs(N_1) < abs(N_2):
    if ans > abs(N_1):
        ans = abs(N_1)
    else:
        pass
else:
    if ans > abs(N_2):
        ans = abs(N_2)
    else:
        pass
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ans = int(N)
while (N > 0):
    N = N - K
    # print(N)
if ans > abs(N):
    ans = abs(N)
print(ans)


Fixed submission:
N, K = map(int, input().split())
ans = int(N)
N_1 = N
N_2 = N
k_range = N // K
# print(k_range)

if k_range == 0:
    N = N - K
    if ans > abs(N):
        ans = abs(N)
else:
    N_1 = N - (K * k_range)
    N_2 = N - (K * (k_range + 1))

if abs(N_1) < abs(N_2):
    if ans > abs(N_1):
        ans = abs(N_1)
    else:
        pass
else:
    if ans > abs(N_2):
        ans = abs(N_2)
    else:
        pass
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ans = int(N)
while (N > 0):
    N = N - K
    if ans > abs(N):
        ans = abs(N)
    # print(N)
print(ans)


Fixed submission:
N, K = map(int, input().split())
ans = int(N)
N_1 = N
N_2 = N
k_range = N // K
# print(k_range)

if k_range == 0:
    N = N - K
    if ans > abs(N):
        ans = abs(N)
else:
    N_1 = N - (K * k_range)
    N_2 = N - (K * (k_range + 1))

if abs(N_1) < abs(N_2):
    if ans > abs(N_1):
        ans = abs(N_1)
    else:
        pass
else:
    if ans > abs(N_2):
        ans = abs(N_2)
    else:
        pass
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
import math

N = int(input())
Al = list(map(int, input().split()))
d_di = {}
d_in = {}

counter = Counter(Al)

As_l = list(set(Al))

for n in As_l:
    cnt = int(counter[n])
    if cnt > 1:
        d_di[n] = (math.factorial(cnt) // (2 * math.factorial(cnt - 2)))
    else:
        pass
    if cnt > 2:
        d_in[n] = (math.factorial(cnt-1) // (2 * math.factorial(cnt - 3)))
    else:
        d_in[n] = 1
# print(d_di)
# print(d_in)
total = sum(v for v in d_di.values())
for k in Al:
    ans = total - (counter[k]-1)
    if ans < 0:
        ans = 0
    else:
        pass
    print(ans)


Fixed submission:
from collections import Counter
import math

N = int(input())
Al = list(map(int, input().split()))
d_di = {}
#d_in = {}
counter = Counter(Al)
As_l = list(set(Al))
for n in As_l:
    cnt = int(counter[n])
    if cnt > 1:
        d_di[n] = (math.factorial(cnt) // (2 * math.factorial(cnt - 2)))
    else:
        pass
#    if cnt > 2:
#        d_in[n] = (math.factorial(cnt-1) // (2 * math.factorial(cnt - 3)))
#    else:
#        d_in[n] = 1
# print(d_di)
# print(d_in)
total = sum(v for v in d_di.values())
for k in Al:
    ans = total - (counter[k]-1)
    if ans < 0:
        ans = 0
    else:
        pass
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))

if 0 in A:
    print(0)
    exit()

r = 1
for a in A:
    r *= a

if r > 10**18:
    print(-1)
else:
    print(r)

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

if 0 in A:
    print(0)
    exit()

r = 1
for a in A:
    r *= a

    if r > 10**18:
        print(-1)
        exit()

print(r)

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

r = 1
for a in A:
    r *= a

if r > 10**18:
    print(-1)
else:
    print(r)

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

if 0 in A:
    print(0)
    exit()

r = 1
for a in A:
    r *= a

    if r > 10**18:
        print(-1)
        exit()

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

a, b, h, m = list(map(int, input().split()))

if m == 0:
	m = 60
if h == 0
	h = 12

if h/12 > m/60:
	k = (h/12 - m/60) * 360
elif h/12 < m/60:
	k = (m/60 - h/12) * 360
else:
	print(0)
	exit()
print(math.sqrt((a**2) + (b**2) - (2 * a * b * math.cos(math.radians(k)))))


Fixed submission:
N = input()

if int(N[-1]) in [2,4,5,7,9]:
	print('hon')
elif int(N[-1]) in [0,1,6,8]:
	print('pon')
else:
	print('bon')
Buggy python submission (verdict: Runtime Error):
import math

a, b, h, m = list(map(int, input().split()))

if m == 0:
	m = 60
if h == 0
	h = 12

if h/12 > m/60:
	k = (h/12 - m/60) * 360
elif h/12 < m/60:
	k = (m/60 - h/12) * 360
else:
	print(0)
	exit()
# print(k)
print(math.sqrt((a**2) + (b**2) - (2 * a * b * math.cos(math.radians(k)))))


Fixed submission:
import math

a, b, h, m = list(map(int, input().split()))
rh = (h + m/60) * 30 
rm = m * 6
rd = abs(rh -rm)
print(math.sqrt((a**2) + (b**2) - (2 * a * b * math.cos(math.radians(rd)))))

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

a, b, h, m = list(map(int, input().split()))


if m == 0:
	m = 60
if h == 0
	h = 12

if h/12 > m/60:
	k = (h/12 - m/60) * 360
elif h/12 < m/60:
	k = (m/60 - h/12) * 360
else:
	print(0)
	exit()
# print(k)
print(math.sqrt((a**2) + (b**2) - (2 * a * b * math.cos(math.radians(k)))))


Fixed submission:
import math

a, b, h, m = list(map(int, input().split()))
rh = (h + m/60) * 30 
rm = m * 6
rd = abs(rh -rm)
print(math.sqrt((a**2) + (b**2) - (2 * a * b * math.cos(math.radians(rd)))))
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
*l, = map(int,input().split())
seenl = [1]
seen = {1}
temp=1
for i in range(k):
  temp=l[temp-1]
  if temp in seen:
    lenloop = len(seenl)-seenl.index(temp)
    r = (k-i-1)%lenloop
    temp = seenl[seenl.index(temp):][r]
    break
  seenl.append(temp)
  seen.add(temp)
print(temp)

Fixed submission:
t,s = [str(input()) for _ in range(2)]
if s[:-1] == t:
	print('Yes')
else:
	print('No')

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = list(map(int, input().split()))
start = 1
seenl = []
seen = set()
for i in range(k):
	start = l[start-1]
	if start in seen:
		loop_len = len(seenl) - seenl.index(start)
		r = (k-i-1)%loop_len
		goal = seenl[seenl.index(start):][r]
		break
	seenl.append(start)
	seen.add(start)
print(goal)

Fixed submission:
t,s = [str(input()) for _ in range(2)]
if s[:-1] == t:
	print('Yes')
else:
	print('No')

Buggy python submission (verdict: Runtime Error):
a, b, c, k = list(map(int, input().split()))
if a > k:
	print(sum(([1] * a)[:k]))
else:
	print(sum([1] * a))

Fixed submission:
t,s = [str(input()) for _ in range(2)]
if s[:-1] == t:
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
a, b, c, k = int(input())
if a > k:
	print(sum(([1] * a)[:k]))
else:
	print(sum([1] * a))

Fixed submission:
a, b, c, k = list(map(int, input().split()))
if k <= a:
	s = k * 1
elif k <= (a+b):
	s = a * 1
else:
	s = (a * 1) + ((k-(a+b)) * (-1))
print(s)