qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N=int(input())
A=list(map(int,input().split()))
ans=1
for i in A:
    ans*=i
    if ans>10**18:
        print(-1)
        exit()
    if i==0:
        print(0)
        exit()
print(ans)


    


            
    


    


    
    














    


    














Fixed code:
N=int(input())
A=list(map(int,input().split()))
ans=1
if 0 in A:
    print(0)
    exit()
for i in A:
    ans*=i
    if ans>10**18:
        print(-1)
        exit()
print(ans)
Buggy code:
N = int(input())
org = input().split()
for i in range(len(org)):
    org[i] = int(org[i])
A = sorted(org)
print(A)

answer = A[0]
overl = False

for i in range(N-1):
    answer *= A[i+1]
    if answer > 10**18:
        overl = True
        break

if overl:
    print("-1")
else:
    print(answer)

Fixed code:
N = int(input())
org = input().split()
for i in range(len(org)):
    org[i] = int(org[i])
A = sorted(org)

answer = A[0]
overl = False

for i in range(N-1):
    answer *= A[i+1]
    if answer > 10**18:
        overl = True
        break

if overl:
    print("-1")
else:
    print(answer)
Buggy code:
n = int(input())
lis = list(map(int, input().split()))
ans = 1

flag = 1
for i in lis:
    ans *= i
    if ans > 10**18:
        flag = -1
        break

if flag == 1:
    print(ans)
else:
    print(-1)

Fixed code:
n = int(input())
lis = list(map(int, input().split()))
ans = 1

flag = 1

for i in lis:
    ans *= i
    if ans > 10**18:
        flag = -1
        break

if 0 in lis:
    flag = 2

if flag == 1:
    print(ans)
elif flag == 2:
    print(0)
else:
    print(-1)
Buggy code:
n=input()
a = list(map(int, input().split()))
ans=1
 
for i in range(len(a)):
    ans*= a[i]
    if i==0:
        ans=0
        break
    if ans>=1000000000000000001:
        ans=-1
        break

print(ans)


Fixed code:
n=input()
a = list(map(int, input().split()))
ans=1
az=a.count(0)

if az>0:
    print(0)
else:
    for i in range(len(a)):
        ans*= a[i]
    
        if ans>=1000000000000000001:
            ans=-1
            break
    print(ans)
Buggy code:
N = int(input())
A=list(map(int, input().split()))

const = 10**18

result = 1
for i in A:
    result *= i
    if result>const:
        print(-1)
        exit(0)
print(result)

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

const = 10**18

if 0 in A:
    print(0)
    exit(0)

result = 1
for i in A:
    result *= i
    if result>const:
        print(-1)
        exit(0)
print(result)
Buggy code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().split()))
ans = 1
for aa in a:
    ans *= aa
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)


Fixed code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().split()))
a.sort()
ans = 1
for aa in a:
    ans *= aa
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)
Buggy code:
N = int(input())
A = N.split(" ")
A = list(map(int, A))
result = A[0]
for i in range(1,N):
  result = result*A[i]
  if result*A[i] > 10**18:
    print("-1")
    exit()
print(result)

Fixed code:
N = int(input())
A = input()
A = A.split(" ")
A = list(map(int, A))
result = 1
for i in range(N):
  result = result*A[i]
  if result > 10**18:
    result = 10**18 + 1
if result == 10**18 + 1:
   result = -1
print(result)
Buggy code:
N = int(input())
Alist = list(map(int,input().split()))
result = 1
for i in range(N):
    if Alist[i] == 0:
        result =0
        break
    else:
        result = result*Alist[i]
    if result > 10**18:
        result = -1
        break
print(result)

Fixed code:
N = int(input())
Alist = list(map(int,input().split()))
result = 1
if 0 in Alist:
    result = 0
else:
    for i in range(N):
        result = result*Alist[i]
        if result > 10**18:
            result = -1
            break
print(result)
Buggy code:
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 code:
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 ()
Buggy code:
n = int(input())
data = list(map(int, input().split()))
data.sort()
data.reverse()

while data[-1] == 0:
  data.insert(0,0)
  data.pop(-1)
 
ans = 1

for d in data:
  ans = ans * int(d)
  if ans > 10*18 or ans == 0:
    break
 
if ans > 10**18:
  print(-1)
else:
  print(ans)

Fixed code:
n = int(input())
data = list(map(int, input().split()))
data.sort()
data.reverse()

while data[-1] == 0:
  data.insert(0,0)
  data.pop(-1)
 
ans = 1

for d in data:
  ans = ans * int(d)
  if ans > 10**18 or ans == 0:
    break
 
if ans > 10**18:
  print(-1)
else:
  print(ans)
Buggy code:
n=int(input())
li=list(map(int,input().split()))
ans=1
if 0 in li:
    print('-1')
    import sys
    sys.exit()
    
for l in li:
    ans*=l
    #print(ans)
    if ans > 10**18:
        print('-1')
        break
else:
    print(ans)

Fixed code:
n=int(input())
li=list(map(int,input().split()))
ans=1
if 0 in li:
    print('0')
    import sys
    sys.exit()
    
for l in li:
    ans*=l
    #print(ans)
    if ans > 10**18:
        print('-1')
        break
else:
    print(ans)
Buggy code:
k=int(input())
mal=1      
n=list(map(int,input().split()))
      
          
for i in range(0,len(n)):
            mal=mal*n[i]
            if(mal>=10**18):
                print(-1)
                break
print(mal)


Fixed code:
k=int(input())
mal=1      
n=list(map(int,input().split()))
      
          
for i in range(0,len(n)):
    mal=mal*n[i]
    if(mal>10**18):
            mal=-1
            break
for j in range(0,len(n)):
    if(n[j]==0):
        mal=0
print(mal)
Buggy code:
from sys import exit

input()
a=list(map(int,input().split()))
ans=1
for i in a:
	ans *= i
	if(ans > 10**18):
		print(-1)
		exit()
print(ans)

Fixed code:
from sys import exit

input()
a=list(map(int,input().split()))
if 0 in a:
	print(0)
	exit()
ans=1
for i in a:
	ans *= i
	if(ans > 10**18):
		print(-1)
		exit()
print(ans)
Buggy code:
def iput(): return int(input())
def mput(): return map(int, input().split())
def lput(): return list(map(int, input().split()))

def solve():
    n = iput()
    a = lput()
    ans = 1
    for i in range(n):
        ans *= a[i]
        if ans > 10**18:
            print(-1)
            exit()
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Fixed code:
def iput(): return int(input())
def mput(): return map(int, input().split())
def lput(): return list(map(int, input().split()))
 
def solve():
    n = iput()
    a = lput()
    ans = 1
    if 0 in a:
        print(0)
        exit()
    for i in range(n):
        ans *= a[i]
        if ans > 10**18:
          print(-1)
          exit()
    print(ans)
    return 0
 
if __name__ == "__main__":
    solve()
Buggy code:
import sys

input = sys.stdin.readline

def main():

    ma = 10**18 +1
    N = int(input())
    A = list(map(int,input().split()))
    ans =1
    for i in A:
        ans *= i

    if ans >ma:
        print(-1)
    else:
        print(ans)




if __name__ == "__main__":
    main()

Fixed code:
import sys

input = sys.stdin.readline

def main():

    ma = 10**18
    N = int(input())
    A = list(map(int,input().split()))
    ans =1

    if 0 in A:
        print(0)
        exit()

    for i in A:
        ans *= i
        if ans >ma:
            print(-1)
            exit()

    if ans >ma:
        print(-1)
    else:
        print(ans)




if __name__ == "__main__":
    main()
Buggy code:
if __name__ == '__main__':
    a = int(input())
    b = [int(i) for i in input().split()]
    ans = 1
    b.sort(reverse=True)
    if 0 in b:
        ans = 0
    else:
        for i in range(len(b)):
            ans *= i
            if ans > 10 ** 18:
                ans = -1
                break
    print(ans)


Fixed code:
if __name__ == '__main__':
    a = int(input())
    b = [int(i) for i in input().split()]
    ans = 1
    b.sort(reverse=True)
    if 0 in b:
        ans = 0
    else:
        for i in range(len(b)):
            ans *= b[i]
            if ans > 10 ** 18:
                ans = -1
                break
    print(ans)
Buggy code:
import sys
N = int(input())
a = list(map(str, input().split()))
total = 1

if '0' in a:
    print('0')
    sys.exit()
for i in a:
    total *= int(i)
    if total >= 10**18:
        print('-1')
        sys.exit()
print(total)


Fixed code:
import sys
N = int(input())
a = list(map(str, input().split()))
total = 1

if '0' in a:
    print('0')
    sys.exit()
for i in a:
    total *= int(i)
    if total > 10**18:
        print('-1')
        sys.exit()
print(total)
Buggy code:
n = int(input())
a = list(map(int, input().split()))

ans = 1
for i in a:
    if i == 0:
        ans = 0
        break
    elif  ans * i > 10**18:
        ans = -1
        break
    else:
        ans *= i

print(ans)



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

ans = 1
if 0 in a:
    ans = 0
else :
    for i in a:
        if  ans * i > 10**18:
            ans = -1
            break
        else:
            ans *= i

print(ans)
Buggy code:
N = int(input())
A = list(map(int,input().split()))
B = 1

if 0 in A:
    print(0)
elif max(A) >= 10**18:
    print(-1)
else:
    for i in A:
        B *= i
        if B > 10 ** 18:
            print(-1)
            break
    print(B)


Fixed code:
N = int(input())
A = list(map(int,input().split()))
B = 1
# print(max(A))
if 0 in A:
    print(0)
elif max(A) > 10**18:
    print(-1)
else:
    for i in A:
        B *= i
        if B > 10 ** 18:
            B = -1
            break
    print(B)
Buggy code:
import sys
n = int(input())
l = list(map(int,input().split()))
##print(n)
##print(l)
x = l[0]
for i in range(1,n):
  ##print(i)
  ##print(l[i])
  x *= l[i]
  if x >+ 1000000000000000000:
    print(-1)
    sys.exit()
print(x)

Fixed code:
import sys
n = int(input())
l = list(map(int,input().split()))
##print(n)
##print(l)
x = l[0]
if 0 in l:
  print(0)
  sys.exit()
for i in range(1,n):
  ##print(i)
  ##print(l[i])
  x *= l[i]
  if x >+ 1000000000000000000:
    ##print(i)
    ##print(x)
    print(-1)
    sys.exit()
print(x)
Buggy code:
n = int(input())
S = list(map(int,input().split()))
ans = 1

for i in S:
  if ans >= 0:
    ans = ans * i
  if ans >= 10**18:
    ans = -1
    
print(ans)
    

Fixed code:
n = int(input())
S = list(map(int,input().split()))
ans = 1

for i in S:
  if ans >= 0:
    ans = ans * i
  if ans > 10**18:
    ans = -1
    
if 0 in S:
  ans = 0
  
print(ans)
Buggy code:
n=int(input())
a=list(map(int,input().split()))
result=1
for i in a:
    result*=i
    if 10**18<result:
        result=-1
        break
print(result)


Fixed code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
result=1
for i in a:
    result*=i
    if 10**18<result:
        result=-1
        break
print(result)
Buggy code:
def main():
    num_1 = input()
    lis = list(input().split())
    s = 1
    num_2 = int (num_1)
    num = 10 ** 18
    if 0 in lis:
        return 0
    for x in range(num_2):
        s = s * int(lis[x])
        if s > num:
            return -1
    return s

print(main())

Fixed code:
def main():
    num_1 = input()
    lis = list(map(int,input().split()))
    s = 1
    num_2 = int (num_1)
    num = 10 ** 18
    if 0 in lis:
        print(0)
        return
    for x in range(num_2):
        s = s * int(lis[x])
        if s > num:
            print(-1)
            return
    print(s)
    return

main()
Buggy code:
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
ans = 1
f = True
for i in A:
    ans *= i
    if ans > 10**18:
        f = False
        break
if f:
    print(ans)
else:
    print(-1)

Fixed code:
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
ans = 1
f = True

if 0 in A:
    print(0)
else:
    for i in A:
        ans *= i
        if ans > 10**18:
            f = False
            break
    if f:
        print(ans)
    else:
        print(-1)
Buggy code:
n = int(input())
A = list(map(int,input().split()))
ans = 1
for i in range(n):
    ans *= A[i]
    if ans > pow(10,18):
        print(-1)
        exit()
print(ans)

Fixed code:
n = int(input())
A = list(map(int,input().split()))
ans = 1
if 0 in A:
    print(0)
    exit()
for i in range(n):
    ans *= A[i]
    if ans > pow(10,18):
        print(-1)
        exit()
print(ans)
Buggy code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    LIM = 10**18
    ans = 1
    for i in range(N):
        ans *= A[i]
        if ans>LIM:
            print(-1)
            return
    print(int(ans))


main()


Fixed code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    LIM = 10**18
    if 0 in A:
        print(0)
        return
    ans = 1
    for i in range(N):
        ans *= A[i]
        if ans>LIM:
            print(-1)
            return
    print(int(ans))

main()
Buggy code:
n=int(input())
l=list(map(int,input().split()))
out=1
for x in l:
    out*=x
    if out>10**18:
        print(-1)
        exit()
print(out)

Fixed code:
n=int(input())
l=list(map(int,input().split()))
out=1
if 0 in l: print(0);exit()
for x in l:
    out*=x
    if out>10**18:
        print(-1)
        exit()
print(out)
Buggy code:
input();l=input().split();x=1
for j in sorted(l):x*=int(j)
  if x>1e18:x=-1;break
print(x)

Fixed code:
input();l=input().split();x=1
for j in sorted(l):
  x*=int(j);
  if x>1e18:x=-1;break
print(x)
Buggy code:
import sys

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

if 0 in A:
  print(0)
  sys.exit()

result = 1
for a in A:
  result *= a
  if (result > 10 ** 18):
    print(-1)
    sys.exit()

print(result)

Fixed code:
import sys

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

if 0 in A:
    print(0)
    sys.exit()

result = 1
for a in list(A):
    result *= a
    if (result > 10 ** 18):
        print(-1)
        sys.exit()

print(result)
Buggy code:
n= int(input())
a= list(map(int,input().split()))

ans = 1

for i in a:
  ans = i * ans

  
if ans > 10**18:
 	print (-1)
    exit()
    
print(ans)

Fixed code:
n= int(input())
a= list(map(int,input().split()))
 
ans = 1
over = -1
 
if 0 in a:
    print(0)
    exit(0)

for i in a:
  ans = i * ans
  if ans > 10**18:
      print(-1)
      exit(0)

print(ans)
Buggy code:
import sys

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

ans = 1

if '0' in str(A):
    print(0)
    sys.exit()

for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        ans = -1

print(ans)


Fixed code:
import sys

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

ans = 1

if 0 in A:
    print(0)
    sys.exit()

for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        ans = -1
        break

print(ans)
Buggy code:
N = int(input())

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

ans = 1
for i in range(N):
    ans *= A[i]
    if ans > 1000000000000000000:
        print(-1)
        exit(0)
print(ans)

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

ans = A[0]

if 0 in A:
  print(0)
  exit()

for i in range(1, N):
  ans *= A[i]
  if ans > 10 ** 18:
    print(-1)
    exit()

print(ans)
Buggy code:
import sys

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

a = sorted(a, reverse=True)

multi = 1

for i in a:
  multi *= i
  if multi > 10**18:
    print('-1')
    sys.exit()

print(multi)

Fixed code:
import sys

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

a = sorted(a, reverse=True)

multi = 1

if 0 in a:
  print('0')
  sys.exit()

for i in a:
  multi *= i
  if multi > 10**18:
    print('-1')
    sys.exit()

print(multi)
Buggy code:
n = int(input())
a = map(int, input().split())
multi = 1

for i in a:
  multi *= i
  if multi > pow(10,18):
    break
if multi > pow(10,18):
  print("-1")
else:
  print(multi)

Fixed code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
multi = 1

for i in a:
  multi *= i
  if multi > pow(10,18):
    break
if multi > pow(10,18):
  print("-1")
else:
  print(multi)
Buggy code:
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    for i in range(N):
        ans *= A[i]
        if ans > 10 ** 18:
            print(-1)
            return

    print(ans)


if __name__ == "__main__":
    main()


Fixed code:
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return

    ans = 1
    for i in range(N):
        ans *= A[i]
        if ans > 10 ** 18:
            print(-1)
            return

    print(ans)


if __name__ == "__main__":
    main()
Buggy code:
N = int(input())
line = input().split()

MAX = 1000000000000000000

ans = 1

for l in line:
    if l == 0:
        ans = 0
        break
    if not ans >= MAX:
        ans = int(l) * ans

if ans <= MAX:
    print(ans)
else:
    print(-1)


Fixed code:
N = int(input())
line = input().split()

MAX = 1000000000000000000

ans = 1

if not '0' in line:
    for l in line:
        if l == 0:
            ans = 0
            break
        if not ans > MAX:
            ans = int(l) * ans

else:
    ans = 0


if ans <= MAX:
    print(ans)
else:
    print(-1)
Buggy code:
n = int(input())
a = list(map(int,input().split()))
a = sorted(a,reverse = True)
ans = 1
for i in a:
  if ans > 10**18:
    ans = -1
    break
  else:
    ans *= i

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

Fixed code:
n = int(input())
a = list(map(int,input().split()))
ans = 1
a = sorted(a)
for i in a:
  if ans > 10**18:
    ans = -1
    break
  else:
    ans *= i

if ans >10**18:
  print(-1)
else:
  print(ans)
Buggy code:
n = int(input())
multi = list(map(int,input().split()))
result = 1 

for i in range(n):
    result = result * multi[i]
    if (result > 10**18):
        ans = -1
        exit()
        
print(result)

Fixed code:
n = int(input())
multi = list(map(int,input().split()))
result = 1 

if 0 in multi:
    result = 0
    print(0)
    exit()

for i in range(n):
    result = result * multi[i]
    if (result > 10**18):
        result = -1
        break 
        
print(result)
Buggy code:
def main():
  n = int(input())
  data = list(map(int, input().split()))
  if 0 in data:
    print(0)
    return
  
  c = 1
  for d in data:
    c *= d
    if c >= 10 ** 18:
      print(-1)
      return
  
  print(c)


if __name__ == "__main__":
  main()


Fixed code:
def main():
  n = int(input())
  data = list(map(int, input().split()))
  if 0 in data:
    print(0)
    return
  
  c = 1
  for d in data:
    c *= d
    if c > 10 ** 18:
      print(-1)
      return
  
  print(c)


if __name__ == "__main__":
  main()
Buggy code:
def main():
  n =int(input())
  A = list(map(int, input().split()))

  if 0 in A:
    print(0)
    return

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

  print(p)
main()

Fixed code:
def main():
  n =int(input())
  A = list(map(int, input().split()))

  if 0 in A:
    print(0)
    return

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

  print(p)
main()
Buggy code:
N = int(input())
A = [int(x) for x in input().split()]
a = 1
for i in range(N):
    if A[i] == 0:
        a = 0
        break
    a *= A[i]

    if a > 1000000000000000000:
        a = -1
        break
print(a)
    

Fixed code:
N = int(input())
A = [int(x) for x in input().split()]
a = 1
if 0 in A:
    a = 0
else:
    for i in range(N):
        a *= A[i]

        if a > 1000000000000000000:
            a = -1
            break
print(a)
Buggy code:
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 code:
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 ()
Buggy code:
n = int(input())
a = list(map(int,input().split()))
lim = 10**18
ans = 1
for i in a:
  ans *= i
  if(ans == 0): break
  if(ans > lim):
    ans = -1
    break
print(ans)

Fixed code:
n = int(input())
a = list(map(int,input().split()))
lim = 10**18
ans = 1
if(0 in a):
  ans = 0
else:
  for i in a:
    ans *= i
    if(ans > lim):
      ans = -1
      break
print(ans)
Buggy code:
n = int(input())
a = list(map(int,input().split()))

ans = 1
if 0 in a:
    print(0)
else:
    for i in a:
        ans *= i
        if ans > 10**18:
            print(-1)
            exit()

print(ans)


Fixed code:
n = int(input())
a = list(map(int, input().split()))
ans = 1
if a.count(0) > 0:
    print(0)
    exit()
else:
    for i in a:
        ans *= i
        if ans > 10**18:
            print('-1')
            exit()
print(ans)
Buggy code:
def solve(ls):
    n = len(ls)
    p = 1
    for i in range(n):
        p *= ls[i]
        if p > 1000000000000000000:
            return -1
    return p


n = int(input())
ls = list(map(int, input().split()))
print(solve(ls))


Fixed code:
def solve(ls):
    n = len(ls)
    p = 1
    for i in range(n):
        if ls[i] == 0:
            return 0
    for i in range(n):
        p *= ls[i]
        if p > 1000000000000000000:
            return -1
    return p


n = int(input())
ls = list(map(int, input().split()))
print(solve(ls))
Buggy code:
# coding: utf-8
# Your code here!
N = int(input())
L = list(map(int, input().split()))
ans = 1

for n in range(N):
 ans = L[n]*ans
 if ans >= 1000000000000000001: ans = -1
 if ans == -1: break

print(ans)

Fixed code:
# coding: utf-8
# Your code here!
N = int(input())
L = list(map(int, input().split()))
ans = 1

for n in range(N):
 ans = L[n]*ans
 if ans >= 1000000000000000001: ans = -1
 if ans == -1: break

for n in range(N):
 if L[n] == 0: ans = 0
print(ans)
Buggy code:
n = int(input())
ls = list(map(int,input().split(' ')))
pro=1
f=0
for i in ls:
    pro = pro*i
    if(pro > 1000000000000000000):
        print(-1)
        f=1
        break
if(f==0 and pro<=1000000000000000000):
    print(pro)

Fixed code:
n = int(input())
ls = list(map(int,input().split(' ')))
pro=1
f=0
zero=0
for i in ls:
    if(i==0):
        zero=1
if(zero==1):
    print(0)
else:
    for i in ls:
        pro = pro*i
        if(pro > 1000000000000000000):
            print(-1)
            f=1
            break
    if(f==0 and pro<=1000000000000000000):
        print(pro)
Buggy code:
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict

n=IN()
a=LI()
p=1
if 0 in a:
    print(0)
    exit()
for i in a:
    p*=i
    print(p)
    if p>pow(10,18):
        print(-1)
        exit()
print(p)


Fixed code:
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict

n=IN()
a=LI()
p=1
if 0 in a:
    print(0)
    exit()
for i in a:
    p*=i
    if p>pow(10,18):
        print(-1)
        exit()
print(p)