qyliang/CodeNanoFix huggingface dataset:
Buggy code:
from sys import stdin
N = stdin.readline().rstrip()
An = [int(x) for x in stdin.readline().rstrip().split()]
W = 1
for A in An:
    W = W * A
    if 1000000000000000000 < W:
        print(-1)
        exit()
print(W)

Fixed code:
from sys import stdin
N = stdin.readline().rstrip()
An = [int(x) for x in stdin.readline().rstrip().split()]
W = 1
if any([A == 0 for A in An]):
    print(0)
    exit()
for A in An:
    W = W * A
    if 1000000000000000000 < W:
        print(-1)
        exit()
print(W)
Buggy code:
n = int(input())
lists = list(map(int,input().split()))
ans = 1
for i in range(n):
    ans *= lists[i]
    if ans > 10**18:
        ans = -1
        break
print(ans)

Fixed code:
n = int(input())
lists = list(map(int,input().split()))
ans = 1
if sorted(lists)[0] == 0:
    ans = 0
else:
    for i in range(n):
        ans *= lists[i]
        if ans > 10**18:
            ans = -1
            break
print(ans)
Buggy code:
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
LIMIT = 10 ** 18
n=int(input())
#a=(int,read.split())
a=[int(i) for i in 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)
	

Fixed code:
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
LIMIT = 10 ** 18
n=int(input())
#a=(int,read.split())
a=[int(i) for i in input().split()]
if 0 in a:
	print(0)
	exit()

ans = 1
for i in a:
	ans *= i
	if ans > LIMIT:
		print(-1)
		exit()
print(ans)
Buggy code:
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IS(): return str(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

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

if ans >= pow(10,18):
    print(-1)
else:print(ans)

Fixed code:
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IS(): return str(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")


def solve(N,A):
    ans = 1
    if 0 in A:
        print(0)
        return
    
    for i in A:
        ans *= i
        if ans > pow(10,18):
            print(-1)
            return
    print(ans)

def main():
    N = II()
    A = LI()
    solve(N,A)

#main
if __name__ == '__main__':
    main()
Buggy code:
# coding: utf-8
# Your code here!
num = int(input())
s = list(map(int,input().split()))
res = 1
for i in s:
    res *= i
    if res >= 10 ** 18:
        break
    
if res <= 10 ** 18:    
    print(res)
else:
    print(-1)
    

Fixed code:
# coding: utf-8
# Your code here!
num = int(input())
s = list(map(int,input().split()))
res = 1
for i in s:
    res *= i
    if res >= 10 ** 18:
        break

if 0 in s:
    print(0)
elif res <= 10 ** 18:    
    print(res)
else:
    print(-1)
Buggy code:
import math
import sys
import collections
from collections import defaultdict
from sys import stdin, stdout

sys.setrecursionlimit(10**9)
n=int(input())
arr=list(map(int,input().split()))
mult=1
flag=0
for i in range(n):
    if arr[i]>10**18:
        flag=1
        break
    mult*=arr[i]
    if mult>10**18:
        flag=1
        break

if flag==0:
    print(mult)
else:
    print(-1)

Fixed code:
import math
import sys
import collections
from collections import defaultdict
from sys import stdin, stdout

sys.setrecursionlimit(10**9)
n=int(input())
arr=list(map(int,input().split()))
mult=1
flag=0
if 0 in arr:
    print(0)
else:
    for i in range(n):
        mult*=arr[i]
        if mult>10**18:
            flag=1
            break

    if flag==0:
        print(mult)
    else:
        print(-1)
Buggy code:
import sys

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

ans = 1

for a in A:
    if a == 0:
        print(0)
        sys.exit()

for a in sorted(A, reverse=True):
    ans *= a
    if 10**18 < ans:
        print(-1)
        sys.exit()


print(ans)


Fixed code:
import sys

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

ans = 1

for a in A:
    if a == 0:
        print(0)
        sys.exit()

for a in sorted(A, reverse=True):
    ans *= a
    if 10**18 < ans:
        print(-1)
        sys.exit()


print(ans)
Buggy code:
from math import log10

N = int(input())
A = list(map(int, input().split()))
s = 1
for a in A:
    if a == 0:
        print(0)
        break
    s *= a
    if log10(s) >= 18:
        print(-1)
        break
else:
    print(s)




Fixed code:
from math import log10

N = int(input())
A = list(map(int, input().split()))
s = 1
threshold = 10**18
if 0 in A:
    print(0)
else:
    for a in A:
        s *= a
        if s > threshold:
            print(-1)
            break
    else:
        print(s)
Buggy code:
N=int(input())
L=list(map(int,input().split()))
A=1
for i in range(N):
  A=A*L[i]
  if 10**18<A:
print(-1)
  exit()
else:
  print(A)

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

Fixed code:
N = int(input())
arr = list(map(int, input().split()))
result = 1
if 0 in arr:
    result = 0
else:
    for i in arr:
        result *= i
        if result > 10**18:
            result = -1
            break
print(result)
Buggy code:
import sys

N = int(input())
A = list(map(int, sys.stdin.readline().split()))
ans = 1

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


Fixed code:
import sys

N = int(input())
A = list(map(int, sys.stdin.readline().split()))
ans = 1

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

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


Fixed code:
import sys
n = int(input())
lis = list(map(int, input().split()))
ans = 1
if 0 in lis:
  print(0)
  sys.exit()
for i in lis:
  ans *= i
  
  if ans > 10**18:
    print(-1)
    sys.exit()
print(ans)
Buggy code:
N=int(input())
s=list(map(int,input().split()))
ans=1
for i in s:
  ans*=i
  if ans>1000000000000000000:
    print('-1')
    exit()

print(ans)

Fixed code:
N=int(input())
s=list(map(int,input().split()))
ans=1
if s.count(0)>0:
  print('0')
  exit()
for i in s:
  ans*=i
  if ans>1000000000000000000:
    print('-1')
    exit()

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

ans = 1

a.sort()
if 0 in a:
    for x in range(n):
        ans *= a[x]

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


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

ans = 1

a.sort(reverse=True)

if 0 not in a:
    for x in range(n):
        ans *= a[x]

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

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

Fixed code:
n=int(input())
m=1
inf=10**18
lol=0
l=list(map(int,input().split()))
if 0 in l:
    print(0)
else:

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

Fixed code:
n=int(input())
a=list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    s=1
    for i in a:
        s=s*i
        if s>10**18:
            s=-1
            break
    print(s)
Buggy code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

n = inp()
x = ip()
ele = 10**18
prod = 1
for i in x:
    prod *= i
    if prod == 0:
        print(0)
        exit()
    if prod > ele:
        print(-1)
        exit()
print(prod)

Fixed code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

n = inp()
x = ip()
ele = 10**18
prod = 1
if 0 in x:
    print(0)
    exit()
for i in x:
    prod *= i
    if prod > ele:
        print(-1)
        exit()
print(prod)
Buggy code:
n = input()
n = int(n)
a = input().split()
b = 1
for i in a:
    b *= int(i)
    if (b > 1000000000000000000):
        print ("-1")
        break
if (b <= 1000000000000000000):
    print (b)


Fixed code:
n = input()
n = int(n)
a = input().split()
b = 1
if '0' in a:
    print ("0")
else:
    for i in a:
        b *= int(i)
        if (b > 1000000000000000000):
            print ("-1")
            break
    if (b <= 1000000000000000000):
        print (b)
Buggy code:
def main():
    input()
    a = list(map(int, input().split()))
    ans = 1
    for el in a:
        ans *= el
        if ans > 1e18:
            print(-1)
            return
    else:
        print(ans)


if __name__ == "__main__":
    main()


Fixed code:
def main():
    input()
    a = list(map(int, input().split()))
    ans = 1
    for el in a:
        if el == 0:
            print(0)
            return
    for el in a:
        ans *= el
        if ans > 1e18:
            print(-1)
            return
    else:
        print(ans)


if __name__ == "__main__":
    main()
Buggy code:
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in a:
    ans*=i
print(-1 if ans>=10**18 else 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:
        ans*=i
        if ans>10**18:
            ans=-1
            break
print(ans)
Buggy code:
n = int(input())
L = list(map(int,input().split()))
num = 1
for i in range(n):
    num *=L[i]
    if num > 10**18:
        print(-1)
        exit()
print(num)

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

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

list.sort(A, reverse=True)
mx = 10 ** 18
mul = 1
for a in A:
    mul *= a
    if mul == 0:
        break
    elif mul > mx:
        mul = -1
        break

print(mul)

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

list.sort(A, reverse=True)
mx = 10 ** 18
mul = 1

if 0 in A:
    print(0)
    exit(0)
    
for a in A:
    mul *= a
    if mul > mx:
        mul = -1
        break

print(mul)
Buggy code:
n = int(input())
A = list(map(int, input().split()))

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


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

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

ans = 1
for a in A:
    ans *= a
    if ans >= 10**18:
        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 a in A:
        ans *= a
        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**18:
        ans=-1
        break

print(ans)

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

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

result = 1
for num in nums:
    result *= num

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



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

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

result = 1
for num in nums:
    result *= num

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

print(result)
Buggy code:
n = int(input())
A = [int(i) for i in input().split()]
A.sort(reverse=True)
work = 1
for a in A:
    work *= a
    if work > 10**18:
        print(-1)
        break
else:
    print(work)

Fixed code:
n = int(input())
A = [int(i) for i in input().split()]
check = [i for i in A if i == 0]
if 0 in check:
    print(0)
else:   
    A.sort(reverse=True)
    work = 1
    for a in A:
        work *= a
        if work > 10**18:
            print('-1')
            break
    else:
        print(work)
Buggy code:
N = int(input())
A = input().split()
i = 0
S = 1
for i in range(N):
    S *= int(A[i])
    if S > 10**18:
        break
if S > 10**18:
    print(-1)
else:
    print(S)


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

ans = 1

for i in As:
    ans *= i
    ans = min(ans, 10**18 + 1)

if ans == 10**18 + 1:
    print(-1)

print(ans)


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

ans = 1

for i in As:
    ans *= i
    ans = min(ans, 10**18 + 1)

if ans == 10**18 + 1:
    print(-1)

else:
    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)
        quit()
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)
        quit()
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 range(n):
    ans=ans*a[i]
    if ans>10**18:
      print(-1)
      break
    else:
      continue
  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=ans*a[i]
    if ans>10**18:
      print(-1)
      break
    else:
      continue
  if ans <= 10**18:
    print(ans)
Buggy code:
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())

"""========main code==============="""
t=ii()

a=ll()
s=1
f=0
for i in a:
    s*=i
    if(s>10**18):
        f=1
        break
if f:
    print(-1)
else:
    print(s)

Fixed code:
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())

"""========main code==============="""
t=ii()

a=ll()
s=1
f=0
val=10**18
if 0 in a:
    print(0)
else:    
    for i in a:
        s*=i
        if(s>val):
            f=1
            break
    if f:
        print(-1)
    else:
        print(s)
Buggy code:
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)[::-1]
ans=a[0]
for i in a[1:]:
    ans*=i
    if ans>10**18:
        print(-1)
        break
else:
    print(ans)

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

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


def solve(nums):
  if any(not n for n in nums):
      return 0

  print(list(nums))
  i = 1
  for n in nums:
      i *= n
      if i > 10 ** 18:
        return -1
  return i

print(solve(nums))


Fixed code:
n = int(input())

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


def solve(nums):
  if any(not n for n in nums):
      return 0

  i = 1
  for n in nums:
      i *= n
      if i > 10 ** 18:
        return -1
  return i

print(solve(nums))
Buggy code:
# -*- coding: utf-8 -*-

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

product = 1

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

Fixed code:
# -*- coding: utf-8 -*-

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

product = 1

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

print(product)
Buggy code:
x=int(input())
s=list(map(int,input().split()))
res=1
for n in s:
	res*=n
	if res>1e18:
		print(-1)
		exit(0)

print(res)

Fixed code:
x=int(input())
s=list(map(int,input().split()))
s.sort()
res=1
for n in s:
	res*=n
	
	if res>1e18:
		res=-1
		print(-1)
		exit(0)
print(res)
Buggy code:
n = int(input())
values = list(map(int, input().split()))
if 0 in values:
  print(0)
  return

mult = 1
for i in values:
  mult *= i
  if mult > 1000000000000000000:
    print(-1)
    return

print(mult)

Fixed code:
def main():
  n = int(input())
  values = list(map(int, input().split()))
  if 0 in values:
    print(0)
    return

  mult = 1
  for i in values:
    mult *= i
    if mult > 1000000000000000000:
      print(-1)
      return
  print(mult)

main()
Buggy code:
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)

ans=1
for i in range(n):
    ans=a[i]*ans
    if ans>10**18:
        break

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

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

a.sort()
if a[0]==0:
    print(0)
else:
    a.sort(reverse=True)
    # print(a)

    ans=1
    for i in range(n):
        ans=a[i]*ans
        if ans>10**18:
            break

    if ans>10**18:
        print(-1)
    else:
        print(ans)
Buggy code:
N = int(input())
numList = list(map(int, input().split()))
product = 1
isZero = False
toPrint = True
for j in numList:
    if j == 0:
        isZero = True
        break
if not isZero:
    for i in numList:
        product *= i
        if product > 10**18:
            toPrint = False
            break
if toPrint:
    print(product)
else:
    print(-1)

Fixed code:
N = int(input())
numList = list(map(int, input().split()))
product = 1
toPrint = True
isZero = False
for j in numList:
    if j == 0:
        isZero = True
if not isZero:
    for i in numList:
        product = product * i
        if product > 10**18:
            toPrint = False
            break
if isZero:
    print(0)
else:
    if toPrint:
        print(product)
    else:
        print(-1)
Buggy code:

N = int(input())
A = list(map(int, input().split()))
import sys
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print(-1)
        sys.exit()

print(tar)


Fixed code:

import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print('-1')
        sys.exit()

print(tar)
Buggy code:
import sys
# from collections import defaultdict
# from collections import Counter
# from queue import Queue
import math

def main():
    N = int(input())

    As = [int(s) for s in input().split()]
    logsum = 0
    prod = 1
    for a in As:
        if a == 0:
            print('0')
            return

        logsum += math.log10(a)
        # sys.stderr.write('{}\n'.format(logsum))


    if logsum > 18:
        print('-1')
        return

    for a in As:
        prod *= a

    if prod >= 10 ** 18:
        print('-1')
        return
    print(prod)

    # As = []
    # for i in range(N):
    #     tmp = int(input())
    #     As.append(tmp)

    return 0

if __name__ == '__main__':
    sys.exit(main())


Fixed code:
import sys
# from collections import defaultdict
# from collections import Counter
# from queue import Queue
import math

def main():
    N = int(input())

    As = [int(s) for s in input().split()]
    logsum = 0
    prod = 1
    for a in As:
        if a == 0:
            print('0')
            return

        logsum += math.log10(a)
        # sys.stderr.write('{}\n'.format(logsum))


    if logsum > 18.2:
        print('-1')
        return

    for a in As:
        prod *= a

    if prod > 10 ** 18:
        print('-1')
        return
    print(prod)

    # As = []
    # for i in range(N):
    #     tmp = int(input())
    #     As.append(tmp)

    return 0

if __name__ == '__main__':
    sys.exit(main())
Buggy code:
import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

n = int(input())
A = [int(i) for i in input().split()]

tmp = 0
res = 1

A = sorted(A)
for i in range(n):
    res *= A[i]
    if res >= 10 ** 18:
        res = -1
        break
    if res == 0:
        break

print(res)


Fixed code:
import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

n = int(input())
A = [int(i) for i in input().split()]

tmp = 0
res = 1

A = sorted(A)
for i in range(n):
    res *= A[i]
    if res > 10 ** 18:
        res = -1
        break
    if res == 0:
        break

print(res)