Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 1
for i in map(int,input().split()):
    ans = ans * i
if ans > 10**18:
    print('-1')
else:
    print(ans)

Fixed submission:
N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 1
rec = True
for i in range(N):
    ans = ans * l[i]
    if ans > 10**18:
        rec = False
        break

if rec:
    print(ans)
else:
    print('-1')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
y = pow(10,18)
x = 1

for i in map(int,input().split()):
    x *= i
if x > y:
    print("-1")
else:
    print(x)

Fixed submission:
N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 1
rec = True
for i in range(N):
    ans = ans * l[i]
    if ans > 10**18:
        rec = False
        break

if rec:
    print(ans)
else:
    print('-1')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
y = 10**18
x = 1

for i in map(int,input().split()):
    x *= i
if x > y:
    print("-1")
else:
    print(x)

Fixed submission:
N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 1
rec = True
for i in range(N):
    ans = ans * l[i]
    if ans > 10**18:
        rec = False
        break

if rec:
    print(ans)
else:
    print('-1')

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

N = int(input())

A = list(map(int, input().split()))

x = functools.reduce(operator.mul, A)
y = 10**18


if x > y:
    print("-1")
else:
    print(x)

Fixed submission:
N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 1
rec = True
for i in range(N):
    ans = ans * l[i]
    if ans > 10**18:
        rec = False
        break

if rec:
    print(ans)
else:
    print('-1')

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

A = list(map(int, input().split()))

x = functools.reduce(operator.mul, A)
y = 10**18


if x > y:
    print("-1")
else:
    print(x)

Fixed submission:
N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 1
rec = True
for i in range(N):
    ans = ans * l[i]
    if ans > 10**18:
        rec = False
        break

if rec:
    print(ans)
else:
    print('-1')

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
x = 1
y = 10**18

x = np.prod(A)
if x > y:
    print("-1")
else:
    print(x)


Fixed submission:
N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 1
rec = True
for i in range(N):
    ans = ans * l[i]
    if ans > 10**18:
        rec = False
        break

if rec:
    print(ans)
else:
    print('-1')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
x = 1
y = 10**18

for i in range(N):
    x *= A[i]
if x > y:
    print("-1")
else:
    print(x)

Fixed submission:
N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 1
rec = True
for i in range(N):
    ans = ans * l[i]
    if ans > 10**18:
        rec = False
        break

if rec:
    print(ans)
else:
    print('-1')

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


for i in range(N):
    x *= A[i]
if x <= 10**18:
    print(x)
else:
    print("-1")

Fixed submission:
N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 1
rec = True
for i in range(N):
    ans = ans * l[i]
    if ans > 10**18:
        rec = False
        break

if rec:
    print(ans)
else:
    print('-1')