ZhenlongDai/ACPR huggingface dataset:
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
res = 1
for i in range(n):
    res*=a[i]
    if res>10**18:
        print(-1)
        break
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())
a = list(map(int,input().split()))
res = 1
if 0 in a:
    print(0)
else:
    for i in range(n):
        res*=a[i]
        if res>10**18:
            print(-1)
            break
    else:
        print(res)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
input()
int_list = list(map(int, input().split()))
max_num = 10**18
ans = 1
for i in int_list:
    ans *= i
    if ans > max_num:
        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):
input()
int_list = list(map(int, input().split()))
max_num = 10**18
ans = 1
for i in int_list:
    ans *= i
    if ans > max_num:
        if min(int_list) == 0:
            print(0)
        else:
            print(-1)
        break
else:
    print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
ans = 1
mark = False
for i in range(n):
    ans *= a[i]
    if ans > 1000000000000000000:
        mark = True
        print(-1)
        break
if 0 in a:
    print(0)
    mark = True
if not mark: 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
0


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
ans = 1
mark = False
if 0 in a:
    print(0)
    mark = True
if mark==False:
    for i in range(n):
        ans *= a[i]
        if ans > 1000000000000000000:
            mark = True
            print(-1)
            break
if not mark: 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 a in A:
    ans *= a
    if ans >= 1e18:
        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 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():
    input()
    A = map(int,input().split())
    if 0 in A:
        print(0)
        return 
    else:
        prod = 1
        for a in A:
            prod*=a
            if prod > 10**18:
                print(-1)
                return
        print(prod)
        return

main()

Failing test case input:
3
111 5000 113287396441

Expected output:
62874505024755000


Actual output:
1


Fixed submission (verdict: Accepted):
input()
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    quit()
else:
    prod = 1
    for a in A:
        prod*=a
        if prod > 10**18:
            print(-1)
            quit()
    print(prod)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
num = int(input())
a_i = list(map(int, input().split()))
ans = 1
for x in a_i:
    ans *= x
    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):
num = int(input())
a_i = list(map(int, input().split()))
ans = 1
if a_i.count(0) > 0: print(0)
else:
    for x in a_i:
        ans *= x
        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()))

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)


Failing test case input:
3
100 5772 2420125321

Expected output:
1396896335281200


Actual output:
0


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

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

Failing test case input:
2
0110011110 0101100010

Expected output:
11122124321111100


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
res = 1
if 0 in a:
    print(0)
else:
    for i in range(n):
        res *= a[i]
        if res > 10**18:
            print(-1)
            quit()
    print(res)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
ans = 1
l = list(map(int,input().split()))
for i in range(n) :
    ans *= l[i]
    if l[i] == 0 :
        print(0)
        exit()
        if ans > 10**18 :
            print('-1')
            exit()
print(ans)

Failing test case input:
3
101 9901 1693005451348

Expected output:
-1


Actual output:
1693007144353451348


Fixed submission (verdict: Accepted):
n = int(input())
ans = 1
l = list(map(int,input().split()))
if l.count(0) != 0 :
    print(0)
    exit()
for i in range(n) :
    ans *= l[i]
    if ans > 10**18 :
        print('-1')
        exit()
print(ans)

Problem: p02658
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N = int(input())
data = [int(i) for i in input().split()]
sum = 1

for j in data:
    sum *= j
    if sum > 10 ** 18:
        print(-1)
    else:
        print(sum)

Failing test case input:
3
110 7647 174147762478

Expected output:
146487873363619260


Actual output:
110
841170
146487873363619260


Fixed submission (verdict: Accepted):
import sys
N = int(input())
data = [int(i) for i in input().split()]
sum = 1

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

for j in data:
    sum *= j
    if sum > 10 ** 18:
        print(-1)
        sys.exit()
        
else:
    print(sum)

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

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
p=int(input())
ans=1
ar=list(map(int,input().split()))
if 0 in ar:ans=0
else:
    for i in range(p):
        if ans<1e18:ans*=ar[i]
        else:ans=-1;break
if ans<1e18:ans=-1
print(ans,end='')

Failing test case input:
3
100 3264 121862688679

Expected output:
39775981584825600


Actual output:
-1

Fixed submission (verdict: Accepted):
p=int(input())
ans=1
ar=list(map(int,input().split()))
if 0 in ar:ans=0
else:
    for i in range(p):
        if ans<1e18:ans*=ar[i]
        else:ans=-1;break
if ans>1e18:ans=-1
print(ans,end='')
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from operator import mul
from functools import reduce

def main ():
  count = int(input())
  c = list(map(int,input().split()))

  if 0 in c:
    print(0)

  a = reduce(mul, c)

  if a > 1000000000000000000:
    print(-1)
  else:
    print(a)

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 0 2 7 9 5 0

Expected output:
0


Actual output:
0
0


Fixed submission (verdict: Accepted):
def main ():
  count = int(input())
  c = list(map(int,input().split()))

  if 0 in c:
    print(0)
    return

  result = 1
  for a in c:
    result *= a
    if result > 1000000000000000000:
      print(-1)
      return

  print(result)

main()

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
print(ans)

Failing test case input:
3
110 7647 174147762478

Expected output:
146487873363619260


Actual output:
-1


Fixed submission (verdict: Accepted):
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 *= a[i]
	if ans > 10**18:
		print(-1)
		exit(0)
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):
  ans = ans * A[i]

if ans >= 1e+18:
  print(-1)
else:
  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()))
A.sort()

ans = 1

for i in range(N):
  if A[i] == 0:
    ans = 0
    break
  ans = ans * A[i]
  if ans > 1e+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()))
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):
import sys
n = int(input())
a = list(map(int, input().split()))
if a.count(0) > 0:
  print(0)
  sys.exit()
ans = 1
for i in a:
  ans *= 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())
list=[int(i) for i in input().split()]
k=1
list.sort()
x=list[0]
while k<n:
  y=x*list[k]
  x=y
  if y<1000000000000000000:
    k=k+1
  else:
    k=n+1
    y=-1
print(y)

Failing test case input:
2
1000000000 1000000000

Expected output:
1000000000000000000

Actual output:
-1


Fixed submission (verdict: Accepted):
n=int(input())
list=[int(i) for i in input().split()]
k=1
list.sort()
x=list[0]
while k<n:
  y=x*list[k]
  x=y
  if y<=1000000000000000000:
    k=k+1
  else:
    k=n+1
    y=-1
print(y)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def multi(L):
    ans = 1
    for l in L:
        if ans <= (10**18):
            ans *= l
            print(ans)
        else:
            ans = -1
            break
    return ans
 
N = int(input())
A_list = list(map(int, input().split()))

print(multi(A_list))

Failing test case input:
2
0001001001 0111111010

Expected output:
111222232121010


Actual output:
1001001
111222232121010
111222232121010


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

ans = 1
if 0 in A_list:
    ans = 0
else:
    for l in A_list:

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

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

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


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

print(product)

Failing test case input:
3
101 9901 1693005451348

Expected output:
-1


Actual output:

Fixed submission (verdict: Accepted):


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)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
A = list(map(int,input().rstrip().split(" ")))
ans=1
for i in range(N):
    ans*=A[i]
if ans>=10**18:
    print(-1)
else:
    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(" ")))
a=sorted(A)

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

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

    over = 10 ** 18

    ans = 1
    for i in An:
        ans *= i
        if ans > over:
            return -1

    return ans

print(Multiplication_2())

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 Multiplication_2():
    N = int(input())
    An = list(map(int,input().split()))

    if 0 in An:
        return 0
    
    over = 10 ** 18

    ans = 1
    
    for i in An:
        ans *= i
        if ans > over:
            return -1
        
    
    return ans

print(Multiplication_2())
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 > 19):
            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
0110011110 0101100010

Expected output:
11122124321111100


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 (PyPy3 (7.3.0), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
ans = 1
for a in A:
    ans *= a

if len(str(ans))>=18:
    print(-1)
else:
    print(ans)

Failing test case input:
2
0110011010 1100000011

Expected output:
121012112210121110


Actual output:
-1


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

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
sum=1
i=list(map(int,input().split()))
for cnt in range(N):
  sum=sum*i[cnt]
  if sum>1000000000000000000:
    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())
sum=1
i=list(map(int,input().split()))
if 0 in i:
  sum=0
else:
	for cnt in range(N):
		sum=sum*i[cnt]
		if sum>1000000000000000000:
			sum=-1
			break
print(sum)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):




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

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

    print(-1 if ans < 10**18 else ans)


if __name__ == "__main__":
    main()


Failing test case input:
2
0110010110 1110000010

Expected output:
122111223200101100


Actual output:
-1


Fixed submission (verdict: Accepted):




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

    A.sort(reverse=True)

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

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


    print(ans)


if __name__ == "__main__":
    main()

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

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

print(c)

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()))
c = 1

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

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

print(c)

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

ans = 1
for val in a:
    ans *= val
    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 = []
a = map(int,input().split())
a = sorted(a)
ans = 1
for val in a:
    ans *= val
    if ans > 10**18:
        print(-1)
        break
else:
    print(ans)

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

M = 10 ** 18
Y = 1

for i in range(N):
    X = A[i]
    X = int(X)
    Y = Y * X
    if Y > M:
        break

if Y > M:
    print(-1)
else:
    print(Y)

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 = input()
N = int(N)
A = input().split()

minA = min(A)
minA = int(minA)
M = 10 ** 18

Y = 0
if minA != 0:
    Y = 1
    for i in range(N):
        X = A[i]
        X = int(X)
        Y = Y * X
        if Y > M:
            break


if Y > M:
    print(-1)
else:
    print(Y)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
As=list(map(int,input().split()))
num=1

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

Failing test case input:
2
0110011010 1101000111

Expected output:
121122134221222110


Actual output:
-1


Fixed submission (verdict: Accepted):

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

if min(As)==0:
    num=0
else:
    num=1
    for i in range(N):
        num *= As[i]
        if num>10**18:
            num=-1
            break

print(num)

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

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

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

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

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

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

i = 0
x = 1
while i < n:
    x = x * a[i]
    i += 1
    if x > 1000000000000000000:
        print(-1)
        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):
n = int(input())

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

i = 0
x = 1
while i < n:
    x = x * a[i]
    i += 1
    if x > 1000000000000000000:
        print(-1)
        exit()

print(x)

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


N = int(input())
L = list(map(int, input().split()))
ans = 1

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

for n in range(N):
 if L[n] == 0: ans = -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())
L = list(map(int, input().split()))
ans = 1

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

for n in range(N):
 if L[n] == 0: ans = 0
print(ans)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
mx=10**18
z=1

a=[int(i) for i in input().split()]
for i in a:
    z*=i
    if z>mx:    z=-1
    if z==0 or z==-1:   break

if z>mx or z<0   : z=-1
print(z)



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())
mx=10**18
z=1

a=[int(i) for i in input().split()]
for i in a:
    if i==0:
        print(0)
        quit()

for i in a:
    z*=i
    if z>mx:    z=-1
    if z==-1:   break

if z>mx or z<0   : z=-1
print(z)

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

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()))
suma = 1
if 0 in a:
    print(0)
    exit()
for i in a:
    suma *= i
    if suma > 10**18:
        print(-1)
        exit()
print(suma)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
lst = map(int, input().split())
mul = 1
thr = 10 ** 18
for ai in lst:
  mul = mul * ai
  if int(mul) > thr:
    print('-1')
    exit()
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):
n = int(input())
lst = list(map(int, input().split()))
mul = 1
thr = 10 ** 18
if 0 in lst:
  print('0')
  exit()
for i in range(n):
  mul = mul * lst[i]
  if mul > thr:
    print('-1')
    exit()
print(mul)

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

s = 1
ten18 = 10**18
over = False

for b in a:
  if not over:
    s *= b
  if s > ten18:
    
    over = True
  if b == 0:
    over = False
    break
  
if over:
  print(-1)
else:
  print(s)


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:
3317625251168256000


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

s = 1
ten18 = 10**18
over = False

for b in a:
  if not over:
    s *= b
  if s > ten18:
    
    over = True
  if b == 0:
    s = 0
    over = False
    break
  
if over:
  print(-1)
else:
  print(s)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = list(map(int,input().split()))
n = list(map(int,input().split()))
ans=1
for i in n:
    ans=ans*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 = list(map(int,input().split()))
n = list(map(int,input().split()))
ans=1
if n.count(0)>=1:
    ans=0
else:
    for i in n:
        ans=ans*i
        if ans>10**18:
            ans=-1
            break
print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = [int(v) for v in input().split()]

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

if __name__ == '__main__':
    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):
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = sorted([int(v) for v in input().split()])

    over = False
    ans = 1
    for a in A:
        ans *= a
        if ans > 1e18:
            over = True
            break
    
    if over:
        print(-1)
    else:
        print(ans)

if __name__ == '__main__':
    main()

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

import sys
n=int(input())
a=list(map(int,input().split()))
ans=1

for i in range(n):
    if a[i]==0:
        print(0)
        sys.exit()
    if ans>10**18:
        print(-1)
        sys.exit()
    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):

import sys
n=int(input())
a=list(map(int,input().split()))
ans=1
 
for i in range(n):
    if a[i]==0:
        print(0)
        sys.exit()

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

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
ans=1
yn=0
for i in range(n):
    ans*=a[i]
    if ans>10**18:
        yn=1
        break
if yn==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())
a=list(map(int,input().split()))
ans=1
yn=0
if a.count(0)!=0:
    print(0)
else:
    for i in range(n):
        ans*=a[i]
        if ans>10**18:
            yn=1
            break
    if yn==1:
        print(-1)
    else:
        print(ans)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input());
l=list(map(int,input().split(" ")))
t=1000000000000000000
at=1;
f=True;
for x in l:
  at=at*x;
  if(at>t):
    f=False
    break
if(f):
  print(at)
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 3 2 7 9 5 0

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n=int(input())
l=list(map(int,input().split(" ")))
l.sort();
t=1000000000000000000
at=1;
f=True;
for x in l:
  at=at*x;
  if(at>t):
    f=False
    break
if(f):
  print(at)
else:
  print(-1)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
ans = 1
flg = True
for i in range(N):
    ans *= A[i]
    if ans > 10**18:
        flg = False
        break
if flg == False:
    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())
A=list(map(int,input().split()))
A.sort(reverse=True)
ans = 1
flg = True
for i in range(N):
    ans *= A[i]
    if A[-1] != 0:
        if ans > 10**18:
            flg = False
            break
    if A[-1] == 0:
        ans = 0
        break
if flg == False:
    print(-1)
else:
    print(ans)

Problem: p02658
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import sys
N = int(input())
L = list(map(int,input().split()))
ans = 1
for i in range(N):
    ans = ans*L[i]
    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())
L = list(map(int,input().split()))
ans = 1

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

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

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



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=1
k=0
if 0 in A:
  print(0)
else:
  for i in range(N):
    a*=A[i]
    if a>10**(18):
      k=1
      break
  if k==1:
    print(-1)
  else:
    print(a)
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

import math
n = int(input())
a = list(map(int, input().split()))
res = 1 
for i in range(n):
  res *= a[i]
if res > 0:
  res = -1 if math.log10(res) > 18 else res
print(res)

Failing test case input:
3
101 9901 999999000001

Expected output:
-1

Actual output:
1000000000000000001


Fixed submission (verdict: Accepted):

import math
n = int(input())
a = list(map(int, input().split()))
res = 1 
if 0 in a:
  res = 0
else:
  for num in a:
    res *= num
    if res > 10**18:
      res = -1
      break
print(res)

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

sums=1
for i in A:
    sums=sums*i
    if sums>1000000000000000000:
        sums=-1
        break
    
if sums==-1:
    print(-1)
else:
    print(sums)

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

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

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
A = list(map(int,input().split()))
A.sort()
ans = A[0]
INF = 1000000000000000000
for i in range(1,n):
    l,r = len(str(ans)),len(str(A[i]))
    if l+r > 18:
        ans = -1
        break
    else:
        ans = ans * A[i]
print(ans)


Failing test case input:
2
0110010100 1110000010

Expected output:
122111212100101000


Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
A = list(map(int,input().split()))
A.sort()
ans = A[0]
INF = 1000000000000000000
for i in range(1,n):
    l,r = len(str(ans)),len(str(A[i]))
    if l+r > 21:
        ans = -1
        break
    else:
        ans = ans * A[i]
        if ans > INF:
            ans = -1
            break
print(ans)

Problem: p02658
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

bb = 10**18

n = ii()
a = li()
ans = 1

for i in range(len(a)):
    ans *= a[i]
    if ans > bb:
        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):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

bb = 10**18

def main():
    n = ii()
    a = li()
    ans = 1

    if 0 in a:
        print(0)
        return

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

if __name__ == "__main__":
    main()
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

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

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

print(mult)

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()))
mult = 1

if 0 in A:
    print(0)
    sys.exit()
else:
    for i in A:
        mult *= i
        if mult > 10**18:
            print('-1')
            sys.exit()

print(mult)

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

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

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

ans = 1
for aa in a:
  ans *= aa
  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()))

ans = 1
for aa in a:
  if aa == 0:
    ans = 0
    break

for aa in a:
  ans *= aa
  if(ans > 1000000000000000000):
    ans = -1
    break

print(ans)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
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()
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):
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))

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

if 0 in a:
  print(0)
else:
  for i in a:
    u = i*u

  if len(str(u)) < 18:
    print(u)
  else:
    print(-1)
    

  
  

Failing test case input:
2
0110011110 1100000010

Expected output:
121012222100111100


Actual output:
-1


Fixed submission (verdict: Accepted):
import sys
def main():
  u = 1  
  n = int(input())
  a = list(map(int,(input().split())))
  
  if 0 in a:
    print(0)
    sys.exit()
	
  for i in a:
    u *=i
    if u > 1000000000000000000:
      print(-1)
      sys.exit()

  print(u)


main()

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

N = int(input())
Alist = [int(x) for x in input().split()]

result = 1
for A in Alist:
  result *= A
  if result > 1000000000000000000:
    break

if result > 1000000000000000000:
  print("-1")
else:
  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):
import math

N = int(input())
Alist = [int(x) for x in input().split()]

result = 1
for A in Alist:
  result *= A
  if result > 1000000000000000000:
    if 0 in Alist:
      result = 0
    break

if result > 1000000000000000000:
  print("-1")
else:
  print(result)

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);exit()
for i in range(n):
    ans*=A[i]
    if ans>10**18:
        print(-1);exit()
print(-1)


Failing test case input:
2
0110011011 0101100010

Expected output:
11122114312210110


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 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())
A = [int(i) for i in input().split()]

A.sort()
if 0 in A:
    multiple = 0
else:
    multiple = 1
    for i in range(N):
        multiple = multiple * A[i]
        if (multiple > 18 ** 10):
            multiple = -1
            break
    print(multiple)

Failing test case input:
3
111 2947 2420125321

Expected output:
791664134629557


Actual output:
-1


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

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

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

mul = 1
for i in l:
    mul *= i
    if(mul>=10**18):break
    
if(mul>10**18):print(-1)
else: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):
n = int(input())
l = list(map(int,input().split()))

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

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
ans = 1
zf = 0
for i in range(n):
    if a[i] == 0:
        ans = 0
    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()))
ans = 1
for i in range(n):
    if a[i] == 0:
        ans = 0
    if ans != -1:
        ans = ans * a[i]
    if ans > 1000000000000000000:
        ans = -1
print(ans)

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

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

if 1000000000000000000 < As:
    print(As)


Failing test case input:
2
0110011010 1101000110

Expected output:
121122134111211100


Actual output:

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

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

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

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
p = 1
large = 0
for x in a:
  p *= x
  if p > 10**18:
    large = 1
    break
if large:
  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):
def f(n, a):
  if 0 in a:
    return 0
  p = 1
  for x in a:
    p *= x
    if p > 10**18:
      return -1
  return p
 
n = int(input())
a = list(map(int, input().split()))
print(f(n, a))
Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
i=0
division=1
for i in range(0,N):
    division=division*A[i]
    i+=1
    if division>10**18:
        print(-1)
        break
if division<=10**18:
    print(division)

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()))
i=0
division=1
if 0 in A:
    print(0)
else:
    for i in range(0,N):
        division=division*A[i]
        i+=1
        if division>10**18:
            print("-1")
            break
    if 0<division<=10**18:
        print(division)

Problem: p02658
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def solve():
    n = int(input())
    lst = list(map(int,input().split()))
    if 0 in lst:
        print(0)
        return
    mul = 1
    for ele in lst:
        mul = mul * ele
        if mul > 1e18:
            print(-1)
            return
    
    print(mul)

Failing test case input:
2
0110011101 0111110010

Expected output:
12223334532221010


Actual output:

Fixed submission (verdict: Accepted):
def solve():
    n = int(input())
    lst = list(map(int,input().split()))
    if 0 in lst:
        print(0)
        return
    mul = 1
    for ele in lst:
        mul = mul * ele
        if mul > 1e18:
            print(-1)
            return
    
    print(mul)
    
solve()

Problem: p02658
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
ls = list(map(int,input().split(' ')))
pro=1
f=0
for i in ls:
    pro = pro*i
    if(pro > 1000000000000000000):
        print(-1)
        f=1
        break
if(f==0 and pro<=1000000000000000000):
    print(pro)

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())
ls = list(map(int,input().split(' ')))
pro=1
f=0
zero=0
for i in ls:
    if(i==0):
        zero=1
if(zero==1):
    print(0)
else:
    for i in ls:
        pro = pro*i
        if(pro > 1000000000000000000):
            print(-1)
            f=1
            break
    if(f==0 and pro<=1000000000000000000):
        print(pro)

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

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


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):
import sys


N = input()


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



ans = 1
for i in A:
    
    ans *= i
    

if ans >= 10**18:
    print("-1")
    sys.exit()
else:
    print(ans)
    sys.exit()

Failing test case input:
2
1000000000 1000000000

Expected output:
1000000000000000000

Actual output:
-1


Fixed submission (verdict: Accepted):
import sys


N = input()


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



ans = 1
if 0 in A:
    print(0)
    sys.exit()


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

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):
    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
A = sorted(A)
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())

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

result = 0

for i in range(n):
  if i == 0:
    result = aList[i]
    continue
  result = result * aList[i]

enemy = 10 ** 18

if result > enemy:
  print(result)
else:
  print("-1")

Failing test case input:
3
100 4275 174147762478

Expected output:
74448168459345000


Actual output:
-1


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

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



n = int(input())
a = input().split()
inf = 1000000000000000000
ans = 1
for x in a:
    x = int(x)
    ans = ans*x
    if ans > inf:
        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 = input().split()
inf = 1000000000000000000
ans = 1
f = 1
for x in a:
    x = int(x)
    if x == 0:
        f = 0
    if ans == -1:
        continue
    ans = ans*x
    if ans > inf:
        ans = -1
print(ans*f)

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

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

A = sorted(A)[::-1]
val = 1

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


Failing test case input:
2
0011011001 0111110110

Expected output:
1223433532320110


Actual output:
1


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