Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
ans=0.0
n=int(input())
for i in range(n):
  a, s = input().split()
  a = double(a)
  if s=="BTC" :
    a *= 380000.0
  ans += a
print(ans)

Fixed submission:
ans=0.0
n=int(input())
for i in range(n):
  a, s = input().split()
  a = float(a)
  if s=="BTC" :
    a *= 380000.0
  ans += a
print(ans)

Buggy python submission (verdict: Runtime Error):
ans=0.0
for i in range(int(input()):
  a, s = input().split()
  a = double(a)
  if s=="BTC" :
    a *= 380000.0
  ans += a
print(ans)

Fixed submission:
ans=0.0
n=int(input())
for i in range(n):
  a, s = input().split()
  a = float(a)
  if s=="BTC" :
    a *= 380000.0
  ans += a
print(ans)
Buggy python submission (verdict: Runtime Error):
s,t,a=input(),0,0
for c in s:
  t+=1 if c is 'B' else a+=t
print(a)

Fixed submission:
s,t,a=input(),0,0
for c in s:
  if c is 'B':
    t+=1
  else:
    a+=t
print(a)
Buggy python submission (verdict: Runtime Error):
print("Christmas"+" Eve"*(25-int(input()))

Fixed submission:
print("Christmas"+" Eve"*(25-int(input())))

Buggy python submission (verdict: Runtime Error):
print("Christmas"+sum([" Eve" for _ in range(25-input())]))

Fixed submission:
print("Christmas"+" Eve"*(25-int(input())))
Buggy python submission (verdict: Runtime Error):
print("YES" if n == 7 or n == 5 or n == 3 for n in [int(input())] else "NO")

Fixed submission:
n = int(input())
print("YES" if n == 7 or n == 5 or n == 3 else "NO")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0

for i in range(n + 1):
    if "3" in str(i) and \
            "5" in str(i) and \
            "7" in str(i) and \
            "1" not in str(i) and \
            "2" not in str(i) and \
            "4" not in str(i) and \
            "6" not in str(i) and \
            "8" not in str(i) and \
            "9" not in str(i) and \
            "0" not in str(i):
        ans += 1

print(ans)


Fixed submission:
import itertools as it

n = input()
ans = 0
nums = ['3', '7', '5']

for j in range(1, len(n) + 1):
    for i in it.product(nums, repeat=j):
        if int(n) >= int("".join(i)) and '3' in i and '5' in i and '7' in i:
            ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0

for i in range(n + 1):
    if "3" in str(i) and "5" in str(i) and "7" in str(i):
        flag = True
        for j in str(i):
            if j != '3' and j != '5' and j != '7':
                flag = False
                break
        if flag:
            ans += 1

print(ans)

Fixed submission:
import itertools as it

n = input()
ans = 0
nums = ['3', '7', '5']

for j in range(1, len(n) + 1):
    for i in it.product(nums, repeat=j):
        if int(n) >= int("".join(i)) and '3' in i and '5' in i and '7' in i:
            ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
import itertools as iter

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

beauty_list = []
for i in range(len(a) + 1):
    for element in iter.combinations(a, i):
        beauty = sum(element)
        beauty_list.append(beauty)

max_and = 0
for combi in iter.combinations(set(beauty_list), k):
    ans = combi[0]
    for element in combi:
        ans &= element
    if ans > max_and:
        max_and = ans

print(max_and)


Fixed submission:
n = int(input())

num = list(map(int, input().split()))
ave = sum(num) / n

diff = None
for i, l in enumerate(num):
    if diff is None or abs(l - ave) < diff:
        diff = abs(l - ave)
        ans = i

print(ans)
Buggy python submission (verdict: Runtime Error):
print(int(input()) + int(input()) / 2)

Fixed submission:
a, b = map(int, input().split())
print(int(a + b / 2))

Buggy python submission (verdict: Runtime Error):
x, y = input().split
print(int(x) + int(y) / 2)

Fixed submission:
a, b = map(int, input().split())
print(int(a + b / 2))

Buggy python submission (verdict: Runtime Error):
x, y = int(input()), int(input())
print(x + y / 2)

Fixed submission:
a, b = map(int, input().split())
print(int(a + b / 2))
Buggy python submission (verdict: Runtime Error):
print((int(input()) - 2) / (int(input()) - 1) + 1)

Fixed submission:
[print(int((n[0] - 2) / (n[1] - 1) + 1)) for n in [list(map(int, input().split()))]]
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
ans = 0
for i in range(n):
  v = int(input())
  if i:
    ans += min(a * (v - last), b);
  last = v
print(ans)

Fixed submission:
n, a, b = map(int, input().split())
ans = 0
v = list(map(int, input().split()))
for i in range(n):
  if i:
    ans += min(a * (v[i] - last), b);
  last = v[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
ans = 0
for x in range(n + 1):
    for y in range(n + 1):
        for z in range(n + 1):
            if x + y + z == m:
                ans += 1
print(ans)

Fixed submission:
n, m = map(int, input().split())
ans = 0
for x in range(n + 1):
    for y in range(n + 1):
        if m - x - y <= n and m - x - y >= 0:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
a, b = ap(int, input().split())
for i in range(a):
  for j in range(b):
    if input() == "snuke":
      print(alph[j] + str(i + 1))
      exit()

Fixed submission:
alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
a, b = map(int, input().split())
for i in range(a):
  c= input().split()
  for j in range(b):
    if c[j] == "snuke":
      print(alph[j] + str(i + 1))
      exit()
Buggy python submission (verdict: Runtime Error):
print("Yes" if ('N' in s) == ('S' in s) and ('W' in s) == ('E' in s) for s in [input()] else "No")


Fixed submission:
import os
import math
import itertools
INF, MOD = float("inf"), 1e9 + 7
MAX, MIN = -INF, INF
dx1, dy1, dx2, dy2 = [-1, 0, 1, 0], [0, -1, 0, 1], [-1, 0, 1, -1, 1, -1, 0, 1], [-1, -1, -1, 0, 0, 1, 1, 1]

def get_int():
    return int(input())

def get_int_list():
    return list(map(int, input().split()))

while(True):
    try:
        s = input()
        if ('N' in s) == ('S' in s) and ('W' in s) == ('E' in s):
            print("Yes")
        else:
            print("No")
    except EOFError:
        exit()

Buggy python submission (verdict: Runtime Error):
print("Yes" if 'N' in s and 'S' in s and 'W' in s and'E' in s for s in [input()] else "No")

Fixed submission:
import os
import math
import itertools
INF, MOD = float("inf"), 1e9 + 7
MAX, MIN = -INF, INF
dx1, dy1, dx2, dy2 = [-1, 0, 1, 0], [0, -1, 0, 1], [-1, 0, 1, -1, 1, -1, 0, 1], [-1, -1, -1, 0, 0, 1, 1, 1]

def get_int():
    return int(input())

def get_int_list():
    return list(map(int, input().split()))

while(True):
    try:
        s = input()
        if ('N' in s) == ('S' in s) and ('W' in s) == ('E' in s):
            print("Yes")
        else:
            print("No")
    except EOFError:
        exit()
Buggy python submission (verdict: Runtime Error):
s = input()
ans = []
for c in s:
    if c == '0':
        ans.append('0')
    elif c == '1':
        ans.append('1')
    else:
        ans.pop(-1)
print(''.join(ans))



Fixed submission:
s = input()
ans = []
for c in s:
    if c == '0':
        ans.append('0')
    elif c == '1':
        ans.append('1')
    elif len(ans):
        ans.pop(-1)
print(''.join(ans))
Buggy python submission (verdict: Runtime Error):
if input().issuper():
  print("a")
else:
  print("a")

Fixed submission:
if input().isupper():
  print("A")
else:
  print("a")
Buggy python submission (verdict: Runtime Error):
up = lambda x: x//2
n = int(input())
itm = []
for _ in range(n):
   v,w = [int(i) for i in input().split()]
   itm.append((v,w))
dplen = min(n,2**8)
dp = [ [0]*(10**5+2) for i in range(dplen+1)]
for i in range(1,dplen+1):
   for j in range(10**5+2):
      dp[i][j] = max(dp[up(i)][j], dp[i][max(0,j-1)])
      if (j >= itm[i-1][1]):
         dp[i][j] = max(dp[i][j], dp[up(i)][j-itm[i-1][1]] + itm[i-1][0])
q = int(input())
#print(dp[3][:10])
for i in range(q):
   vrt, l = [int(i) for i in input().split()]
   if vrt <= 2**8:
      print(dp[vrt][l])
      continue
   koho = []
   y = vrt
   for i in range(10):
      if y <= 2**8:
        break
      koho.append(y)
      y = up(y)
   bn = len(koho)
   mb = 2**bn
   ans = 0
   for j in range(mb):
      curv,curw = 0,0
      for k in range(bn):
         if (j >> k) & 1 :
            curv += itm[koho[k]-1][0]
            curw += itm[koho[k]-1][1]
      if curw <= l:
         curv += dp[vrt][l-curw]
         ans = max(curv)
   print(ans)

Fixed submission:
print(input()[:3])
Buggy python submission (verdict: Runtime Error):
a,b=  map(int,input(0.split()))
print(a*b)

Fixed submission:
a,b=  map(int,input().split())
print(a*b)
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):
x,y,z = map(int,inout().split())
print(str(z)+' '+str(x) + ' ' + str(y))

Fixed submission:
x,y,z = map(int,input().split())
print(str(z)+' '+str(x) + ' ' + str(y))
Buggy python submission (verdict: Runtime Error):
from collections import deque
x,y,a,b,c = map(int,input().split())
red = [int(i) for i in input().split()]
g = [int(i) for i in input().split()]
w = [int(i) for i in input().split()]
red.sort(reverse=True)
g.sort(reverse=True)
g = g[:y]
gw = g+w
gw.sort(reverse=True)
gwrui = []
rui = 0
for i in range(y+c):
    rui += gw[i]
    gwrui.append(rui)
redq = deque(red[:x])
ans = 0
oisr = 0
#print(red,gw,gwrui)
for i in range(1,x+1):
    oisr += redq.popleft()
    temp = oisr
    temp += gwrui[x+y-i-1]
    ans = max(ans,temp)
print(ans)

Fixed submission:
from collections import deque
x,y,a,b,c = map(int,input().split())
red = [int(i) for i in input().split()]
g = [int(i) for i in input().split()]
w = [int(i) for i in input().split()]
red.sort(reverse=True)
g.sort(reverse=True)
g = g[:y]
gw = g+w
gw.sort(reverse=True)
gwrui = []
rui = 0
for i in range(y+c):
    rui += gw[i]
    gwrui.append(rui)
red = red[:x]
rrui = []
rui = 0
for i in range(x):
    rui += red[i]
    rrui.append(rui)
rrui = [0] + rrui
ans = 0
oisr = 0
lgw = len(gw)
#print(red,gw,gwrui)
for i in range(0,x+1):
    temp = rrui[i]
    if x+y-i <= lgw:
        temp += gwrui[x+y-i-1]
        ans = max(ans,temp)
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import deque
x,y,a,b,c = map(int,input().split())
red = [int(i) for i in input().split()]
gw = [int(i) for i in input().split()] + [int(i) for i in input().split()]
red.sort()
gw.sort()
gwrui = []
rui = 0
for i in range(b+c):
    rui += gw[i]
    gwrui.append(rui)
redq = deque(red[:x])
ans = 0
oisr = 0
for i in range(1,x+1):
    oisr += redq.popleft()
    temp = oisr
    temp += gwrui[x+y-i]
    ans = max(ans,temp)
print(ans)

Fixed submission:
from collections import deque
x,y,a,b,c = map(int,input().split())
red = [int(i) for i in input().split()]
g = [int(i) for i in input().split()]
w = [int(i) for i in input().split()]
red.sort(reverse=True)
g.sort(reverse=True)
g = g[:y]
gw = g+w
gw.sort(reverse=True)
gwrui = []
rui = 0
for i in range(y+c):
    rui += gw[i]
    gwrui.append(rui)
red = red[:x]
rrui = []
rui = 0
for i in range(x):
    rui += red[i]
    rrui.append(rui)
rrui = [0] + rrui
ans = 0
oisr = 0
lgw = len(gw)
#print(red,gw,gwrui)
for i in range(0,x+1):
    temp = rrui[i]
    if x+y-i <= lgw:
        temp += gwrui[x+y-i-1]
        ans = max(ans,temp)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = list(map(int,input().split()))
a = 0
for i in (1,2):
    if n[0] == n[i]:
        a += 1
if a == 1:
    ans = "Yes"
elif a == 2 or n[1] != n[2]:
    ans = "No"
print(ans)

Fixed submission:
n = list(map(int,input().split()))
a = 0
for i in (1,2):
    if n[0] == n[i]:
        a += 1
if a == 1:
    ans = "Yes"
elif a == 2 or n[1] != n[2]:
    ans = "No"
else:
    ans = "Yes"
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int,input().split())
if a >= k:
    ans = [a-k,b]
else:
    ans = [0,a+b-k]
print(str(ans[0]+" "+str(ans[1])))

Fixed submission:
# coding: utf-8
# Your code here!

a, b, k = map(int,input().split())
if a >= k:
    ans = [a-k,b]
elif a+b >=k:
    ans = [0,a+b-k]
else :
    ans = [0,0]
print(str(ans[0])+" "+str(ans[1]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
l = sum(a)
b = list()
t = 0
ans = 10**10
for i in a:
    t += i
    n.append(t)
for j in b:
    x = abs(l-(2*j))
    if x < ans:
        ans = x

print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
l = sum(a)
b = list()
t = 0
ans = 10**10
for i in a:
    t += i
    b.append(t)
for j in b:
    x = abs(l-(2*j))
    if x < ans:
        ans = x

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = "No"
for i in range(2,10):
    if n % i = 0 and n // i < 10 :
        ans = "Yes"
        break()
print(ans)

Fixed submission:
n = int(input())
ans = "No"
for i in range(1,10):
    if n % i == 0 and n // i < 10 :
        ans = "Yes"
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = tuple(map(int,input().split()))
c = 0
ans = "YES"
for i in range(1,n+1) :
    if p[i] != i :
        c += 1
if c <= 2 :
    ans = "NO"
print(ans)

Fixed submission:
n = int(input())
p = tuple(map(int,input().split()))
c = 0
ans = "YES"
for i in range(n) :
    if p[i] != i+1 :
        c += 1
if c > 2 :
    ans = "NO"
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
lg = b - a + 1

def div (n):
    rt = lg // n
    if lg % n != 0 and ((n- a%n) + (b%n) < n):
        rt += 1
    return(rt)

cm = c * d // math.gcd(c,d)
ans = lg - div(c) - div(d) + div(cm)
print(ans)

Fixed submission:
import fractions
a,b,c,d = map(int,input().split())
lg = b - a + 1

def div (n):
    rt = lg // n
    if lg % n != 0 and ((n- a%n) + (b%n) < n):
        rt += 1
    return(rt)

cm = c * d // fractions.gcd(c,d)
ans = lg - div(c) - div(d) + div(cm)
print(ans)
Buggy python submission (verdict: Runtime Error):
n , k = imap ( int , input ().split())
ans = n - k + 1
print ( ans)

Fixed submission:
n , k = map ( int , input ().split())
ans = n - k + 1
print ( ans)
Buggy python submission (verdict: Runtime Error):
num = int(input())
value = map (int,input().split())
price = map (int,input().split())
ans = 0
for i in range(num):
  if value[i] > price[i] :
      income = value[i] - price[i]
      ans += income
print(ans)

Fixed submission:
num = int(input())
value = tuple( map (int,input().split()))
price = tuple(map (int,input().split()))
ans = 0
for i in range(num):
  if value[i] > price[i] :
      income = value[i] - price[i]
      ans += income
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c = map ( int , input () .split())
if a==b && b==c :
    print ("Yes")
else :
    print ("No")


Fixed submission:
a,b,c = map ( int , input () .split())
if a==b and b==c :
    print ("Yes")
else :
    print ("No")
Buggy python submission (verdict: Runtime Error):
num = int(input())
col = input()
r = clo.count("R")
b = num - r
if r > b :
    ans = "Yes"
else :
    ans = "No"
print (ans)

Fixed submission:
num = int(input())
col = input()
r = col.count("R")
b = num - r
if r > b :
    ans = "Yes"
else :
    ans = "No"
print (ans)
Buggy python submission (verdict: Runtime Error):
a,b = map (int , input().split())
if b % a == 0 ;
    c = a+b
else;
    c = b-a
print (c)

Fixed submission:
a,b = map (int , input().split())
if b % a == 0 :
    c = a+b
else:
    c = b-a
print (c)

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

Fixed submission:
a,b = map (int , input().split())
if b % a == 0 :
    c = a+b
else:
    c = b-a
print (c)
Buggy python submission (verdict: Runtime Error):
man,food = map ( int ,input ().split())
num = set(range(food+1))
for i in range(man) :
    a = list ( map ( int () , input . split ()))
    del a[0]
    num = num & a
plint (len (num) )


Fixed submission:
man,food = map ( int ,input().split())
num = set(range(food+1))
for i in range(man) :
    a = list ( map ( int  , input().split ()))
    del a[0]
    a = set (a)
    num = num & a
print (len (num) )
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
cost = [100000] * n
cost[0] = 0
cost[1] = abs(h[0]-h[1])
for i in range(2,n):
    sgl = cost[i-1] + abs(h[i]-h[i-1])
    dbl = cost[i-2] + abs(h[i]-h[i-2])
    cost[i] = min(sgl,dbl)
print(cost[n])

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
cost = [100000] * n
cost[0] = 0
cost[1] = abs(h[0]-h[1])
for i in range(2,n):
    sgl = cost[i-1] + abs(h[i]-h[i-1])
    dbl = cost[i-2] + abs(h[i]-h[i-2])
    cost[i] = min(sgl,dbl)
print(cost[-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
cost = [100000] * n
cost[0] = 0
cost[1] = abs(h[0]-h[1])
for i in range(2,n):
    sgl = cost[i-1] + abs(h[i]-[i-1])
    dbl = cost[i-2] + abs(h[i]-[i-2])
    cost[i] = min(sgl,dbl)
print(cost[n])

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
cost = [100000] * n
cost[0] = 0
cost[1] = abs(h[0]-h[1])
for i in range(2,n):
    sgl = cost[i-1] + abs(h[i]-h[i-1])
    dbl = cost[i-2] + abs(h[i]-h[i-2])
    cost[i] = min(sgl,dbl)
print(cost[-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
cost = [100000] * n
cost[0] = 0
cost[1] = abs(h[0]-h[1])
for i in range(2,n):
    sgl = cost[i-1] + abs(h[i]-abs[i-1])
    dbl = cost[i-2] + abs(h[i]-abs[i-2])
    cost[i] = min(sgl,dbl)
print(cost[n])

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
cost = [100000] * n
cost[0] = 0
cost[1] = abs(h[0]-h[1])
for i in range(2,n):
    sgl = cost[i-1] + abs(h[i]-h[i-1])
    dbl = cost[i-2] + abs(h[i]-h[i-2])
    cost[i] = min(sgl,dbl)
print(cost[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,w = map(int,input().split())
dp = [[0]*(w+1) for _ in range(n+1)]#[[0]*(w+1)] *(n+1)
for i in range(1,n+1):
    wi,vi = [int(i) for i in input().split()]
    #DPテーブルの更新
    for j in range(w+1):
        if j >= wi : #選べるかどうか
            dp[i][j] = max(dp[i-1][j] , dp[i-1][j-wi]+vi) #選ぶ場合
        else:
            dp[i][j] = max(dp[i-1][j] , dp[i][j]) #選ばない場合
print(dp[n][w])

Fixed submission:
n,w = map(int,input().split())
dp = [[0]*(w+1) for _ in range(n+1)]#[[0]*(w+1)] *(n+1)
for i in range(1,n+1):
    wi,vi = [int(i) for i in input().split()]
    #DPテーブルの更新
    for j in range(w+1):
        if j >= wi : #選べるかどうか
            dp[i][j] = max(dp[i-1][j] , dp[i-1][j-wi]+vi) #選ぶ場合
        else:
            dp[i][j] = max(dp[i-1][j] , dp[i][j]) #選ばない場合
print(dp[n][w])

Buggy python submission (verdict: Time Limit Exceeded):
n,w = map(int,input().split())
dp = [[0]*(w+1) for _ in range(n+1)]#[[0]*(w+1)] *(n+1)
for i in range(1,n+1):
    wi,vi = map(int,input().split())
    #DPテーブルの更新
    for j in range(w+1):
        if j >= wi : #選べるかどうか
            dp[i][j] = max(dp[i-1][j] , dp[i-1][j-wi]+vi) #選ぶ場合
        else:
            dp[i][j] = max(dp[i-1][j] , dp[i][j]) #選ばない場合
print(dp[n][w])

Fixed submission:
n,w = map(int,input().split())
dp = [[0]*(w+1) for _ in range(n+1)]#[[0]*(w+1)] *(n+1)
for i in range(1,n+1):
    wi,vi = [int(i) for i in input().split()]
    #DPテーブルの更新
    for j in range(w+1):
        if j >= wi : #選べるかどうか
            dp[i][j] = max(dp[i-1][j] , dp[i-1][j-wi]+vi) #選ぶ場合
        else:
            dp[i][j] = max(dp[i-1][j] , dp[i][j]) #選ばない場合
print(dp[n][w])

Buggy python submission (verdict: Runtime Error):
n,w = map(int,input().split())
dp = [[0]*(w+1)] *(n+1)
for i in range(1,n+1):
    wi,vi = map(int,input().split())
    #DPテーブルの更新
    for j in range(w+1):
        if j >= wi : #選べるかどうか
            dp[i][j] = max(dp[i-1][j] , dp[i-1][j-wi]+vi) #選ぶ場合
        else:
            dp[i][j] = max(dp[i-1][j] , dp[i][j]) #選ばない場合
print(dp[n+1][w+1])

Fixed submission:
n,w = map(int,input().split())
dp = [[0]*(w+1) for _ in range(n+1)]#[[0]*(w+1)] *(n+1)
for i in range(1,n+1):
    wi,vi = [int(i) for i in input().split()]
    #DPテーブルの更新
    for j in range(w+1):
        if j >= wi : #選べるかどうか
            dp[i][j] = max(dp[i-1][j] , dp[i-1][j-wi]+vi) #選ぶ場合
        else:
            dp[i][j] = max(dp[i-1][j] , dp[i][j]) #選ばない場合
print(dp[n][w])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
cnt = 1
if 0 in a:
    print(0)
    exit()
for i in range(n):
    cnt *= a[i]
    if cnt > 10**18:
        cnt = -1
print(cnt)

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
cnt = 1
for i in range(n):
    cnt *= a[i]
if cnt > 10**18:
    cnt = -1
print(cnt)

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
cnt = 1
for i in range(n):
    cnt *= a[i]
if cnt > 10**18:
        cnt = -1
print(cnt)

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
cnt = 1
for i in range(n):
    cnt *= a[i]
    if cnt > 10**18:
        cnt = -1
print(cnt)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
cnt = 1
if 0 in a:
    print(0)
    exit()
for i in range(n):
    cnt *= a[i]
    if cnt > 10**18:
        cnt = -1
        break
print(cnt)
Buggy python submission (verdict: Runtime Error):
import math
a, b, h, m = map(int(), input().split())
angle = abs(30*h - 5.5*m)
distance = (a*a + b*b - 2*a*b*math.cos(math.radians(angle)))
print(math.sqrt(distance))

Fixed submission:
import math
a, b, h, m = map(int, input().split())
angle = abs(30*h - 5.5*m)
distance = (a*a + b*b - 2*a*b*math.cos(math.radians(angle)))
print(math.sqrt(distance))
Buggy python submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input().split())
palace = [abs(T - (int(x)*0.006) -A) for x in input().split('')]
print(palace.index(min(min(palace)+1)))

Fixed submission:
N = int(input())
T, A = map(int, input().split())
palace = [abs(T - (int(x)*0.006) - A) for x in input().split()]
print(palace.index(min(palace))+1)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
M = [int(input()) for _ in range(N)]
ans = 0
for m in range(M):
    X -= m
    ans += 1
ans += X // min(M)
print(ans)


Fixed submission:
N, X = map(int, input().split())
M = [int(input()) for _ in range(N)]
ans = 0
for m in M:
    X -= m
    ans += 1
ans += X // min(M)
print(ans)

Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
M = list(map(int, input().split()))
ans = 0
for m in range(M):
    X -= m
    ans += 1
ans += X // min(M)
print(ans)

Fixed submission:
N, X = map(int, input().split())
M = [int(input()) for _ in range(N)]
ans = 0
for m in M:
    X -= m
    ans += 1
ans += X // min(M)
print(ans)

Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
M = list(map(int. input().split()))
ans = 0
for m in range(M):
    X -= m
    ans += 1
ans += X // min(M)
print(ans)

Fixed submission:
N, X = map(int, input().split())
M = [int(input()) for _ in range(N)]
ans = 0
for m in M:
    X -= m
    ans += 1
ans += X // min(M)
print(ans)