qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = int(input())
num = list(map(int,input().split(" ")))
 
zero=num.count(0)
z= 10 ** 18
if zero != 0:
  print(0)
else:
  s = num[0]
  for i in range(1,n):
    s = s * num[i]
    if len(str(s)) > z:
      s=-1
      break
  print(s)

Fixed code:
n = int(input())
num = list(map(int,input().split(" ")))
 
zero=num.count(0)
z= 10 **18
if zero != 0:
  print(0)
else:
  s = num[0]
  for i in range(1,n):
    s = s * num[i]
    if s > z:
      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>10*18:
  print(-1)
else:
  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 = 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 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 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())
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()))
if 0 in a:
    print(0)
    exit()
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
Buggy code:
n = int(input())
l = list(map(int, input().split()))
cur = 1
for i in l:
    cur *= i
    if cur > 1000000000000000000:
        print(-1)
        exit()
print(cur)

Fixed code:
n = int(input())
l = list(map(int, input().split()))
cur = 1
if 0 in l:
    print(0)
    exit()
for i in l:
    cur *= i
    if cur > 1000000000000000000:
        print(-1)
        exit()
print(cur)
Buggy code:
n=int(input())
A=[int(i) for i in input().split()]
prod=1
for i in range(0,n):
  prod=prod*A[i]
  if(prod>1000000000000000000):
    prod=-1
    break
print(prod)


Fixed code:
n=int(input())
A=[int(i) for i in input().split()]
A.sort()
prod=1
for i in range(0,n):
  prod=prod*A[i]
  #print(prod)
  if(prod==0):
      break
  if(prod>1000000000000000000):
    prod=-1
    break
print(prod)
Buggy code:
N = int(input())
lista = [int(x) for x in input().split()]
q = 0
for i in lista:
  q *= i
  if q > 10**18:
    print(-1)
    return
 print(q)

Fixed code:
def main():

    N = int(input())
    lista = [int(x) for x in input().split()]
    q = 1
    if 0 in lista:
        return print(0)
    for i in lista:
        q *= i
        if q > 10**18:
            print(-1)
            return
    print(q)


main()
Buggy code:
answer = 1
lens = int(input())
arrs = [int(x) for x in input().split()]
for x in arrs:
    answer *= x
    if answer > int(10 ** 18):
        answer = -1
        break
print(answer)


Fixed code:
answer = 1
lens = int(input())
arrs = [int(x) for x in input().split()]
if 0 in arrs:
    answer = 0
else:
    for x in arrs:
        answer *= x
        if answer > int(10 ** 18):
            answer = -1
            break
print(answer)
Buggy code:
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 1000000000000000000:
        break
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

Fixed code:
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in range(n):
    if a[i] == 0:
        print(0)
        exit()
for i in range(n):
    ans *= a[i]
    if ans > 1000000000000000000:
        break
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)
Buggy code:
n,*a=map(open(0).read().split())
if 0 in a:
  print(0)
  exit()
s=1
for i in a:
  s*=i
  if s>10**18:
    print(-1)
    exit()
print(s)

Fixed code:
n,*a=map(int,open(0).read().split())
if 0 in a:
  print(0)
  exit()
s=1
for i in a:
  s*=i
  if s>10**18:
    print(-1)
    exit()
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):
    ans = -1
    print(-1)
    break
if ans != -1:
  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 range(n):
    ans *= a[i]
    if ans > pow(10,18):
        ans = -1
        print(ans)
        break
  if ans != -1:
    print(ans)
Buggy code:
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
a = nl()
ans = 1
for ele in a:
    ans *= ele
    if ans > 10 ** 18:
        break

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

Fixed code:
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
a = sorted(nl())
ans = 1
for ele in a:
    ans *= ele
    if ans > 10 ** 18:
        break

if ans > 10 ** 18:
    print(-1)
else:
    print(ans)
Buggy code:
def main():
    N = int(input())
    A = list(map(int, input().split()))

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


if __name__ == "__main__":
    main()


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

    if A.__contains__(0):
        print(0)
        return

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


if __name__ == "__main__":
    main()
Buggy code:
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    a = map(int, input().split())
    ans = 1
    for x in a:
        ans *= x
        if ans > 10 ** 18:
            print(-1)
            exit()
    print(ans)

main()

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

def main():
    n = int(input())
    a = sorted(map(int, input().split()))
    ans = 1
    for x in a:
        ans *= x
        if ans > 10 ** 18:
            print(-1)
            exit()
    print(ans)

main()
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()

print(ans)

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

ans = 1

if min(a)==0:
    print(0)
    exit()

for i in a:
    ans *= 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=ans*a[i]
    if ans>1000000000000000000:
        ans=-1
        break
print(ans)

Fixed code:
N = int(input())
a = list(map(int,input().split()))
ans=1
check=0
for i in range(N):
    ans=ans*a[i]
    if a[i]==0:
        ans=0
        check=2
        break
    if ans>1000000000000000000:
        ans=1
        check=1
if check==1:
    ans=-1
print(ans)
Buggy code:
import sys

def main():
    N=int(input())
    A=list(map(int,input().split()))
    res=1
    for a in A:
        res=res*a
        if res>pow(10,18):
            print("-1")
            sys.exit()
    print(res)
        
    
    
if __name__=="__main__":
    main()
    

Fixed code:
import sys


def main():
    N = int(input())
    A = list(map(int, input().split()))
    res = 1

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

    for a in A:
        res = res * a
        if res > pow(10, 18):
            print("-1")
            sys.exit()
    print(res)


if __name__ == "__main__":
    main()
Buggy code:
n=int(input())
l = list(map(int,input().split()))
s=1
for i in l:
    s*=i
    if s>10**18:
        s=-1
        break
print(s)

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

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

ans = A[0]
for a in A[1:]:
    ans *= a
    if ans > 10 ** 18:
        ans = -1
        break

print(ans)

Fixed code:

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

ans = A[0]
for a in A[1:]:
    ans *= a
    if ans > 10 ** 18:
        ans = -1
        break

for a in A:
    if a == 0:
        ans = 0

print(ans)
Buggy code:
import math

def main():

    test = int(input())
    inp = input().split(' ')

    p=1;
    for x in inp:
        p = p*int(x)
        if p> 10**18:
            break;
    
    if(p>10**18):
        print(-1);
    else:
        print(p);

        
        

if __name__ == '__main__':
    main()

Fixed code:
import math

def main():

    test = int(input())
    inp = input().split(' ')
    inp = sorted(inp)
    p=1;
    for x in inp:
        p = p*int(x)
        if p> 10**18 or p==0:
            break;
    
    if(p>10**18):
        print(-1);
    else:
        print(p);

        
        

if __name__ == '__main__':
    main()
Buggy code:
N = int(input())
A = list(map(int,input().split()))
cnt = 1

for i in range(N):
    cnt *= A[i]
    if(cnt > 1e18):
	print(-1)
	sys.exit()

if(cnt <= 1e18):
    print(cnt)
else:
    print(-1)




Fixed code:
import sys

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

for i in range(N):
    if(A[i] == 0):
        print(0)
        sys.exit()

for i in range(N):
    cnt *= A[i]
    if(cnt > 1e18):
        print(-1)
        sys.exit()

if(cnt <= 1e18):
    print(cnt)
else:
    print(-1)
Buggy code:
def solve(n, a):
    for x in a:
        if x == 0:
            return 0
    ans = 1
    for x in a:
        ans *= x
        if ans >= 10**18:
            return -1
    return ans
    
n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))

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

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

for i in a:
  ans *= i
  if ans > (10 ** 18):
    break

if not ans > (10 ** 18):
  print(ans)
else:
  print(-1)
Buggy code:
n = int(input())
a = [int(num) for num in input().split()]
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
        ans = -1
        break
        
print(ans)

Fixed code:
n = int(input())
a = [int(num) for num in input().split()]
ans = 1
if 0 in a:
    ans = 0
for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
        ans = -1
        break
        
print(ans)
Buggy code:
import sys

N = int(input())
nums = list(map(int, input().split(' ')))

output = 1

for x in nums:
  output *= x
  if output > 10**18:
    print('-1')
    sys.exit()
    
print(output)

Fixed code:
import sys

N = int(input())
nums = list(map(int, input().split(' ')))

output = 1

if 0 in nums:
  print(0)
  sys.exit()
  
else:
  for x in nums:
    output *= x

    if output > 10**18:
      print(-1)
      sys.exit()

  print(output)
Buggy code:

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

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




Fixed code:

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

tmp = 1
A.sort()
#print(A)
if A[0] == 0:
    print(0)
    exit()
for i in range(n):
    tmp *= A[i] 
    if tmp > 10**18:
            tmp = -1
            print(tmp)
            exit()
print(tmp)
Buggy code:
n = int(input())
A = list(map(int,input().split()))

prod = 1
flag = 0
lim = 1e18
for num in A:
  prod = num*prod
  if prod > lim:
    flag = 1
    break
if flag == 1:
  print(-1)
else:
  print(prod)

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

prod = 1
flag = 0
lim = 1e18
A.sort()
for num in A:
  prod = num*prod
  if prod > lim:
    flag = 1
    break
if flag == 1:
  print(-1)
else:
  print(prod)
Buggy code:
N=int(input())
a=list(map(int,input().split()))
c=1
flag=True
for i in range(N):
    c*=a[i]
    if c>10**18:
        flag=False
        break
if flag:
    print(c)
else:
    print(-1)

Fixed code:
N=int(input())
a=list(map(int,input().split()))
a.sort()
c=1
flag=True
for i in range(N):
    c*=a[i]
    if c>10**18:
        flag=False
        break
        
if flag:
    print(c)
else:
    print(-1)
Buggy code:
N = int(input())
num_list = list(map(int, input().split()))

ans = 1

for i in num_list:
    ans *= i
    if ans > 10**18:
        print('-1')
        break

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

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

ans = 1

if 0 in num_list:
    print(0)
else:
    for i in num_list:
        ans *= i
        if ans > 10**18:
            print('-1')
            break

    if ans<= 10**18:
        print(ans)
Buggy code:
n=int(input())
l=list(map(int,input().split()))
z,flag=1,0
m=10**18
for i in l:
  z*=i  
  if z>m:
    flag=1
    break
if flag==1:
  print(-1)
else:
  print(z)


Fixed code:
n=int(input())
l=list(map(int,input().split()))
z,flag=1,0
m=10**18
mi=min(l)
if mi==0:
  print(0)
else:
  for i in l:
    z*=i  
    if z>m:
      flag=1
      break
  if flag==1:
    print(-1)
  else:
    print(z)
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(ans)
    exit(0)
else:
    print(-1)
         

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

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

print(ans)
Buggy code:
N = int(input())
l = [int(x) for x in input().split()]

if 0 in l:
    ans = 0
else:
    n = min(N,len(l))
    ans = 1
    for i in l[:n]:
        ans *= i
        if ans > 10**18:
            ans = -1
            bre
print(ans)

Fixed code:
N = int(input())
l = [int(x) for x in input().split()]

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

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

Fixed code:
n = int(input())
li = list(map(int,input().split()))
li.sort()
ans = 1
 
for i in range(n):
  ans = ans*li[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 > 10**8:
    print(-1)
    exit()
print(ans)

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

Fixed code:
N=int(input())
A=list(map(int,input().split()))
s=1
if 0 in A:
  print(0)
else:
  for i in range(N):
    s*=A[i]
    if s>10**18:
      print(-1)
      break
  if s<=10**18:
    print(s)
Buggy code:
import sys
n = int(input())
x = [int(i) for i in input().split()]
ans=1
for i in range(0,n):
    if x[i]==0:
        print(0)
        sys.exit()
    ans*=x[i]
    if ans>10**18:
        print(-1)
        sys.exit()
print(ans)

Fixed code:
import sys
n = int(input())
x = [int(i) for i in input().split()]
ans=1
for i in range(0,n):
    if x[i]==0:
        print(0)
        sys.exit()
for i in range(0,n):
    ans*=x[i]
    if ans>10**18:
        print(-1)
        sys.exit()
print(ans)
Buggy code:
import sys

input = sys.stdin.readline
INF = 10 ** 18


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

    if 0 in A:
        ans = -1
    else:
        ans = 1
        for a in A:
            ans *= a
            if ans > INF:
                ans = -1
                break

    print(ans)


if __name__ == "__main__":
    main()


Fixed code:
import sys

input = sys.stdin.readline
INF = 10 ** 18


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

    if 0 in A:
        ans = 0
    else:
        ans = 1
        for a in A:
            ans *= a
            if ans > INF:
                ans = -1
                break

    print(ans)


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

ans = 1

for num in a:
  ans *= num
  if ans > 1000000000000000000:
    ans = -1
    break

print(ans)

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

ans = 1

if 0 in a:
  ans = 0
else:
  for num in a:
    ans *= num
    if ans > 1000000000000000000:
      ans = -1
      break

print(ans)
Buggy code:
N = int(input())
array = list(map(int,input().split()))
product =  1
if 0 in array:
  print(0)
  exit()
for i in array:
  product *= i
  if product > 10**18:
    print(product)
    exit()
print(product)


Fixed code:
N = int(input())
array = list(map(int,input().split()))
product =  1
if 0 in array:
  print(0)
  exit()
for i in array:
  product *= i
  if product > 10**18:
    print(-1)
    exit()
print(product)
Buggy code:
import math
import re
import copy
import sys

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

Fixed code:
import math
import re
import copy
import sys

n = int(input())
a = list(map(int,input().split()))
ceil = 10 ** 18
ans = 1
if all([b > 0 for b in a]):
    for i in range(n):
        ans *= a[i]
        if ans > ceil:
            break
if any([b == 0 for b in a]):
    print(0)
elif ans > ceil:
    print("-1")
else:
    print(ans)
Buggy code:
import sys

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

if(A.index(0) >= 0):
    print(0)
    sys.exit(0)

prod = 1
for a in A:
    prod *= a
    if prod > 1000000000000000000:
        print(-1)
        sys.exit(0)

print(prod)

Fixed code:
import sys

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

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

prod = 1
for a in A:
    prod *= a
    if prod > 1000000000000000000:
        print(-1)
        sys.exit(0)

print(prod)
Buggy code:
import sys

n= int(input())
a = list(map(int,input().split()))
ans = int(a[0])

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


print(ans)

Fixed code:
import sys

n= int(input())
a = list(map(int,input().split()))
ans = a[0]
ans_max = 10 ** 18

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

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

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

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

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

if 0 in a:
    s = 0
else:
    for i in range(n):
        s = s * a[i]
        if s > 10 ** 18:
            s = -1
            break
print(s)
Buggy code:
N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
    print(0)
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
if 0 in A:
    print(0)
    exit()
for i in range(len(A)):
    ans *= A[i]
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)
Buggy code:
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
for i in a:
    ans *= i
    if (ans >= pow(10,18)):
        flag = True

if (flag):
    ans = -1
if 0 in a:
    ans = 0

print(ans)




Fixed code:
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
zeros = False
over = pow(10,18)
for i in a:
    if flag == False:
        ans *= i
    if (ans > over):
        flag = True
    if i == 0:
        zeros = True

if (flag):
    ans = -1
if (zeros):
    ans = 0

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

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

Fixed code:
n=int(input())
x=list(map(int,input().split()))
ans=1
for i in x:
  if i==0:
    print(0)
    exit()

for i in x:
    ans=ans*i
    if ans>10**18:
      ans=-1
      break
print(ans)
Buggy code:
from sys import stdin

n = int(stdin.readline().strip())
seq = list(map(int, stdin.readline().split()))

mul = 1
for k in seq:
  mul *= k
  if mul>int(1e18):
    mul = -1
    break
print(mul)
  
  
  

Fixed code:
from sys import stdin

n = int(stdin.readline().strip())
seq = list(map(int, stdin.readline().split()))

mul = 0
if 0 not in seq:
  mul = 1
  for k in seq:
    mul *= k
    if mul>int(1e18):
      mul = -1
      break
print(mul)
Buggy code:
N = int(input())
As = list(map(int,input().split()))
sum = 1
for i in As:
    sum *=i
    if sum>10**18:
        sum = -1
        break
print(sum)

Fixed code:
N = int(input())
As = list(map(int,input().split()))
sum = 1
if 0 in As:
    print(0)
    exit()
for i in As:
    sum *=i
    if sum>10**18:
        sum = -1
        break
print(sum)
Buggy code:
n = int(input())
k = list(map(int, input().split()))
import collections
c = collections.Counter(k)
re = 1
if c[0] == 0:
  for i in range(n):
    re = re * k[i]
    if re >= 10**18:
      print(-1)
      exit()
  print(re)
else:
  print(0)

Fixed code:
n = int(input())
k = list(map(int, input().split()))
import collections
c = collections.Counter(k)
re = 1
if c[0] == 0:
  for i in range(n):
    re = re * k[i]
    if re > 10**18:
      print(-1)
      exit()
  print(re)
else:
  print(0)
Buggy code:
from sys import stdin
input = sys.stdin

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

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

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