Buggy python submission (verdict: Runtime Error):
#B
from functools import reduce

n = int(input())
a = list(map(int,input().split()))
flg = True
MAX = 10 ** 18
cnt = 1
a.sort()
result = reduce(lambda ans, x:ans * x, a)
if result > MAX:
    flg = False
    break
        
if flg:
    print(result)
else:
    print(-1)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()

Buggy python submission (verdict: Runtime Error):
#B
from functools import reduce
n = int(input())
a = tuple(map(int,input().split()))
flg = True
MAX = 10 ** 18
cnt = 1
a.sort()
result = reduce(lambda ans, x:ans * x, a)
if result > MAX:
    flg = False
    break
        
if flg:
    print(result)
else:
    print(-1)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import decimal
n = int(input())
a = list(map(int,input().split()))

a_n = np.array(a,dtype=np.dtype(decimal.Decimal))
#print(a_n)
#a_n.sort()
tmp = np.prod(a_n)

#result = int(np.prod(a_n))
#print(tmp)

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

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()

Buggy python submission (verdict: Time Limit Exceeded):
#B
from functools import reduce
n = int(input())
a = tuple(map(int,input().split()))
flg = True
MAX = 10 ** 18
cnt = 1
result = reduce(lambda ans, x:ans * x, a)
if result > MAX:
    flg = False
        

if flg:
    print(result)
else:
    print(-1)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()

Buggy python submission (verdict: Runtime Error):
#B
n = int(input())
a = tuple(map(int,input().split()))
flg = True
MAX = 10 ** 18
cnt = 1
result = reduce(lambda ans, x:ans * x, a)
if result > MAX:
    flg = False
        

if flg:
    print(result)
else:
    print(-1)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int,input().split()))
a_n = np.array(a,dtype=np.float64)
#print(a_n)
result = np.prod(a_n)
if result >= 10**18:
    print(-1)
else:
    print(int(result))

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int,input().split()))
a_n = np.array(a,dtype=np.float64)
#print(a_n)
result = np.prod(a_n)
if result > 10**18:
    print(-1)
else:
    print(int(result))

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

n = int(input())
a = list(map(int,input().split()))
MAX = 10**18
a.sort()
if a[0] == 0:
    print(0)
else:
    mul = reduce(lambda ans,x:ans*x, a)
    if mul > MAX:
        print(-1)
    else:
        print(mul)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import mul
n = int(input())
a = list(map(int,input().split()))
MAX = 10**18

mul = reduce(mul,a)
if mul > MAX:
    print(-1)
else:
    print(mul)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import mul
n = int(input())
a = list(map(int,input().split()))
MAX = 10**18

mul = reduce(mul,a)
if mul > MAX:
    print(-1)
else:
    print(mul)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()

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

if flg:
    print(cnt)
else:
    print(-1)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()