Problem:


Score : 400 points

Problem Statement

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.

Constraints

All values in input are integers.

1 \leq N \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

Print the maximum number of times the operation can be applied.

Sample Input 1

24

Sample Output 1

3

We can apply the operation three times by, for example, making the following choices:

Choose z=2 (=2^1). (Now we have N=12.)

Choose z=3 (=3^1). (Now we have N=4.)

Choose z=4 (=2^2). (Now we have N=1.)

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

We can apply the operation three times by, for example, making the following choices:

Choose z=2 (=2^1). (Now we have N=32.)

Choose z=4 (=2^2). (Now we have N=8.)

Choose z=8 (=2^3). (Now we have N=1.)

Sample Input 4

1000000007

Sample Output 4

1

We can apply the operation once by, for example, making the following choice:

z=1000000007 (=1000000007^1). (Now we have N=1.)

Sample Input 5

997764507000

Sample Output 5

7



Sample input:
24


Sample output:
3

Submission status: Wrong Answer

Solution code:
n=int(input())

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
if n==1:
    print(0)
    exit(0)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a = factorization(n)

n = len(a)

cnt =0
for i in range(n):
    if a[i][1]==1 or a[i][1]==2:
        cnt+=1
    elif a[i][1]==3 or a[i][1]==4 or a[i][1]==5:
        cnt+=2
    elif a[i][1]==6 or a[i][1]==7 or a[i][1]==8 or a[i][1]==9:
        cnt+=3
    elif a[i][1]==10 or a[i][1]==11 or a[i][1]==12 or a[i][1]==13 or a[i][1]==14:
        cnt+=4

print(cnt)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush


def solve():
    n = II()

    cd = []
    for i in range(1, int(pow(n, 0.5))+1):
        if n % i: continue
        cd.append(i)
        if n // i != i:
            cd.append(n // i)
    cd = sorted(cd)
    # print(cd)

    ans = 0
    for d in cd:
        if d == 1: continue
        if n % d == 0:
            n //= d
            # print(d, n)

            ans += 1
            # if n == 1:
            #     print(ans)
            #     return
    print(ans)

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
from collections import deque
import math
N = int(input())
# 以下の条件を全て満たすzを選ぶ
# ある素数pと正の整数eを用いてz=p**eと表すことができる
# Nがzで割り切れる
# 以前の操作で使ったものは使えない

# これを、N=N/zで繰り返し行い、何回行えるかを出力する

used_nums = deque([1])


def prime_numbers(n):
    if n < 2:
        return []

    m = (n + 1) // 2
    p = [True] * m
    for i in range(1, int((n ** 0.5 - 1) / 2) + 1):
        if p[i]:
            for j in range(2 * i * (i + 1), m, 2 * i + 1):
                p[j] = False
    # 素数のみ返す
    a = [2 * i + 1 for i in range(m) if p[i]]
    a[0] = 2
    return a


P = set(prime_numbers(int(math.sqrt(N))))
# これが素数
P = [n for n in P if (N % n) == 0]
# Nを割り切れるもののみのこす
# print(P)
ans = 0
for num in P:
    start_x = 1
    while N >= num**start_x:
        if N % num**start_x != 0:
            start_x += 1
            continue
        if N % (num**start_x) == 0:
            N = int(N / (num**start_x))
            ans += 1
            used_nums.append(num**start_x)
        start_x += 1
# print(N)
# print(used_nums)
if N not in used_nums:
    used_nums.append(N)
print(len(used_nums) - 1)

Submission status: Wrong Answer

Solution code:
history = set([])

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def func(n):
    if n == 1:
        return 
    l = make_divisors(n)
    for i in sorted(l[1:]):
        if i in history:
            continue
        if len(factorization(i)) > 1:
            continue
        history.add(i)
        _ = n // i
        func(_)
        break
    return

N = int(input())
if N == 0:
    print(0)
elif N == 1:
    print(1)
else:
    func(N)
    print(len(history))

Submission status: Wrong Answer

Solution code:
import numpy as np

def seachPrimeNum2(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    primeNum2 = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    for i in range(1,10):
      for j in primeNum:
        primeNum2.append(j**i)
    return primeNum2
def seachPrimeNum3(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    primeNum2 = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    for i in range(1,6):
      for j in primeNum:
        primeNum2.append(j**i)
    return primeNum2
def seachPrimeNum4(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    primeNum2 = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    for i in range(1,3):
      for j in primeNum:
        primeNum2.append(j**i)
    return primeNum2
P = seachPrimeNum2(1000)
P += seachPrimeNum3(10010)
P = set(P+seachPrimeNum4(1000010))
N = int(input())
ans = 0
for p in P:
  if N%p == 0:
    ans += 1
    N = N//p
  if N == 1:
    print(ans)
    exit()
print(max(1,ans))

Submission status: Wrong Answer

Solution code:
import sys
import math


def is_prime(N):
    if N == 1:
        return False
    i = 2
    while i * i <= N:
        if N % i == 0:
            return False
        i += 1
    return True

def prime(N):
    prime = []
    is_prime = [True for i in range(N+1)]  # 全て素数であると初期化
    is_prime[0] = is_prime[1] = False # 0,1は素数ではない
    for i in range(2, N+1):
        if is_prime[i]:
            # iは素数である
            prime.append(i)
            for j in range(2 * i, N+1, i):
                # iの倍数は素数でない
                is_prime[j] = False
    # N以下の素数を表示
    return prime

def main():
    N = int(input())
    if N == 1:
        print(0)
        sys.exit()
    if is_prime(N):
        print(1)
        sys.exit()
    else:
        n = math.ceil(math.sqrt(N))
        prime_list = prime(n)
        ans = []
        for i in range(len(prime_list)):
            now = prime_list[i]
            j = 1
            while now ** j <= n:
                ans.append(now ** j)
                j += 1
        ans.sort()
        count = 0
        for i in range(len(ans)):
            now = ans[i]
            if N < now:
                break
            if N % now == 0:
                count += 1
                N /= now
        print(count)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
dim = 6
prime = [1]*(10**dim+1)
from collections import Counter
p = Counter()
p_set = []
for i in range(2,10**dim+1):
    j = i
    if prime[i] != 0:
        p[i] += 1
        p_set.append(i)
        while(j <= 10**dim):
            prime[j] = 0
            j += i

N = int(input())
cnt = 0
for n in p_set:
    if n > N:
        break
    while(1):
        if N%(n**p[n])==0:
            N //= n**p[n]
            cnt += 1
            p[n] += 1
        else:
            break
if cnt == 0 and N > 1:
    cnt = 1
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
  
divs = make_divisors(n)

sNR = [1,2,3,4,5,7,8,9,11]

#print(divs)
count=0
for div in divs:
  if div in sNR:
    n /= div
    count+=1
    if n == 1:
      break

print(count)

Submission status: Wrong Answer

Solution code:
import math
import sys
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


n = int(input())
if n==1:
    print(0)
    sys.exit()
ans = 0
array = factorization(n)
#print(array)

array2 = [row[1] for row in array]

for i in array2:
    ans += math.floor(math.sqrt(2*i+9/4)-1/2)
    #print(math.floor(math.sqrt(2*i+9/4)-1/2))

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)

n=int(input().rstrip())
a=[]
tmp=n
for i in range(2,int(n**0.5)+1):
    if tmp%i==0:
        #print(i)
        while tmp%i==0:
            a.append(i)
            tmp//=i
if tmp!=1:
    a.append(tmp)
#print(a)
s=set()
t=1
for i in a:
    if i not in s:
        s.add(i)
    else:
        t*=i
    if t not in s and t>1:
        s.add(t)
        t=1
print(len(s))

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
def factorization(num):
    factor = []
    flag = True
    is_Prime= True
    if num == 1:
        is_Prime = False
    while num > 1 and flag:
        flag = False
        for i in range(int(math.sqrt(num))+2):
            k = i + 2
            if num % k == 0:
                factor.append(k)
                num = int(num / k)
                is_Prime = False
                flag = True
                break
    if is_Prime:
        factor.append(num)
    return factor
a = factorization(n)
from collections import Counter
co = Counter(a)
result = 0
for k, num in co.items():
    c = 0
    for i in range(1, num+1):
        c += i
        result += 1
        if c > num:
            result -= 1
            break
print(result)

Submission status: Wrong Answer

Solution code:
# 2020/05/31
# AtCoder Beginner Contest 169 - D

import math

# Input
n = int(input())

# Calc
wkval = n
idx = 2
ans = 0
lim = math.ceil(n**(1/2))
while(wkval > 1 and idx <= lim):
    if wkval // idx == wkval / idx:
        wkval = wkval // idx
        ans = ans + 1

    idx = idx + 1

if ans == 0 and idx > lim:
    ans = 1

if n == 1:
    ans = 0

# Output
print(ans)

Submission status: Wrong Answer

Solution code:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr
 
t=int(input())
if t==1:
  print(0)
  exit()

fac=factorization(t)
 
def pcount(a):
  p=1
  cout=0
  while a>0:
    a=a-p
    p+=1
    if a<0:break
    cout+=1
  return cout
#print(fac)
tt=0

for po in fac:
  
  cc=pcount(po[1])
  print(cc)
  tt+=cc

print(cc)

Submission status: Wrong Answer

Solution code:
N = int(input())
if N == 1:
  print(0)
  exit(0)
import math
import numpy as np
def seachPrimeNum(N):
  max = int(np.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum
target=min(1000000, N)
primenumbers=seachPrimeNum(target)
primenumbers.append(N)
cnts=[0] * 6
ans=0
for i in range(len(primenumbers)):
  for j in range(len(cnts)):
    cnt = j+1
    data = primenumbers[i]**cnt
    if N % data == 0:
      ans += 1
      N = N // data
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
for i in range(2, 10 ** 6 + 1):
    for x in range(1, 40):
        y = i ** x
        if N // y == N / y:
            ans += 1
            N = N // y
        else:
            break


if N > 10 ** 6:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
H = N
count = 0
coun = 0
flag = False
lis = list()
for i in range(2,int(math.sqrt(N))+1):
  if N % i == 0:
    flag = True
    break
if flag == True:
  for i in range(2,int(math.sqrt(N))+100000):
    if N%i == 0:
      count = 0
      while N%i == 0:
        N = N//i
        count += 1
      lis.append(count)
  M = len(lis)
  for i in range(M):
    su = 1
    for j in range(lis[i]):
      if lis[i] - su >= 0:
        lis[i] -= su
        su += 1
        coun += 1
if flag == True or H == 1:
  print(coun)
else:
  print(1)

Submission status: Wrong Answer

Solution code:
n = int(input())

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

if is_prime(n):
    print(1)
    exit()

cnt = 0
for z in range(2,10**12):
    if n % z == 0:
        n = n // z
        cnt += 1
    if n == 1 or is_prime(n) == True:
        print(cnt)
        exit()

Submission status: Wrong Answer

Solution code:
import math
N = int(input())

X = N
cnt = 0
for i in range(2, int(math.sqrt(N))):
    for j in range(1, 40):
        if X < i**j:
            break
        if (X % (i**j)) == 0:
            X = X / i**j
            cnt = cnt + 1
        else:
            break

flg = 0
if X > int(math.sqrt(N)):
    if not N < 2:
        if N == 2:
            cnt = cnt + 1
        else:
            for p in range(2, int(math.sqrt(X))):
                if X % p == 0:
                    flg = 1
                    break
            if flg == 0:
                cnt = cnt + 1
print(cnt)

Submission status: Wrong Answer

Solution code:
import sys
import collections
readline = sys.stdin.readline
 
n = int(readline().strip())
 
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)

if len(a) == 0:
  print(0)
  exit()

c = collections.Counter(a)
p = c.keys()
ans = 0
for i in p:
  v = c[i]
  m = 0
  ans += 1
  for j in range(1,v):
    m += j
    if m + j == v:
      break
    if m >= v:
      break
    else:
      ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
if n==1:
    print(0)
    quit()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
ans = 0
for f in factorization(n):
    index = f[1]
    if index<3:
        ans+=1
        continue
    num=2
    while True:
        num+=1
        if index<math.factorial(num):
            ans+=num-1
            break
print(ans)

Submission status: Wrong Answer

Solution code:
import math

n=int(input())
N=n
if n==1:
    print(0)
    exit()
ans=0
for i in range(2,int(math.sqrt(n))+1):
    if n%i==0:
        x=i#xは素数
        s=1
        while n>=1:
            #print(n,s)
            if n%(x**s)==0:
                n=n//x**s
                s+=1
                ans+=1
            else:
                break
    if n==1:
        break

    
if ans==0:
    print(1)
else:
    if n>math.sqrt(N):
        ans+=1
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

def prime(n_):
    if n_ == 1:
        return []
    num = int(pow(n_, 0.5)) + 1
    pr = [True] * (num + 1)
    pr[0], pr[1] = False, False
    for i in range(2, int(pow(num, 0.5) + 1)):
        if not pr[i]:
            continue
        for j in range(i * 2, num + 1, i):
            pr[j] = False
    return [i for i in range(num + 1) if pr[i]]

def factorization(num):
    pr = prime(num)
    data = []
    temp = num
    for i in pr:
        if temp % i == 0:
            count = 0
            while temp % i == 0:
                count += 1
                temp //= i
            data.append([i, count])
    if temp != 1:
        data.append([temp, 1])
    if data == []:
        data.append([n, 1])
    return data

def main():
    ans = 0
    pr = factorization(n)
    for i, j in pr:
        count = 1
        sub = j
        while sub >= count:
            ans += 1
            sub -= count
            count += 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())
x_list = factorization(n)
ans = 0
for x in x_list:
    n = 2
    while True:
        if x[1] < (n * n + n) // 2:
            ans += n - 1
            break 
        n += 1

print(ans)

Submission status: Wrong Answer

Solution code:
m = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

#    if temp!=1:
#        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a = factorization(m)
b = len(a)
c = b

for j in range(b):
    d = a[j][1]
    if (d >= 3) and (d <= 5):
        c = c + 1
    elif (d >= 6) and (d <= 9):
        c = c + 2
    elif (d >= 10) and (d <= 14):
        c = c + 3
    elif (d >= 15) and (d <= 20):
        c = c + 4
    elif (d >= 21) and (d <= 27):
        c = c + 5
    elif (d >= 28) and (d <= 35):
        c = c + 6
    elif (d >= 36) and (d <= 44):
        c = c + 7
    elif (d >= 45) and (d <= 54):
        c = c + 8
    elif (d >= 55) and (d <= 65):
        c = c + 9

if m == 1:
    c = 0

print(c)

Submission status: Wrong Answer

Solution code:

n = int(raw_input())
 
def f(c):
	stack = []
	cumul = 0
	step = 1
	while(cumul < c):
		stack.append(step)
		cumul += step
		step += 1
	if cumul > c: 
		while(stack):
			u = stack.pop()
			cumul -= u
			if stack:
				dd = stack[-1]
			else:
				dd = 0
			if c - dd > dd:
				stack.append(c - dd)
				break

	return len(stack)
d = 2
count = 0
on = n


for d in range(2, int(n ** 0.5) + 2):
	if n%d==0:
		c = 0
		while(n%d == 0): 
			c += 1
			n /= d
		count += f(c)
	if n == 1:
		break
if n != 1:
	print 1
else:
	print count

Submission status: Wrong Answer

Solution code:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def calcN(num):
    if num >= 45:
        return 9
    elif num >= 36:
        return 8
    elif num >= 28:
        return 7
    elif num >= 21:
        return 6
    elif num >= 15:
        return 5
    elif num >= 10:
        return 4
    elif num >= 6:
        return 3
    elif num >= 3:
        return 2
    elif num >= 1:
        return 1
    

A = int(input())
insuu =  factorization(A)
ret = 0
for i in insuu:
    ret += calcN(i[1])
print(ret)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
max_n = math.sqrt(N)

if N == 1:
    print(0)
    exit()
count = 0
for i in range(2, int(max_n+1)):
    if N % i == 0:
        count += 1
        N /= i
print(1 if count == 0 else count)

Submission status: Wrong Answer

Solution code:
import bisect
N = int(input())

base = pow(N, 1/2)
dic = {}
i = 2
li = []
now = 0
count = 0

for j in range(1, 51):
    now += j
    li.append(now)

while N != 1 and i <= base+10:
    # print(N)
    if N % i == 0:
        dic[i] = 0
        while N % i == 0:
            N /= i
            dic[i] += 1
    i += 1
# print(dic)
if len(dic.keys()) == 0:
    if N == 1:
        print(0)
    else:
        print(1)
else:
    # print(li)
    for d in dic.values():
        # print(d)
        count += bisect.bisect_right(li, d)
    print(count)

Submission status: Wrong Answer

Solution code:
#デフォルト
import itertools
from collections import defaultdict
import collections
from decimal import *
import math
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

n = int(input())

def Prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

MAX = 100010 * 3
is_prime = [False] * MAX
is_prime[0] = False
is_prime[1] = False
for i in range(2, MAX):
    if Prime(i):
        j = i * i
        is_prime[i] = True
        while j < MAX:
            is_prime[j] = True
            j *= i
if (Prime(n)):
    print("1")
else:
    ans = 0
    for i in range(2, MAX):
        if is_prime[i]:
            if n % i == 0:
                ans += 1
                n = n / i

        if n == 1:
            break

    print(ans)

Submission status: Wrong Answer

Solution code:
def solve():
    n = int(input())

    p = [2]
    A = 10000
    for L in range(3, A, 2): # 2 以外の素数は奇数なので
        if all(L % L2 != 0 for L2 in p):  # すべての既存素数で割り切れなかったら素数
            p.append(L)
    z = []
    for i in p:
        for e in range(1, 20):
            if n%i**e == 0 and i**e not in z:
                n /= i**e
                z.append(i**e)
    if not z: z.append(n)
    return len(z)
    

print(solve())

Submission status: Wrong Answer

Solution code:
def divisor(x):
    ret = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            ret.append(i)
            ret.append(x // i)
    return sorted(list(set(ret)))

def prime_factor(n):
    ass = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            ass.append(i)
            n = n // i
    if n != 1:
        ass.append(n)
    return len(set(ass))==1

n = int(input())

div = divisor(n)[1:]

l=[]
for i in div:
    if prime_factor(i):
        l.append(i)

ans = 0
for i in div:
    if n % i == 0:
        ans += 1
        n //= i
 
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
from itertools import combinations
import numpy as np

# 引用元
# https://note.nkmk.me/python-prime-factorization/
def prime_factorize(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

def get_list(counter, index):
    ans = []
    for key, val in sorted(counter.items()):
        if val > index:
            ans += [key] * index
        else:
            ans += [key] * val
    return ans

def choice_min_data(counter, min_num):
    temp = sum(counter.values())
    temp_min_num = 10**12
    co_li = None
    for index in range(1, temp+1):
        flag = False
        to_comb_list = get_list(counter, index)
        for co in combinations(to_comb_list, index):
            check_val = np.prod(co)
            if temp_min_num > check_val > min_num:
                co_li = co
                temp_min_num = check_val
                flag = True
                break

        # 最小更新せず = 終了
        if co_li is not None and flag == False:
            break

    if co_li is None:
        return None, -1
    else:
        # print(co_li, temp_min_num)
        return counter - Counter(co_li), temp_min_num

def main():
    # ルール
    # 素数p, 整数e: z == p ** e
    # N / z = int(x)
    # zは被らない
    # N を N/zに置き換える
    N = int(input())

    if N <= 1:
        print(0)
        return

    counter = Counter(prime_factorize(N))
    # print(counter)
    ans = 0
    min_num = 0
    while counter is not None:
        counter, min_num = choice_min_data(counter, min_num)
        if min_num == -1:
            break
        ans += 1
    
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
aaa = 2
maxi = 2
def prime(aaa):
    if n != 1:
        i = 2
        while i*i <= aaa:
            if aaa % i == 0:
                return False
            i += 1
        return True
    else:
        return False
def divisors(a, i):
    global ans, aaa, maxi
    while i*i <= n:
        if a % i == 0:
            ans += 1
            num = a / i
            aaa = num
            if maxi <= i:
                maxi = i
            divisors(num, i+1)
            break
        i += 1
def divisors2(a, i):
    global ans
    while i <= a:
        if a >= 10**6 + 1:
            if prime(a):
                ans += 1
            break
        elif a % i == 0:
            ans += 1
            num = a / i
            divisors2(num, i+1)
            break
        i += 1
if n == 1:
    print(0)
else:
    if prime(n):
        print(1)
    else:
        divisors(n, 2)
        divisors2(aaa, maxi + 1)
        print(ans)

Submission status: Wrong Answer

Solution code:
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

sosuu = primes(1000100)
count = [0] * (len(sosuu) + 10)
convert = [0] * 56

N = int(input())
ans = 0

flag = True
while (flag):
        flag = False
        for i in range(len(sosuu)):
                if N % sosuu[i] == 0:
                        N = N // sosuu[i]
                        count[i+1] += 1
                        flag = True

tmp = 0
for i in range(1, 11):
        tmp += i
        convert[tmp] = i
for i in range(1, len(convert)):
        if convert[i] == 0:
                convert[i] = convert[i - 1]

for i in count:
        ans += convert[i]

if N > sosuu[-1] and ans == 0:
        ans = 1
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())

def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = sorted(list(set(table)))
    return table[1:]

lis=divisor(N)
count=0
for z in lis:
    if N % z ==0:
        N=N/z
        count+=1
print(count)

Submission status: Wrong Answer

Solution code:
import math
def yakusuu(num):
    min = 1
    flag = 0
    for i in range(2, num+1):
        if num % i == 0:
            if min == 1:
                min = i
            if i % min != 0:
                print(i)
                flag = 1
                break
    if flag == 0 and num != 1:
        return True
    else:
        return False
n = int(input())
max = math.sqrt(n)
max = int(max)
count = 0
for i in range(2,max+1):
    if n < i :
        break
    if n % i == 0 and yakusuu(i):
        n = n // i
        count += 1

if count == 0 and n != 1:
    count = 1
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0

if N % 2 == 0:
    i = 1
    while N % 2**i == 0:
        N //= 2**i
        ans += 1
        i += 1

if N % 3 == 0:
    i = 1
    while N % 3**i == 0:
        N //= 3**i
        ans += 1
        i += 1

if N % 5 == 0:
    i = 1
    while N % 5**i == 0:
        N //= 5**i
        ans += 1
        i += 1

if N % 7 == 0:
    i = 1
    while N % 7**i == 0:
        N //= 7**i
        ans += 1
        i += 1

if N % 11 == 0:
    i = 1
    while N % 11**i == 0:
        N //= 11**i
        ans += 1
        i += 1

if N % 13 == 0:
    i = 1
    while N % 13**i == 0:
        N //= 13**i
        ans += 1
        i += 1

def prime_factorize(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 set(a)

prime_list = prime_factorize(N)

if prime_list:
    for prime_num in prime_list:
        if N % prime_num == 0:
            i = 1
            while N % prime_num**i == 0:
                N //= prime_num**i
                ans += 1
                i += 1
# print(N)
# print(prime_list)
print(ans)