Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
a, b, c, d = 0, 0, 0, 0
for i in range(n):
  s = input()
  if s == 'AC':
    a+=1
  elif s== 'WA':
    b+=1
  elif s=='TLE':
    c+=1
  else:
    d+=1
print("AC x "a)
print("WA x "b)
print("TLE x "c)
print("RE x "d)

Fixed submission:
n = int(input())
a, b, c, d = 0, 0, 0, 0
for i in range(n):
  s = input()
  if s == 'AC':
    a+=1
  elif s== 'WA':
    b+=1
  elif s=='TLE':
    c+=1
  else:
    d+=1
print("AC x {}".format(a))
print("WA x {}".format(b))
print("TLE x {}".format(c))
print("RE x {}".format(d))
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
import math
a = 0
b = 1
for i in range(n):
  a += math.log(x[i], 10)
if a > 18:
  print('-1')
else:
  for i in range(n):
    b *= x[i]
  print(b)

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
a = 1
flag = True
for i in range(n):
  a *= x[i]
  if a > 10**18:
    if 0 in x:
      print(0)
    else:
      print('-1')
    flag = False
    break
if flag:
  print(a)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [[] for i in range(n)]
for i in range(m + 1):
  a, b = map(int, input().split())
  l[a].append(b)
  l[b].append(a)
ans = [-1] * (n+1)
ans[0] = 0
x = [1]
y = []
count = 1
while x != []:
  for i in x:
    for j in l[i]:
      if ans[j] == -1:
        ans[j] = i
        y.append(j)
        count += 1
  x = y
  y = []
print('Yes')
for i in range(2, n+1):
    print(ans[i])


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

#グラフをリストにする
#リストの第i番目の集合は、頂点iが繋がっている頂点の集合である
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 = [-1] * (n+1)
ans[1] = 0

#解（道しるべとなる点）を書き込んでいく
#深さdの点の集合をxに、d＋１の集合をyとする
#yの要素は、l[i]と一致する
x = [1]
y = []
while x != []:
  for i in x:
    for j in l[i]:
      if ans[j] == -1:
        ans[j] = i
        y.append(j)
  x = y
  y = []
print('Yes')
for i in range(2, n+1):
  print(ans[i])
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
c = list(map(int, input().split()))
x = 1
for i in range(k):
  x = c[x-1]
print(x)

Fixed submission:
s = input()
t = input()
u = s + t[-1]
if u == t:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [map(int, input().split())]
s = 1
for i in range(n):
  flag = 0
  for j in range(n-1-i):
    if h[j] <= h[n-1-i] + 1:
      flag += 0
    else:
      flag += 1
  if flag != 0:
    s *= 0
if s = 0:
  print("No")
else:
  print("Yes")


Fixed submission:
a, b, c = map(int, input().split())
if b + c <= a:
  print(0)
else:
  print(b + c - a)
Buggy python submission (verdict: Runtime Error):
S = int(input())

A = [0,0,1]
if S == 1 or S == 2:
  print(0)
elif S == 3:
  print(1)
else:
  for i in range(3,S):
    A += [A[i-1] + A[i-3]]
print(A[i] % (10 ** 9 + 7))

Fixed submission:
S = int(input())
 
A = [0,0,1]
if S == 1 or S == 2:
  print(0)
elif S == 3:
  print(1)
else:
  for i in range(3,S):
    A += [A[i-1] + A[i-3]]
  print(A[i] % (10 ** 9 + 7))

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

A = [0,0,1]
for i in range(3,S):
  A += [A[i-1] + A[i-3]]
print(A[i] % (10 ** 9 + 7))

Fixed submission:
S = int(input())
 
A = [0,0,1]
if S == 1 or S == 2:
  print(0)
elif S == 3:
  print(1)
else:
  for i in range(3,S):
    A += [A[i-1] + A[i-3]]
  print(A[i] % (10 ** 9 + 7))

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

A = [0,0,1]
for i in range(3,S):
  A += [A[i-1] + A[i-3]]
print(A[i]%(10 ** 9 + 7))

Fixed submission:
S = int(input())
 
A = [0,0,1]
if S == 1 or S == 2:
  print(0)
elif S == 3:
  print(1)
else:
  for i in range(3,S):
    A += [A[i-1] + A[i-3]]
  print(A[i] % (10 ** 9 + 7))

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

A = [0,0,1]
for i in range(3,S):
  A += [A[i-1] + A[i-3]]
print(A[i])

Fixed submission:
S = int(input())
 
A = [0,0,1]
if S == 1 or S == 2:
  print(0)
elif S == 3:
  print(1)
else:
  for i in range(3,S):
    A += [A[i-1] + A[i-3]]
  print(A[i] % (10 ** 9 + 7))

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

def retu(n):
  if n == 0 or n == 1 or n == 2:
    return 0
  elif n == 3:
      return 1
  else:
    a = retu(n-1) + retu(n-3)
    return a
print(retu(S))

Fixed submission:
S = int(input())
 
A = [0,0,1]
if S == 1 or S == 2:
  print(0)
elif S == 3:
  print(1)
else:
  for i in range(3,S):
    A += [A[i-1] + A[i-3]]
  print(A[i] % (10 ** 9 + 7))
Buggy python submission (verdict: Runtime Error):
N = int(input())

if N%9 == 0:
  print(Yes)
else:
  print(No)

Fixed submission:
N = int(input())
 
if N%9 == 0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
X = int(input())

if X => 30:
  print('Yes')
else:
  print('No')

Fixed submission:
X = int(input())
 
if X >= 30:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
ai = [int(x) for x in input().split()]


c = 0

for i in range(N):
  if i % 2 == 1 and a[i] % 2 ==1:
    c += 1
  
print(c)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
 
c = 0

for i in range(N):
  if i % 2 == 0 and a[i] % 2 ==1:
    c += 1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

r = []

for i in range(N):
  r = r + [input()]

ac = 0
wa = 0
tle = 0
re = 0

for j in r:
  if j == 'AC':
    ac += 1
  elif j == 'WA':
    wa += 1
  elif j == 'TLE':
    tle += 1
  elif j == 'RE':
    re += 1
print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)

Fixed submission:
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0

for i in range(N):
  j = input()
  if j == 'AC':
    ac += 1
  elif j == 'WA':
    wa += 1
  elif j == 'TLE':
    tle += 1
  else:
    re += 1
print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)
Buggy python submission (verdict: Runtime Error):
aa

Fixed submission:
l,r,d=map(int,input().split())
c=0

for i in range(l,r+1):
    if i%d==0:
        c+=1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
seq=list(map(int,input().split()))
p=1
f=1
for i in range(n):
    p*=seq[i]
    
        
        
if(p>10**18):
        print(-1)
else:
    print(p)


Fixed submission:
n=int(input())
seq=list(map(int,input().split()))
p=1
f=1
c=int(1e18)
if 0 in seq:
    print(0)
else:
    for i in range(n):
        p*=seq[i]
        if p>c:
            print(-1)
            f=0
            break
            
    if f==1:
        print(p)

Buggy python submission (verdict: Runtime Error):
n=int(input())
seq=list(map(int,input().split()))
p=1
f=1
for i in range(n):
	p*=seq[i]
    if(p>=10**18):
		print(-1)
        f=0
        break
if f==1:
  print(p)
       
	

Fixed submission:
n=int(input())
seq=list(map(int,input().split()))
p=1
f=1
c=int(1e18)
if 0 in seq:
    print(0)
else:
    for i in range(n):
        p*=seq[i]
        if p>c:
            print(-1)
            f=0
            break
            
    if f==1:
        print(p)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
seq=list(map(int,input().split()))
v=[False]*n
path=[]
i=seq.index(1)
while True:
        if v[seq[i]-1]==False:
                v[seq[i]-1]=True
                path.append(seq[i])
                i=seq[i]-1
                
        else:
                break
print(path[(k%len(path))])
print(path)
                


Fixed submission:
n,k=map(int,input().split())
seq=list(map(int,input().split()))
v=[False]*n
path=[1]
i=0
v[0]=True
while True:
        if v[seq[i]-1]==False:
                v[seq[i]-1]=True
                path.append(seq[i])
                i=seq[i]-1
                
        else:
                t=seq[i]
                break

ind=path.index(t)
path2=path[ind:]
path1=path[:ind]
x=len(path1)
if k>=x:
        k-=x
        #print(t,ind,path1,path2)
        print(path2[(k%len(path2))])

else:
        print(path1[k])
Buggy python submission (verdict: Runtime Error):
s,w=map(int,input.split())
if w>=s:
  print("unsafe")
else:
  print("safe")

Fixed submission:
s,w=map(int,input().split())
if w>=s:
  print("unsafe")
else:
  print("safe")

Buggy python submission (verdict: Runtime Error):
s,w=map(int,input().split())
if w>=s:
  print("unsafe")
 else:
  print("safe")

Fixed submission:
s,w=map(int,input().split())
if w>=s:
  print("unsafe")
else:
  print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
import itertools


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

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

line = int(input())

a = list(range(1,line + 1))
b = list(range(1,line + 1))
c = list(range(1,line + 1))

result = list(itertools.product(a,b,c))
#print(result)

all = 0

for i in result:
    tmp = gcd(i[0], i[1], i[2])
    all += tmp

print(all)

Fixed submission:
from math import gcd

line = int(input())

ans = 0

for a in range(1, line + 1):
    for b in range(1, line + 1):
        c = gcd(a,b)
        for d in range(1, line + 1):
            ans += gcd(d,c)
print(ans)

Buggy python submission (verdict: Runtime Error):
def gcd(*numbers):
    return reduce(math.gcd, numbers)

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

line = int(input())

a = list(range(1,line + 1))
b = list(range(1,line + 1))
c = list(range(1,line + 1))

result = list(itertools.product(a,b,c))

all = 0

for i in result:
    tmp = gcd(i[0], i[1], i[2])
    all += tmp

print(all)

Fixed submission:
from math import gcd

line = int(input())

ans = 0

for a in range(1, line + 1):
    for b in range(1, line + 1):
        c = gcd(a,b)
        for d in range(1, line + 1):
            ans += gcd(d,c)
print(ans)
Buggy python submission (verdict: Runtime Error):
def abs_result(x,y):
    tmp = abs(x-y)
    return tmp

def main():
    line = list(map(int,input().split()))
    n,k = line[0],line[1]
    
    # nを、nとkの差の絶対値で置き換える
    if n == 0 or k == 1:
        print(0)
        return
    
    if n % 2 == 0 k % 2 == 0 and n < k:
        print(2)
    
    if n % 2 == 0 k % 2 == 0 and n > k:
        print(0)
        
    if n % 2 == 1 and k % 2 == 0 and n > k:
        print(1)
        
    
    com = 2
    for i in range(0,10**18):
        ans = abs_result(n,k)
        if ans == 0:
            print(0)
            return
        elif ans == 1:
            print(1)
            return
        if ans <= com:
            print(ans)
            return
        n = ans

main()

Fixed submission:
def main():
    n,k = map(int,input().split())
    t = n % k
    x = k - t
    if t < x:
        print(t)
    else:
        print(x)
main()

Buggy python submission (verdict: Time Limit Exceeded):
def abs_result(x,y):
    tmp = abs(x-y)
    return tmp

def main():
    line = list(map(int,input().split()))
    n,k = line[0],line[1]
    
    # nを、nとkの差の絶対値で置き換える
    if n == 0 or k == 1:
        print(0)
        return
    
    com = 2
    for i in range(0,10**18):
        ans = abs_result(n,k)
        if ans == 0:
            print(0)
            return
        elif ans == 1:
            print(1)
            return
        if ans <= com:
            print(ans)
            return
        n = ans

main()

Fixed submission:
def main():
    n,k = map(int,input().split())
    t = n % k
    x = k - t
    if t < x:
        print(t)
    else:
        print(x)
main()
Buggy python submission (verdict: Runtime Error):
for i in range(3):
    line = input().rstrip().split(' ')
    array_1.append(line)

bool_array = []
for i in range(3):
    tmp = []
    for j in range(3):
        tmp.append(False)
    bool_array.append(tmp)
num = int(input().rstrip())
for i in range(num):
    input_line = input().rstrip()
    for j in range(3):
        for k in range(3):
            if array_1[j][k] == input_line:
                bool_array[j][k] = True

ans = "No"
for i in range(3):
    if bool_array[i][0] and bool_array[i][1] and bool_array[i][2]:
        ans = 'Yes'

    if bool_array[0][i] and bool_array[1][i] and bool_array[2][i]:
        ans = 'Yes'

if bool_array[0][0] and bool_array[1][1] and bool_array[2][2]:
    ans = 'Yes'

if bool_array[0][2] and bool_array[1][1] and bool_array[2][0]:
    ans = 'Yes'
print(ans)


Fixed submission:
array_1 = []
for i in range(3):
    line = input().rstrip().split(' ')
    array_1.append(line)
    
# print(array_1)

bool_array = []
for i in range(3):
    tmp = []
    for j in range(3):
        tmp.append(False)
    bool_array.append(tmp)

# print(bool_array)

num = int(input().rstrip())
for i in range(num):
    input_line = input().rstrip()
    for j in range(3):
        for k in range(3):
            if array_1[j][k] == input_line:
                bool_array[j][k] = True

ans = "No"
for i in range(3):
    if bool_array[i][0] and bool_array[i][1] and bool_array[i][2]:
        ans = 'Yes'

for i in range(3):
    if bool_array[0][i] and bool_array[1][i] and bool_array[2][i]:
        ans = 'Yes'

if bool_array[0][0] and bool_array[1][1] and bool_array[2][2]:
    ans = 'Yes'

if bool_array[0][2] and bool_array[1][1] and bool_array[2][0]:
    ans = 'Yes'
    
    
print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
h = int(input())

print((a + b) * h / / 2)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())

print((a + b) * h // 2)

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

print((a + b) * h / 2)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())

print((a + b) * h // 2)
Buggy python submission (verdict: Time Limit Exceeded):
m = 1000000007

factorials = [1]

for i in range(1,1000001):
    factorials.append((factorials[-1]*i) % m)

n = int(input())

if n == 1:
    print(0)
else:

    singles = 0
    for i in range(1,n+1):

        comb = (factorials[n] * pow(factorials[n-i],m-2,m) * pow(factorials[i],m-2,m)) % m
        singles += (comb * pow(8,n-i,m)) % m

    temp = pow(10,n,m) - pow(8,n,m) - 2*singles
    print(temp % m)

Fixed submission:
m = 1000000007
 
factorials = [1]
 
for i in range(1,1000001):
    factorials.append((factorials[-1]*i) % m)
 
n = int(input())
 
if n == 1:
    print(0)
else:
    temp = pow(10,n,m) - (2*pow(9,n,m) - pow(8,n,m))
    print(temp % m)
Buggy python submission (verdict: Runtime Error):
x = int(input(x))
if x == 0:
  print(1)
else:
  print(0)

Fixed submission:
x = int(input())
if x == 0:
  print(1)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
x = int(input(x))
if x == 1:
  print(0)
else:
  print(1)

Fixed submission:
x = int(input())
if x == 0:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
x = [int(i) for i in input().split(' ')]
print(x[3], x[0], x[1])

Fixed submission:
x = [int(i) for i in input().split(' ')]
print(x[2],' ',x[0], ' ',x[1])
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;
typedef long long ll;

int N, M;
ll K;
vector<ll> A;
vector<ll> B;

bool is_ok(vector<ll> B, int cnt_a, int mid){
  return A[cnt_a] + B[mid] <= K;
}

int binary_search(vector<ll> B, int cnt_a) {
    int left = -1; // 配列の左端
    int right = B.size(); // 配列の右端
    // 両端の差が1になるまで続ける
    while (right - left > 1){
        int mid = (right + left) / 2; // 区間の真ん中
        if (is_ok(B, cnt_a, mid)) left = mid;  // もし調べている対象が「is_okの条件」に当てはまればleftをmidまで移動
        else right = mid;  // 当てはまらなければrightをmid-1に移動
    }
    return left;
}

int main(){
  cin >> N >> M >> K;
  // 0インデックスには何も読まない0という初期値をそのまま入れておく
  A.push_back(0);
  B.push_back(0);

  rep(i, N){
    ll a;
    cin >> a;
    A.push_back(a);
  }
  rep(i, M){
    ll b;
    cin >> b;
    B.push_back(b);
  }

  rep(i, N) A[i+1] += A[i];
  rep(i, M) B[i+1] += B[i];

  int ans = 0;
  int cnt_b;
  rep(cnt_a, N+1){
    if (A[cnt_a] > K) continue;
    cnt_b = binary_search(B, cnt_a);
    ans = max(ans, cnt_a + cnt_b);
  }
  cout << ans << endl;
}

Fixed submission:
from itertools import accumulate

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

a_acc = [0] + list(accumulate(a))  # aを0冊読む=1冊も読まない場合があるので
b_acc = [0] + list(accumulate(b))  # 今度は[0]が必要です

ans = 0
for an in range(n + 1):
    rem = k - a_acc[an]
    if rem < 0:
        break

    # 最初は 0 <= x < m + 1 の範囲で、この範囲を狭めていきます
    ok = 0
    ng = m + 1   
    # ng = ok + 1のとき、ok <= x < ng は ok <= x < ok + 1で、x = okに確定します
    while abs(ng - ok) > 1:
        mid = (ok + ng) // 2
        # bをmid冊読めるか？
        if b_acc[mid] <= rem:
        # 読めるならok
            ok = mid
        else:
        # 読めないならng
            ng = mid

    bn = ok
    ans = max(ans, an + bn)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# import numpy as np
# from decimal import Decimal

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

# A = np.array(A).astype(np.int64)

# ans = int(np.prod(A))


import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)

ans = functools.reduce(lambda a, b: a * b, A)

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


Fixed submission:
import sys

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

ans = 1

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

for i in range(N):
  ans *= A[i]
  if ans > 1e18:
    print(-1)
    sys.exit()
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# import numpy as np
# from decimal import Decimal

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

# A = np.array(A).astype(np.int64)

# ans = int(np.prod(A))


import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)

ans = prod(A)

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


Fixed submission:
import sys

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

ans = 1

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

for i in range(N):
  ans *= A[i]
  if ans > 1e18:
    print(-1)
    sys.exit()
print(ans)

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

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

ans = np.prod(A)

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

Fixed submission:
import sys

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

ans = 1

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

for i in range(N):
  ans *= A[i]
  if ans > 1e18:
    print(-1)
    sys.exit()
print(ans)

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

ans = 1

for i in range(N):
  ans *= A[i]
if ans <= 1e18:
  print(ans)
else:
  print(-1)

Fixed submission:
import sys

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

ans = 1

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

for i in range(N):
  ans *= A[i]
  if ans > 1e18:
    print(-1)
    sys.exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
from decimal import Decimal

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

A = np.array(A).dtype(np.int64)

ans = int(np.prod(A))

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

Fixed submission:
from decimal import Decimal
A, B = map(str, input().split())

A = Decimal(A)
B = Decimal(B)

print(int(A*B))
Buggy python submission (verdict: Runtime Error):
import math
from decimal import *
import sympy
a, b, h, m = map(int, input().split())

big = max(30*h, 6*m)
small = min(30*h, 6*m)
gap = min(big - small, 360 - (big - small)) + (m*0.5)


print(format(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(gap))), ".20f"))

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

big = max(30*h + (m*0.5), 6*m)
small = min(30*h + (m*0.5), 6*m)
gap = min(big - small, 360 - (big - small))

print(format(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(gap))), ".20f"))

Buggy python submission (verdict: Runtime Error):
import math
from decimal import *
import sympy
a, b, h, m = map(int, input().split())

big = max(30*h, 6*m)
small = min(30*h, 6*m)
gap = min(big - small, 360 - (big - small)) + (m*0.5)


print(format(Decimal(a**2 + b**2 - 2*a*b*sympy.cos(sympy.radians(gap)))**Decimal("0.5"), ".20f"))


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

big = max(30*h + (m*0.5), 6*m)
small = min(30*h + (m*0.5), 6*m)
gap = min(big - small, 360 - (big - small))

print(format(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(gap))), ".20f"))

Buggy python submission (verdict: Runtime Error):
import math
from decimal import *
import mpmath
a, b, h, m = map(int, input().split())

big = max(30*h, 6*m)
small = min(30*h, 6*m)
gap = min(big - small, 360 - (big - small)) + (m*0.5)


print(format(Decimal(a**2 + b**2 - 2*a*b*math.cos(mpmath.radians(gap)))**Decimal("0.5"), ".20f"))

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

big = max(30*h + (m*0.5), 6*m)
small = min(30*h + (m*0.5), 6*m)
gap = min(big - small, 360 - (big - small))

print(format(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(gap))), ".20f"))
Buggy python submission (verdict: Runtime Error):
from sys import stdin

K = int(stdin.readline())

if K=="ABC":
  print("ARC")
else:
  print("ARC")

Fixed submission:
from sys import stdin

K = str(stdin.readline().strip())

if K=="ABC":
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

X = int(stdin.readline())
Y = 100

count = 1
while True:
  Y += Y*0.01
  if Y >= X:
    print(count)
  else:
    count += 1

Fixed submission:
from sys import stdin

X = int(stdin.readline())
Y = 100

count = 1
while True:
  Y += int(Y*0.01)
  if Y >= X:
    print(count)
    break
  else:
    count += 1
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 1
for i in range(N):
    ans = ans*A[i]

if ans>1e18:
    ans = -1

print(ans)


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

A.sort()
ans = 1

if A[0] == 0:
    ans = 0
else:
    for i in range(N):
        ans = ans * A[N-1-i]
        if ans > 10**18:
            ans = -1
            break

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

if S == "ABC":
  print(ARC)
else:
  print(ABC)

Fixed submission:
S = input()

if S == "ABC":
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Runtime Error):
def f(x):
  if (x == 0):
    return 1
  else if (x == 1):
    return 0

  
f(int(input())

Fixed submission:
def f(x):
	if x == 0:
		return 1
	elif x == 1:
		return 0


n = float(input())
r = f(n)
if r != None:
	print(r)
Buggy python submission (verdict: Runtime Error):
x = int(input())
if x > 30:
  print("Yes")
else
  print("No")

Fixed submission:
x = int(input())
if x >= 30:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split())
p.sort()
ans = sum(p[:k])
print(ans)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
         
p.sort()
ans = sum(p[:k])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
chars = "Xabcdefghijklmnopqrstuvwxyz"
n_rem = n
ans = ""
 
while True:
  x = n_rem % 26
  if x == 0:
      x = 26
  ans += chars[x]
  n_rem -= x
  if n_rem == 0:
    break
  n_rem //= 26
print(ans[::-1])

Fixed submission:
n = int(input())
chars = "Xabcdefghijklmnopqrstuvwxyz"
n_rem = n
ans = ""
 
while True:
  x = n_rem % 26
  if x == 0:
      x = 26
  ans += chars[x]
  n_rem -= x
  if n_rem == 0:
    break
  n_rem //= 26
  
print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
n = input()
chars = "Xabcdefghijklmnopqrstuvwxyz"
n_rem = n
ans = ""

while True:
  x = n_rem % 26
  if x == 0:
    x = 26
  ans += chars[x]
  n_rem -= 26
  if n_rem == 0:
    break
  n_rem //= 26
print(ans[::-1])

Fixed submission:
n = int(input())
chars = "Xabcdefghijklmnopqrstuvwxyz"
n_rem = n
ans = ""
 
while True:
  x = n_rem % 26
  if x == 0:
      x = 26
  ans += chars[x]
  n_rem -= x
  if n_rem == 0:
    break
  n_rem //= 26
  
print(ans[::-1])