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
if 0 in A:
    print(0)
    exit()

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
if 0 in A:
    print(0)
else:
    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())

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

result = aList[0]

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

enemy = 10 ** 18

if result < enemy:
  print(result)
else:
  print(-1)

n = int(input())

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

result = aList[0]

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

enemy = 10 ** 18

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

n = int(input())

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

result = aList[0]

for i + 1 in range(n):
  result = result * aList[i]

enemy = 10 ** 18

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

n = int(input())

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

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

  enemy = 10 ** 18

  if result < enemy:
    print(result)
  else:
    print(-1)

n = int(input())

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

result = 0

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

enemy = 10 ** 18

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

n = int(input())

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

if 0 in aList:
  print(0)
else:
  for i in range(n):
    if i == 0:
      continue
    result = result * aList[i]
    if result > 10 ** 18:
      result = -1
      break
  print(result)

n = int(input())

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

result = 0

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

enemy = 10 ** 18

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

n = int(input())

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

result = 0

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

enemy = 10 ** 18

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

n = int(input())

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

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

  enemy = 10 ** 18

  if result < enemy:
    print(result)
  else:
    print(-1)

n = int(input())

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

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

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

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


if ans > 10**18:
    ans = -1
elif min(A) == 0:
    ans = 0

print(ans)

import numpy as np

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

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

print(ans if ans < x else -1)

n = int(input())
a = list(map(int, input().split()))
x = 10**18
ans = 1

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

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

if 0 in l:
    print("0")
else:
    for i in range(n):
        ans*= l[i]
        if ans>= 10**18:
            break
    if ans>= 10**18:
        print("-1")
    else:
        print(ans)

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

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
an = list(map(int, input().split()))
s = 1
flg = False
for a in an:
  s = s * a
  if s > 10**8 or s< 0:
    flg = True
    break
if flg:
  print(-1)
else:
  print(s)

n = int(input())
an = list(map(int, input().split()))
s = 1
flg = False
for a in an:
  s = s * a
  if s > 10**18 or s< 0:
    flg = True
    break
if 0 in s:
  print(0)
elif flg:
  print(-1)
else:
  print(s)

n = int(input())
an = list(map(int, input().split()))
s = 1
flg = False
for a in an:
  s = s * a
  if s > 10**18 or s< 0:
    flg = True
    break
if 0 in an:
  print(0)
elif flg:
  print(-1)
else:
  print(s)


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

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

main ()

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

main()

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

if __name__ == "__main__":
    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 ()

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

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

if __name__ == "__main__":
    main()

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

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

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

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())
lim = 10**18
ans,exc = 1,False
a = map(int,input().split())
if 0 in a:
  print(0)
else:
  for x in a:
    ans *= int(x)
    if ans > lim:
      exc = True
      print("-1")
      break
  if not exc:
    print(ans)


n = int(input())
a = list(map(int,input().split()))
res = 1
exc = False
for i in a:
	res *= i
	if res > 10**18:
      exc = True
      print(-1)
if not exc:
  print(res)

n = int(input())
lim = 10**18
ans,exc = 1,False
a = list(map(int,input().split()))
# print(a)
if 0 in a:
  print(0)
else:
  for x in a:
    ans *= x
    if ans > lim:
      exc = True
      print("-1")
      break
  if not exc:
    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, *l = map(int, open(0).read.split())

a = 1
for i in l:
	a *= i
	if a > 1e18:
		a =-1
		break
print(a)
	

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

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

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

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

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

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

if((0 in A_list) ==True):
  print("0")
  exit()
  
ans = 1
for i in range(N):
  if(ans<10**18):
    ans = ans * A_list[i]
  else:
    print("-1")
    exit()
    
if(ans<10**18):
    print(ans)
else:
  print("-1")


N = int(input())

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

if((0 in A_list) ==True):
  print("0")
  exit()
  
ans = 1
for i in range(N):
  if(ans<=10**18):
    ans = ans * A_list[i]
  else:
    print("-1")
    exit()
    
if(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):
import numpy as np

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


ans = np.prod(a)

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


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

for b in a:
    if b:
        ans *= b
        if ans > pow(10, 18):
            ans = -1
            break
    else:
        ans = 0
        break

print(ans)


Verdicts: Wrong Answer

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

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

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

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

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

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

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


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

print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
def main():
    n = int(stdin.readline())
    a = list(map(int,stdin.readline().split()))
    f = 1
    flag=0
    a = sorted(a)
    for i in range(n):
        f = f*a[i]
        if f>10**18:
            flag=1
            break
    if flag:
        print("-1")
    else:
        print(f)

main()

from sys import stdin, stdout
from collections import defaultdict

def main():
    n = int(stdin.readline())
    a = list(map(int,stdin.readline().split()))
    f = 1
    flag=0
    a = sorted(a)
    for i in range(n):
        f = f*a[i]
        if f>10**18:
            flag=1
            break
    if flag:
        print("-1")
    else:
        print(f)

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):
import numpy as np
 
N = input()
s = input().split()
k = [int(_) for _ in s]
p = np.prod(k)
if 0 in k:
    print(0)
 
if p < 10**18:
    print(p)
else:
    print(-1)

import numpy as np

N = input()
s = input().split()
k = [int(_) for _ in s]
p = np.prod(k)

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

N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
Ax = 1
i = 0
while Ax <= 10**18:
    Ax *= A[i]
    i += 1
    if i == N-1:
        print(Ax)
        exit()
print(-1)

import numpy as np

N = input()
s = input().split()
k = [int(_) for _ in s]
p = np.prod(k)

if p < 10**18:
    print(p)
else:
    print('-1')

import numpy as np

N = int(input())
s = input().split()
k = [int(_) for _ in s]
p = np.prod(k)

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

import sys
N = int(input())
L = list(map(int, input().split()))
cnt = 1
if 0 in L:
    print(0)
    sys.exit()
for i in range(N):
    cnt *= L[i]
    if cnt > 10^18:
        print(-1)
        sys.exit()
print(cnt)


N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
Ax = 1
i = 0
while Ax > 10**18:
    Ax *= A[i]
    if i == N-1:
        print(Ax)
        exit()
    i += 1
print(-1)

import numpy as np

N = int(input())
s = input().split()
k = [int(_) for _ in s]
p = np.prod(k)

if p < 10**18:
    print(p)
else:
    print('-1')

import numpy as np
 
N = input()
s = input().split()
k = [int(_) for _ in s]
p = np.prod(k)
if 0 in k:
    print(0)
 
elif p < 10**18:
    print(p)
else:
    print(-1)

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


Verdicts: Wrong Answer

Wrong Answer

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):
#! /usr/bin/env python3
input()
l = 10**18
a = 1
for i in map(int, input()):
    a *= i
    if a > l:
        a = -1
        break
print(a)

#! /usr/bin/env python3
input()
l = 10**18
a = 1
*b, = map(int, input().split())
if 0 in b:
    a = 0
else:
    for i in b:
        a *= i
        if a > l:
            a = -1
            break
print(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):
#B
N = int(input())
A = list(map(int, input().split()))
result = 1
for i in range(len(A)):
    result *= A[i]
if result >=10**18:
    print(-1)
else:
    print(result)

#B
unti()

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

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

Verdicts: Wrong Answer

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):
    if A[i] == 0:
        ans = 0
        break
    else:
        ans *= A[i]
  
if ans < 1000000000000000000:
    print(ans)
else:
    print(-1)

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:
            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()))
 
ans=1
c=0
 
while c<N:
    if A[c]==0:
        ans=0
    elif ans>10000000000000000/A[c]:
        ans=10000000000000001
    else :
        ans=ans*A[c]
    
    c+=1
    
if ans>10000000000000000: print(-1)
else: print(ans)

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

ans=1
c=0

while c<N:
    if A[c]==0:
        ans=0 break;
    else if ans*A[c]>10000000000000000:
        ans=10000000000000001
    else :
        ans=ans*A[c]
    
    c+=1
    
if ans>10000000000000000: print(-1)
else: print(ans)

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

ans=1
c=0

while c<N:
    ans=ans*A[c]
    c+=1
    
if ans>10000000000000000: print(-1)
else: print(ans)

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

ans=1
c=0

while c<N:
    if A[c]==0: ans=0 break;
    else if ans*A[c]>10000000000000000: ans=10000000000000001
    else :
        ans=ans*A[c]
    
    c+=1
    
if ans>10000000000000000: print(-1)
else: print(ans)

N = int(input())
A=list(map(int, input().split()))
 
ans=1
c=0
 
while c<N:
    if A[c]==0:
        ans=0
    elif ans*A[c]>10000000000000000:
        ans=10000000000000001
    else :
        ans=ans*A[c]
    
    c+=1
    
if ans>10000000000000000: print(-1)
else: print(ans)

N = int(input())
A=list(map(int, input().split()))
 
ans=1
c=0
 
while c<N:
    if A[c]==0:
        ans=0
    elif ans*A[c]>1000000000000000000:
        ans=1000000000000000001
    else :
        ans=ans*A[c]
    
    c+=1
    
if ans>1000000000000000000: print(-1)
else: print(ans)

Verdicts: Wrong Answer

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

for e in a:
    sum_a *= e

if sum_a > 10e18:
    sum_a = -1

print(sum_a)


a = list(map(int, input().split()))
sum_a = sum(a)
if sum_a > 10e18:
    sum_a = -1

print(sum_a)

import sys

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

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

for e in a:
    sum_a *= e
    if sum_a > 1e18:
        print(-1)
        sys.exit()

if sum_a > 1e18:
    sum_a = -1

print(sum_a)

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
import collections

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

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

counter = collections.Counter(A)
ans = 1
for k, v in counter.items():
  ans *= k * v
if ans > 10**18:
  print(-1)
else:
  print(ans)

import collections

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

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

counter = collections.Counter(A)
ans = 1
for k, v in counter.items():
  ans += k * v
if ans > 10**18:
  print(-1)
else:
  print(ans)

import collections

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

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

counter = collections.Counter(A)
ans = 0
for k, v in counter.items():
  ans += k * v
if ans > 10**18:
  print(-1)
else:
  print(ans)

from operator import mul
from functools import reduce

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

ans = reduce(mul, A)
if ans >= 10**18:
  print(-1)
else:
  print(ans)

import numpy as np

n = int(input())
ans = np.array(list(map(int, input().split()))).prod()

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

import math
a, b = map(float, input().split())
print(math.floor(a*b))

def main():
  ## IMPORT MODULE
  #import sys

  
  #input=lambda :sys.stdin.readline().rstrip()

  #f_inf=float("inf")
  #MOD=10**9+7
  
  if 'get_ipython' in globals(): 
    ## SAMPLE INPUT
    n = 2
    A = [1000000000, 1000000000]

  else:
    ##INPUT 
    n = input()
    A = list(map(int, input().split()))

  ## SUBMITION CODES HERE
  if 0 in A:
    print(0)
    exit()
  
  ans = 1
  for a in A:
    ans *= a
    if ans > 10**18:
      ans = -1
      break
  
  print(ans)
    
main()

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

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

Verdicts: Wrong Answer

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

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

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

N = int(input())
MM = input().split()
total = 1
for i in MM:
  total = total*int(i)

  if total > 10**18:
    break
for i in MM:
  if int(i) == 0:
    total = 0
if total > 10**18:
  print(-1)
else:
  print(total)
  

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 = ans * a[i]
    if len(str(ans))>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 = ans * a[i]
    if len(str(ans))>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 = 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):
N = int(input())
m,k = input().split()
result=int(m)*int(k)
print("%d"%result)
if result>=10**18:
    print("-1")





N = int(input())
m,k = input().split()
result=int(m)*int(k)
print("%d"%result)
if result>=10**18:
    print("-1")





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

for S in B:
    result *= S
    if result > 10**18:
        print(-1)
        exit()
print("%d"%result)


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

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

        return ans

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

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

        return ans


if __name__=="__main__":
        ans = main()
        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):
import itertools
import operator

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

if 0 in ms:
  r = 0
else:
  r = itertools.reduce(operator.mul, li)
if r > 10 ** 18:
  r = -1
print(r)

n = int(input())
ms = list(map(int, input().split()))
iter_ms = iter(ms) 
r = 1
if 0 in ms:
  r = 0
else:
    for i in range(n):
        x = next(iter_ms)
        r *= x
        if r > 10 ** 18:
            r = -1
            break
        
print(r)

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 solve():
    n = int(input())
    a = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    x = 1
    for tmp in a:
        x *= tmp
        if x > 1000000000000000000:
            print(-1)
            return
    print(x)

solve()

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    if 0 in a:
        print(0)
        return
    x = 1
    for tmp in a:
        x *= tmp
        if x > 1000000000000000000:
            print(-1)
            return
    print(x)

solve()

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

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

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

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

n=int(input())
a=list(map(int,input().split()))
a.sort()
i=n-1
res=1
z=10**18
for i in a:
    if(i==0):
        res=0
        break
while(i>=0):
    if(res>z/a[i]):
        res=z+1
        break
    res*=a[i]
    if(a[i]>z):
        break
    i-=1
if(res>z):
    res=-1
print(res)

n=int(input())
a=list(map(int,input().split()))
a.sort()
res=1
z=10**18
for i in a:
    if(i==0):
        res=0
        break
i=n-1
while(i>=0):
    if(a[i]==0):
        res=0
        break
    if(res>z/a[i]):
        res=z+1
        break
    res*=a[i]
    if(a[i]>z):
        break
    i-=1
if(res>z):
    res=-1
print(res)

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):
import numpy as np
import functools
import operator

prod2 = functools.partial(functools.reduce, operator.mul)

n = int(input())
nums = list(map(int, input().split()))
print(nums)

val = prod2(nums)

if val > 1e18:
    val = -1

print(val)


import numpy as np
import functools
import operator

prod2 = functools.partial(functools.reduce, operator.mul)

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

# val = prod2(nums)

val = 1
if 0 in nums:
    val = 0

else:
    for num in nums:
        val *= num
    
        if val > 1e18:
            val = -1
            break


print(val)


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(float,input().split())
print(int((a*b)//1))

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


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


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


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



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


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

s = 1
mod = pow(10, 18)
for i in a:
    s = s*i
    if s < mod:
        print(-1)
        exit()
else:
    print(s)


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

s = 1
mod = pow(10, 18)

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

for i in a:
    s = s*i
    if s > mod:
        print(-1)
        exit()
else:
    print(s)


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

using namespace std;

int main ()
{
	long n, a;
	long ret = 1;
	bool flag = true;

	cin >> n;

	for (int i=0; i<n; i++) {
		cin >> a;
		if (a == 0) {
			cout << 0 << endl;
			return 0;
		}
		ret *= a;
		if (ret <= 0 || 1000000000000000000 < ret) {
			flag = false;
		}
	}

	if (flag == false) {
		cout << -1 << endl;
	} else {
		cout << ret << endl;
	}

	return 0;
}


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

if '0' in A:
    ans = 0
    print(ans)
    exit()

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

print(ans)


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

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

print(ans)

N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 1
check = 10 ** 18

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

print(ans)

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N=int(input)
s=list(map(int,input().split()))
ans=1
for i in s:
  ans*=i
  if ans>10e18:
    print('-1')
    break
print(ans)

N=int(input)
s=list(map(input().split()))
ans=1
for i in s:
  ans*=i
  if ans>10e18:
    print('-1')
    break
print(ans)

N=int(input())
s=list(map(int,input().split()))
ans=1
if s.count(0)>0:
  print('0')
  exit()
for i in s:
  ans*=i
  if ans>1000000000000000000:
    print('-1')
    exit()

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

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

import decimal
N = int(input())
A = list(input().split())

ans = 1
for i in range(len(A)):
    ans *= decimal.Decimal(A[i])
    
if(len(str(ans)) >= 18):
    print(-1)
else:
    print(ans)

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

aa = set(A)
ans = 1
for i in range(len(A)):
    if(len(str(ans)) >= 18):
        if(0 not in aa):
            ans = -1
            break
        else:
            ans = 0
    ans *= A[i]

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

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

aa = set(A)
ans = 1
for i in range(len(A)):
    if(ans > 10**18):
        if(0 not in aa):
            ans = -1
            break
        else:
            ans = 0
    ans *= A[i]

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

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

n = int(input())
A = sorted(map(int,input().split()), reverse = True)

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

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

rslt = 1

for v in vals:
  rslt = rslt * v
  
  if rslt > 10 ** 18:
    print(-1)
	import sys
    sys.exit()
    
print(rslt)
    


N = int(input())
vals = [int(v) for v in input().split()]

rslt = 1

if 0 in vals:
  rslt = 0

for v in vals:
  rslt = rslt * v
  
  if rslt > 10 ** 18:
    rslt = -1
    break

print(rslt)
    


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
for i in a:
    s = s*i
if s > 10**18:
    print('-1')
else:
    print(s)

n = int(input())

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

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

n = int(input())

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

s = 1
for i in a:
    s = s*i
    s = min(s,10**18+1)
if s == 10**18+1:
    print('-1')
else:
    print(s)

Verdicts: Runtime Error

Runtime Error

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

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

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

if ans > 1000000000000000000:
    print(-1)    
elif ans < 1000000000000000000:
    print(ans)

def main():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A:
        print(0)
        return

    ans = 1
    for i in A:
        ans *= i
        if ans > 1000000000000000000:
            print(-1)
            return
    print(ans)
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(inut())
x = [input() for i in range(n)]

ans = 1
for i in x:
  ans = ans*i
  
print(ans)


from functools import reduce
from operator import add, mul
 
n=int(input())
x=list(map(int, input().split()))
 
ans=reduce(mul, x)
  
if ans>=1000000000000000000:
  ans=-1
print(ans)


n=int(input())
x=list(int(input().split())
 
ans = 1
for i in x:
  ans = ans*i
  
if ans > 1000000000000000000:
  ans = -1
print(ans)


n=int(input())
x=[int(input()) for i in range(n)]
 
ans=1
for i in x:
  ans = ans*i
  
if ans > 1000000000000000000:
  ans=-1
print(ans)

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

ans=1
if 0 in x:
  print(0)
  break
  for i in x:
    ans=ans*i  
if ans>=1000000000000000000:
  ans=-1
print(ans)

n = int(input())
x = [int(input().split()) for i in range(n)]
 
ans = 1
for i in x:
  ans = ans*i
  
if ans > 1000000000000000000:
  ans = -1
print(ans)

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

n = int(input())
x = [int(input()) for i in range(n)]

ans = 1
for i in x:
  ans = ans*i
  
if ans > 1000000000000000000:
  ans = -1

print(ans)


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

n = int(input())
x = [input() for i in range(n)]

ans = 1
for i in x:
  ans = ans*i
  
if ans > 1000000000000000000:
  ans = -1

print(ans)

n = int(inut())
x = [input() for i in range(n)]

ans = 1
for i in x:
  ans*i
  
print(ans)

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

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

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

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

for i in a:
  result = i * result
  
if result >= 1000000000000000000:
  result = -1

print(result)


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

Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N. Consider repeatedly applying the operation below on N:    * First, choose a positive integer z satisfying all of the conditions below:     * z can be represented as z=p^e, where p is a prime number and e is a positive integer;     * z divides N;     * z is different from all integers chosen in previous operations.   * Then, replace N with N/z.  Find the maximum number of times the operation can be applied.

Submission attempts (in order):
import math
a=int(input())
b=[]
ans=0
for i in range(1,int(math.sqrt(a)),1):
  if a%i==0:
    b=b+[i]+[int(a/i)]
b.remove(1)
for i in b:
  cnt=0
  if a%i==0:
    while a%i==0:
      cnt+=1
      a=a/i
    ans+=(math.sqrt(2*cnt+0.25)-0.5)//1
print(int(ans))

import math
a=int(input())
ans=0
for i in range(1,int(math.sqrt(a)),1):
  if a%i==0 and not i==1:
    cnt=0
    while a%i==0:
      cnt+=1
      a=a/i
    ans+=(math.sqrt(2*cnt+0.25)-0.5)//1
if not a==1:
  print(int(ans+1))
else:
  print(int(ans))

Verdicts: Runtime Error

Accepted
Problem: Given is a positive integer N. Consider repeatedly applying the operation below on N:    * First, choose a positive integer z satisfying all of the conditions below:     * z can be represented as z=p^e, where p is a prime number and e is a positive integer;     * z divides N;     * z is different from all integers chosen in previous operations.   * Then, replace N with N/z.  Find the maximum number of times the operation can be applied.

Submission attempts (in order):
from functools import reduce
def divgame(n):    
    r=set(reduce(list.__add__, 
                ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))
    r=len(r)
    if r%2==0:
        return r/2
    else:
        return (r-1)/2
inp=int(input())
print(int(divgame(inp)))

import math 
def prime(n):
    d = {}
    if n%2==0:
        d[2]=0
    while n % 2 == 0: 
        d[2]+=1
        n = n / 2
    for i in range(3,int(math.sqrt(n))+1,2):
        if n%i==0:
            d[i]=0
        while n % i== 0: 
            d[i]+=1
            n = n / i 
    if n > 2:
        d[n]=1
    return d
def maxsum(di):
    ans = 0
    for i in di.items():
        c = 1
        x = 0
        y = i[1]
        while y-c>=0:
            #print(y, c, x)
            y-=c
            c+=1
            x+=1
        ans+=x
    return ans
di = prime(int(input()))
#print(di)
print(maxsum(di))


Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N. Consider repeatedly applying the operation below on N:    * First, choose a positive integer z satisfying all of the conditions below:     * z can be represented as z=p^e, where p is a prime number and e is a positive integer;     * z divides N;     * z is different from all integers chosen in previous operations.   * Then, replace N with N/z.  Find the maximum number of times the operation can be applied.

Submission attempts (in order):
n = int(input())
b = n
def pf(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
l = list(set(pf(n)))
cnt = 0
for i in l:
    n = b
    t = 1
    j = i
    while i <= n:
        if n % i == 0:
            cnt += 1
            n = n // i
            a.append(i)
        i *= j
print(cnt)

n = int(input())
b = n
def pf(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
l = list(set(pf(n)))
cnt = 0
for i in l:
    n = b
    t = 1
    j = i
    while i <= n:
        if n % i == 0:
            cnt += 1
            n = n // i
        i *= j
print(cnt)

Verdicts: Runtime Error

Accepted
Problem: Given is a positive integer N. Consider repeatedly applying the operation below on N:    * First, choose a positive integer z satisfying all of the conditions below:     * z can be represented as z=p^e, where p is a prime number and e is a positive integer;     * z divides N;     * z is different from all integers chosen in previous operations.   * Then, replace N with N/z.  Find the maximum number of times the operation can be applied.

Submission attempts (in order):
import os

N = int(input())

def prime_fact(value):
    
    import math
    prime_list = {}
    prime = 2
    loop_num = 0
    while 1:
        loop_num+=1
        if math.sqrt(value)<loop_num:
            prime_list[int(value)] = 1
            break
        if value%prime==0:
            value/=prime
            if prime in prime_list.keys():
                prime_list[prime]+=1
            else:
                prime_list[prime]=1
        else:
            prime+=1
        if value == 1:
            break
    return prime_list

def sieve(max_num):
    
    droped = []
    uniqued = []
    prime_list = list(range(2, max_num+1))
    for i, current_num in enumerate(prime_list):
        if current_num in droped:
            continue
        else:
            uniqued.append(current_num)
        if i+1>=len(prime_list):
            break
        for num in prime_list[i+1:]:
            if num in droped:
                continue
            if num%current_num==0:
                droped.append(num)
    return uniqued

tmp = prime_fact(N)
result = 0
for prime, num in tmp.items():
    diff = 1
    while num>0:
        num-=diff
        if num<0:
            break
        diff+=1
        result+=1
print(result)


import os

N = int(input())

def prime_fact(value):
    
    import math
    prime_list = {}
    prime = 2
    loop_num = 0
    while 1:
        if int(math.sqrt(value))+100<loop_num:
            prime_list[int(value)] = 1
            break
        if value%prime==0:
            value/=prime
            if prime in prime_list.keys():
                prime_list[prime]+=1
            else:
                prime_list[prime]=1
        else:
            prime+=1
        if value == 1:
            break
        loop_num+=1
    return prime_list

def sieve(max_num):
    
    droped = []
    uniqued = []
    prime_list = list(range(2, max_num+1))
    for i, current_num in enumerate(prime_list):
        if current_num in droped:
            continue
        else:
            uniqued.append(current_num)
        if i+1>=len(prime_list):
            break
        for num in prime_list[i+1:]:
            if num in droped:
                continue
            if num%current_num==0:
                droped.append(num)
    return uniqued

tmp = prime_fact(N)
result = 0
for prime, num in tmp.items():
    diff = 1
    while num>0:
        num-=diff
        if num<0:
            break
        diff+=1
        result+=1
print(result)


Verdicts: Wrong Answer

Accepted