qyliang/CodeNanoFix huggingface dataset:
Buggy code:
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    n=int(input())
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    a=list(map(int,sys.stdin.readline().split(' ')))
    ams=1
    for x in a:
        ams*=x
        if ams> 1000000000000000000:
            ams=-1
            break

    print(ams)
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()


Fixed code:
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    n=int(input())
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    a=list(map(int,sys.stdin.readline().split(' ')))
    ams=1

    if 0 in a:
        print(0)
        continue
        
    for x in a:
        ams*=x
        if ams> 1000000000000000000:
            ams=-1
            break

    print(ams)
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()
Buggy code:
n = int(input())
a = list(map(int,input().split()))

ans = 1
for i in range(len(a)):
	if ans > 10**18:
    	print(-1)
        exit()
    else:
    	ans *= a[i]
if ans > 10**18:
	print(-1)
    exit()
print(ans)

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

for i in range(len(a)):
    if a[i] == 0:
        print(0)
        exit()

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

print(ans)
Buggy code:
N=int(input())
a=list(map(int,input().split()))
b=1
for i in range(N):
  b=b*a[i]
  if b>10**18:
    print(-1)
    exit()
print(b)    

Fixed code:
N=int(input())
a=list(map(int,input().split()))
a.sort()
b=1
if a[0]==0:
  print(0)
  exit()
for i in range(N):
  b=b*a[i]
  if b>10**18:
    print(-1)
    exit()
print(b)
Buggy code:

n=int(input())
l1=list(map(int,input().split()))
p=1
k=0
for i in range(n):
  p*=l1[i]
  if p>10**18:
    k=1
    break
if k==1:
  print("-1")
else:
  print(p)

Fixed code:

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

Fixed code:
N = int(input())
A = list(map(int, input().split()))
ans = A[0]
if A.count(0) != 0:
    ans = 0
else:
    for i in range(1,N):
        ans = ans * A[i]
        if ans > 10 ** 18:
            ans = -1
            break
print(ans)
Buggy code:
n = int(input())
a = map(int, input().split());

ans = 1
above = False
for x in a:
	ans *= x
	if ans > 10**18:
		above = True
		break

if not above:
	print(ans)
else:
	print(-1)

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

a.sort()
ans = 1
above = False
for x in a:
	ans *= x
	if ans > 10**18:
		above = True
		break

if not above:
	print(ans)
else:
	print(-1)
Buggy code:
#TIME : 
import sys
from math import sqrt
input = sys.stdin.readline

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

MAX = 10**18
n = inp()
a = inlt()
res = 1
for num in a:
    res*=num
    if res > MAX:
        print(-1)
        exit() 
print(res)

Fixed code:
#TIME : 
import sys
from math import sqrt
input = sys.stdin.readline

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

MAX = 10**18
n = inp()
a = inlt()
if 0 in a:
    print(0)
    exit()
res = 1
for num in a:
    res*=num
    if res > MAX:
        print(-1)
        exit()
print(res)
Buggy code:
n=int(input())
a=list(input().split())
ans=1
f=0
i=0
while(i<=n):
    if i==n-1:
        ans=ans*int(a[i])
    else:
        ans=ans*int(a[i])*int(a[i+1])
        i+=1
    if f==0 and ans>1000000000000000000:
        f=1
    if ans==0:
        print(0)
        exit()
    i+=2
if f==1:
    print(-1)
    exit()
print(ans)

Fixed code:
n=int(input())
a=list(input().split())
ans=1
f=0
i=0
while(i<n):
    if f==0:
        ans=ans*int(a[i])
    if f==0 and ans>1000000000000000000:
        f=1
    if int(a[i])==0:
        print(0)
        exit()
    i+=1
if f==1:
    print(-1)
    exit()
print(ans)
Buggy code:
n=int(input())
a=map(int,input().split())
val = 1
exceed = 0
for i in a:
	if(exceed==0):
		val*=i
	if(val==0):
		print(0)
		exit(0)
	if(val>1000000000000000000):
		exceed=1
if(exceed==0):
	print(val)
else:
	print(-1)

Fixed code:
n=int(input())
a=map(int,input().split())
val = 1
exceed = 0
for i in a:
	if(exceed==0 or i==0):
		val*=i
	if(val==0):
		print(0)
		exit(0)
	if(val>1000000000000000000):
		exceed=1
if(exceed==0):
	print(val)
else:
	print(-1)
Buggy code:
n = int(input())
a = list(map(int, input().split()))

for i in a:
    if i == 0:
        print(0)
        exit()

ans = 1
for i in a:
    if ans * i <= 1e18:
        ans *= i
        print(ans)
    else:
        print(-1)
        exit()
print(ans)


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

for i in a:
    if i == 0:
        print(0)
        exit()

ans = 1
for i in a:
    if ans * i <= 1e18:
        ans *= i
    else:
        print(-1)
        exit()
print(ans)
Buggy code:
N = int(input())
A = list(map(int,input().split()))

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

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

if 0 in A:
  print(0)
else:
  prod = 1
  for i in A:
    prod *= i
    if prod>10**18:
      print(-1)
      F = False
      break
  if F:
  	print(prod)
Buggy code:
N = int(input())
inputs = list(map(int, input().split()))

total = 1
flag = 0
for i in range(len(inputs)):
    total = total * inputs[i]
    if total > 10 ** 18:
        print('-1')
        flag = 1
        break
if flag == 0:
    print(total)

Fixed code:
N = int(input())
inputs = list(map(int, input().split()))
#print(inputs)
total = 1
flag = 0
if 0 in inputs:
    print('0')
else:
    for i in range(len(inputs)):
        total = total * inputs[i]
        if total > 10 ** 18:
            print('-1')
            flag = 1
            break
    if flag == 0:
        print(total)
Buggy code:
N = int(input())
A = list(map(int, input().split()))

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

print(ans)


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

ans = A[0]

if 0 in A:
    ans = 0
else:
    for i in range(1, N):
        ans = ans * A[i]

        if ans > 10 ** 18:
            ans = -1
            break

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

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

res=1
for x in A:
	res*=x
	if res>pow(10,18):
		print('-1')
		exit()

else:
	print(res)

Fixed code:
N=int(input())

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

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

res=1
for x in A:
	res*=x
	if res>pow(10,18):
		print('-1')
		exit()

else:
	print(res)
Buggy code:
n=int(input())
a=[int(x) for x in input().split()]
s=1
for c in range(n):
    s=s*a[c]
    if s>10**18:
        s=-1
        break
print(s)

Fixed code:
n=int(input())
a=[int(x) for x in input().split()]
if 0 in a:
    print(0)
else:
    s=1
    for c in range(n):
        s=s*a[c]
        if s>10**18:
            s=-1
            break
    print(s)
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()))

a.sort()
ans = 1
for i in range(n):
   ans *= a[i]
   if ans > pow(10, 18):
      print(-1)
      exit()

print(ans)
Buggy code:
import sys

INF = 10e17
N = int(input())
A = list(map(int, sys.stdin.readline().rstrip().split()))
ans = 1
for a in A:
    ans = ans*a
    if ans == 0:
        print(0)
        sys.exit()
    if ans > INF:
        print(-1)
        sys.exit()
if ans > INF:
    print(-1)
else:
    print(ans)

Fixed code:
import sys

INF = 10e17
N = int(input())
A = list(map(int, sys.stdin.readline().rstrip().split()))
ans = 1
for a in A:
    if a == 0:
        print(0)
        sys.exit()
for a in A:
    ans = ans*a
    if ans > INF:
        print(-1)
        sys.exit()

print(ans)
Buggy code:
N = int(input())
A = [int(x) for x in input().split()]
ans = 1
for a in A:
    ans *= a
    if ans > 10 ** 18:
        print(-1)
        exit(0)
print(ans)


Fixed code:
N = int(input())
A = [int(x) for x in input().split()]
ans = 1
if 0 in A:
    print(0)
    exit(0)
for a in A:
    ans *= a
    if ans > 10 ** 18:
        print(-1)
        exit(0)
print(ans)
Buggy code:
n = int(input())
a = list(map(int, input().split()))
res = 1
for a_i in a:
    if 0 == a_i:
        print(0)
        exit(0)
    elif res > 10 ** 18 or res:
        continue
    else:
        res *= a_i

print(-1 if res > 10 ** 18 else res)


Fixed code:
n = int(input())
a = list(map(int, input().split()))
res = 1
for a_i in a:
    if 0 == a_i:
        print(0)
        exit(0)
    elif res > 10 ** 18:
        continue
    else:
        res *= a_i

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

Fixed code:
n=input()
flag=0
flag1=0
a=list(map(int,input().split()))
sum=1
a.sort()
for i in a :
    sum*=i
    if(i==0):
        flag1=1
    if(sum>1e18) :
        flag=1
        break
if(flag==0 or flag1==1):
    print(sum)
else : print(-1)
Buggy code:
n=int(input())
a=list(map(int,input().split()))
import sys
b=a[0]
for i in range(1,n):
    b*=a[i]
    
    if b>1000000000000000000:
        print(-1)
        sys.exit()
print(b)

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

b=a[0]
if a.count(0)>0:
    print(0)
    sys.exit()

for i in range(1,n):
    b*=a[i]
    if b>1000000000000000000:
        print(-1)
        sys.exit()

print(b)
Buggy code:
# -*- coding: utf-8 -*-
from sys import stdin
import numpy as np
input = stdin.readline
N = int(input())
A = list(map(int,input().split()))
np_A = np.array(A)
ans = np_A[0]

2
for i in range(1, N, 1):
    ans = ans*np_A[i]
    if ans > 10**18:
        flag = False
        break


if flag == False:
    print(-1)

else:
    print(ans)


Fixed code:
# -*- coding: utf-8 -*-
from sys import stdin
from decimal import *
import numpy as np
input = stdin.readline
N = int(input())
A = list(map(Decimal,input().split()))
np_A = np.array(A)
ans = np_A[0]

zero_flag = False
if 0 in A:
    zero_flag = True

flag = True

for i in range(1, N, 1):
    ans = Decimal(ans)*Decimal(np_A[i])
    #print(ans)
    if ans > 10**18:
        flag = False
        break


if zero_flag == True:
    print(0)


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

    else:
        print(ans)
Buggy code:
from sys import stdin

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
res = 1
for i in range(N):
  res *= A[i]
  if res > 10**18:
    res = -1
    break


print(res)

Fixed code:
from sys import stdin

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
A.sort()
res = 1
if 0 in A:
  res = 0
else:
  for i in range(N):
    res *= A[i]
    if res > 10**18:
      res = -1
      break

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

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

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


if __name__ == '__main__':
    main()


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

    if 0 in a:
        print(0)
        return

    maks = 10**18
    mnozenje = 1
    for i in a:
        mnozenje *= i

        if mnozenje > maks:
            print(-1)
            return

    print(mnozenje)


if __name__ == '__main__':
    main()
Buggy code:
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)
        exit()
print(ans)

Fixed code:
n = int(input())
a = list(map(int,input().split()))
ans = 1
for j in range (n) :
    if a[j] == 0 :
        print(0)
        exit()
for i in range (n) :
    ans *= a[i]
    if ans > 10**18 :
        print(-1)
        exit()
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 = 0:
        print(0)
        exit()
    elif ans > 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 > 10**18:
        print(-1)
        exit()

print(ans)
Buggy code:
n = int(input())
A = [int(i) for i in input().split()]
product = 1

for i in range(n):
  product *= A[i]
  if(product > 10**18):
    print("-1")
    break

if(product <= 10**18):
  print(product)

Fixed code:
n = int(input())
A = [int(i) for i in input().split()]
product = 1
A.sort()

for i in range(n):
  product *= A[i]
  if(product > 10**18):
    print("-1")
    break

if(product <= 10**18):
  print(product)
Buggy code:
import sys

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

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

Fixed code:
import sys

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

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

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

print(res)
Buggy code:
n = int(input())
a = [int(x) for x in input().split()]
otv = 1
for x in a:
  otv *= x
  if otv > 10**18:
    print(-1)
    exit(0)
print(otv)

Fixed code:
n = int(input())
a = [int(x) for x in input().split()]
otv = 1
for x in sorted(a):
  otv *= x
  if otv > 10**18:
    print(-1)
    exit(0)
print(otv)
Buggy code:
num = int(input())
nums = list(map(int,input().split()))
ans = 1
for i in nums:
    if i == 0:
        ans = 0
        break
    ans *= i
    if ans > 10 **18:
        ans = -1
        break
print(ans)


Fixed code:
num = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 1
for i in nums:
    if i == 0:
        ans = 0
        break
    ans *= i
    if ans > 10 **18:
        ans = -1
        break
print(ans)
Buggy code:
N = int(input())
A = list(map(int, input().split()))

sum = 1
A.sort()
for i in A:
    sum = sum*i
    if sum >= pow(10,18):
        sum = -1
        break
print(sum)

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

sum = 1
A.sort()
for i in A:
    sum = sum*i
    if sum > pow(10,18):
        sum = -1
        break
print(sum)
Buggy code:
N = int(input())
A = list(map(int, input().split()))

border = pow(10, 18)

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

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

print(ans)

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

border = pow(10, 18)

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

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

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


Fixed code:
N = int(input())
A = list(map(int,input().split()))
thres = 10**18
res = A[0]
if 0 in A:
    print(0)
    exit()
for i in range(N-1):
    res *= A[i+1]
    if res > thres:
        res = -1
        break
print(res)
Buggy code:
n = int(input())
a= list(map(int, input().split()))

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

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

print(ans)
Buggy code:
from sys import exit
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in a:
  ans *= i
  if (ans > 1e18):
    print(-1)
    exit(0)
print(ans)

Fixed code:
from sys import exit
n = int(input())
a = list(map(int, input().split()))
ans = 1
a.sort()
for i in a:
  ans *= i
  if (ans > 1e18):
    print(-1)
    exit(0)
print(ans)
Buggy code:
n=int(input())
a=list(map(int,input().split()))
l=1
for i in range(n):
    l*=a[i]
    if l>10**18:
        break
if l>10**18:
    print(-1)
else:
    print(l)

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

for i in range(n):
    l*=a[i]
    if l>10**18:
        break
if min(a)==0:
    print(0)
elif l>10**18:
    print(-1)
else:
    print(l)
Buggy code:
N = int(input())
A = list(map(int, input().split()))

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

Fixed 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 > 1000000000000000000:
            print(-1)
            exit()
    print(ans)
Buggy code:
n = int(input())
a = [int(i) for i in input().split()]

result = a[0]
p = pow(10,18)

for i in range(n-1):
    result *= a[i+1]
    if result > p:
        result = -1
        break

print(result)

Fixed code:
n = int(input())
a = [int(i) for i in input().split()]

result = a[0]
p = pow(10,18)

if 0 in a:
    result = 0

else:
    for i in range(n-1):
        result *= a[i+1]
        if result > p:
            result = -1
            break

print(result)
Buggy code:
from sys import stdin
input = stdin.readline

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

ans = 1

for a in A:
    ans *= a
    if a > pow(10, 18) or ans > pow(10, 18):
        print(-1)
        exit()

print(ans)


Fixed code:
from sys import stdin
input = stdin.readline

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

ans = 1

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

for a in A:
    ans *= a
    if a > pow(10, 18) or ans > pow(10, 18):
        print(-1)
        exit()


print(ans)
Buggy code:
N = input()
A = list(map(int, input().split()))
 
result = 1 
if 0 in A:
    print(0)
else:
    for i in A:
        result *=i
        if result > 10**18:
            print(-1)
            break
        elif result <= 10**18:
            continue
        else:
            print(result)

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

result = 1
if 0 in A:
    print(0)
else:
    for i in A:
        result *=i
        if result > 10**18:
            print(-1)
            break
    if result <= 10**18:
        print(result)
Buggy code:
def multiplyList(myList) : 
      
    # Multiply elements one by one 
    result = 1
    for x in myList: 
         result = result * x
         if result == 0:
             return 0
         if result > 10**18:
             return -1
    return result
 
n = int(input())
l = list(map(int, input().split()))
res = multiplyList(l)
print(res)

Fixed code:
def multiplyList(myList) : 
      
    # Multiply elements one by one 
    result = 1
    for x in myList: 
        result = result * x
        if result == 0:
             return 0 
        if result > 10**18:
             return -1
    return result
 
n = int(input())
l = list(map(int, input().split()))
l.sort()
res = multiplyList(l)
print(res)
Buggy code:
N - int(input())
A = list(map(int,input().split()))
ans = 1
for i in A:
  ans*=i
if ans > 10**18:
  ans = -1
print(ans)

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

A.sort()
ans = 1
for i in A:
    ans *= i
    if ans > 10**18:
        ans = -1
        break
print(ans)
Buggy code:
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    for i in A:
        ans *= i
        if ans > 10**18:
            print("-1")
            exit()
    print(ans)
resolve()

Fixed code:
def resolve():
    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)
resolve()
Buggy code:
N=int(input())
A=list(map(int,input().split()))
M=1
if 0 in A:
    print('0')
else:
    for i in range(len(A)):
        M*=A[i]
        if M > 10**18:
            break
if M > 10**18:
    print('-1')
else:
    print(int(M))

Fixed code:
N=int(input())
A=list(map(int,input().split()))
M=1
if 0 in A:
    print('0')
else:
    for i in range(len(A)):
        M*=A[i]
        if M > 10**18:
            break
    if M > 10**18:
        print('-1')
    else:
        print(int(M))
Buggy code:
N = int(input())
A = list(map(int, input().split()))
ans = 1
b = 1
c = 1
p = 10**18
    
for i in range(N):
  elif A[i] == 0:
    c = 0
    break
  else:
    ans *= A[i]
    if p < ans:
      b = -1
      ans = 0
if c == 0:
  print(c)
elif b == -1:
  print(b)
else:
  print(ans)
    
  

Fixed code:
N = int(input())
A = list(map(int, input().split()))
ans = 1
b = 1
c = 1
p = 10**18
    
for i in range(N):
  if A[i] == 0:
    c = 0
    break
  else:
    ans *= A[i]
    if p < ans:
      b = -1
      ans = 0
if c == 0:
  print(c)
elif b == -1:
  print(b)
else:
  print(ans)
Buggy code:
import sys
n = int(input())
nums = [int(e) for e in input().split()]
g = 1;
for i in nums:
  g*=i;
  if g>1000000000000000000:
    print("-1")
    sys.exit()
print(g)


Fixed code:
import sys
n = int(input())
nums = [int(e) for e in input().split()]
g = 1;
for a in nums:
  if a == 0:
    print("0");
    sys.exit()
for i in nums:
  g*=i;
  if g>1000000000000000000:
    print("-1")
    sys.exit()
print(g)
Buggy code:
n=int(input())
ans=1
l=list(map(int,input().split()))
for x in l:
  ans=ans*x
  if(ans>1000000000000000000):
    break
if(ans>1000000000000000000):
  print(-1)
else:
  print(ans)

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