ZhenlongDai/ACPR huggingface dataset:
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A  = [int(x) for x in input().split()]
total = 1
for a in A:
    total *= a 
    if total > 10 ** 18:
        print(-1)
        break

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

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1
-1


Fixed submission (verdict: Accepted):
N = int(input())
A  = [int(x) for x in input().split()]
total = 1
if 0 in A:
    print(0)
else:    
    for a in A:
        total *= a 
        if total > 10 ** 18:
            print(-1)
            break

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

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import array


n = int(input())
a=[]
a=input().split(" ")
f=0
f1=0
b=0
for i in a:
    if int(i) == 0:
        print("0");
        f1=1
        

sum =1
if f1==0:
    for i in a:
        sum=sum*int(i);
        if sum>1e18:
            f=1
            print("-1");
    
if f==0 and f1==0:
    print(sum)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 0 2 7 9 5 0

Expected output:
0


Actual output:
0
0


Fixed submission (verdict: Accepted):
import array


n = int(input())
a=[]
a=input().split(" ")
f=0
f1=0
b=0
for i in a:
    if int(i) == 0:
        print("0")
        f1=1
        break
        

sum =1
if f1==0:
    for i in a:
        sum=sum*int(i)
        if sum>1e18:
            f=1
            print("-1")
            break
    


if f==0 and f1==0:
    print(sum)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
nums = sorted([int(e) for e in input().split()])
ans = 1
for a in nums:
    ans *= a
    if(10 * 18 < ans):
        ans = -1
        break
    elif(ans == 0):
        break
print(ans)

Failing test case input:
3
100 7647 174147762478

Expected output:
133170793966926600


Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
num = sorted([int(e) for e in input().split(" ")])
lim = 10 ** 18
i = -1
ans = 1
for a in num:
    ans *= a
    if(ans > lim):
        print(-1)
        break
    elif(ans == 0):
        print(0)
        break
else:
    print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
lis = list(map(int,input().split()))
res = 1
for i in lis:
    if res >= 10**18:
        print(-1)
        exit()
    else:
        res *= i
print(res if res <= 10**18 else -1)


Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
lis = list(map(int, input().split()))

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

res = 1
for i in lis:
    if res > 10**18:
        print(-1)
        exit()
    else:
        res *= i
print(res if res <= 10**18 else -1)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
arr = [int(x) for x in input().split()]
res = 1
flag = False
for i in range(n):
    if flag == False:
        res *= arr[i]
    if res == 0:
        print(0)
        exit()
    if res > 10**18:
        flag = True
if res > 10**18:
    print(-1)
else:
    print(res)


Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
arr = [int(x) for x in input().split()]
res = 1
flag = False
for i in range(n):
    if flag == False:
        res *= arr[i]
    if arr[i] == 0:
        print(0)
        exit()
    if res > 10**18:
        flag = True
if res > 10**18:
    print(-1)
else:
    print(res)

Problem: p02658
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N = int(input())
arr = sorted(map(int, input().split()))
INF = 10 ** 18
ans = 1
for num in arr:
    if ans > INF:
        ans = -1
        break
    elif ans == 0:
        break

print(ans)


Failing test case input:
3
111 4415 2420125321

Expected output:
1186018715435865


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
arr = sorted(map(int, input().split()))
INF = 10 ** 18
ans = 1
for num in arr:
    ans *= num
    if num > 0 and ans > INF:
        ans = -1
        break
    elif ans == 0:
        break

print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    N = int(input())
    A = map(int,input().split())
    result = 1
    if 0 in A:
        print(0)
        return

    for i in A:
        result *= i

    if result > 1000000000000000000:
        print(-1)
        return
    print(result)

main()


Failing test case input:
2
0011001000 1000000110

Expected output:
11001001210110000


Actual output:
1


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    A = list(map(int,input().split()))
    result = 1
    if 0 in A:
        print(0)
        return

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

main()

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def m():  
    N = int(input())
    A = list(map(int, input().split()))
    times = 1
    for i in A: 
        if times < 10**18:
            times *= i
        else:
            pass
    if times > 10**18:
        print(-1)
    else:
        print(times)
m()

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
def m():  
    N = int(input())
    A = list(map(int, input().split()))
    times = 1
    c = 0

    for i in A: 
        if times <= 10**18 and c < N:
            times *= i
            c += 1   
    if times > 10 ** 18:
        times = -1
    if 0 in A:
        times = 0
    print(times)
m()
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
ans=1
check=0
a=sorted(list(map(int,input().split())))
for i in range(n):
  if ans>=10**18:
    check=1
    break
  else:
    ans*=a[i]
print([ans,-1][check])

Failing test case input:
3
101 9901 1693005451348

Expected output:
-1


Actual output:
1693007144353451348


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

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
ans=1
flg=0
for i in A:
    ans=ans*i
    if ans>10**18:
        flg=1
        print(-1)
        break
if flg==0:
    print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=1
flg=0
for i in A:
    ans=ans*i
    if ans>10**18:
        flg=1
        print(-1)
        break
if flg==0:
    print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

N=int(input(""))

ar=[]
total=1
big=False

ar = list(map(int, input().strip().split(' ')))

A=len(ar)
      
while big == False:
      for i in range (0,A):
            total=ar[i]*total
            if total>(10^18):
                  big=True
                  break

if big == False:
      print(total)

if total==0:
      big = False
      print("0")

if big == True:
      print("-1")

Failing test case input:
2
0001001001 1000000010

Expected output:
1001001010010010


Actual output:
-1


Fixed submission (verdict: Accepted):
N=int(input(""))

ar=[]
total=1
big=False
lion = False
A=N-1
ar = list(map(int, input().strip().split(' ')))

if 0 in ar:
      print("0")
      big=True
      lion=False
      
while big == False and lion == False:
      for i in range (0,N):
            total=ar[i]*total
            if i == A:
                  lion = True
            if total>(1000000000000000000):
                  big=True
                  lion=True
                  break

if big == False and lion == True:
      print(total)

if big == True and lion == True:
      print("-1")

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

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


Failing test case input:
2
0110110001 1010000010

Expected output:
111211102111100010


Actual output:
-1


Fixed submission (verdict: Accepted):

n=int(input())
a = list(map(int, input().split()))
a.sort()
ans=1
for i in a:
    ans *= i
    if ans == 0:
        break
    if ans > 10 ** 18:
        ans = -1
        break
print(ans)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def aaa(a_list):
    ans = 1
    for i in a_list:
        ans *= i
        if ans > 10**18 or ans < 0:
            return -1
    return ans

N = input()
a = map(int, input().split())
if 0 in a:
    print(0)
else:
    print(aaa(a))

Failing test case input:
3
110 7647 174147762478

Expected output:
146487873363619260


Actual output:
1


Fixed submission (verdict: Accepted):
def aaa(a_list):
    ans = 1
    for i in a_list:
        ans = ans * i
        if ans > 10**18:
            return -1
    return ans

N = input()
a = input().split()
a = [int(i) for i in a]

if 0 in a:
    print(0)
else:
    print(aaa(a))

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

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)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):

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)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))

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

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))

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

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

Problem: p02658
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))

limit = 10**18
ans = 1
for one in A:
    ans*=one
    if ans>limit:
        ans=-1
        break
print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))

limit = 10**18
ans = 1
if 0 in A:
    print(0)
else:
    for one in A:
        ans*=one
        if ans>limit:
            ans=-1
            break
    print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
a = [int(i) for i in input().split()]
A = 1
if 0 in a:
    A = 0
else: 
    for i in range(N-1):
        A = A * a[i]
        if A > 1000000000000000000:
            A = -1
        break
print(A)

Failing test case input:
3
111 5000 29935402316

Expected output:
16614148285380000


Actual output:
111


Fixed submission (verdict: Accepted):
N = int(input())
a = [int(i) for i in input().split()]
A = 1
if 0 in a:
  print(0)
  exit()
for i in range(N):
  A = A * a[i]
  if A > 1000000000000000000:
    print(-1)
    exit()
print(A)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        a = A[i]
        for j in range(19):
            if a <= 10**j:
                m = j
                break
        for k in range(19):
            if ans <= 10**k:
                n = k
                break
        if(m+n > 18):
            print(-1)
            break
        elif(ans*a == 10**18):
            ans = ans*a
        elif(m+n == 18):
            print(-1)
            break
        elif(ans*a > 10**18):
            print(-1)
            break
        else:
            ans = ans*a
        if i == N-1:
            print(ans)

Failing test case input:
2
0110011010 0101100010

Expected output:
11122114211110100


Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        a = A[i]
        for j in range(19):
            if a <= 10**j:
                m = j
                break
        for k in range(19):
            if ans <= 10**k:
                n = k
                break
        if(m+n > 19):
            print(-1)
            break
        elif(ans*a == 10**18):
            ans = ans*a
        elif(ans*a > 10**18):
            print(-1)
            break
        else:
            ans = ans*a
        if i == N-1:
            print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = input()
ans = 1
A = map(int, input().split())
if 0 in A:
  ans = 0
else:
  for a in A:
    ans *= a
ans = -1 if ans > 10 ** 18 else ans
print(ans)

Failing test case input:
2
0110111001 1010000010

Expected output:
111212112111110010


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
ans = 1
A = list(map(int, input().split()))
A.sort(reverse=True)
if A[N-1] == 0:
  ans = 0
else:
  for a in A:
    ans *= a
    if ans > 10 ** 18:
      ans = -1
      break
print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = map(int,input().split())
A = list(map(int, input().split()))
ans = 1
for a in A:
    ans *= a
    if ans >= 10**18:
        ans = -1
        break
        
print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = map(int,input().split())
A = list(map(int, input().split()))
A.sort()
ans = 1
for a in A:
  ans *= a
  
  if ans > 10**18:
    ans = -1
    break
print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
n=int(input())
a=input().split()
ans=1
for i in range(n):
  ans*=int(a[i])
  if ans>=1e18:
    print(-1)
    sys.exit()
print(ans)


Failing test case input:
2
1000000000 1000000000

Expected output:
1000000000000000000

Actual output:
-1


Fixed submission (verdict: Accepted):
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)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
arr = list(map(int,input().split()))
arr = sorted(arr,reverse=True)
ans = 1
idx = 0
for a in arr:
  ans *= a
  if ans > 10**18:
    print(-1)
    exit()
print(ans)
  

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
arr = list(map(int,input().split()))
arr = sorted(arr,reverse=True)
ans = 1
idx = 0
if arr[-1]==0:
  ans = 0
for a in arr:
  ans *= a
  if ans > 10**18:
    print('-1')
    exit()
print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
score=1
a=list(map(int,input().split()))
if 0 in a:
  print("0")

  
for i in a:
  score*=i
if score>1e18:
    print("-1")
else:
    print(score)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
0
0


Fixed submission (verdict: Accepted):
n= int(input())
a = list(map(int,input().split()))
score=1
if 0 in a:
  print(0)
  exit()
for i in a:
  score*=i
  if score>10**18:
    print(-1)
    exit()
print(score)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
l = list(map(int,input().strip().split()))[:n] 
rs= 1
l.sort()
if l[0]==0 : 
    print(0)
else:
    for i in range(n):
        rs=l[i]*rs
        if (rs>10**18) or (rs<0):
            rs = -1
            break
print(rs)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 0 2 7 9 5 0

Expected output:
0


Actual output:
0
1


Fixed submission (verdict: Accepted):
n=int(input())
l = list(map(int,input().strip().split()))[:n] 
rs= 1
l.sort()
if l[0]==0 :
    rs=0
else:
    for i in range(n):
        if(10**18 
            rs = -1
            break
        rs=l[i]*rs
print(rs)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(float,input().split( )))
ans = 1
for a in A:
    ans *= a
    if ans > 1e18:
        ans = '-1'
        break
for a in A:
    if a == 0:
        ans = 0
print(ans)

Failing test case input:
2
0110011011 0101000110

Expected output:
11111124212211210


Actual output:
1.111112421221121e+16


Fixed submission (verdict: Accepted):
N = int(input())
A= list(map(int,input().split( )))
ans = 1
for a in A:
    ans *= a
    if ans > 1e18:
        ans = '-1'
        break
for a in A:
    if a == 0:
        ans = 0
        break
print(ans)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    i = 1
    for a in A:
        i *= a
        if i > 10 ** 18:
            return -1

    return i

print(main())




Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        return 0
    i = 1
    for a in A:
        i *= a
        if i > 10 ** 18:
            return -1

    return i

print(main())

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
ans = 1
print(A)
for v in A:
    ans = ans * v
    if ans > 10 ** 18:
        ans = -1
        break
print(ans)    

Failing test case input:
3
001 188 468791915

Expected output:
88132880020


Actual output:
[1, 188, 468791915]
88132880020


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
ans = 1
if 0 in A:
    ans = 0
else:
    for v in A:
        ans = ans * v
        if ans > 10 ** 18:
            ans = -1
            break;
print(ans)

Problem: p02658
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
MV = 10**18
ans =1
if 0 in a :
    print(-1)
for ele in a:
    ans *= ele
    if ans > MV :
        print(-1)
        exit()
print(ans)


Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1
-1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
MV = 10**18
ans =1
if 0 in a :
    print(0)
    exit()

for ele in a:
    ans *= ele
    if ans > MV :
        print(-1)
        exit()
print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
ans = 1

kMax = 10**18

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

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
I = list(map(int, input().split()))
ans = 1

kMax = 10**18

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

for i in I:
    ans *= i
    if ans > kMax:
        print(-1)
        exit()
print(ans)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = input().split()
answer = 1
flag = 0
x = 10**18

if '0' in A:
  print(0)
  flag = 1
  
for i in range(N):
  answer *= int(A[i])
  if answer > x:
    print(-1)
    flag = 1
    break

if flag == 0:
  print(answer)



Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
0
-1


Fixed submission (verdict: Accepted):
N = int(input())
A = input().split()
answer = 1
flag = 0
x = 10**18

if '0' in A:
  print(0)
  flag = 1
  


if flag == 0:
  for i in range(N):
    answer *= int(A[i])
    if answer > x:
      print(-1)
      flag = 1
      break

if flag == 0:    
  print(answer)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int,input().split()))
ans = 1
for i in range(N):
    if a[i] == 0:
        ans = 0
if ans != 0:
    for i in range(N):
        ans *= a[i]
        if ans > 10**18:
            ans = -1
            break

print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
mod=10**18

cnt=1
for i in range(n):
    cnt*=a[i]
    if cnt>mod:
        print(-1)
        exit()

print(cnt)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
mod=10**18

cnt=1
for i in range(n):
    cnt*=a[i]
    if cnt>mod:
        print(-1)
        exit()

print(cnt)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
num = input().split()
ans = int(num[0])
cov = 10**18
if ('0' in num):
  ans = 0  
else:
  for i in range (int(N)-1):
    if ans == -1 or ans == 0:
      break
    elif int(ans) > int(cov):
      ans = -1
    else:
      ans *= int(num[i+1])
print(ans)

Failing test case input:
3
101 9901 1693005451348

Expected output:
-1


Actual output:
1693007144353451348


Fixed submission (verdict: Accepted):
N = int(input())
num = input().split()
ans = int(num[0])
cov = 10**18
if ('0' in num):
  ans = 0  
else:
  for i in range (int(N)-1):
    if ans == -1 or ans == 0:
      break
    else:
      ans *= int(num[i+1])
    if int(ans) > int(cov):
      ans = -1
print(ans)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = [int(i) for i in input().split()]

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

else:
    print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
A = sorted([int(i) for i in input().split()])

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

else:
    print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A_list = [int(e) for e in input().split()]

ans = A_list[0]
for i in range(1,N):
    ans *= A_list[i]
    
    if ans >= 10**18:
        print(-1)
        break
else:
    print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
A_list = [int(e) for e in input().split()]
A_list.sort(reverse=False)
ans = A_list[0]
for i in range(1,N):
    ans *= A_list[i]
    
    if ans > 10**18:
        print(-1)
        break
else:
    print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def mul2():
    n = int(input())
    nums = list(map(int,input().split()))
    limit = 10**18
    res = 1
    i = 0
    while i<n:
        res *= nums[i]
        i += 1
        if res > limit:
            res = -1
            break
    return res

if __name__ == "__main__":
    print(mul2())

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
nums = list(map(int,input().split()))
limit = 10**18
res = 1
i = 0
if 0 in nums:
    print(0)
    exit()
while i<n:
    res *= nums[i]
    i += 1
    if res > limit:
        res = -1
        break
print(res)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
p=list(map(int, input().split()))
i=0
ans=1
flag=0
k=1e18
while(n>i):
	ans*=p[i]
	if(p[i]==0):
		break
	if(ans>k):
		break
	i+=1		
if(ans>k):
		print(-1)
else:
		print(ans)
		


Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n=int(input())
p=list(map(int, input().split()))
i=0
ans=1
flag=0
k=1e18
while(n>i):
	if(p[i]==0):
		flag=1
	i+=1
if(flag==1):
	print(0)
else:
	flag=0
	i=0			
	while(n>i):
		ans*=p[i]
		if(ans>k):
			flag=1
			break
		i+=1		
	if( flag==1):
		print(-1)
	else:
		print(ans)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
D=int(1)
 
A.sort()
if A[0]==0:
    print(0)
else:
    A.sort(reverse=True)
    for i in range(N):
        D*=A[i]
        if  D>10**18:
            print(-1)
            break
        else:
            print(D)
            break

Failing test case input:
3
101 5000 834116832270

Expected output:
421229000296350000


Actual output:
834116832270


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
D=int(1)
ans=int(0)
A.sort()
if A[0]==0:
    ans==0
else:
    A.sort(reverse=True)
    for i in range(N):
        D*=A[i]
        if  D>10**18:
            ans=-1
            break

        else:
            ans=D
        

print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split(' ')))
ans = 1
for l in A:
    ans *= l
    if 10**18 < ans:
        ans = -1
        break
print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split(' ')))
ans = 1
if 0 in A:
    ans = 0
else:
    for l in A:
        ans *= l
        if 10**18 < ans:
            ans = -1
            break
print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
sum = 1
Max = 1000000000000000000

l = list(map(int, input().split()))
for i in range(n):
  sum=sum*l[i]
  if sum>Max:
    break
  
if sum<=Max:
  print("%d" % sum)
else :
  print("%d" % -1)


Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
Sum = 1
Max = 1000000000000000000

l = list(map(int, input().split()))
f = 0
for i in range(n):
  if l[i]==0:
    f = 1
for i in range(n):
  Sum=Sum*l[i]
  if Sum>Max:
     break
if f == 1:
  print("0")
elif Sum<=Max:
  print("%d" % Sum)
else :
  print("%d" % -1)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main ():
  input()
  result = 1
  for i in map(int, input().split()):
    result = result * i
    if result > 10 ** 18:
      result = -1
      break
    if result == 0:
      break
  
  return result

print(main())

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
def main ():
  input()
  result = 1
  for i in map(int, input().split()):
    if i == 0:
      result = 0
      break
    
    if result == -1:
      continue
      
    result = result * i
    if result > 10 ** 18:
      result = -1
  
  return result

print(main())
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = [int(i) for i in input().split()]

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

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(i) for i in input().split()]
if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10**18:
            print(-1)
            break
    else:
        print(ans)

Problem: p02658
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N = int(input())
A = [int(x) for x in input().split()]
ans = 1
for r in A:
  ans *= r
  if ans > 1e18:
      print(-1)
      exit()
print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
A=list(map(int,input().split()))

ans = 1
if 0 in A:
  print(0)
  exit()
  
for r in A:
  ans *= r
  if ans > 1e18:
      print(-1)
      exit()
      
print(ans)

Problem: p02658
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import sys

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

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

print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
import sys

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

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

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

print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = input()
A = sorted([int(x) for x in input().split()])

product = 1
for a in A:
    product *= a
    if a == 0:
        break
    if product <= 10**18:
        product = -1
        break

print(product)


Failing test case input:
3
100 4415 2420125321

Expected output:
1068485329221500


Actual output:
-1


Fixed submission (verdict: Accepted):
import sys

n = input()
A = sorted([int(x) for x in input().split()], reverse=True)

if A[-1] == 0:
    print(0)
    sys.exit()

product = 1
for a in A:
    product *= a
    if product > 10**18:
        product = -1
        break

print(product)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)


Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
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)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = input().split(" ")
result = 1
for i in range(N):
  result *= int(A[i])
  if result > 10**18:
    print(-1)
    exit()
print(result)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
A = input().split(" ")
result = 1
if "0" in A:
  print(0)
  exit()
else:
  for i in range(N):
    result *= int(A[i])
    if result > 10**18:
      print(-1)
      exit()
print(result)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
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)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
nums = input().split()
mul = int(nums[0])
if str(0) in nums:
    mul = 0
else:
    for i in nums[1:]:
        mul *= int(i)
        if len(str(mul)) >= 19:
            mul = -1
            break
print(mul)

Failing test case input:
2
1000000000 1000000000

Expected output:
1000000000000000000

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
nums = input().split()
mul = int(nums[0])
if str(0) in nums:
    mul = 0
else:
    for i in nums[1:]:
        mul *= int(i)
        if len(str(mul)) >= 19 and str(mul) != "1000000000000000000":
            mul = -1
            break
print(mul)

Problem: p02658
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
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)


Failing test case input:
2
1000000000 1000000000

Expected output:
1000000000000000000

Actual output:
-1


Fixed submission (verdict: Accepted):
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)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
n=int(input())
As = list(map(int, input().split()))
ans=1
for val in As:
    if val==0:
        ans=0
        break
    ans=val*ans
    if 10**18<ans:
        ans=-1
        break

print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
import sys
n=int(input())
As = list(map(int, input().split()))
ans=1
for val in As:
    if val==0:
        ans=0
        break
for val in As:
    if ans==0:
        break
    if val==0:
        ans=0
        break
    ans=val*ans
    if 10**18<ans:
        ans=-1
        break

print(ans)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))

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

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))

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

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

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
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)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
arr = list(map(int,input().split()))
ans = 1
f = 0
for i in arr:
    ans = ans*i
    if ans>10**18:
        f = 1
        break
if f==1:
    print(-1)
else:
    print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
arr = list(map(int,input().split()))
if 0 in arr:
    print(0)
else:
    ans = 1
    f = 0
    for i in arr:
        ans = ans*i
        if ans>10**18:
            f = 1
            break
    if f==1:
        print(-1)
    else:
        print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))

ans = a[0]
for i in range(1, n):
  ans = ans * a[i]
  if ans > 1000000000000000000:
    ans = -1
    break

print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))

if (0 in a):
  print(0)
else:
  ans = 1
  for num in a:
    ans *= num
    if ans > 1000000000000000000:
      print(-1)
      exit()
  print(ans)
Problem: p02658
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N=int(input())

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

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

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

print(ans)


Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
0
-1


Fixed submission (verdict: Accepted):
N=int(input())

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

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

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

print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
flag = False
limit = 1e18
a = [int(item) for item in input().split()]
if(flag):
    print(0)
ans = 1
for i in a:
    if(i == 0):
        flag = True
        break
if(flag):
    print(0)
for i in a:
    ans = ans*i
    if(ans > limit):
        flag = True
        break
if(flag):
    print(-1)
else:
    print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 0 2 7 9 5 0

Expected output:
0


Actual output:
0
-1


Fixed submission (verdict: Accepted):
n = int(input())
flag = False
limit = 1000000000000000000
a = [int(item) for item in input().split()]
ans = 1
for i in a:
    if(i == 0):
        flag = True
        break
for i in a:
    ans = ans*i
    if(ans > limit):
        break
if(flag):
    print(0)
elif(ans > limit):
    print(-1)
else:
    print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
n=int(input())
a=list(map(int,input().split()))
x=1
for i in range(n):
	x *=a[i]
	if x>10**18:
		print(-1)
		sys.exit()
        
print(x)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
import sys
n=int(input())
a=list(map(int,input().split()))
a.sort()
x=1
for i in range(n):
	x *=a[i]
	if x>10**18:
		print(-1)
		sys.exit()
        
print(x)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
num = list(map(int,input().split(" ")))
 
zero=num.count(0)

if zero != 0:
  print(0)
else:
  s = num[0]
  for i in range(1,n):
    s = s * num[i]
  if len(str(s)) > 18:
    print(-1)
  else:
    print(s)

Failing test case input:
2
1000000000 1000000000

Expected output:
1000000000000000000

Actual output:
-1


Fixed submission (verdict: Accepted):
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)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
ans = 1

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

print(ans)

Failing test case input:
3
011 133 315218201

Expected output:
461164228063


Actual output:
11
1463
461164228063
461164228063


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
ans = 1

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

print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):



def solve(*args: str) -> str:
    n = int(args[0])
    A = map(int, args[1].split())

    ret = 1
    for a in A:
        if 10**18 < ret*a:
            ret = -1
            break
        else:
            ret *= a

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):



def solve(*args: str) -> str:
    n = int(args[0])
    A = list(map(int, args[1].split()))
    A.sort()

    ret = 1
    for a in A:
        if 10**18 < ret*a:
            ret = -1
            break
        else:
            ret *= a

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
a_list = list(map(int, input().split()))

res = 1
for a in a_list:
    res *= a
    if res > (10 ** 18):
        res = -1
        break
print(res)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
a_list = list(map(int, input().split()))

res = 1
if 0 in a_list:
    print(0)
    exit()

for a in a_list:
    res *= a
    if res > (10 ** 18):
        res = -1
        break
print(res)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = map(int, input().split())

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

maxn = 10**18
ans = 1
for k in a:
    ans *= k
    if ans > maxn:
        ans = -1
        break


print(ans)


Failing test case input:
3
100 5772 2420125321

Expected output:
1396896335281200


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
a = map(int, input().split())
a = list(a)

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

maxn = 10**18
ans = 1
for k in a:
    ans *= k
    if ans > maxn:
        ans = -1
        break


print(ans)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)
  
  
  

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
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)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys











stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def main():
    n = int(stdin.readline().rstrip())
    
    A = list(map(int, stdin.readline().rstrip().split()))
    
    
    
    
    ans = 1
    if 0 in A:
        print(0)
        exit()
    for i in range(n):
        if ans > 10**18:
            print(-1)
            exit()
        ans *= A[i]
    print(ans)

main()


Failing test case input:
3
101 9901 999999000001

Expected output:
-1

Actual output:
1000000000000000001


Fixed submission (verdict: Accepted):
import sys

stdin = sys.stdin

def main():
    n = int(stdin.readline().rstrip())
    A = list(map(int, stdin.readline().rstrip().split()))
    A.sort()
    ans = 1
    for i in range(n):
        if ans > 10**18:
            if A[0] == 0:
                print(0)
                exit()
            print(-1)
            exit()
        ans *= A[-i]
    print(ans if ans <= 10**18 else -1)


main()

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=input().split()
x=1
if 0 in a:
    print('0')
else:
    for i in range(n):
        x*=int(a[i])
        if x>10**18:
            print("-1")
            break
        elif i==n-1:
            print(x)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
 
mul=1
if 0 in A:print("0")
else:
    for i in range(N):
        mul*=A[i]
        if mul>pow(10,18):
            print("-1")
            break
        elif i==N-1:print(mul)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))

mul = 1
if 0 in set(a): print(0)
else:
    iter = 0
    for i in range(n):
        mul *= a[i]
        if mul > 1e18:
            mul = -1
            break
print(mul)    

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
0
1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))

mul = 1
if 0 in set(a): mul = 0
else:
    iter = 0
    for i in range(n):
        mul *= a[i]
        if mul > 1e18:
            mul = -1
            break
print(mul)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

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

ans = 1
max = 10**18
if 0 in N:
  print(0)
else:
  for i in range(len(N)):
    ans = ans * N[i]
    if ans > max:
      ans = -1
      break

print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
0
1


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

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

ans = 1
max = 10**18
if 0 in N:
  print(0)
else:
  for i in range(len(N)):
    ans = ans * N[i]
    if ans > max:
      ans = -1
      break
  print(ans)

Problem: p02658
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
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)
        break
else:
    print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
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 > 10**18:
            print(-1)
            break
    else:
        print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
d_pre=input().split()
d=[int(s) for s in d_pre]
d.sort()
d_2=d[::-1]
ans=1
for i in range(N):
    ans*=d_2[i]
    if ans>10**18:
        print(-1)
        break
    elif i==N-1:
        print(ans)

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N=int(input())
d_pre=input().split()
d=[int(s) for s in d_pre]
d.sort()
d_2=d[::-1]
ans=1
if 0 in d_2:
    print(0)
else:
    for i in range(N):
        ans*=d_2[i]
        if ans>10**18:
            print(-1)
            break
        elif i==N-1:
            print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
x=10**18
l=list(map(int,input().split()))
if 0 in l:
  print("0")
s=1
for i in l:
  s=s*i
if s<=x:
  print(s)
else:
  print("-1")

Failing test case input:
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 0 2 7 9 5 0

Expected output:
0


Actual output:
0
0


Fixed submission (verdict: Accepted):
n=int(input())
l=list(map(int,input().split()))
l.sort()
x=10**18
a=1
for i in l:
  a=a*i
  if a>x:
    a=-1
    break
print(a)