Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18 + 1
total = 1
cnt = 0
while cnt < N:
    total *= A[cnt]
    if total >= over_value:
        total = -1
    cnt += 1
    
for i in range(N):
    if A[i] == 0:
        total = 0
print(total)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18
total = 1
cnt = 0
while cnt < N:
    total *= A[cnt]
    if total > over_value:
        total = -1
        break
    cnt += 1
    
for i in range(N):
    if A[i] == 0:
        total = 0
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18 + 1
total = 1
cnt = 0
while cnt < len(A):
    total *= A[cnt]
    cnt += 1
    
if total >= over_value:
    total = -1
print(total)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18
total = 1
cnt = 0
while cnt < N:
    total *= A[cnt]
    if total > over_value:
        total = -1
        break
    cnt += 1
    
for i in range(N):
    if A[i] == 0:
        total = 0
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18 + 1
total = 1
if A.count(0):
    print(0)
else:
    cnt = 0
    while cnt < len(A):
        total *= A[cnt]
        cnt += 1
        
    if total >= over_value:
        total = -1
    print(total)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18
total = 1
cnt = 0
while cnt < N:
    total *= A[cnt]
    if total > over_value:
        total = -1
        break
    cnt += 1
    
for i in range(N):
    if A[i] == 0:
        total = 0
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18 + 1
total = 1
if A.count(0):
    print(0)
else:
    for i in A:
        total *= i
    if total >= over_value:
        total = -1
    print(total)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18
total = 1
cnt = 0
while cnt < N:
    total *= A[cnt]
    if total > over_value:
        total = -1
        break
    cnt += 1
    
for i in range(N):
    if A[i] == 0:
        total = 0
print(total)

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

N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18 + 1
total = functools.reduce(operator.mul, A)

if total >= over_value:
    total = -1
print(total)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18
total = 1
cnt = 0
while cnt < N:
    total *= A[cnt]
    if total > over_value:
        total = -1
        break
    cnt += 1
    
for i in range(N):
    if A[i] == 0:
        total = 0
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18 + 1
total = 1
if A.count(0):
    print(0)
else:
    for i in A:
        total *= i
    if total >= over_value:
        total = -1
    print(total)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18
total = 1
cnt = 0
while cnt < N:
    total *= A[cnt]
    if total > over_value:
        total = -1
        break
    cnt += 1
    
for i in range(N):
    if A[i] == 0:
        total = 0
print(total)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18 + 1
total = 1
if A.index(0):
    print(0)
else:
    for i in A:
        total *= i
    if total > over_value:
        total = -1
    print(total)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18
total = 1
cnt = 0
while cnt < N:
    total *= A[cnt]
    if total > over_value:
        total = -1
        break
    cnt += 1
    
for i in range(N):
    if A[i] == 0:
        total = 0
print(total)