Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
[H,W]=[int(x) for x in raw_input().split()]
N=int(raw_input())
A=[int(x) for x in raw_input().split()]
B=[[0 for x in range(W)] for y in range(H)]
p=0
q=0
d=1
k=0
for i in range(1,N+1):
    for j in  range(A[i-1]):
        B[p][(q+k)*d]=i
        q+=1
        if q==N:
            p+=1
            q=0
            d*=-1
            k= not k
for i in range(H):
    print "".join([str(x) for x in B[i]])
        
        

Fixed submission:
[H,W]=[int(x) for x in raw_input().split()]
N=int(raw_input())
A=[int(x) for x in raw_input().split()]
B=[[0 for x in range(W)] for y in range(H)]
p=0
q=0
d=1
k=0
D=6
for i in range(1,N+1):
    for j in  range(A[i-1]):
        B[p][(q+k)*d]=i
        q+=1
        if q==W:
            p+=1
            q=0
            d*=-1
            k= not k
for i in range(H):
    print "".join([str(x).ljust(D) for x in B[i]])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
an = list(map(int, input().split()))

ans = 1

for i in an:
    
    ans *= i
    
else:
    print(ans if ans <= 10 ** 18 else -1)

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

ans = 1

if(0 in an):
    print(0)
    
else:
    for i in an:
        
        ans *= i
        if(ans > 10 ** 18):
            print(-1)
            break
        
    else:
        print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lGain = []
for i in range(N):
    r = input()
    for j in range(len(lGain)):
        if r == lGain[j]:
            break
    else:
        lGain.append(r)

print(len(lGain))

Fixed submission:
N = int(input())
lResult = [input() for i in range(N)]

gain = list(set(lResult))

print(len(gain))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lResult = [input() for i in range(N)]
lGain = []

for i in range(N):
    for j in range(len(lGain)):
        if lResult[i] == lGain[j]:
            break
    else:
        lGain.append(lResult[i])

print(len(lGain))

Fixed submission:
N = int(input())
lResult = [input() for i in range(N)]

gain = list(set(lResult))

print(len(gain))
Buggy python submission (verdict: Runtime Error):
def main():
	n, k = map(int, input().split())
	P = list(map(int, input().split()))
	sorted_p = sorted(P)
	ans = sum(sorted_p[:k])
	print(ans)
	return

if __name__ == "__main__":
	main(

Fixed submission:
def main():
	n, k = map(int, input().split())
	P = list(map(int, input().split()))
	sorted_p = sorted(P)
	ans = sum(sorted_p[:k])
	print(ans)
	return

if __name__ == "__main__":
	main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
A = map(int, input().split())
m = 1

for item in A:
    m *= item

if m > 10 ** 18:
    print("-1")
    sys.exit()
print(m)

Fixed submission:
import sys
N = int(input())
A = list(map(int, input().split()))
m = 1
if 0 in A:
    print(0)
    sys.exit()

for item in A:
    m *= item
    if m > 10 ** 18:
        print("-1")
        sys.exit()
print(m)
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
t_eq = -(-C//B)
a_eq = -(-A//D)
if t_eq <= a_eq:
    print('Yes')
else:
    print('No')

Fixed submission:
S, W = map(int, input().split())
print('unsafe' if S <= W else 'safe')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n = int(input())
Al = list(input().split())
count = Counter(Al)
for i in range(n):
    if str(i + 1) in Al:
        print(count[str(i+1)])
    else:
        print(0)

Fixed submission:
from collections import Counter
n = int(input())
Al = list(input().split())
cdict = Counter(Al)
for i in range(n):
    print(cdict[str(i+1)])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
Al = list(map(int, input().split()))
for i in range(n):
    print(Al.count(i+1))

Fixed submission:
from collections import Counter
n = int(input())
Al = list(input().split())
cdict = Counter(Al)
for i in range(n):
    print(cdict[str(i+1)])
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


ans = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
            ans += gcd(gcd(a+1, b+1), c+1)

print(ans)


Fixed submission:
K = int(input())


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


ans = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
            ans += gcd(gcd(a+1, b+1), c+1)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
bc = []


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


fin = 0
for a in range(K):
    bc = []
    for b in range(K):
        for c in range(K):
            ans = gcd(b+1, c+1)
            bc.append(ans)
    fin += sum([gcd(a+1, i) for i in bc])

print(fin)


Fixed submission:
K = int(input())


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


ans = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
            ans += gcd(gcd(a+1, b+1), c+1)

print(ans)
Buggy python submission (verdict: Runtime Error):
import math
n, m = map(int, input().split())
ans = math.factorial(n - 1) + math.factorial(m)
print(ans)

Fixed submission:
from math import factorial
n, m = map(int, input().split())
c_n = factorial(n) / (factorial(2) * factorial(n - 2)) if n > 1 else 0
c_m = factorial(m) / (factorial(2) * factorial(m - 2)) if m > 1 else 0
ans = int(c_n) + int(c_m)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
S = input()

def isKaibun(txt, n):
    for i in range(n):
        if txt[i] == txt[-(i+1)]:
            continue
        else:
            print("No")
            sys.exit(-1)
    return 0

l = len(S)
isKaibun(S, l//2)

l_b = (l-1)//2 
isKaibun(S[:l_b], l_b//2)

l_a = (l+3)//2
isKaibun(S[l_a-1:], (l-l_a)//2)

print("Yes")

Fixed submission:
import sys
S = input()

def isKaibun(txt, n):
    for i in range(n):
        if txt[i] == txt[-(i+1)]:
            continue
        else:
            print("No")
            sys.exit()
    return 0

l = len(S)
isKaibun(S, l//2)

l_b = (l-1)//2 
isKaibun(S[:l_b], l_b//2)

l_a = (l+3)//2
isKaibun(S[l_a-1:], (l-l_a)//2)

print("Yes")
Buggy python submission (verdict: Runtime Error):
In = list(map(int, input().split()))
sin = set(In)
print("Yes" if len(sin) == 2 else "No")


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

"""
ans = 1
for x in range(N):
    ans *= A[x]
"""
A = sorted(A)

ans = 1
for x in A:
    ans *= x

if ans > 1.0e+18:
    print(-1)
else:
    print(ans)


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

"""
ans = 1
for x in range(N):
    ans *= A[x]
"""
A = sorted(A)

ans = 1
for x in A:
    ans *= x
    if ans == 0 or ans > 1.0e+18:
        break


if ans > 1.0e+18:
    print(-1)
else:
    print(ans)

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

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

if ans > 1.0e+18:
    print(-1)
else:
    print(ans)



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

"""
ans = 1
for x in range(N):
    ans *= A[x]
"""
A = sorted(A)

ans = 1
for x in A:
    ans *= x
    if ans == 0 or ans > 1.0e+18:
        break


if ans > 1.0e+18:
    print(-1)
else:
    print(ans)

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

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

if ans > 1.0e+18:
    print(-1)
else:
    print(ans)

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

"""
ans = 1
for x in range(N):
    ans *= A[x]
"""
A = sorted(A)

ans = 1
for x in A:
    ans *= x
    if ans == 0 or ans > 1.0e+18:
        break


if ans > 1.0e+18:
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import functools
import math

K = int(input())

def gcd_2(*vals):
    return functools.reduce(math.gcd, vals)

ans=0
for x in range(1,K+1):
    for y in range(1,K+1):
        for z in range(1,K+1):
            ans += gcd_2(x,y,z)

print(ans)


Fixed submission:
import functools
import math

K = int(input())

def gcd_2(*vals):
    return functools.reduce(math.gcd, vals)

ans=0
for x in range(1,K+1):
    for y in range(1,K+1):
        for z in range(1,K+1):
            ans += gcd_2(x,y,z)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N, K = list(map(int,input().split()))

ans = 1e+19

while True:
    N = abs(N-K)
    if N >= ans:
        break
    ans = N

print(ans)

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

ans = min(N%K, K-(N%K))

print(ans)

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

ans = 1e+19

while True:
    N = abs(N-K)
    if N >= ans:
        break
    ans = N

print(ans)


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

ans = min(N%K, K-(N%K))

print(ans)
Buggy python submission (verdict: Runtime Error):
from itertools import permutations

n = int(input())
nums1 = list(map(int,input(),split("")))
nums2 = list(map(int,input(),split("")))

t1 = tuple(nums1)
t2 = tuple(nums2)

index = 1
a = b = -1

for perm in permutations(list(range(1,n+1))):
    if perm == t1:
        a = index
    if perm == t2:
        b = index
    index +=  1

print(abs(a-b))

Fixed submission:
from itertools import permutations

n = int(input())
nums1 = list(map(int,input().split(" ")))
nums2 = list(map(int,input().split(" ")))

t1 = tuple(nums1)
t2 = tuple(nums2)

index = 1
a = b = -1

for perm in permutations(list(range(1,n+1))):
    if perm == t1:
        a = index
    if perm == t2:
        b = index
    index += 1

print(abs(a-b))

Buggy python submission (verdict: Runtime Error):
from itertools import permutations

n = int(input())
nums1 = list(map(int,input(),split("")))
nums2 = list(map(int,input(),split("")))

t1 = tuple(nums1)
t2 = tuple(nums2)

index = 1
a = b = -1

for perm in permtations(list(range(1,n+1))):
    if perm == t1:
        a = index
    if perm == t2:
        b = index
    index +=  1

print(abs(a-b))

Fixed submission:
from itertools import permutations

n = int(input())
nums1 = list(map(int,input().split(" ")))
nums2 = list(map(int,input().split(" ")))

t1 = tuple(nums1)
t2 = tuple(nums2)

index = 1
a = b = -1

for perm in permutations(list(range(1,n+1))):
    if perm == t1:
        a = index
    if perm == t2:
        b = index
    index += 1

print(abs(a-b))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k = map(int,input().split())
num=0
for i in range(1,k+1):
    if i <= a:
        num+=1
        continue
    elif i <= a+b:
        continue
    else:
        num-=1
        continue
print(num)



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

Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
l = [1]*a + [0]*b + [-1]*c
print(sum(l[0:k]))


Fixed submission:
a,b,c,k = map(int,input().split())
if k <= a:
    print(k)
elif k <= a+b:
    print(a)
else:
    print(a-(k-(a+b)))
Buggy python submission (verdict: Runtime Error):
x=int(input())
n = 1000
l = [x**5 for x in range(n)]
for i,y in enumerate(l):
    if abs(x-y) in l:
        if 0 < x-y:
            print(f"{l.index(x-y)} {-i}")
            break
        else:
            print(f"{i} {-(l-index(abs(x-y)))}")
            break



Fixed submission:
x = int(input())
for a in range(1000):
    for b in range(1000):
        if a**5 - b**5 == x:
            print(f"{a} {b}")
            break
        elif a**5 - (-b)**5 == x:
            print(f"{a} {-b}")
            break
    else:
        continue
    break

Buggy python submission (verdict: Runtime Error):
x=int(input())
n = 1000
l = [x**5 for x in range(n)]
for i,y in enumerate(l):
    if abs(x-y) in l:
        print(f"{l.index(x-y)} {-i}")
        break


Fixed submission:
x = int(input())
for a in range(1000):
    for b in range(1000):
        if a**5 - b**5 == x:
            print(f"{a} {b}")
            break
        elif a**5 - (-b)**5 == x:
            print(f"{a} {-b}")
            break
    else:
        continue
    break

Buggy python submission (verdict: Runtime Error):
x=int(input())
n = 1000
l = [x**5 for x in range(-n, n)]
for i,y in enumerate(l):
    if y+x in l:
        print(f'{int(l.index(y+x)-len(l)/2+1)} {int(i-len(l)/2+1)}')
        break
    elif y-x in l:
        print(f'{int(i-len(l)/2+1)} {int(l.index(y-x)-len(l)/2+1)}')
	break

Fixed submission:
x = int(input())
for a in range(1000):
    for b in range(1000):
        if a**5 - b**5 == x:
            print(f"{a} {b}")
            break
        elif a**5 - (-b)**5 == x:
            print(f"{a} {-b}")
            break
    else:
        continue
    break
Buggy python submission (verdict: Runtime Error):
k = int(input())
a,b=map(int, input().split())
for i in range(1,2000):
    x=k*i
    if a <= k and k <= b:
        print("OK")
        break
    else b < k:
        print("NG")
	break


Fixed submission:
k = int(input())
a,b=map(int, input().split())
for i in range(1,2000):
    x=k*i
    if a <= x and x <= b:
        print("OK")
        break
    elif b < x:
        print("NG")
        break
Buggy python submission (verdict: Runtime Error):
import itertools
n,m,q=map(int,input().split())
abcd=[None]*q
for i in range(q):
    abcd[i]=list(map(int,input().split()))
num=0
for l in list(map(list, itertools.combinations(list(range(1,m+1))*m, n))):
    num_ = 0
    for x in abcd:
        if l[x[1]-1]-l[x[0]-1] == x[2]:
            num_ += x[3]
    num = max(num ,num_)
print(num)


Fixed submission:
a,b,n=map(int, input().split())
if n < b:
    print((a*n)//b - a*(n//b))
else:
    print((a*(b-1))//b - a*((b-1)//b))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))
for i in range(1,n+1):
    print(a.count(i))


Fixed submission:
import collections
n=int(input())
a=list(map(int, input().split()))
a=collections.Counter(a)
for i in range(1,n+1):
    print(a.get(i, 0))
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
s=input()
l=list(collections.Counter(s).values())
ans=l[0]*l[1]*l[2]
for i in range(n):
    for j in range(i+1,n):
        k = 2*j-i
        if n <= k:
            break
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans-=1
print(ans)

Fixed submission:
import collections
n = int(input())
s=input()
l=list(collections.Counter(s).values())
if len(l) == 3:
    ans=l[0]*l[1]*l[2]
    for i in range(n):
        for j in range(i+1,n):
            k = 2*j-i
            if n <= k:
                break
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans-=1
    print(ans)
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
s=input()
l=list(collections.Counter(s).values())
ans=l[0]*l[1]*l[2]
for i in range(n):
    for j in range(i+1,n):
        k = 2*j-i
        if n<=k:
            continue
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans-=1
print(ans)

Fixed submission:
import collections
n = int(input())
s=input()
l=list(collections.Counter(s).values())
if len(l) == 3:
    ans=l[0]*l[1]*l[2]
    for i in range(n):
        for j in range(i+1,n):
            k = 2*j-i
            if n <= k:
                break
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans-=1
    print(ans)
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s=input()
r=[]
g=[]
b=[]
for i,c in enumerate(s):
    if 'R' == c:
        r.append(i+1)
    elif 'G' == c:
        g.append(i+1)
    elif 'B' == c:
        b.append(i+1)
count=0
for i in r:
    for j in g:
        for k in b:
            l=sorted([i,j,k])
            if l[1]*2-l[0]-l[2]:
                count+=1
print(count)

Fixed submission:
import collections
n = int(input())
s=input()
l=list(collections.Counter(s).values())
if len(l) == 3:
    ans=l[0]*l[1]*l[2]
    for i in range(n):
        for j in range(i+1,n):
            k = 2*j-i
            if n <= k:
                break
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans-=1
    print(ans)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
x,y,z=map(int,input().split())
print(f'{z} {x} {y}')



Fixed submission:
x,y,z=map(int,input().split())
print('{0} {1} {2}'.format(z,x,y))
Buggy python submission (verdict: Runtime Error):
import math
n,m=map(int,input().split())
a=list(map(int,input().split()))
t=sum(a)
a=list(filter(lambda x: math.ceil(t/(4*m)) < x, a))
print('Yes' if m <= len(a) else 'No')


Fixed submission:
k=int(input())
l=list(map(str,range(1,10)))
for i in range(k):
    x=l[i][-1]
    if x=='0':
        l.append(l[i]+x)
        l.append(l[i]+'1')
    elif x=='9':
        l.append(l[i]+'8')
        l.append(l[i]+x)
    else:
        n=int(x)
        l.append(l[i]+str(n-1))
        l.append(l[i]+x)
        l.append(l[i]+str(n+1))
print(sorted(map(int,l))[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
h,n=map(int,input().split())

ab=[None]*n
for i in range(n):
    ab[i]=tuple(map(int,input().split()))

dp=[float('inf')]*(h+1)

for i in range(1,h+1):
    for a,b in ab:
        if 0 < i-a:
            dp[i]=min(dp[i], dp[i-a]+b)
        else:
            dp[i]=min(dp[i], b)
print(dp[h])

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

ab=[None]*n
for i in range(n):
    ab[i]=tuple(map(int,input().split()))

dp=[float('inf')]*(h+1)

for i in range(1,h+1):
    for a,b in ab:
        if 0 < i-a:
            dp[i]=min(dp[i], dp[i-a]+b)
        else:
            dp[i]=min(dp[i], b)
print(dp[h])
Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
print(Yes if n==m else No)

Fixed submission:
n,m=map(int, input().split())
print('Yes' if n==m else 'No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
li=[]
for i in range(0,n):
    flag=True
    x,l=map(int, input().split())
    mi=x-l
    ma=x+l
    for j in li:
	if j[0] < mi < ma < j[1]:
            flag=False
            break
    if flag:
	li.append([mi,ma])
print(len(li))

Fixed submission:
n=int(input())
li=[None]*n
for i in range(0,n):
    flag=True
    x,l=map(int, input().split())
    li[i]=(x+l, x-l)
li=sorted(li)
count=1
x,y=li[0]
for i in range(1,n):
    x2,y2=li[i]
    if y2 < x:
        continue
    count=count+1
    x=x2
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
print(s.count('ABC')

Fixed submission:
n = int(input())
s = input()
print(s.count('ABC'))
Buggy python submission (verdict: Runtime Error):
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())
m1 == m2 if ans = 0 else ans = 1
print(ans)


Fixed submission:
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())
print(0 if m1 == m2 else 1)
Buggy python submission (verdict: Runtime Error):
n=input()
print((n-2)*180)

Fixed submission:
n=int(input())
print((n-2)*180)
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split(" "))
s = input()
s[k-1] = s[k-1].lower()
print(s)


Fixed submission:
n,k = map(int, input().split(" "))
s = list(input())
s[k-1] = s[k-1].lower()
print("".join(s))
Buggy python submission (verdict: Runtime Error):
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(n):
    for j in range(n):
        x = l[2]*i
        y = l[1]*j
        if (n - (x + y) < 0:
            break
        if (n-(x+y))%l[0] == 0:
            count = count + 1
print(count)

Fixed submission:
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(int(n/l[2])+1):
    for j in range(int(n/l[1])+1):
        x = l[2]*i
        y = l[1]*j
        if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:
            count = count + 1
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split(" ")))
for i in range(1, n-1):
    print(a)
    if 0 <= a[i-1] and 0 <= a[i] and 0 <= a[i+1]:
        continue
    elif a[i-1] < 0 and 0 <= a[i] and a[i+1] < 0:
        a[i-1] = abs(a[i-1])
        a[i+1] = abs(a[i+1])
    elif a[i-1] < 0 and a[i] < 0:
        a[i-1] = abs(a[i-1])
        a[i] = abs(a[i])
    elif a[i] < a[i+1]:
        if abs(a[i]) >= abs(a[i+1]):
            a[i] = a[i]*-1
            a[i+1] = a[i+1]*-1
    elif a[i-1] < a[i]:
        if abs(a[i-1]) >= abs(a[i]):
            a[i-1] = a[i-1]*-1
            a[i] = a[i]*-1
    else:
        continue
print(sum(a))

Fixed submission:
n = int(input())
a = list(map(int, input().split(" ")))
if len(list(filter(lambda x: x < 0, a))) % 2 == 0:
    print(sum(list(map(abs, a))))
else:
    a = list(map(abs, a))
    print(sum(a) - min(a)*2)
Buggy python submission (verdict: Runtime Error):
inputs = [int(input()) for i in range(2)]

print(max([sum(inputs), inputs[0]*2-1, inputs[1]*2-1]))

Fixed submission:
inputs = list(map(int, input().split(" ")))
print(max([sum(inputs), inputs[0]*2-1, inputs[1]*2-1]))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

num_data = sys.stdin.readlines()
str_num_list = num_data[1].split()
num_list = [int(s) for s in str_num_list]
ans = 1
for i in range(int(num_data[0])):
  ans *= num_list[i]

if ans > pow(10, 18):
  print("-1")
else:
  print(ans)


Fixed submission:
import sys
import numpy as np

num_data = sys.stdin.readlines()
str_num_list = num_data[1].split()
num_list = [int(s) for s in str_num_list]
ans = 1
if 0 in num_list:
  ans = 0
else:
  for i in range(int(num_data[0])):
    ans *= num_list[i]
    if ans > pow(10, 18):
      ans = -1
      break

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

num_list = input().split()
ans = int(num_list[0]) * float(num_list[1]) * 100
ans = str(int(ans))[:-2]
print(int(ans))


Fixed submission:
import sys
from decimal import Decimal

num_list = input().split()
ans = Decimal(num_list[0]) * Decimal(num_list[1])
print(int(ans))