Buggy python submission (verdict: Runtime Error):

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

    if 0 in A:
        print(0)

    prod = 1
    for a in A:
        prod *= a
        if prod > 10**18:
            print(-1)

    print(prod)

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)
    return

main ()

Buggy python submission (verdict: Runtime Error):
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 ()


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)
    return

main ()

Buggy python submission (verdict: Runtime Error):

n=int(input())
a = list(map(int,input().split()))
if 0 in a:
    print(0)

prod = 1
for a in A:
    prod *= a
    if prod > 10**18:
        print(-1)

print(prod)


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)
    return

main ()

Buggy python submission (verdict: Runtime Error):

n=int(input())
a = list(map(int,input(). split ()))
if 0 in a:
    print(0)

prod = 1
for a in A:
    prod *= a
    if prod > 10**18:
        print(-1)

print(prod)


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)
    return

main ()

Buggy python submission (verdict: Runtime Error):

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 > 10**18:
        print(-1)
        return

print(prod)


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)
    return

main ()

Buggy python submission (verdict: Time Limit Exceeded):


import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, *a = map(int, read().split())

val=1
for x in a:
    val*=x

print(val if val<=10**18 else '-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)
    return

main ()

Buggy python submission (verdict: Runtime Error):

n,*a=map(int,input().split)

val=1
for x in a:
    val*=x

print(val if val<=10**18 else '-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)
    return

main ()

Buggy python submission (verdict: Time Limit Exceeded):

import math

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

if 0 in a:
    print(0)

else:
    val=1
    for i in range(len(a)):
        val*=a[i]
    
    print(val if val<=10**18 else '-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)
    return

main ()

Buggy python submission (verdict: Time Limit Exceeded):

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


val=1
for i in range(len(a)):
    val*=a[i]


print(val if val<=10**18 else '-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)
    return

main ()