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

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

for i in A:
  if ans <= 10**18:
    ans *= i
  else:
    break

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


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

Flag = False

if 0 in A:
  Flag = True
else:
  for i in A:
    if ans <= 10**18:
      ans *= i
    else:
      break

if Flag:
  print(0)
elif ans <= 10**18:
  print(ans)
else:
  print(-1)

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

for i in range(len(a)):
    print(a[i])
    if a[i] == 0:
        print(0)
        exit()

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

print(ans)

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

for i in range(len(a)):
    if a[i] == 0:
        print(0)
        exit()

ans = a[0]
for i in range(1, len(a)):
    ans *= a[i]
    if ans > 1000000000000000000:
        ans = -1
        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())
nums = [int(i) for i in input().split()]

border_num = 10 ** 18


if 0 in nums:
    output = 0
else :
    output = 1
    for _ in nums :
        output *= _
        if output >= border_num:
            output = -1
            break
            
print(output)

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

border_num = 10 ** 18


if 0 in nums:
    output = 0
else :
    output = 1
    for _ in nums :
        output *= _
        if output > border_num:
            output = -1
            break
            
print(output)

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()))
ans=1
for i in range(n):
    ans*=a[i]

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

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

ans=1
i=0
while ans<=10**18:
    ans*=a[i]
    i+=1
    
if ans>10**18:
    print("-1")
else:
    print(ans)

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


if 0 in a:
    print(0)
else:
    ans=1
    i=0
    while ans<=10**18 and i<n:
        ans*=a[i]
        i+=1

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

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

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

ans = 1

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

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):
import sys
N = int(input())
A = list(map(int, input().split()))
A.sort(reversed=True)
res = 1
for a in A:
  res *= a
  if res > 1e18:
    print(-1)
    sys.exit()
print(res)

import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
res = 1
for a in A:
  res *= a
  if res > 1e18:
    print(-1)
    sys.exit()
print(res)

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())
sum = list(map(int,input().split()))
x = 1

for i in range(n):
    x *= list[i]

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

N=int(input())
number=list(map(int,input().split()))
ans=1
if 0 in number:
    print(0)
    exit(0)
    
for i in range(N):
    ans *= number[i]
    if ans>1000000000000000000:
        print(-1)
        exit(0)
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
for i in a:
  ans = ans * i

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

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

n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in a:
  ans *= i

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

n = int(input())
a = [int(i) for i in input().split()]
ans = 1
for i in a:
  ans = ans * i
  if ans >= 1000000000000000000:
  	break:

if ans >= 1000000000000000000:
    print('-1')
else:
  print(ans)

n = int(input())
a = [int(i) for i in input().split()]
ans = 1
for i in a:
  ans = ans * i

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

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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):
import numpy as np
 
N = int(input())
A = list(map(int, input().split()))  
a = 1
if 0 in A:
	print(0)
for i in range(N):
  a = a*A[i] 
	if (a > 10**18):
  	a = -1
    return
print(a)

import numpy as np
 
N = int(input())
A = list(map(int, input().split()))  
a = 1
if 0 in A:
	print(0)
for i in range(N):
  a *= *A[i] 
  if (a > 10**18):
  	a = -1
print(a)

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



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


N=int(input())
A=list(map(int,input().split()))
sorted(A)
result=1
if 0 in A:
    result=0
for i in A:
    if result==0:
        break
    result*=i
    if result>1000000000000000000:
        result=-1
        break

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

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

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

ans = 1
if 0 in A:
  print(0)
  sys.exit()
  
for i in range(n):
  ans *= A[i]
  if ans > 1e18:
    ans = -1
    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 = map(int, input().split())
limit = 10**18+1

mul = 1
if 0 in A:
    print("0")
else:
    for i in A:
        mul *= i
        if mul >= limit:
            print("-1")
            break
    if mul < limit:
        print(mul)


N = int(input())
A = list(map(int, input().split()))
limit = 10**18+1

mul = 1
if 0 in A:
    print("0")
else:
    for i in A:
        mul *= i
        if mul >= limit:
            print("-1")
            break
    if mul < limit:
        print(mul)


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


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

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):
#coding: utf-8
times= int(input())
a= 1
if 0 in times:
  print(0)
for i in list(map(int, input().split())):
  a*= i
  if a > 10**18:
    print('-1')
else:
  print(a)

#coding: utf-8
times= int(input())
a= 1
for i in list(map(int, input().split())):
  a*= i

#coding: utf-8
times= int(input())
nums= list(map(int, input().split()))
a= 1
if 0 in nums:
  print(0)
  exit()
for i in nums:
  a*= i
  if a > 10**18:
    print('-1')
    exit()
else:
  print(a)

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

ret = 1
for a in A:
  ret *= a
  if a == 0:
    ret = 0
    break
  if a > 10 ** 18:
    ret = -1
    break
print( ret )

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

if 0 in A:
  print( 0 )
else:
  ret = 1
  for a in A:
    ret *= a
    if ret > 10 ** 18:
      ret = -1
      break
  print( ret )


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

if 0 in A:
  print( 0 )
else:
  ret = 1
  for a in A:
    ret *= a
    if ret > 10 ** 18:
      ret = -1
      break
  print( ret )

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 = input()
lines = input()
line = [int(i) for i in lines.split(' ')]
sum = 1
for i in line:
  if sum > 1.0 * 10^18:
    sum = -1
    break
   else:
    sum = sum * i
print(sum)


n = input()
lines = input()
lines = [int(i) for i in lines.split(' ')]
sum = 1
if 0 in lines:
	print(0)
else:
	for i in lines:
		sum = sum * i
		if sum > 10**18:
			sum = -1
			break
	print(sum)

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 operator as op
n=int(input())
a=list(map(int,input().split()))
ans=reduce(operator.mul,a,1)
if ans>10**18:
    anscheck=False
else:
    anscheck=True
print(ans if anscheck else -1)

import numpy as np
n=int(input())
a=list(map(int,input().split()))
ans=1
if 0 in a:
    print(0)
    exit()
for i in range(n):
    ans=ans*a[i]
    if ans>10**18 and not 0 in a:
      print(-1)
      exit()
if ans>10**18:
    anscheck=False
else:
    anscheck=True
print(ans if anscheck else -1)

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()))
cal=1
i=0
new_A=A.sort()
if A[0]==0:
    cal==0
else:
    while i < len(A):
        cal*=A[i]
        i+=1
    if cal>=10**18:
        print(-1)
    else:
        print(cal)


N=int(input())
if N>=2 and N<=10**5:
    array=list(map(int,input().strip().split()))
    if array[0]>=0 and array[-1]<=10**18:
        multipul=1
        for i in len(array-1):
            multipul=multipul*array[i]
        print(multipul)

N=int(input())
if N>=2 and N<=10**5:
    array=list(map(int,input().strip().split()))
    if range(array)==N:
        if array[0]>=0 and array[-1]<=10**18:
            multipul=1
            for i in len(array-1):
                multipul=multipul*array[i]
            print(multipul)

N=int(input())
A=list(map(int, input().split()))
cal=1
i=0
while i < len(A):
    cal*=A[i]
    i+=1
if cal>=10**18:
        print(-1)
else:
        print(cal)


N=int(input())
if N>=2 and N<=10**5:
    array = list(map(int, input().strip().split()))
    if N==len(array):
        if array[0]>=0 and array[-1]<=10**18:
            mul=1
            for index,number in enumerate(array):
                mul*=array[index]
            if mul>=10**18:
               print(-1)
            else:
                print(mul)



N=int(input())
A=list(map(int, input().split()))
if N>=2 and N<=10**5:
    cal=1
    for i in range(N):
        cal*=A[i]
    if cal>=10**18:
        print(-1)
    else:
        print(cal)




N=int(input())
if N>=2 and N<=10**5:
    array = list(map(int, input().strip().split()))
    if N==len(array):
        if array[0]>=0 and array[-1]<=10**18:
            mul=1
            for i in array:
                mul*=array[i-1]
            if mul>=10**18:
               print(-1)
            else:
                print(mul)

N=int(input())
A=list(map(int, input().split()))
cal=1
i=0
while i <= range(N):
    cal*=A[i]
    i+=1
if cal>=10**18:
        print(-1)
else:
        print(cal)



N=int(input())
if N>=2 and N<=10**5:
    array = list(map(int, input().strip().split()))
    if N==len(array):
        if array[0]>=0 and array[-1]<=10**18:
            mul=1
            for index,number in enumerate(array):
                mul*=array[index]
            if mul>=10**18:
               print(-1)
            else:
                print(mul)



n = int(input())
m = list(map(int, input().split()))
ans = 1
if min(m) == 0:
    print(0)
else:
    m.sort(reverse=True)
    for i in m:
        ans *= i
        if ans > 1000000000000000000:
            ans = -1
            break
    print(ans) 

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

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):
import numpy as np
N = input()
Mul = np.prod(list(map(int, input().split())))
if Mul < 10**18:
  print(Mul)
else:
  print("-1")

import numpy
N = int(input())
ls = input().split()
Mul = numpy.prod(ls)
if Mul < 10**18:
  print(Mul)
else:
  print("-1")

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

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 numpy as np
n = int(input())
data = list(map(int, input().split()))
data = np.array(data)
ans = np.prod(data)
if ans >= 10**18:
    ans = -1
print(ans)

import numpy as np
n = int(input())
data = list(map(int, input().split()))
if 0 in data:
    print(0)
    exit()
ans = 1
for a in data:
    ans*=a
    if ans > 10**18:
        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())
a=1
for i in range(n):
  a*=A[i]
  if a>10**18
  print(-1)
  exit()

print(a)

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

print(ans)

n=int(input())
ans=1
for i in range(n):
  x=int(input())
  ans*=x

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

=int(input())
A=list(map(int,input().split()))
x=1
flag=0
A.sort()
if 0 in A:
  print(0)
  exit()

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

if flag==0:
  print(x)

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

print(ans)


n=int(input())
A=list(map(int,input().split()))
x=1
A.sort()
if 0 in A:
  print(0)
  exit()

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

print(x)

Verdicts: Runtime Error

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):
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:
        break
    
print(-1 if ans>=10**18 else ans)


import sys
input = sys.stdin.readline

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


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]

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


import sys
input = sys.stdin.readline

N = int(input())
A =list(map(int,input().split()))
ans = 1
if 0 in A:
    ans=0
else:
    for i in range(N):
        ans *= A[i]
        if ans >= 10**18:
            break
    
print(-1 if ans>10**18 else 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):
a = int(input())
s = list(map(int,input().split()))
mod = 10**18
cus = a//2
num =1
if cus %2 ==0:
    for i in range(cus):
        num = num *s[i] * s[-i-1]
else:
    for i in range(cus):
        num = num *s[i] * s[-i-1]
    num *= s[cus]
if num > mod:
    print(-1)
    exit()
print(num)



a = int(input())
s =list(map(int,input().split()))
mod = 10 **18
ans = 1
if 0 in s:
    print(0)
    exit()
for i in s:
    ans = ans *i
    if ans > 1e18:
      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 = [int(x) for x in input().split()]

maxval = 10 ** 18
ans = 1

for i in a:
    if i <= maxval:
        ans = -1
        break
    
    if ans <= maxval:
        ans *= i
    else:
        ans = -1
        break

print(ans)

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

maxval = 10 ** 18
ans = 1

for i in a:
    if i >= maxval:
        ans = -1
        break

    if ans >= maxval:
        ans *= i
    else:
        ans = -1
        break

print(ans)


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

maxval = 10 ** 18
ans = 1


for i in range(n):
    ans *= a[i]
    if ans > maxval:
        ans = -1
        break
    
if 0 in a:
    ans = 0
    
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 = int(input())
a = sorted(list(map(int,input().split())))
m = 1
threshold = 1e18
for i in a:
    m *= i
    if m >= threshold:
        m = -1  
        break
print(m)

n = int(input())
a = list(map(int,input().split()))
m = 1
threshold = 1e18
for i in a:
    m *= i
    if m >= threshold:
        m = -1
        break
print(m)

n = int(input())
a = sorted(list(map(int,input().split())))
m = 1
threshold = 1e18
for i in a:
    m *= i
    if m > threshold:
        m = -1  
        break
print(m)

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):
t = int(input())
list_v = list(map(int,input().split()))
 
res = 1
for v in list_v:
  if v == 0:
    return 0
  res = res * v
  if res > 10**18:
    res = -1
    break
print(res)

import math 
t = int(input())
list_v = [int(x) for x in input().split()]

res = float(math.prod(list_v))

if res > math.pow(10,18):
	print(-1)
else:
	print(res)
  

t = int(input())
list_v = list(map(int,input().split()))

res = 1
for v in list_v:
  if v = 0:
    return 0
  res = res * v
  if res > 10**18:
    res = -1
    break
print(res)

t = int(input())
list_v = list(map(int,input().split()))
 
res = 1
if 0 in list_v:
  res = 0
else:
  for v in list_v:
    res *= v
    if res > 10**18:
      res = -1
      break
print(res)

Verdicts: Runtime Error

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

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

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

print(temp)

import numpy as np

n = int(input())
a = list(map(int, input().split()))
b = np.array(a, dtype=np.float128)

temp = b.prod()

if temp > 10**18 or temp < 0:
  print('-1')
  exit()

print(temp)

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

if a.count(0) > 0:
  print(0)
  exit()
  
for i in range(n):
  temp = temp * a[i]

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

print(temp)

import numpy as np
from decimal import *
 
n = int(input())
a = list(map(Decimal, input().split()))
b = np.array(a)
temp = 1
 
if a.count(0) >0:
  print(0)
  exit()
 
for i in range(n):
  temp = b[i] * temp
  if temp > 10**18 or temp < 0:
    print('-1')
    exit()
 
print(temp)

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())
s=input().split()

if s[0]*s[1]>10**18:
    print(s[0]*s[1])
else:
    print("-1")

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

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 = map(int, input().split());

a.sort()
ans = 1
above = False
for x in a:
	ans *= x
	if ans > 10**18:
		above = True
		break

if not above:
	print(ans)
else:
	print(-1)

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

a.sort()
ans = 1
above = False
for x in a:
	ans *= x
	if ans > 10**18:
		above = True
		break

if not above:
	print(ans)
else:
	print(-1)

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):
# -*- coding: utf-8 -*-
import sys


N, *d = map(int, open(0).read().split())
A = 1

for O in d:
    A = A*O
    print(O)
    if A > 10 ** 18:
     A = -1
     break
    
print(A)

def main():

	N, *d = map(int, open(0).read().split())

	if 0 in d:
  		print(0)
  		return

	A = 1
	for O in d:
		A *= O
		#print(O)
		if A > 1000000000000000000:
			print(-1)
			return

	print(A)

main()

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
key=0
for i in range(len(a)):
    if a[i]==0:
        key=1
        print(0)
        break;
if key==0:
    for i in range(len(a)):
        mul=mul*a[i]
        if mul>1000000000000000000:
        break
    if(mul<1000000000000000001):
        print(mul)
    else:
        print(-1)

n=int(input())
a=list(map(int,input().split()))
mul=1
key=0
for i in range(len(a)):
    if a[i]==0:
        key=1
        print(0)
        break;
if key==0:
    for i in range(len(a)):
        mul=mul*a[i]
        if mul>1000000000000000000:
            break
    if(mul<1000000000000000001):
        print(mul)
    else:
        print(-1)

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 = map(int, input().split())

if 0 in A:
  return 0

product = 1

for a in A:
  product *= a

  if product > 10 ** 18:
    return -1

  return product


def solve(A):
    if 0 in A:
        return 0

    product = 1

    for a in A:
        product *= a

        if product > 10 ** 18:
            return -1

    return product


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

print(solve(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):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A,reverse=True)
B = 1
if 0 in A:
    print(0)
    quit()
else:
    for i in range(N):
        B = B*A[i]
        if B>= 10**18:  
            print(-1)
            quit()
print(B)

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

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

N = int(input())
A = list(map(int, input().split()))
A = sorted(A,reverse=True)
B = 1
for i in range(N):
    B = B*A[i]
    if B>= 10**18:  
        print(-1)
        quit()
print(B)

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

N = int(input())
A = list(map(int, input().split()))
A = sorted(A,reverse=True)
B = 1
if 0 in A:
    print(0)
    quit()
else:
    for i in A:
        B = B*i
        if B>= 10**18:  
            print(-1)
            quit()
print(B)

from functools import reduce
N = int(input())
A = list(map(int, input().split()))
print(A)
re = reduce((lambda x, y: x * y), A)
if re <= 10**18: 
    print(re)
else:
    print(-1)

N = int(input())
A = list(map(int, input().split()))
A = sorted(A,reverse=True)
B = 1
if 0 in A:
    print(0)
    quit()
else:
    for i in A:
        B *= i
        if B> 10**18:  
            print(-1)
            quit()
print(B)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

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


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

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

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


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


n = int()
a = list[map(int, input().split())]
s = 1
for i in n+1 :
  ans = s*a[i]
if ans => 10**8:
  print("-1")
else:
  print(ans)


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

Verdicts: 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):
N = int(input())
Al = list(map(int,input().split()))
result = 0
for i in Al:
    result *= i
    if result > 10**18:
        result = -1
        break

print(result)

N = int(input())
Al = list(map(int,input().split()))
result = 1
if 0 in Al:
    result = 0
else:
    for i in Al:
        result *= i
        if result > 10**18:
            result = -1
            break

print(result)

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 = 1
L = list(map(int, input().split()))
for i in L:
    a *= i
    if(a > 1e18)break

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


N = int(input())
a = 1
L = list(map(int, input().split()))
L.sort()
for i in L:
    a *= i
    if (a > 1e18):
        break

print(-1 if a > 1e18 else 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):
n = int(input())

a = list(map(int, input().split()))
for _, val in enumerate(a):
    ans *= val
if ans > 10**18:
    print(-1)
else:
    print(ans)


n = int(input())

a = list(map(int, input().split()))
ans = 1
if 0 in a:
    print(0)
else:
    for num, val in enumerate(a):
        ans *= val
        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):
a=input()
ans=1;
ok=True
for i in range(a):
    c=input()
    ans*=c
    if ans>1000000000000000000:
        ok=False
        break
if ok:
    print(ans)
else :
    print(-1)

a=int(input())
ans=1;
ok=True
for i in range(a):
    c=int(input())
    ans*=c
    if ans>10**18:
        ans=-1
        break
print(ans)

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


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):
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 1
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        return
print(ans)

from sys import exit, stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 1
if 0 in A:
    print(0)
    exit()
for a in A:
    ans *= a
    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()))
ans = 1

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

n = int(input())
a = list(map(int,input().split()))
ans = 1
a.sort()
if a[0] == 0:
    ans = 0
    print(ans)
    exit()

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

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

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

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

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

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

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

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

ans = 1
if 0 in A:
    print(0)
else:
    for a in A:
        ans *= a
        if ans > 10**18:
            print(-1)
            break
    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):
using System;
using System.Linq;
class program{
  static void Main(){
    int n = int.Parse(Console.ReadLine());
    long[] a = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long ans = 1;
    a.Sort();
    if(a[0] == 0){
      Console.Write(0);
      return;
    }
    for(int i = 0;i<n;i++){
      if(ans*a[i] > 1e18){
        Console.Write(-1);
      	return;
      }
      ans *= a[i];
    }
    Console.Write(ans);
  }
}

def Ii():return int(input())
def Mi():return map(int,input().split())
def Li():return list(map(int,input().split()))
n = Ii()
a = sorted(Li())

mx = 10**18
ans = 1
for i in a:
  
  ans *= i
  if ans > mx:
    ans = -1
    break
  elif ans == 0:
    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())
A = list(map(int, input().split()))
A = sorted(A,reverse=True)
ans = 1
if 0 in A:
    print(0)
    quit()
else:
    for i in A:
        ans *= i
        if ans>= 10**18:  
            print(-1)
            quit()
print(ans)

N = int(input())
A = list(map(int, input().split()))
A = sorted(A,reverse=True)
B = 1
if 0 in A:
    print(0)
    quit()
else:
    for i in A:
        B *= i
        if B> 10**18:  
            print(-1)
            quit()
print(B)

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 = input().split()
answer = 1
flag = 0
for i in range(N):
  answer *= int(A[i])
  if (answer // (10**18)) >= 1:
      print(-1)
      flag = 1
      break
if flag == 0:
  print(answer)

N = int(input())
A = input().split()
answer = 1
for i in range(N):
  answer *= int(A[i])
  
if (answer // (10**18)) >= 1:
  print(-1)
else:
  print(answer)

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

N = int(input())
A = input().split()
answer = 1
flag = 0
x = 10**18

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


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

if flag == 0:    
  print(answer)

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):
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    if 0 in a:
        print('0')
        exit()
    ans = 1
    for hoge in a:
        print(ans)
        ans *= hoge
        if ans >= 10**18:
            print('-1')
            exit()
    print(ans)

if __name__ == '__main__':
    main()



import sys
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    if 0 in a:
        print('0')
        return
    ans = 1
    for hoge in a:
        ans *= hoge
        if ans > 10**18:
            print('-1')
            return
    print(ans)

if __name__ == '__main__':
    main()

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;

const double eps = 1e-9;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  long long ans = 1;
  vector<long long> a(n);
  bool ok = false;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 0) ok = true;
  }
  if (ok) {
    cout << "0\n";
    return 0;
  }
  double foo = (double)1e18;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      cout << "0\n";
      return 0;
    }
    double bar = foo / a[i];
    if (bar < 1.0 * ans) {
      cout << "-1\n";
      return 0;
    }
    ans *= a[i];
  }
  cout << ans << '\n';
  return 0;
}

from math import *
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
ok = False
fail = False
for x in a:
  if (x == 0):
    ok = True
    break
for x in a:
  if (ans * x > 1000000000000000000):
    fail = True
    break
  ans *= x
if (ok):
  print(0)
else:
  if (fail):
    print("-1")
  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):
i = 0
if 0 in number:
    total = 0
else:
    while i < N:
            total *= number[i]
            i = i + 1
            if total > 10**18:
                total = -1
                break
print(total)

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

if any [x == 0 for x in numbers]:
  print(0)
else:
  t = numbers [0]
  for el in numbers:
  	while total < 10**18:
    	t *= el 
  	if t < 10**18:
    	print(t)
    else:
      print(-1)

N = int(input())
numbers = [int(x) for x in input().split()]
 
if any ([x == 0 for x in numbers]):
    t = 0
else:
    t = 1
    for i in numbers:
        t *= i
        if t > 10 ** 18:
            t = -1
            break
print(t)

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

N = int(input())
A = list(map(int, input().split()))
A.sort()
if A[0] == 0:
  print(0)
else:
  ans = 1
  for i in range(N):
    ans *= A[i]
    if ans > 10**18:
      ans = -1
      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()))

if 0 in A:
    print(0)
    return

ans = 1
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

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

    print(ans)

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())
numlist=list(map(int,input().split()))
result=1
for x in numlist:
    result=result*x
    if result>1000000000000000000:
        print(-1)
        break
    print(result)


N=int(input())
numlist=list(map(int,input().split()))
result=1
if 0 in numlist:
    print(0)
else:
    for x in numlist:
        result=result*x
        if result>10**18:
            break
    if result<=10**18:
        print(result)
    else:
        print(-1)


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

for i in range(n):
  m = int(input())
  
  re *= m
if(re >= 1000000000000000000):
    print("-1")
else:
    print(re)

n =int(input())
limit = 10**18
re =0

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

l.sort()

if(l[0]) != 0):
  for i in l:
    re *= i
    if(re > limit):
      print(-1)
      exit()

print(re)
  

n = int(input())
re = 1

list = [int(s) for s in input().split()]
  
for i in range(n):
    re *= list[i]
    
if(re >= 1000000000000000000):
    print("-1")
else:
    print(re)

n =int(input())
limit = 10**18
re =0
 
l = list(map(int, input().split()))
 
l.sort()
 
if(l[0] != 0):
  for i in l:
    re *= i
    if(re > limit):
      print(-1)
      exit()
print(re)

n = int(input())
re = 1

for i in range(n):
    m= int(input())
    re *= m
    
if(re > 1000000000000000000):
    print("-1")
else:
    print(re)

n =int(input())
limit = 10**18
re =1
 
l = list(map(int, input().split()))
 
l.sort()
#print(l)
if(l[0] == 0):
    re = 0
else:
  for i in l:
    re *= i
    #print(re)
    if(re > limit):
      re = -1
      break
print(re)

Verdicts: Runtime Error

Runtime Error

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())
numLi = list(map(int, input().split()))
prod = 1
for i in range(len(numLi)):
    prod *= numLi[i]
    if 0 in numLi:
        prod = 0
        break
    if prod >= 10 ** 18:
        prod = -1
        break
    else:
        continue
print(prod)


N = int(input())
numLi = list(map(int, input().split()))
prod = 1
for i in range(len(numLi)):
    prod *= numLi[i]
    if prod >= 10 ** 18:
        prod = -1
        break
    else:
        continue
print(prod)


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

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):
A, B = input().split()
A = int(A)
fb = float(B)
B100 = int(fb * 100)
ans = A * B100
print(int(ans/100))

N = int(input())
A = list(map(int,input().split()))
ans = 1
A.sort(reverse=True)
t = A.pop()
if t == 0:
    print(0)
    exit(0)

A.append(t)

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

print(ans)

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

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

print(ans)

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

ans = 1
n = int(input())
arr = list(map(int , input().split()))
f  = 1
for i in range(n):
	ans*=arr[i]
	if ans >= 10**18:
		f = 0
		break

if f: print(ans)
else: print(-1)


ans = 1
n = int(input())
arr = sorted(list(map(int , input().split())))
f  = 1
for i in range(n):
	if arr[i] == 0:
		ans = 0
		break
	ans*=arr[i]
	#print(ans)
	if ans >= 10**18:
		f = 0
		break

if f: print(ans)
else: print(-1)


input = sys.stdin.readline
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

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

ans = 1
n = int(input())
arr = sorted(list(map(int , input().split())))
f  = 1
for i in range(n):
	ans*=arr[i]
	#print(ans)
	if ans > 10**18:
		f = 0
		break
#print(ans)
if f: 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 = input()
nums = input().split()
res = int(nums.pop(0))

if 0 in nums:
  print('0')
  return

for i in nums:
  res *= int(i)

print(res)

import sys
import numpy as np

N = input()
nums = input().split()
 
if 0 in nums:
  print('0')
  sys.exit(0)

nums = [int(x) for x in nums]
res = np.prod(nums)

if res >= 1000000000000000000:
  res = -1
print(res)

import sys
import numpy as np

N = input()
nums = input().split()
 
if 0 in nums:
  print('0')
  sys.exit(0)

nums = [int(x) for x in nums]
res = np.prod(nums)

if res >= 1000000000000000000:
  res = -1
print(res)

import sys
 
N = input()
nums = list(map(int, input().split()))
res = 1

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

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted