TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
#d
import math
from collections import deque


n = int(input())
a = []
ans = 0
d = 2
for i in range(2,int(math.sqrt(n)+1)):
    
    if n%i==0:
        a.append(i)
        n/=i
ans = len(a)
if ans == 0 and n >1:
    ans = 1
print(ans)

#b
n = int(input())
a = list(map(int,input().split()))
ans = 1
e = 0
m = 10**18
a.sort()
for i in range(n):
    ans *= a[i]
    if a[i] == 0:
        ans = 0
        e = 0
        break
    if ans > m:
        e = 1
        break


if e == 1:
    print(-1)
else:
    print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split(' ')))
if a.index(0) >= 0:
	print(0)
else:
	lim = int(1e18)
	mult = 1
	for v in a:
		if mult > lim:
			break
		else:
			mult *= v
	if mult > lim:
		print("-1")
	else:
		print(mult)

n = int(input())
a = list(map(int, input().split(' ')))
if a.count(0) > 0:
	print("0")
else:
	lim = int(1e18)
	mult = 1
	for v in a:
		if mult > lim:
			break
		else:
			mult *= v
	if mult > lim:
		print("-1")
	else:
		print(mult)

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
for i in a:
    ans = ans * i
if ans >= 10**18:
    print(-1)
elif ans == 0:
     print(0)
else:
    print(ans)

n = int(input())
a = [int(x) for x in input().split()]
ans = 1
for i in a:
    ans = ans * i
    if ans == 0:
        print(0)
        break
    elif ans >= 10**18:
        if 0 in a[i:-1]:
            print(0)
            break
        else:
            print(-1)
            break
if ans != 0 and ans <= 10**18:
    print(ans)

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import math
import numpy as np

N = int(input())
A = list(map(int,input().split()))
ans = 1
A_log = A
try:
    A_log = list(map(math.log10,A))
except ValueError:
    print(0)
else:
    print(A_log, sum(A_log))
    if sum(A_log) > 18:
        print(-1)
    else:
        for i in A:
            ans *= i
        if ans <= 1e18:
            print(ans)
        else:
            print(-1)

import math
import numpy as np

N = int(input())
A = list(map(int,input().split()))
ans = 1
A_log = A
try:
    A_log = list(map(math.log10,A))
except ValueError:
    print(0)
    exit()

if sum(A_log) >= 18:
    print(-1)
else:
    for i in A:
        ans *= i
    print(ans)

import math
import numpy as np

N = int(input())
A = list(map(int,input().split()))
ans = 1
A_log = list(map(math.log10,A))

if sum(A_log) >= 18:
    print(-1)
else:
    for i in A:
        ans *= i
    print(ans)

import math
import numpy as np

N = int(input())
A = list(map(int,input().split()))
ans = 1
A_log = A
try:
    A_log = list(map(math.log10,A))
except ValueError:
    print(0)
else:
    if sum(A_log) > 18:
        print(-1)
    else:
        for i in A:
            ans *= i
        if ans <= 1e18:
            print(ans)
        else:
            print(-1)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = int(input())
L = list(map(int,input().split()))
C = 1
for i in range(N):
    if L[i] == 0:
        C = 0
    else:
        while C <= 10**18:
            C *= L[i]
if C <= 10**18:
    print(C)
else:
    print(-1)
    

N = int(input())
L = list(map(int,input().split()))
C = 1
for i in range(N):
    if L[i] == 0:
        C = 0
while C <= 10**18:
    for i in range(N):
        C *= L[i]
if C <= 10**18:
    print(C)
else:
    print(-1)
    

N = int(input())
L = list(map(int,input().split()))
C = 1
for i in range(N):
    if L[i] == 0:
        C = 0
while C <= 10**18:
    C *= L[i]
if C <= 10**18:
    print(C)
else:
    print(-1)

N = int(input())
li = list(map(int,input()))
C = 1
for i in range(N):
  C *= li[i]
if C <= 10 ** 18:
  print(C)
else: print(-1)

N = int(input())
li = []
C = 1
while C <= 10**18:
	for i in range(N):
		li.insert(i,int(input())
    	C *= li[i]
if C <= 10**18:
	print(C)
else: print(-1)

    
	
            
  

N = int(input())
L = list(map(int,input().split()))
L.sort()
c = 1
for i in range(N):
    c *= L[i]
    if c > 10**18:
        c = -1
        break
print(c)
    

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import math
a,b=map(str,input().split())
a=int(a)
b=float(b)

#x=int(a*b)
x=math.floor(a*b)
print(x)

import numpy as np
n=int(input())

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

x=np.prod(a)

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

import numpy as np
n=int(input())
a=list(map(int,input().split()))



x=np.prod(a)

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

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

x=a[0]

if 0 not in a:
    for i in range (1,n):
        x=x*a[i]
        if x > pow(10,18):
            print(-1)
            exit()           
    print(x)         
else:
    print(0)


Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
a = int(input())
b = [int(i) for i in input().split()]

ans =1
for I in b:
  ans = ans*I
  if ans > 10**18:
    print('-1')
    break
  else:
    if I == b[-1]:
        print(ans)


a = int(input())
b = input().split()
c =[]
for i in range(a):
    d = int(b[i])
    c.append(d)
from operator import mul
from functools import reduce
P = reduce(mul, c)
if P>=10**18:
    print(-1)
else:
    print(P)
print(P)

a = int(input())
b = input().split()
c =[]
for i in range(a):
    d = int(b[i])
    c.append(d)
from operator import mul
from functools import reduce
P = reduce(mul, c)
if P>=10**18:
    print(-1)
else:
    print(P)
print(int(P))

a = int(input())
b = input().split()
c =[]
for i in range(a):
    d = int(b[i])
    c.append(d)
from operator import mul
from functools import reduce
P = reduce(mul, c)
if P>10**18:
    print(-1)
else:
    print(P)
print(P)

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

ans =1
b = sorted(b)
for I in b:
  ans = ans*I
  if b[0] == 0:
      ans = 0
      print(0)
      break
  elif ans > 10**18:
    print('-1')
    ans = -1
    break
if ans >=1:
    print(ans)
      
    





Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
k=int(input())
mal=1      
n=list(map(int,input().split()))
      
          
for i in range(0,len(n)):
            mal=mal*n[i]
            if(mal>=10**18):
                print(-1)
                break
print(mal)


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

        
           

           


k=int(input()
mal=1
a=[]      
for i in range(1,k+1):
      n=int(input()
      a.append(n)      
for i in range(0,len(a)-1):
            mal=mal*a[i]
if(mal<=10**18):
            print(mal)
else:
     print(-1)       

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

        
           


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

        
           


k=int(input())
mal=1      
n=list(map(int,input().split()))
      
          
for i in range(0,len(n)):
    mal=mal*n[i]
    if(mal>10**18and n[i]!=0):
            mal=-1
            break
     if(n[i]==0):
        mal=0
        break
print(mal)

        
           


k=int(input())
mal=1      
n=list(map(int,input().split()))
      
          
for i in range(0,len(n)):
    mal=mal*n[i]
    if(mal>10**18and n[i]!=0):
            mal=-1
            break
        if(n[i]==0):
        mal=0
        break
print(mal)

        
           


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


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
ans = 1
s = input()
a = [int(x.strip()) for x in s.split(' ')]
if 0 in a:
  print(0)
  return
for i in range(n):
  ans *= a[i]
  if ans>1000000000000000000:
    print(-1)
    return
print ans

import sys
n = int(input())
ans = 1
s = input()
a = [int(x.strip()) for x in s.split(' ')]
if 0 in a:
  print(0)
  sys.exit()
for i in range(n):
  ans *= a[i]
  if ans>1000000000000000000:
    print(-1)
    sys.exit()
print(ans)


Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import sys
n = int(input())
l = list(map(int,input().split()))
count = 1
for i in l:
    count= count*i
if count >= 10**18:
        print("-1")
        sys.exit()
print(count)

import sys
n = int(input())
l = list(map(int,input().split()))
l.sort()
count = 1
for i in l:
    count= count*i
    if count == 0:
        print("0")
        sys.exit()
    elif count > 10**18:
        print("-1")
        sys.exit()
if count > 10**18:
    print("-1")
    sys.exit()
print(count)

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
l = list(map(int, input().split()))

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

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

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

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int ,input().split()))
ans = 1
for i in a:
  ans *= i
  if ans > 10**18:
    print(-1)
    break


n = int(input())
a = list(map(int ,input().split()))
ans = 1
for i in a:
  ans *= i
  if ans >= 10**8:
    print(-1)
    break

n = int(input())
a = list(map(int ,input().split()))
ans = 1
for i in range(n):
  ans *= a[i]
  if (10**18+1)//ans <= a[i]:
    print(-1)
    exit()
print(ans)

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)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
num_list = list(map(int, input().split()))

num = 1

for i in num_list:
  num *= i

if num > 10**18:
  num = -1

print(num)

N = int(input())

num_list = list(map(int, input().split()))
     
num = 1
     
for i in num_list:
    num *= i
    
    if num == 0:
        break

if num > 1000000000000000000:
    num = -1
    break

print(num)

def product(list):
    num = 1

    if any([i == 0 for i in num_list]):
        print(0)
        return
     
    for i in num_list:
        num *= i
        if num > 1000000000000000000:
            num = -1
            break

    print(num)


N = int(input())

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

product(num_list)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
from functools import reduce
from operator import mul

n = int(input())

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

a = sorted(a)
ans = 1
for x in a:
    ans = ans * x
    if (ans > 10*18):
        ans = -1
        break

print(ans)


import functools
import operator

n = int(input())

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

ans = functools.reduce(operator.mul, a)
print(ans)

print(-1) if ans > 1e18 else print(ans)


from functools import reduce
from operator import mul

n = int(input())

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

a = sorted(a)
ans = 1
for x in a:
    ans = ans * x
    if (ans > 1e18):
        ans = -1
        break

print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import sys

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

total = 1

for i in range(n):
    total *= a[i]
    if len(str(total)) >= 18:
        print("-1")
        sys.exit()

print(total)

import sys

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

total = 1

for i in range(n):
    total *= a[i]

if total > 100000000000000000:
    print("-1")
else:
    print(total)

import sys

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

total = 1
a_sort = sorted(a)
if a_sort[0] == 0:
    print("0")
    sys.exit()

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

print(total)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
# cook your dish here
n=int(input())
a=[int(x) for x in input().split()]
ans=1 
for i in range(n):
    ans*=a[i]
    if(ans>=1e18):
        ans=-1 
        break
print(ans)

# cook your dish here
n=int(input())
a=[int(x) for x in input().split()]
ans=1  
mod=int(1e18)
for i in range(n):
    if a[i]==0:
        ans=0 
        break 
for i in range(n):
    ans*=a[i]
    if ans>mod:
        ans=-1 
        break 
    if ans==0:
        break
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))

Answer = 1
for i in range(N):
    Answer *= A[i]

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



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

B = set(A)
Answer = 1
if 0 in B:
    print(0)
    exit()
for i in range(N):
    Answer *= A[i]
    if Answer > 1000000000000000000:
        print(-1)
        exit()
print(Answer)


Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import sys

n=int(input())

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

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

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


if ans <=pow(10,18):
  print(ans)

import sys

n=int(input())

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

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

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


if ans <=pow(10,18):
  print(ans)

import sys

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

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

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

if ans<=pow(10,18):
  print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n, *a = map(int, read().split())
if 0 in a:
    print('0')
    exit()
ans = 1
for x in a:
    ans = ans * x
    if ans > 10 ** 18:
        print('-1')
        exit()
print(ans)

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = int(input())
A = list(map(int,input().split()))

x = 1
for i in range(len(A)):
	x = x * A[i]

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

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

flag = 0
for i in range(len(A)):
	if A[i]==0:
		flag =1

if flag == 1 :
	print("0")
else:
	x = 1
	for i in range(len(A)):
		x = x * A[i]
		if x > 10 ** 18:
			break
          
    
	if x > 10 ** 18:
		print("-1")
	else:
		print(x)

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
A, B = input().split()
A = int(A)
B = int(B)
print(A*B)

listed = input().split()
mul = 1
for num in listed:
  num = int(num)
  if num == 0:
    mul = 0
    break
  if mul != -1:
    mul *= num
    if mul > 10**18:
      mul = -1
print(mul)

listed = input().split()
mul = 1
for num in listed:
  num = int(num)
  if num == 0:
    mul = 0
    break
  if mul != -1:
    mul *= num
    if mul > 10**18:
      mul = -1
print(mul)

listed = input().split()
mul = 1
maxi = 10**18
for num in listed:
  num = int(num)
  mul *=num
  if num == 0:
    print(mul)
  if num > maxi**18:
    print(mul)
print(mul)

listed = input().split()
mul = 1
maxi = 10**18
for num in listed:
  num = int(num)
  mul *= num
  if num == 0:
    mul = 0
    break
  if num > maxi**18:
    mul = -1
    break
print(mul)

listed = input().split()
mul = 1
maxi = 10**18
for num in listed:
  num = int(num)
  mul *= num
  if num == 0:
    print(0)
  if num > maxi**18:
    mul = -1
    break
print(mul)

listed = input().split()
mul = 1
for num in listed:
  num = int(num)
  if num == 0:
    mul = 0
    break
  if mul != -1:
    mul *= num
    if mul > 10**18:
      mul = -1
print(int(mul))

listed = input().split()
mul = 1
maxi = 10**18
for num in listed:
  mul*=num
  if num == 0:
    print(mul)
  if num > maxi**18:
    print(mul)
print(mul)

listed = input().split()
mul = 1
maxi = 10**18
for num in listed:
  num = int(num)
  mul *= num
  if num == 0:
    print(mul)
  if num > maxi**18:
    print(-1)
print(mul)

listed = input().split()
mul = 1
for num in listed:
  num = int(num)
  if num == 0:
    mul = 0
    break
  if mul != -1:
    mul *= num
    if mul > 10**18:
      mul = -1
print(mul)

N = input()
listed = input().split()
mul = 1
for num in listed:
  num = int(num)
  if num == 0:
    mul = 0
    break
  if mul != -1:
    mul *= num
    if mul > 10**18:
      mul = -1
print(mul)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n=input()
s=list(map(int,(input().split(" "))))
ans=1
for i in s:
    ans*=i
if ans>1e18:
    print(-1)
else:
    print(s)

n,*l=map(int,open(0).read().split())
a=1
for i in sorted(l):
  a*=i
  if a>10**18: a=-1; break
print(a)


Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import numpy
n = int(input())
ls = [int(input()) for _ in range(n)]
if 0 in ls:
    print(0)
res = numpy.prod(ls)
elif res > 10**18:
    print(-1)
else:
    print(numpy.prod(ls))


import numpy
n = int(input())
ls = list(map(int, input().split()))
if 0 in ls:
    print(0)
res = numpy.prod(ls)
elif res > 10**18:
    print(-1)
else:
    print(numpy.prod(ls))


n = int(input())
ls = list(map(int, input().split()))
res = 1
if 0 in ls:
    print(0)
    quit()
for x in ls:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))

ans = 1
for i in range(n):
    ans *= a[i]

print(ans if ans < 1000000000000000000 else -1)


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 > 1000000000000000000:
        print(-1)
        exit()

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
res = 1
for i in a:
    res *= 1
if res > 10**18:
    print(-1)
else:
    print(res)

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)

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)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
def main():
    n = int(input())
    in_list = list(map(int,input().split()))
    result = 1
    if in_list.count(0)>0:
        print(0)
        return

    for i in range(n):
        result = result*in_list[i]
        if result >= 10**18:
            print(-1)
            return
    print(result)

main()

import numpy as np
n = int(input())
in_list = list(map(int,input().split()))

p = np.prod(in_list)
if p<10**18:
    print(p)
else:
    print(-1)


def main():
    n = int(input())
    in_list = list(map(int,input().split()))
    result = 1
    if in_list.count(0)>0:
        print(0)
        return

    for i in range(n):
        result = result*in_list[i]
        if result >= 10**18:
            print(-1)
    print(result)

main()

def main():
    n = int(input())
    in_list = list(map(int,input().split()))
    result = 1
    if in_list.count(0)>0:
        print(0)
        return

    for i in range(n):
        result = result*in_list[i]
        if result > 10**18:
            print(-1)
            return
    print(result)

main()

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
a = int(input())
b = input().split()

for i in range(a):
    if b[i] == 0:
        print(0)
        return

c = 1
for i in range(a):
    c = c*int(b[i])
    if c > 1000000000000000000:
        break

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

a = int(input())
b = input().split()
c = 1
for i in range(a):
    if int(b[i]) == 0:
        c = 0

if c == 1:
    for i in range(a):
        c = c*int(b[i])
        if c > 1000000000000000000:
            break

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

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
from math import log10
N = int(input())
A = map(int, input().split())

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

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

from math import log10
N = int(input())
A = list(map(int, input().split()))

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

s = 1
for a in A:

    s *= a
    if s > 10 ** 18:
        print('-1')
        exit()
print(s)

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = sorted(list(map(int, input().split())))
s = 1
if o in a:
    print(0)
    exit()
for i in range(n):
  s *= a[i]
  if s>10**18:
      print(-1)
      exit()
print(s)

n = int(input())
a = list(map(int, input().split()))
for i in range(n-1):
  a[i+1]*=a[i]
  print(a[i+1])
print(a[i+1] if a[i+1]<=10**18 else -1)


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

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
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)

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)

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n=int(input())
l=list(map(int,input().split()))
if min(l)=0:
    print(0)
else:    
    s=1
    for x in l:
        s *= x
    
    if s>1000000000000000000:
        print(-1)
    else:
        print(s)

n=int(input())
l=list(map(int,input().split()))
if min(l)== 0:
    print(0)
else:    
    s=1
    for x in l:
        s *= x
        if s>1000000000000000000:
            s=-1
            break
            
     print(s)

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = 1
for i in range(0,n):
    a*=int(input())
    if(a>10**18):
        a=-1
if(a<0):
    a=-1
print(a)

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
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)
     

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

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

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

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


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
x = input()
y = [int(a) for a in input().split(" ")]
if 0 in y:
  print(0)
  exit(0)
res = 1
for i in y:
  res *= i
  print(res)
  if res > int(1e+18):
    print(-1)
    exit(0)
print(res)

x = input()
y = [int(a) for a in input().split(" ")]
if 0 in y:
  print(0)
  exit(0)
res = 1
for i in y:
  res *= i
  if res > int(1e+18):
    print(-1)
    exit(0)
print(res)

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    ll result = 1;
    for(int i=0;i<N;i++) {
        cin >> A.at(i);
    }

    if(find(A.begin(),A.end(),0) != A.end()) {
        cout << "0" << endl;
        exit(0);
    }
    for(int i=0;i<N;i++) {
        result = result * A.at(i);
        if (result > (ll)pow(10,18)) {
            cout << "-1" << endl;
            exit(0);
        }
    }
    cout << result << endl;
}

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

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

print(result)

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
#include <bits/stdc++.h>
using namespace std;
 
 
long long LIMIT = 1000000000000000000;
 
int main(){
  int n;
  cin >> n;
  vector<long long> vec(n);
  
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  
  if ( std::find(vec.begin(), vec.end(), 0) != vec.end() ) {
    cout << 0 << endl;
    return 0;
  }
  
  long long products = 1;
  for (int i = 0; i < n; i++) {
    products *= vec.at(i);
	if(products > LIMIT) {
      cout << -1 << endl;
      return 0;
    }
  }
  
  cout << products << endl;
  
  return 0;


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

def main():
  if(0 in A):
    print(0)
    return

  products = 1
  for a in A:
    products *= a
    if(products > 1000000000000000000):
      print(-1)
      return
  print(products)
  return

main()


Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
arr = list(map(int,input().split()))
arr.sort(reverse=True)
ans = 1
limit = 10 * 18

if arr[-1] == 0:
  ans = 0
else:
  for i in arr:
    ans *= arr[i]
    if ans > limit:
      ans = -1
      break
print(ans)

n = int(input())
arr = list(map(int,input().split()))
arr.sort(reverse=True)
ans = 1
limit = 10**18

if arr[-1] == 0:
  ans = 0
else:
  for i in arr:
    ans *= i
    if ans > limit:
      ans = -1
      break
print(ans)


Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
numlist = list(map(int, input().split()))
if 0 in numlist:
    print(0)
else:
    ans = 1
    for i in numlist:
        ans *= i
        if ans > 10**18:
            print(-1)
            exit()
	print(ans)

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

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

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

import sys
n = int(input())
numlist = list(map(int, input().split()))
if 0 in numlist:
    print(0)
else:
    ans = 1
    for i in numlist:
        ans *= i
        if ans > 10**18:
            print("-1")
            sys.exit()
    print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n= int(input())
A = list(map(int, input().split()))

kakeru = A[0]
for i in range(n):
    
    temp = A[i]
    kakeru = kakeru*temp
ans = int(kakeru/A[0])
if ans > 10**18-1:
    print("-1")
else:
    print(ans)

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

zero = 0
if zero in A:
    print("0")
else:
    for i in range(n):
    
        temp = A[i]
        if i ==0:
            kakeru = temp
        else:
            kakeru = kakeru*temp
        if kakeru >10**18:
            kakeru = -1
            break
    
    print(kakeru)


Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

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

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

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
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)


n = int(input())
a = list(map(int,input().split()))
ans = 1
mark = False
for i in range(n):
    if i==0:
        mark = True
        print(0)
        break
    ans *= a[i]
    if ans > 1000000000000000000:
        mark = True
        print(-1)
        break
if not mark: print(ans)


n = int(input())
a = list(map(int,input().split()))
ans = 1
mark = False
for i in range(n):
    if i==0:
        ans = 0
        mark = True
        break
    ans *= a[i]
    if ans > 1000000000000000000:
        print(-1)
        mark = True
        break
if not mark: print(ans)


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)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N=int(input())
A=map(int,input().split())
ans = 1
if 0 in A:
  print(0)
  exit()
else:
  for i in range(N):
    ans *= A[i]
    if ans > 10**18:
      print(-1)
      exit()
  print(ans)


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

N=int(input())
A=list(map(int,input().split()))
ans = 1
if 0 in A:
	print(0)
	return
for a in A:
   	ans *= a
   	if ans > 1000000000000000000:
      	print(-1)
      	return
print(ans)


N=int(input())
A=list(map(int,input().split()))
ans = 1
if 0 in A:
	print(0)
	return
else:
	for a in A:
    	ans *= a
    	if ans > 1000000000000000000:
      	print(-1)
      	return
	print(ans)


def main():
  N=int(input())
  A=list(map(int,input().split()))
  ans = 1
  if 0 in A:
      print(0)
      return
  for a in A:
      ans *= a
      if ans > 1000000000000000000:
          print(-1)
          return
  print(ans)

  main()

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


N=int(input())
A=list(map(int,input().split()))
ans = 1
if 0 in A:
  print(0)
  return
else:
  for i in range(N):
    ans *= A[i]
    if ans > 10**18:
      print(-1)
      return
  print(ans)


N=int(input())
A=list(map(int,input().split()))
ans = 1
if 0 in A:
  print(0)
  return
else:
  for a in A:
    ans *= a
    if ans > 1000000000000000000:
      print(-1)
      return
  print(ans)


def main ():
	N = int(input())
	A = list(map(int,input(). split ()))
	if 0 in A:
		print(0)
		return
	prod = 1
	for a in A:
		prod *= a
		if prod > 1000000000000000000:
			print(-1)
			return
	print(prod)
main ()

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import functools

n = int(input())
xs = map(int, input().split())

def foldSum(acc, x):
    return acc*x

if 0 in xs:
    print(0)
elif len([x for x in xs if x > 1]) >= 60:
    print(-1)
else:
    res = functools.reduce(foldSum, xs, 1)

    if res > 1e18:
        print(-1)
    else:
        print(res)



import functools

n = int(input())
xs = input().split()

def foldSum(acc, x):
    return acc*int(x)

if 0 in res:
    print(0)
else:
    res = functools.reduce(foldSum, xs, 1)

    if res > 1e18:
        print(-1)
    else:
        print(res)



import functools

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

def foldMulti(acc, x):
    return acc*x

if 0 in xs:
    print(0)
elif len([x for x in xs if x > 1]) >= 60:
    print(-1)
else:
    res = functools.reduce(foldMulti, xs, 1)

    if res > 1e18:
        print(-1)
    else:
        print(res)



Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
import functools
import operator
n = int(input())
number = map(int,input().split())
X = functools.partial(functools.reduce, operator.mul)
s=X(number)
if s>=pow(10,18):
    print(-1)
else:
    print(s)

import functools
import operator

n = int(input())
number = map(int,input().split())
X = functools.partial(functools.reduce, operator.mul)

s=X(number)
if s>=pow(10,18):
    print(-1)
else:
    print(s)

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

    if 0 in A:
        print(0)
        return

    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
main()

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

    if 0 in A:
        print(0)
        return

    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
main()

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
count = 1
for i in a:
  count *= i
if count > 100000000000000000:
  print(-1)
else:
  print(count)


n = int(input())
a = list(map(int, input().split()))
count = 1
l = 0
if (0 in a) == True:
  print(0)
else:
  for i in a:
    count *= i
    if count > 1000000000000000000:
      l = -1
      break
  if l == 0:
    print(count)
  else:
    print(l)

Verdicts: Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n=int(input())
a = list(map(int,input().split()))
mul = 1
large = 0
for x in a:
  mul *= x
  if mul >= 10**18:
    large = 1
    break
if large:
  print(-1)
else:
  print(mul)

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(int, input().split())
print(f(n, a))

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

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))

def f(x):
  x.sort()
  if x[0]==0:
    return 0

  x.sort(reversed=True)
  
  ans=1
  
  for i in a:
    ans=ans*i

    if ans>10**18:
      return -1
      
    if n==0:
      return ans
  


print(f(a))

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

def f(x):
  x.sort()
  if x[0]==0:
    return 0

  x.sort(reverse=True)
  
  ans=1
  
  for i in a:
    ans=ans*i

    if ans>10**18:
      return -1
      
  return ans
  


print(f(a))

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
num = int(input())

str2 = input().split(" ")
nums = [int(s) for s in str2]

isOdd = num%2 == 1
available = range(len(nums))

while available > 1:
    for i in range(available / 2)
    nums[i] = nums[2 * i] * nums[2 * i + 1]
    if(ans > 1000000000000000000):
        print(-1)
        quit()
    if isOdd:
        nums[available / 2 + 1] = nums[-1]
        available //= 2
    if isOdd:
        available += 1
    if a == 0:
        print(0)
        quit()
print(ans)
quit()

num = int(input())
str2 = input().split(" ")
nums = [int(s) for s in str2]
nums.sort()

for i in range(len(nums)):
    ans = ans * nums[i]
    if(ans > 1000000000000000000):
        print(-1)
        quit()
print(ans)
quit()

while available > 1:
    for i in range(available / 2):
    nums[i] = nums[2 * i] * nums[2 * i + 1]
    if(ans > 1000000000000000000):
        print(-1)
        quit()
    if isOdd:
        nums[available / 2 + 1] = nums[-1]
        available //= 2
    if isOdd:
        available += 1
    if a == 0:
        print(0)
        quit()
print(ans)
quit()

num = int(input())
str2 = input().split(" ")
nums = [int(s) for s in str2]
nums.sort()

ans = 1

for i in range(len(nums)):
    ans = ans * nums[i]
    if(ans > 1000000000000000000):
        print(-1)
        quit()
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
if a.count(0)>0:
  print(0)
else:
  ans=a[0]
  flag=0
  for i in range(1,N):
    ans*=a[i]
    if ans>10**18:
      flag+=1
      print(-1)
      break
      

import numpy as np
N=int(input())
p=[int(input()) for i in range(N)]
x=np.prod(p)
if x<10**18:
  print(x)
else:
  print(-1)

import numpy as np
N = int(input())
p = list(map(int, input().split()))
if np.prod(p) < 10**18:
    print(np.prod(p))
else:
    print("'-1'")

import numpy as np
N=int(input())
p=list(map(int,input().split()))
x=np.prod(p,axis=1)
if x<10**18:
  print(x)
else:
  print(-1)

import numpy as np
N=int(input())
p=list(map(int,input().split()))
x=np.prod(p)
if x<10**18:
  print(x)
else:
  print(-1)

import numpy as np
N = int(input())
p = list(map(int, input().split()))
if np.prod(p) < 10**18:
    print(np.prod(p))
else:
    print("-1")

import numpy as np
N = int(input())
p = list(map(int, input().split()))
if np.prod(p) < 10**18:
    print(np.prod(p))
else:
    print(-1)


N=int(input())
p=list(map(int,input().split()))
x=0
for i in range(len(p)):
  x=x*i
if x<10**18:
  print(x)
else:
  print(-1)
  

import numpy as np
N=map(int,input().split())
p=list(map(int,input().split()))
x=np.prod(p)
if x<10**18:
  print(x)
else:
  print(-1)

import numpy as np
N=map(int,input().split())
p=list(map,input().split())
x=np.prod(p)
if x<10**18:
  print(x)
else:
  print(-1)

import numpy as np
N=int(input())
lista=[]
p=input().split()
for i in range(N):
  print(p[i])
  lista.append(p[i])
if np.prod(lista)<10**18:
  print(np.prod(lista))
else:
  print(-1)


import numpy as np
N=int(input())
p=list(int,input().split())
x=np.prod(p)
if x<10**18:
  print(x)
else:
  print(-1)

import numpy as np
N = int(input())
p = list(map(int, input().split()))
if np.prod(p) < 10**18:
    print(np.prod(p))
else:
    print(-1)


N=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
if a.count(0)>0:
  print(0)
else:
  ans=a[0]
  flag=0
  for i in range(1,N):
    ans*=a[i]
    if ans>10**18:
      flag+=1
      print(-1)
      break
  if flag==0:
    print(ans)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
n = int(input())
mul = 1
for i in range(n):
  ai = int(input())
  mul = mul * ai
  if mul > 10 ** 18:
    print('-1')
    exit()

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)

Verdicts: Runtime Error

Accepted
Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range(N):
  ans *= A[i]
if(ans > 10**8):
  print(-1)
else:
  print(ans)

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

Verdicts: Wrong Answer

Accepted