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

tar = reduce(lambda x, y: x*y, A)

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


Fixed submission:

import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print('-1')
        sys.exit()

print(tar)

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

tar = reduce(lambda x, y: x*y, A)

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


Fixed submission:

import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print('-1')
        sys.exit()

print(tar)

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

tar = reduce(lambda x, y: x*y, values)

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


Fixed submission:

import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print('-1')
        sys.exit()

print(tar)

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

tar = 1
for i in A:
    tar *= i

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


Fixed submission:

import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print('-1')
        sys.exit()

print(tar)

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

tar = 1
for i in range(A):
    tar *= i

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


Fixed submission:

import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print('-1')
        sys.exit()

print(tar)

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

tar = 1
for i in range(A):
    tar *=  i

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


Fixed submission:

import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print('-1')
        sys.exit()

print(tar)

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

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

tar = functools.reduce(operator.mul, A)

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


Fixed submission:

import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print('-1')
        sys.exit()

print(tar)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
tar = 1
for i in range(N):
    tar *= A[i]

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


Fixed submission:

import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print('-1')
        sys.exit()

print(tar)

Buggy python submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split))
tar = 1
for i in range(N):
    tar *= A[i]

print(tar)

Fixed submission:

import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print('-1')
        sys.exit()

print(tar)