Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator
n = int(input())

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


pre = functools.reduce(operator.mul, a)
if pre <= 1000000000000000000:
    print(pre)
else:
    print(-1)


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)

    if 0 in A:
        print('0')
        return
    prod=1
    for a in A:
        prod*=a
        if prod> 1000000000000000000:
            print('-1')
            return
    print(prod)

ans=main()

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())

a=list(map(int,input().split()))
import functools
import operator

pre = functools.reduce(operator.mul, a)
if pre <= 1000000000000000000:
    print(pre)
else:
    print(-1)


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)

    if 0 in A:
        print('0')
        return
    prod=1
    for a in A:
        prod*=a
        if prod> 1000000000000000000:
            print('-1')
            return
    print(prod)

ans=main()

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())

a=list(map(int,input().split()))
c=np.array(a)
pre = abs(np.prod(c))
if pre <= 1000000000000000000:
    print(pre)
else:
    print(-1)


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)

    if 0 in A:
        print('0')
        return
    prod=1
    for a in A:
        prod*=a
        if prod> 1000000000000000000:
            print('-1')
            return
    print(prod)

ans=main()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
pre = 1
a=list(map(int,input().split()))
for i in range(n):
    pre = pre * a[i]
if pre <= 1000000000000000000:
    print(pre)
else:
    print(-1)


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)

    if 0 in A:
        print('0')
        return
    prod=1
    for a in A:
        prod*=a
        if prod> 1000000000000000000:
            print('-1')
            return
    print(prod)

ans=main()

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


if score <= 10 ** 18:
    print(score)
else:
    print(-1)


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)

    if 0 in A:
        print('0')
        return
    prod=1
    for a in A:
        prod*=a
        if prod> 1000000000000000000:
            print('-1')
            return
    print(prod)

ans=main()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
pre = a[0]

s=1
while True:
    score = pre * a[s]
    pre = score
    s += 1
    if s==len(a):
        break
if score <= 10 ** 18:
    print(score)
else:
    print(-1)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)

    if 0 in A:
        print('0')
        return
    prod=1
    for a in A:
        prod*=a
        if prod> 1000000000000000000:
            print('-1')
            return
    print(prod)

ans=main()

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
pre=a[0]
score=0
for i in range(1,n):
    score=pre*a[i]

    pre=score

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

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)

    if 0 in A:
        print('0')
        return
    prod=1
    for a in A:
        prod*=a
        if prod> 1000000000000000000:
            print('-1')
            return
    print(prod)

ans=main()

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
pre=a[0]
score=0
for i in range(1,n):
    score=pre*a[i]

    pre=score

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

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)

    if 0 in A:
        print('0')
        return
    prod=1
    for a in A:
        prod*=a
        if prod> 1000000000000000000:
            print('-1')
            return
    print(prod)

ans=main()

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
pre=a[0]
score=0
for i in range(1,n):
    score=pre*a[i]
    
    pre=score
    
if score>10**18:
    print(-1)
else:
    print(score)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)

    if 0 in A:
        print('0')
        return
    prod=1
    for a in A:
        prod*=a
        if prod> 1000000000000000000:
            print('-1')
            return
    print(prod)

ans=main()