Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
min_s = []
max_s = []
for i in range(n):
    a, b = map(int, input().split())
    min_s.append(a)
    max_s.append(b)

min_s.sort()
max_s.sort()
if n % 2 == 0:
    min_med = (min_s[n//2-1] + min_s[n//2-1])/2
    max_med = (max_s[n//2-1] + max_s[n//2-1])/2
    print(int(max_med-min_med)*2+1)))

else:
    min_med = min_s[(n+1)//2-1]
    max_med = max_s[(n+1)//2-1]
    print(int((max_med-min_med)+1))

Fixed submission:
n = int(input())
min_s = []
max_s = []
for i in range(n):
    a, b = map(int, input().split())
    min_s.append(a)
    max_s.append(b)

min_s.sort()
max_s.sort()
if n % 2 == 0:
    min_med = (min_s[n // 2 - 1] + min_s[n // 2]) / 2
    max_med = (max_s[n // 2 - 1] + max_s[n // 2]) / 2
    print(int((max_med - min_med) * 2 + 1))

else:
    min_med = min_s[(n + 1) // 2 - 1]
    max_med = max_s[(n + 1) // 2 - 1]
    print(int((max_med - min_med)+1))
Buggy python submission (verdict: Runtime Error):
if h1 <= h2:
    time = h2 * 60 + m2 - h1 * 60 + m1
else:
    time = (h2+24) * 60 + m2 - h1 * 60 + m1
if k >= time:
    print(0)
else:
    print(time - k)

Fixed submission:
h1, m1, h2, m2, k = map(int, input().split())
 
if h1 <= h2:
    time = h2 * 60 + m2 - h1 * 60 - m1
else:
    time = (h2+24) * 60 + m2 - h1 * 60 - m1
if k >= time:
    print(0)
else:
    print(time - k)

Buggy python submission (verdict: Runtime Error):
h1, m1, h2, m2. k = map(int, input().split())

time = h2 * 60 + m2 - h1 * 60 + m1
if k >= time:
    print(1)
else:
    print(time - k)

Fixed submission:
h1, m1, h2, m2, k = map(int, input().split())
 
if h1 <= h2:
    time = h2 * 60 + m2 - h1 * 60 - m1
else:
    time = (h2+24) * 60 + m2 - h1 * 60 - m1
if k >= time:
    print(0)
else:
    print(time - k)
Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int, input().split())
cards = [1]*a + [0]*b + [-1]*c
print(sum(cards[:k]))

Fixed submission:
a,b,c,k = map(int, input().split())
if k<=a:
    print(k)
elif a<k and k<=a+b:
    print(a)
else:
    print(a-(k-a-b))
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,m,x = map(int,input().split())
info = []
for i in range(n):
    info.append(list(map(int,input().split())))
info = np.array(info)

money = np.sum(info, axis = 0)[0]
flag = 0
for i in range(2**n):
    tem = np.zeros(m+1)
    for j in range(n):
        if (i >> j) & 1:
            tem += info[j]
    non = np.any(tem < 10)
    if non == False:
        flag = 1
        if tem[0] < money:
            money = tem[0]

if flag == 0:
    print(-1)
else:
    print(money)

Fixed submission:
import numpy as np
n,m,x = map(int,input().split())
info = []
for i in range(n):
    info.append(list(map(int,input().split())))
info = np.array(info)


money = np.sum(info, axis = 0)[0]
flag = 0
for i in range(2**n):
    tem = np.zeros(m+1, dtype = int)
    for j in range(n):
        if ((i >> j) & 1):
            tem += info[j]
    skill = tem[1:]
    non = np.all(skill >= x)
    if non:
        flag = 1
        if tem[0] < money:
            money = tem[0]

if flag == 0:
    print(-1)
else:
    print(money)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

a.sort()
for i in range(1,n):
    tem = a.count(i)
    print(tem)
    a = a[tem:]

print(0)

Fixed submission:
import collections
n = int(input())
a = list(map(int, input().split()))

a.sort()
a = collections.deque(a)
counter = 0
for i in range(1, n+1):
    while len(a) != 0:
        if i != a[0]: 
            break
        counter += 1
        a.popleft()    
    print(counter)
    counter = 0
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

k = int(input())
sum = 0
for p in range(1,k+1):
    for q in range(1,k+1):
        for r in range(1,k+1):
            sum += np.gcd.reduce([p,q,r])

print(sum)

Fixed submission:
import math

k = int(input())
sum = 0
gcds = [[0 for i in range(k)] for i in range(k)]
for p in range(1,k+1):
    for q in range(1,k+1):   
        gcds[p-1][q-1] = math.gcd(p,q)          
        for r in range(1,k+1):
            sum += math.gcd(gcds[p-1][q-1], r)
            


print(sum)

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

k = input()
sum = 0
for p in range(k):
    for q in range(k):
        for r in range(k):
            sum += np.gcd.reduce([i,j,k])

print(sum)

Fixed submission:
import math

k = int(input())
sum = 0
gcds = [[0 for i in range(k)] for i in range(k)]
for p in range(1,k+1):
    for q in range(1,k+1):   
        gcds[p-1][q-1] = math.gcd(p,q)          
        for r in range(1,k+1):
            sum += math.gcd(gcds[p-1][q-1], r)
            


print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y = map(int, input().split())
import collections

g = [[] for i in range(n)]
for i in range(n):
    if i != 0:
        g[i].append(i-1)
    if i != n-1:
        g[i].append(i+1)
g[x-1].append(y-1)
g[y-1].append(x-1)


inf = 10**5
dp = [[inf for i in range(n)] for j in range(n)]
todo = collections.deque()

for i in range(n):
    dp[i][i] = 0
    for j in g[i]:
        todo.append(j)
    while len(todo) > 0:
        now = todo.popleft()
        leng = inf
        for j in g[now]:
            if dp[i][j] == inf:
                todo.append(j)
            else:
                tem = dp[i][j] + 1
                if tem < leng:
                    leng = tem
        dp[i][now] = leng

for i in range(1,n):
    ans = 0
    for j in range(n):
        for k in range(j+1,n):
                if dp[j][k] == i:
                    ans += 1
    print(ans)

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

ans = [0]*(n-1)
for j in range(1, n+1):
    for i in range(1, j):
        dis = min(j-i, abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
        ans[dis-1] += 1

for i in ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n,x,y = map(int, input().split())
import collections

g = [[] for i in range(n)]
for i in range(n):
    if i != 0:
        g[i].append(i-1)
    if i != n-1:
        g[i].append(i+1)
g[x-1].append(y-1)
g[y-1].append(x-1)

inf = 10**5
dp = [[inf for i in range(n)] for j in range(n)]
todo = collections.deque()

for i in range(n):
    dp[i][i] = 0
    for j in g[i]:
        todo.append(j)
    while len(todo) > 0:
        now = todo.popleft()
        leng = inf
        for j in g[now]:
            if dp[i][j] == inf:
                todo.append(j)
            else:
                tem = dp[i][j] + 1
                if tem < leng:
                    leng = tem
        dp[i][now] = leng

for i in range(1,n):
    ans = 0
    for j in range(n):
        for k in range(n):
            if j < k:
                if dp[j][k] == i:
                    ans += 1
    print(ans)

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

ans = [0]*(n-1)
for j in range(1, n+1):
    for i in range(1, j):
        dis = min(j-i, abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
        ans[dis-1] += 1

for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
s_and_c = []
for i in range(m):
    s_and_c.append(list(map(int, input().split())))

ans = ["-1" for i in range(n)]
s_and_c.sort()


if m == 0:
    if n == 1:
        ans = ["0"ß]
    else:
        ans[0] = "1"

elif n != 1 and s_and_c[0][0] == 1 and s_and_c[0][1] == 0:
    ans = -1
else:
    for i in range(m):
        if ans[s_and_c[i][0] - 1] == "-1":
            ans[s_and_c[i][0] - 1] = str(s_and_c[i][1])
        elif ans[s_and_c[i][0] - 1] == str(s_and_c[i][1]):
            continue
        else:
            ans = -1


if ans != -1:
    for i in range(n):
        if ans[i] == "-1":
            ans[i] = "0"
    ans = "".join(ans)

print(ans)


Fixed submission:
n,m = map(int, input().split())
s_and_c = []
for i in range(m):
    s_and_c.append(list(map(int, input().split())))

ans = ["-1" for i in range(n)]
s_and_c.sort()


if m == 0:
    if n == 1:
        ans = ["0"]
    else:
        ans[0] = "1"

elif n != 1 and s_and_c[0][0] == 1 and s_and_c[0][1] == 0:
    ans = -1
else:
    for i in range(m):
        if ans[s_and_c[i][0] - 1] == "-1":
            ans[s_and_c[i][0] - 1] = str(s_and_c[i][1])
        elif ans[s_and_c[i][0] - 1] == str(s_and_c[i][1]):
            continue
        else:
            ans = -1


if ans != -1:
    for i in range(n):
        if ans[i] == "-1":
            if i == 0:
                ans[i] = "1"
            else:
                ans[i] = "0"
    ans = "".join(ans)

print(ans)

Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
s_and_c = []
for i in range(m):
    s_and_c.append(list(map(int, input().split())))

ans = ["-1" for i in range(n)]
s_and_c.sort()

if n != 1 and s_and_c[0][0] == 1 and s_and_c[0][1] == 0:
    ans = -1
else:
    for i in range(m):
        if ans[s_and_c[i][0] - 1] == "-1":
            ans[s_and_c[i][0] - 1] = str(s_and_c[i][1])
        elif ans[s_and_c[i][0] - 1] == str(s_and_c[i][1]):
            continue
        else:
            ans = -1


if ans != -1:
    for i in range(n):
        if ans[i] == "-1":
            ans[i] = "0"
    ans = "".join(ans)

print(ans)


Fixed submission:
n,m = map(int, input().split())
s_and_c = []
for i in range(m):
    s_and_c.append(list(map(int, input().split())))

ans = ["-1" for i in range(n)]
s_and_c.sort()


if m == 0:
    if n == 1:
        ans = ["0"]
    else:
        ans[0] = "1"

elif n != 1 and s_and_c[0][0] == 1 and s_and_c[0][1] == 0:
    ans = -1
else:
    for i in range(m):
        if ans[s_and_c[i][0] - 1] == "-1":
            ans[s_and_c[i][0] - 1] = str(s_and_c[i][1])
        elif ans[s_and_c[i][0] - 1] == str(s_and_c[i][1]):
            continue
        else:
            ans = -1


if ans != -1:
    for i in range(n):
        if ans[i] == "-1":
            if i == 0:
                ans[i] = "1"
            else:
                ans[i] = "0"
    ans = "".join(ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
info = list(map(int, input().split()))

for i in n:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            if i == n:
                print("APPROVED")
            else:
                continue
        else:
            print("DENIED")
            break

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

for i in range(n + 1):
    if i == n:
        print("APPROVED")
    else:
        if info[i] % 2 == 0:
            if info[i] % 3 == 0 or info[i] % 5 == 0:
                continue
            else:
                print("DENIED")
                break
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

flag = 1
for i in range(n):
    if flag == 0:
        break
    for j in range(i+1, n):
        if a[i] == a[j]:
            flag = 0
            break

if flag == 1:
    print("YES")
else:
    print("NO")

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

flag = 1
a.sort()
for i in range(n-1):
    if a[i] == a[i+1]:
        flag = 0
        break
    
if flag == 1:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
p = list(map(int, input().split()))

for i in range(n):
    p[i] = (p[i]+1)/2

ans = [0]*(n-k+1)
for i in range(n-k+1):
    ans[i] = sum(p[i:i+k])

print(max(ans))

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

for i in range(n):
    p[i] = (p[i]+1)/2

ans = [0]*(n)
tem = 0
for i in range(n):
    tem = tem
    if i < k:
        tem = tem + p[i]
    else:
        tem = tem + p[i] - p[i-k]
    ans[i] = tem

print(max(ans))

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

ans = [0 for i in range(n-k+1)]
for i in range(n-k+1):
    for j in range(k):
        ans[i] += (p[i+j]+1)/2

print(max(ans))

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

for i in range(n):
    p[i] = (p[i]+1)/2

ans = [0]*(n)
tem = 0
for i in range(n):
    tem = tem
    if i < k:
        tem = tem + p[i]
    else:
        tem = tem + p[i] - p[i-k]
    ans[i] = tem

print(max(ans))
Buggy python submission (verdict: Runtime Error):
n = input()
k = int(input())
import math
digit = math.floor(math.log10(int(n))) + 1
dp0 = [[0 for i in range(k+1)] for j in range(digit+1)]
dp1 = [[0 for i in range(k+1)] for j in range(digit+1)]

dp1[1][1] = 1
dp0[1][1] = int(n[0])-1
for i in range(1, digit+1):
    dp0[i][0] = 1

for i in range(2, digit+1):
    for j in range(1, k+1):
        num = int(n[i-1])
        if num == 0:
            dp0[i][j] = dp0[i-1][j-1]*9 + dp0[i-1][j]
            dp1[i][j] = dp1[i-1][j] 
        else:
            dp0[i][j] = dp0[i-1][j-1]*9 + dp0[i-1][j] + dp1[i-1][j-1] * (num-1) + dp1[i-1][j]
            dp1[i][j] = dp1[i-1][j-1]



Fixed submission:
n = input()
k = int(input())
digit = len(n)
dp0 = [[0 for i in range(k+1)] for j in range(digit+1)]
dp1 = [[0 for i in range(k+1)] for j in range(digit+1)]

dp1[1][1] = 1
dp0[1][1] = int(n[0])-1
for i in range(1, digit+1):
    dp0[i][0] = 1

for i in range(2, digit+1):
    for j in range(1, k+1):
        num = int(n[i-1])
        if num == 0:
            dp0[i][j] = dp0[i-1][j-1]*9 + dp0[i-1][j]
            dp1[i][j] = dp1[i-1][j] 
        else:
            dp0[i][j] = dp0[i-1][j-1]*9 + dp0[i-1][j] + dp1[i-1][j-1] * (num-1) + dp1[i-1][j]
            dp1[i][j] = dp1[i-1][j-1]

print(dp0[digit][k] + dp1[digit][k])
Buggy python submission (verdict: Runtime Error):
7
1 2 3 4 5 6 7

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

p_sort=sorted(info)
tem_1=0
tem_2=0
tem=0
for i in range(n-1):
  if info[i]>info[i+1]:
    tem_1=i
    for j in range(n-i-2):
      if info[i+j+1]>info[i+j+2]:
        tem_2=i+j+2
        break
    break
tem=info[tem_1]
info[tem_1]=info[tem_2]
info[tem_2]=tem


for i in range(n):
  if info[i]!=p_sort[i]:
    print("NO")
    break
  
  if i==n-1:
    print("YES")
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())

from math import gcd
c_d=c*d/gcd(c,d)
if a%c==0:
    wari_c=int(b//c-a//c+1)
else:
    wari_c=int(b//c-a//c)
if a%d==0:
    wari_d=int(b//d-a//d+1)
else:
    wari_d=int(b//d-a//d)
if a%c_d==0:
    wari_c_d=int(b//c_d-a//c_d+1)
else:
    wari_c_d=int(b//c_d-a//c_d)

print(b-a+1-(wari_c+wari_d-wari_c_d))

Fixed submission:
a,b,c,d = map(int, input().split())

import fractions
lcmcd = c * d // fractions.gcd(c,d)
bc = b // c
ac = a // c
bd = b // d
ad = a // d
blcmcd = b // lcmcd
alcmcd = a // lcmcd

if a % c != 0:
    ac += 1
if a % d != 0:
    ad += 1
if a % lcmcd != 0:
    alcmcd += 1

print((b - a + 1) - ((bc - ac + 1) + (bd - ad + 1) - (blcmcd -alcmcd + 1)))

Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())

from math import gcd
c_d=c*d/gcd(c,d)
wari_c=int(b//c-a//c)
wari_d=int(b//d-a//d)
wari_c_d=int(b//c_d-a//c_d)

print(b-a+1-(wari_c+wari_d-wari_c_d))

Fixed submission:
a,b,c,d = map(int, input().split())

import fractions
lcmcd = c * d // fractions.gcd(c,d)
bc = b // c
ac = a // c
bd = b // d
ad = a // d
blcmcd = b // lcmcd
alcmcd = a // lcmcd

if a % c != 0:
    ac += 1
if a % d != 0:
    ad += 1
if a % lcmcd != 0:
    alcmcd += 1

print((b - a + 1) - ((bc - ac + 1) + (bd - ad + 1) - (blcmcd -alcmcd + 1)))

Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())

from math import gcd
c_d=c*d/gcd(c,d)
wari_c=int(b//c-a//c)
wari_d=int(b//d-a//d)
wari_c_d=int(b//c_d-a//c_d)

print(b-a+1-(wari_c+wari_d-wari_c_d))

Fixed submission:
a,b,c,d = map(int, input().split())

import fractions
lcmcd = c * d // fractions.gcd(c,d)
bc = b // c
ac = a // c
bd = b // d
ad = a // d
blcmcd = b // lcmcd
alcmcd = a // lcmcd

if a % c != 0:
    ac += 1
if a % d != 0:
    ad += 1
if a % lcmcd != 0:
    alcmcd += 1

print((b - a + 1) - ((bc - ac + 1) + (bd - ad + 1) - (blcmcd -alcmcd + 1)))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())

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

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

if(k==1):
    print(0)
else:
    print(n-k)
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
 
if a >= 13:
  print(b)
elif 6 <= a && a <= 12:
  print(int(b/2))
else:
  print(0)

Fixed submission:
a,b = map(int, input().split())
 
if a >= 13:
  print(b)
elif 6 <= a and a <= 12:
  print(int(b/2))
else:
  print(0)

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

if a >= 13:
  print(b)
elif 6 <= a && a <= 12:
  print(b/12)
else:
  print(0)

Fixed submission:
a,b = map(int, input().split())
 
if a >= 13:
  print(b)
elif 6 <= a and a <= 12:
  print(int(b/2))
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
cards = []
for i in range(m):
    cards.append(list(map(int,input().split())))

min = cards[0][0]
max = cards[0][1]

for i in range(m):
    if cards[i][0] > min:
        min = cards[i][0]
    if cards[i][1] < max:
        max = cards[i][1]

if max >= min:
    print(max - min + 1)
else:
    print(0)

Fixed submission:
a,b = map(int, input().split())
 
if a >= 13:
  print(b)
elif 6 <= a and a <= 12:
  print(int(b/2))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
b=input()
 
if b="A":
    print("T")
elif b="T":
    print("A")
elif b="G":
    print("C")
elif b="C":
    print("G")

Fixed submission:
b=input()
 
if b=="A":
    print("T")
elif b=="T":
    print("A")
elif b=="G":
    print("C")
elif b=="C":
    print("G")

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

if b="A":
    print("T")
elif b="T":
    print("A")
elif b="G":
    print("C")
elif b="C":
    print("G")

Fixed submission:
b=input()
 
if b=="A":
    print("T")
elif b=="T":
    print("A")
elif b=="G":
    print("C")
elif b=="C":
    print("G")
Buggy python submission (verdict: Runtime Error):
s=list(map(int,input().split("/")))
 
if s[0]<=2018:
  print("Heisei")
elif s[0]=2019 and s[1]<5:
  print("Heisei")
else:
  print("TBD")

Fixed submission:
s=list(map(int,input().split("/")))
 
if s[0]<=2018:
  print("Heisei")
elif s[0]==2019 and s[1]<5:
  print("Heisei")
else:
  print("TBD")

Buggy python submission (verdict: Runtime Error):
s=list(map(int,input().split("/")))
 
if s[0]<=2018:
  print(Heisei)
elif s[0]=2019 and s[1]<5:
  print(Heisei)
else:
  print(TBD)

Fixed submission:
s=list(map(int,input().split("/")))
 
if s[0]<=2018:
  print("Heisei")
elif s[0]==2019 and s[1]<5:
  print("Heisei")
else:
  print("TBD")

Buggy python submission (verdict: Runtime Error):
s=list(map(int,input().split()))
 
if s[0]<=2018:
  print(Heisei)
elif s[0]=2019 and s[1]<5:
  print(Heisei)
else:
  print(TBD)

Fixed submission:
s=list(map(int,input().split("/")))
 
if s[0]<=2018:
  print("Heisei")
elif s[0]==2019 and s[1]<5:
  print("Heisei")
else:
  print("TBD")

Buggy python submission (verdict: Runtime Error):
s=list(map(int,input().split(/)))

if s[0]<=2018:
  print(Heisei)
elif s[0]=2019 and s[1]<5:
  print(Heisei)
else:
  print(TBD)


Fixed submission:
s=list(map(int,input().split("/")))
 
if s[0]<=2018:
  print("Heisei")
elif s[0]==2019 and s[1]<5:
  print("Heisei")
else:
  print("TBD")
Buggy python submission (verdict: Runtime Error):
n=int(input())
yr_m=[]
sum_m=0
for i in range(n):
  yr_m.append(list(map(float,str,input().split())))
 
  
for j in range(n):
  if yr_m[j][1]=="BTC":
    yr_m[j][0]=yr_m[j][0]*380000.0
  sum_m=sum_m+yr_m[j][0]
 
print(sum_m)

Fixed submission:
n=int(input())
yr_m=[]
sum_m=0
for i in range(n):
    yr_m.append(list(map(str,input().split())))

for k in range(n):
    yr_m[k][0]=float(yr_m[k][0])

for j in range(n):
    if yr_m[j][1]=="BTC":
        yr_m[j][0]=yr_m[j][0]*380000.0
    sum_m=sum_m+yr_m[j][0]

print(sum_m)

Buggy python submission (verdict: Runtime Error):
n=int(input())
yr_m=[]
sum_m=0
for i in range(n):
  yr_m.append(list(map(float,input().split())))

  
for j in range(n):
  if yr_m[j][1]=="BTC":
    yr_m[j][0]=yr_m[j][0]*380000.0
  sum_m=sum_m+yr_m[j][0]

print(sum_m)


Fixed submission:
n=int(input())
yr_m=[]
sum_m=0
for i in range(n):
    yr_m.append(list(map(str,input().split())))

for k in range(n):
    yr_m[k][0]=float(yr_m[k][0])

for j in range(n):
    if yr_m[j][1]=="BTC":
        yr_m[j][0]=yr_m[j][0]*380000.0
    sum_m=sum_m+yr_m[j][0]

print(sum_m)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())

a=(input().split())
#print(a)
ans=1

for i in range(n):
    ans=ans*int(a[i])


if ans>10**18:
    ans=-1

print(ans)

Fixed submission:
import numpy as np
n=int(input())
ans=1
a=input().split()
#print(a)
if '0' in a:
    ans=0
    print(ans)
if ans!=0:
    for i in a:
        ans=ans*int(i)
        if ans>10**18:
            ans=-1
            break
    print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())

a= list(map(float,input().split()))
def calc_double(n):
    return n / 10
a2 = list(map(calc_double,a))
#print(a2)

ans=np.prod(a2)*10**n

if ans>10**(18) or ans<0:
    ans=-1
print(int(ans))

Fixed submission:
import numpy as np
n=int(input())
ans=1
a=input().split()
#print(a)
if '0' in a:
    ans=0
    print(ans)
if ans!=0:
    for i in a:
        ans=ans*int(i)
        if ans>10**18:
            ans=-1
            break
    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):
    if a[i]==0:
        ans=0
        exit
    ans*=a[i]

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

Fixed submission:
import numpy as np
n=int(input())
ans=1
a=input().split()
#print(a)
if '0' in a:
    ans=0
    print(ans)
if ans!=0:
    for i in a:
        ans=ans*int(i)
        if ans>10**18:
            ans=-1
            break
    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):
    if a[i]==0:
        ans=0
        exit
for i in range(n):
    ans*=a[i]

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

Fixed submission:
import numpy as np
n=int(input())
ans=1
a=input().split()
#print(a)
if '0' in a:
    ans=0
    print(ans)
if ans!=0:
    for i in a:
        ans=ans*int(i)
        if ans>10**18:
            ans=-1
            break
    print(ans)
Buggy python submission (verdict: Runtime Error):
#Skill Up
n,m,x = map(int, input().split())

#ca = [map(int, input().split()) for _ in range(n)]
#ca = [input().split() for l in range(n)]
import sys
ca = [[int(c) for c in l.split()] for l in sys.stdin]
#c, a = [list(i) for i in zip(*ca)]
#print(ca)
#print(ca[0][0])
c=[]
a=[]
for l in range(n):
    c.append(ca[l][0])
#print(c)

for l in range(n):
    del ca[l][0]
#print(ca)
a=ca

INF = float('INF')
min_cost = INF
 
def dfs(i, cost, learn):
    if i == n:
        if min(learn) >= x:
            return cost
        else:
            return INF
    else:
        new_learn = [X + Y for (X, Y) in zip(a[i], learn)]
        cost = min(dfs(i + 1, cost, learn), dfs(i + 1, cost + C[i], new_learn))
        return cost
 
min_cost = dfs(0, 0, [0] * m)
 
if min_cost == INF:
    print(-1)
else:
    print(min_cost)




Fixed submission:
#Skill Up
n,m,x = map(int, input().split())

#ca = [map(int, input().split()) for _ in range(n)]
#ca = [input().split() for l in range(n)]
import sys
ca = [[int(c) for c in l.split()] for l in sys.stdin]
#c, a = [list(i) for i in zip(*ca)]
#print(ca)
#print(ca[0][0])
c=[]
for l in range(n):
    c.append(ca[l][0])
#print(c)

for l in range(n):
    del ca[l][0]
#print(ca)

INF = float('INF')
min_cost = INF
 
def dfs(i, cost, learn):
    if i == n:
        if min(learn) >= x:
            return cost
        else:
            return INF
    else:
        new_learn = [X + Y for (X, Y) in zip(ca[i], learn)]
        cost = min(dfs(i + 1, cost, learn), dfs(i + 1, cost + c[i], new_learn))
        return cost
 
min_cost = dfs(0, 0, [0] * m)
 
if min_cost == INF:
    print(-1)
else:
    print(min_cost)