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):
import numpy as np
n = int(input())
l = np.array(list(map(int, input().split())))
b = 1
def multi(n,b,l):
    for i in range(n):
        b = b * l[i-1] 
    if b > 10 ** 18:
        b = -1
    return b
b = multi(b,l)
print(b)

import numpy as np
n = int(input())
l = np.array(list(map(int, input().split())))
b = 1
def multi(n,b,l):
    for i in range(n):
        b = b * l[i] 
    if b > 10 ** 18:
        b = -1
    b = int(b)
    return b
b = multi(b,l)
print(b)

import numpy as np
n = int(input())
l = np.array(list(map(int, input().split())))
b = 1
def multi(n,b,l):
    for i in range(n):
        b = b * l[i] 
    if b > 10 ** 18:
        b = -1
    return b
b = int(multi(b,l))
print(b)


import numpy as np
n = int(input())
l = np.array(list(map(int, input().split())))
b = 1
def multi(b,l):
    for a in l:
        b = b * a 
    if b >= 10 ** 18:
        b = -1
    return b
b = multi(b,l)
print(b)

import sys
sys.setrecursionlimit(1000000)

def input():
    return sys.stdin.readline()[:-1]
n = int(input())
l = list(map(int, input().split(" ")))
output = 1

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

for i in range(n):
    output = output * int(l[i])
    if output > 10 ** 18:
        output = -1
        break
print(output)


Verdicts: 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):
# B
N = int(input())
A = [int(i) for i in input().split()]
if 0 in A:
    print(0)
else:
    result = 1
    for i in range(len(A)):
        result = result * A[i]
        print(result)
        if result > 1000000000000000000:
            result = -1
            break
    print(result)

# B
N = int(input())
A = [int(i) for i in input().split()]
if 0 in A:
    print(0)
else:
    result = 1
    for i in range(len(A)):
        result = result * A[i]
        if result > 1000000000000000000:
            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 = list(map(int,input().split()))
if a.index(0) >= 0:
    print(0)
    exit()
ret = 1
for a_ in a:
    ret *= a_
    if ret > 10**18:
        print(-1)
        exit()
print(ret)

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

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

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


n = int(input())
*a, = map(int, input().split())
th = 10**18

if 0 in a:
    print(0)
    exit()
mul = 1
for i in range(n):
    mul *= a[i]
    if mul > th:
        print(-1)
        exit()
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):
import numpy as np
n = input()

a = np.array(list(map(int, input().split())))
b = np.prod(a)

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

n = int(input())

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

count = 1
if 0 in a:
    print(0)
else:

    for i in a:
        count *= i
        if count > 10 ** 18:
            print(-1)
            break
    if count <= 10 ** 18:
        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):
a,b=map(int and float ,input().split())
b=100*b
c=a*b
print(int(c/100))

N=int(input())
A = list(map(int,input().split()))
A.sort()
x=1
y=True
for i in A:
    x= x*i
    if x > 10**18:
        print('-1')
        y=False
        break
if y:
    print(x)

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 functools import reduce

input()
mul = lambda x, y: x*y
ret = reduce(mul, map(int, input().split()), 1)

if 10**8 < ret:
    print(-1)
else:
    print(ret)


from functools import reduce

mul = lambda x, y: x*y
ret = reduce(mul, map(int, input().split()), 1)

if 10**8 < ret:
  print(-1)
else:
  print(ret)


from functools import reduce

mul = lambda x, y: x*y
ret = reduce(mul, map(int, input().split()), 1)

if 10**8 <= ret:
  print(-1)
else:
  print(ret)


def main():
    N = int(input())
    A_i = list(map(int, input().split()))
    t = 10**18

    if 0 in A_i:
        print(0)
        return

    acc = 1
    for i in A_i:
        acc *= i
        if t < acc:
            print(-1)
            return

    print(acc)
    return


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())
arr = [ int(x) for x in input().strip().split(' ') ]
isZ = False
for x in arr:
    if x == 0:
        isZ = True

if isZ:
    print ("0")
    exit(0)

res = 1
for x in arr:
    res *= x
    if res > 1000000000000000000:
        print ("-1")
        exit(0)
p

n = int(input())
arr = [ int(x) for x in input().strip().split(' ') ]
isZ = False
for x in arr:
    if x == 0:
        isZ = True

if isZ:
    print ("0")
    exit(0)

res = 1
for x in arr:
    res *= x
    if res > 1000000000000000000:
        print ("-1")
        exit(0)
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())
A = map(int, input().split())

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

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

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

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

ans = 1
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):
def main():
    n = int(input())
    list = list(map(int, input().split()))
    ans = 1

    for i in range(n):
        ans = ans * list[i]
        if ans > 1000000000000000000:
            print(-1)
            return

    print(ans)


main()


def main():
    n = int(input())
    list = list(map(int, input().split()))
    ans = 1

    for i in range(n):
        ans = ans * list[i]
        if ans > 1000000000000000000:
            print(-1)
            return

    print(ans)


main()


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

    if 0 in A:
        print(0)
        return

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

    print(ans)


main()


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

prod = 1
for a in A:
    prod *= a
    if prod >= 1e18:
        print(-1)
        exit()

print(prod)


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

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

prod = 1
for a in A:
    prod *= a
    if prod > 1e18:
        print(-1)
        exit()

print(prod)


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
if 0 in A:
    print('0')
else:
    for a in A:
        ans *= a
        print(ans)
        if ans > 10**18:
            ans = -1
            break

    print(ans)

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

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

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

N = int(input())
lst = list(map(int, input().split()))
if (0 in lst):
  print(0)
else:
  product = 1
  for i in lst: 
    product *= i

    if(product > 1000000000000000000):
      print(-1)
      break
  else:
    print(product)

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

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



result = 0
if 0 in x2:
  None 
else:
  result + 1
  for xv in x2:
  
     result = xv * result
  
     if xv == 0:
        result = 0
        break
  
     if 10**18 < result : 
        result = -1
        break


print(result) 


x1 = input()
x2 = [int(i) for i in input().split(" ")]

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


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

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

N = int(input())
As = map(int, input().split())
result = 1
 
for a in As:
  result *= a
 
if result >= 10**18:
  print(-1)
else:
  print(result)

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

N = int(input())
As = map(int, input().split())
result = 1

for a in As:
  result = 1*a
 
if a >= 10**18:
  print(-1)
else:
  print(result)
  

N = int(input())
As = map(int, input().split())
result = 1
 
for a in As:
  result *= a
 
if result >= 10**18:
  print(-1)
else:
  print(result)

N = int(input())
As = map(int, input().split())
result = 1
 
for a in As:
  result *= a
 
if result >= 10**18:
  print("-1")
else:
  print(result)

N = int(input())
As = map(int, input().split())
result = 1
 
for a in As:
  result *= a
 
if result >= 10**18:
  print("-1")
 else:
  print(result)

N = int(input())
A = list(map(int, input().split()))
result = 1
 
if 0 in A:
  print(0)
  exit()

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

print(result)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

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):
import sys
import math                                               
a,b = [float(x) for x in sys.stdin.readline().split(" ")]
c = str(a * b).split(".")[0]                              
print(c)                                                  

import sys
def calc():                                             
    _ = int(sys.stdin.readline())                       
    xs = [int(x) for x in sys.stdin.readline().split(" ")]
    for x in xs:                                          
        if x == 0:                                        
            return 0                                      
    r = 1                                                 
    m = 10 ** 18                                          
    for x in xs:                                          
        r *= x                                            
        if r > m:                                         
            return -1                                     
    return r                                              
                                                          
print(calc())                                             

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

output = 1

if 0 in nums:
  print(0)
  sys.exit()
  
else:
  for x in nums:
    output *= x

    if output > 10**18:s
      print('-1')
      sys.exit()

  print(output)

import sys

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

output = 1

if 0 in nums:
  print(0)
  sys.exit()
  
else:
  for x in nums:
    output *= x

    if output >= 10**18:
      print('-1')
      sys.exit()

  print(output)

import sys

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

output = 1

if 0 in nums:
  print(0)
  
else:
  for x in nums:
    output *= x

    if output > 10**18
      print('-1')
      sys.exit()

  print(output)

import sys

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

output = 1

if 0 in nums:
  print(0)
  sys.exit()
  
else:
  for x in nums:
    output *= x

    if output >= 10**18:
      print(-1)
      sys.exit()

  print(output)

import sys

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

output = 1

if 0 in nums:
  print(0)
  sys.exit()
  
else:
  for x in nums:
    output *= x

    if output > 10**18:
      print(-1)
      sys.exit()

  print(output)

Verdicts: Runtime Error

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

ans = 1

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

for i in range(N):
    if a[i] == 0:
        ok = True
        ans = 0

if ok == True:
    print(ans)
else:
    print(-1)

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

ans = 1

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

for i in range(n):
    if a[i] == 0:
        ok = True
        ans = 0

if ok == True:
    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):
n = int(input())

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

ans = 1
if min(a) == 0:
    print(0)
else:    
    for i in a:
        ans *= i
        if len(str(ans)) >= 18:
            print(-1)
            exit()

    print(ans)        

n = int(input())

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

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

if ans // 1000000000000000000 > 0:
    print(-1)
else:
    print(ans)    

n = int(input())

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

ans = 1
if min(a) == 0:
    print(0)
    exit()
    
for i in a:
    ans *= i
    if ans > 1000000000000000000:
        print(-1)
        exit()
        
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())
ls = list(map(int, input().split()))
res = 1
if 0 in ls:
    res = 0
for x in ls:
    res *= x
    if res > 10**18:
        res = -1
     	break
print(res)

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

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

if alist[0]==0:
  print(0)
  sys.exit(0)

answer=1
for a in alist:
  answer*=a
  if answer>1<<18:
    print(-1)
    break
else:
  print(answer)

N=int(input())
alist=list(map(int,input().split()))
alist.sort()

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

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

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

    if 0 in A:
        print(0)
        return

    prod = 1
    for a in A:
        values *= 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:
        values *= a
        if prod >  1000000000000000000:
            print('-1')
            return
    print(prod)
main()

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

A.sort(reverse=True)

values = 1
flg = True
for n in range(N):
    values *= A[n]
    if values >= 10e+17:
        flg = False
        break
if flg == True:
    print(values)
else:
    print('-1')

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

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

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

print(ans)
    

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

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

ans = 1
for i in s:
    ans *= 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):
def q_b():
    k = int(input())
    a = map(int, input().split())

    is_finished = False
    for i in a:
        if i == 0:
            print(0)
            is_finished = True
        break

    if is_finished:
        return

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

    if 1 <= answer and answer <= 10 ** 18:
        print(answer)


if __name__ == '__main__':
    q_b()


def q_b():
    k = int(input())
    a = map(int, input().split())
    a = list(a)

    is_finished = False
    for i in a:
        if i == 0:
            print(0)
            is_finished = True
            break

    if is_finished:
        return

    answer = 1
    for i in a:
        answer *= i
        if answer > 10 ** 18:
            print(-1)
            is_finished = True
            break

    if is_finished is False:
        print(answer)


if __name__ == '__main__':
    q_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 = list(map(int, input().split()))

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

ans = 1
for i in a:
    if ans * i <= 1e18:
        ans *= i
        print(ans)
    else:
        print(-1)
        exit()
print(ans)


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

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

ans = 1
for i in a:
    if ans * i <= 1e18:
        ans *= i
    else:
        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):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

MAX = 10**18
result = 1
for i in input().split():
    result *= i

if result > MAX:
    print(-1)
else:
    print(result)

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

MAX = 10**18
result = 1
A = FLI()
if 0 in A:
    print(0)
    exit()
    
for i in A:
    result *= int(i)
    if result > MAX:
        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):
n=int(input())
a=list(map(int,input().split()))
ans=1
if 0 in a:
    print(0)
    exit()
for i in a:
    ans *= i
    if ans>10**8:
        print(-1)
        exit()
print(ans)

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

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

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

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

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

import sys

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

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

for i in range(N):
    ans *= A[i]
    if ans > 1000000000000000000:
        print(-1)
        sys.exit(0)
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 = long(input())
a = [long(x) for x in input().split()]

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

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


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

abc=0

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

	if(ans>1000000000000000000):
		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):
n = int(input()) 
a = list(map(int,input().split())) 
s = 1 
f = 0 
for _ in range(n): 
  s *= a[_] 
  if len(str(s)) > 18 : 
    print("-1")
    f += 1 
    break 
if f == 0: 
  print(s) 

n = int(input()) 
a = list(map(int,input().split())) 
s = 1 
f = 0 
if not a.count(0) == 0:
  print("0")
  f += 1
if f == 0:
  for _ in range(n): 
    s *= a[_]
    if len(str(s)) > 18 : 
      print("-1")
      f += 1 
      break 
if f == 0: 
  print(s) 


n = int(input())
s = list(map(int,input().split()))
if 0 in s:
  print(0)
  exit()
for _ in range(n):
  ans *= s[_]
  if len(str((ans-1))) > 18:
    print(-1)
    exit()
else:
  print(ans)

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



n = int(input())
a = list(map(int,input().split()))
s = 1
for _ in range(n):
  s *= a[_]
if len(str(s)) < 19 :
  print(s)
else :
  print("-1")
  

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



Verdicts: 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):
#! /usr/bin/env python3
# -*- coding:utf-8 -*-

def product_many(N):
    if 0 in N: return 0
    ans = 1
    for x in N:
        ans *= x
        if ans > 10 ^ 18: return -1
    return ans

def main():
    _ = input()
    N = list(map(int, input().split()))
    print(product_many(N))

if __name__ == "__main__":
    main()


#! /usr/bin/env python3
# -*- coding:utf-8 -*-

def product_many(N):
    if 0 in N: return 0
    ans = 1
    for x in N:
        if (10 ^ 18 / ans) < x: return -1  
        ans *= x
        if ans > 10 ^ 18: return -1
    return ans

def main():
    _ = input()
    N = list(map(int, input().split()))
    print(product_many(N))

if __name__ == "__main__":
    main()


#! /usr/bin/env python3
# -*- coding:utf-8 -*-

def product_many(N):
    if 0 in N: return 0
    ans = 1
    for x in N:
        if (10 ** 18 / ans) < x: return -1
        ans *= x
        if ans > 10 ** 18: return -1
    return ans

def main():
    _ = input()
    N = list(map(int, input().split()))
    print(product_many(N))

if __name__ == "__main__":
    main()


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 math
l1=list(map(int,input().split()))
a=math.prod(l1)
if a>=10**18:
  print("-1")
else:
  print(a)

import prod
l1=list(map(int,input().split()))
a=math.prod(l1)
if a>=10**18:
  print("-1")
esle:
  print(a)

import math
n=int(input())
l1=list(map(int,input().split()))
a=math.prod(l1)
if a>=10**18:
  print("-1")
else:
  print(a)

331import math
l1=list(map(int,input().split()))
a=math.prod(l1)
if a>10**18:
  print("-1")
else:
  print(a)


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

Verdicts: Wrong Answer

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):
import numpy as np
#from numba import njit

def getVar():
    return map(int, input().split())
def getArray():
    return np.array(list(map(int, input().split())))

N = getVar()
A = getArray()

m = 1
upper = pow(10, 18)
if 0 in A:
    print(0)
else:
    for a in A:
        m *= a
        print(m)
        if m > upper:
            break

    if m > upper:
        print('-1')
    else:
        print(str(m))


import numpy as np
#from numba import njit

def getVar():
    return map(int, input().split())
def getArray():
    return np.array(list(map(int, input().split())))

N = getVar()
A = getArray()

m = 1
upper = pow(10, 18)
for a in A:
    m *= a
    if m >= upper:
        break

if m >= upper:
    print('-1')
else:
    print(str(m))
    

import numpy as np
#from numba import njit

def getVar():
    return map(int, input().split())
def getArray():
    return list(map(int, input().split()))
def getNumpy():
    return np.array(list(map(int, input().split())), dtype='int64')

def main():
    N = getVar()
    A = getArray()

    m = 1
    upper = 1000000000000000000

    if 0 in A:
        print(0)
        return
        
    for a in A:
        m *= a
        if m > upper:
            print(-1)
            return

    print(m)

main()

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

import sys

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

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

ans = 1
for a in sorted(A, reverse=True):
    ans *= a
    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())
if 0 in a:exit(print(0))
ans=1
for i in a:
  ans*=i
  if ans>10**18:exit(print(-1))
print(ans)

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

MAX_A= 10**18
aa = 1

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


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

MAX_A= 10**18
aa = 1

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

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

n = int(input())
arr = list(map(int,input().split()))
arr = sorted(arr)
ans = 1
for val in arr:
  ans*= val
  if ans>10**18:
    print(-1)
    break
  else:
    print(ans)

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

ans = 1

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

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




import sys
ans = 1
N = int(input())
A = list(map(int, input().split()))  
if A.count(0):
    print(0)
else:
    for _ in range(N):    
        ans *= A[_]
        if ans >= pow(10,18):
            print(-1)
            sys.exit()
    print(ans)





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

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

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

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

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

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

if a_list[0] == 0:
  print(0)
else:
  ans = 1
  for i in a_list:
    ans *= i
    if ans > 10**18:
      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):
import math as m
a,b=list(map(float,input().split()))
print(m.floor(a*(b*10**5)/10**5))

import math as m
a,b=list(map(float,input().split()))
print(m.floor(a*(b*1000)/1000))

N=int(input())
s=list(map(int, input().split()))
a=1
for i in range(N):
  if if a>1000000000000000000:
    break
  a*=s[i]
print(-1 if a>1000000000000000000 else a)

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


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())
lista = [int(x) for x in input().split()]
q = 0
for i in lista:
  q *= i
  if q > 10**18:
    print(-1)
    return
 print(q)

def main():

    N = int(input())
    lista = [int(x) for x in input().split()]
    q = 1
    if 0 in lista:
        return print(0)
    for i in lista:
        q *= i
        if q > 10**18:
            print(-1)
            return
    print(q)


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

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

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

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

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
a = 1
if 0 in A:
    print(0)
    exit()
for i in A:
    a *= i
    if a >= 10**18:
        print('-1')
        exit()
print(a)

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

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

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
a = 1
if 0 in A:
    print(0)
    exit()
for i in A:
    a *= i
    if a > 10**18:
        print('-1')
        exit()
print(a)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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

ans = 1
for i in a:
    if i == 0:
        ans = 0
        break
    else:
        ans *= i

if ans * i > 10 ** 18:
        ans = -1

print(ans)


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

if 0 in a:
    print(0)
else:

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

    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=1
for i in range(N):
   A=A*int(input())
print(A if A<=100000000000000000 else -1)

N=int(input())
A=list(map(int,input().split()))
ans=1
for i in range(N):
    ans=ans*int(A[i])
print(ans if ans<=100000000000000000 else -1)

N=int(input())
A=1
for i in range(N):
   A=A*int(input())
print(A if len(A)<=18 else -1)

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

if 0 in As:
    print(0)
else:
    for i in range(N):
        ans*=As[i]
        if ans>int(1e18):
            break
    print(ans if ans<=int(1e18) else -1)

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

def main ():
	n = int(input())
	a = list(map(int,input(). split ()))
    
	if 0 in a:
		print(0)
		return
	prod = 1
	for i in a:
		prod *= i
		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):
N = int(input())
A = map(int, input().split())

if not all(A):
  print(0)
else:
  r, p = 1, 10 ** 18
  for num in A:
    if r > p:
      r = -1
      break
  print(r)


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

  if 0 in A:
    print(0)
    return

  r, max = 1, 10 ** 18
  for num in A:
    r *= num
    if r > max:
      print(-1)
      return
  print(r)

main()


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

  if 0 in A:
    print(0)
    return

  r, max = 1, 10 ** 18
  for num in A:
    r *= num
    if r > max:
      print(-1)
      return
  print(r)

main()


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

  if not all(A):
    return 0

  r, max = 1, 10 ** 18
  for num in A:
    r *= num
    if r > max:
      return -1
  return r

print(main())


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

  if not all(A):
    return 0

  r, max = 1, 10 ** 18
  for num in A:
    r *= num
    if r > max:
      return -1
  return r

print(main())


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

  if 0 in A:
    return 0

  r, max = 1, 10 ** 18
  for num in A:
    r *= num
    if r > max:
      return -1
  return r

print(main())


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

  if 0 in A:
    return 0

  r, max = 1, 10 ** 18
  for num in A:
    r *= num
    if r > max:
      return -1
  return r

print(main())


Verdicts: Wrong Answer

Wrong Answer

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

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

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):
def aaa(a_list):
    ans = 1
    for i in a_list:
        ans *= i
        if ans > 10**18 or ans < 0:
            return -1
    return ans

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

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

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

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

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

print(ans)

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

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

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):
from functools import reduce 
k = input()
x = [int(x) for x in input().split()] 
yes = reduce((lambda x, y: x * y), x)
if yes > 10^18:
    print (-1)
else:
    print(yes)

import math 
k = input()
x = [int(x) for x in input().split()] 
yes = math.prod(x) 
if yes > 10^18:
    print (-1)
else:
    print(yes)

res = 1

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

for x in N:
    res *= x
    if res > pow(10, 18):
        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):
input()
A = list(map(int, input().split()))
A = A.sorted()
p = 1
for i in A:
  p *= i
  if p > 10**18:
    p = -1
    break
print(p)

input()
A = list(map(int, input().split()))
A = sorted(A)
p = 1
for i in A:
  p *= i
  if p > 10**18:
    p = -1
    break
print(p)


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())
ls = list(map(int, input().split()))
if 0 in ls:
  print(0)
  return
ans = 1
for l in ls:
  ans *= l
  if ans > 1000000000000000000:
    print(-1)
    return
print(ans)

ls = list(map(int, input().split()))
ans = 1
for l in ls:
  ans *= l
  if ans > 1e18:
    print(-1)
    return
print(ans)

n = int(input())
ls = list(map(int, input().split()))
ans = 1
for l in ls:
  ans *= l
  if ans > 1e18:
    print(-1)
    return
print(ans)

def main():
  n = int(input())
  ls = list(map(int, input().split()))
  if 0 in ls:
    print(0)
    return
  ans = 1
  for l in ls:
    ans *= l
    if ans > 1e18:
      print(-1)
      return
  print(ans)
  
main()

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted