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

Solution code:
import math 
def primeFactors(n):
    pf = []
    while n % 2 == 0: 
        pf.append(2) 
        n = n / 2 
    for i in range(3,int(math.sqrt(n))+1,2): 
        while n % i== 0: 
            pf.append(i) 
            n = n / i 
    if n > 2: 
        pf.append(n) 
    return pf
n = int(input())
pf = primeFactors(n)

dic = {}
for i in pf:
    try:
        dic[i] += 1
    except:
        dic[i] = 1
ans = 0
for i in dic:
    c = dic[i]
    tmp = (((1 + 8 * c) ** (0.5)) - 1) // 2
    ans += tmp
print(int(ans))

Submission status: Accepted

Solution code:
import math

N = int(input())
ans = 0
Flag = True

def prime_fac(n):
  p_lis = []
  temp = n

  for i in range(2, int(math.sqrt(n)) + 1):
    if temp % i == 0:
      cnt = 0
      while temp % i == 0:
        cnt += 1
        temp //= i
      p_lis.append([i, cnt])
  
  #割り切れてなかったら残り(temp)は素数
  if temp != 1:
    p_lis.append([temp, 1])

  #素数だったら自身が1つ
  if p_lis == []:
    p_lis.append([n, 1])

  return p_lis

def f(n):
  cnt = 0
  i = 1
  temp = n - 1
  while temp >= 0:
    cnt += 1
    i += 1
    temp -= i
  return cnt

if N == 1:
  Flag = False
else:
  L = prime_fac(N)
  for P in L:
    ans += f(P[1])

if Flag:
  print(ans)
else:
  print(0)

Submission status: Accepted

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 getnum(n):
    ret = 1
    _sum = 1
    while True:
        if _sum > n:
            return ret-1
        ret += 1
        _sum += ret

def main():
    n = int(input())
    aa = factorization(n)
    ret = 0
    for a in aa:
        if a[0] == 1:
            continue
        ret += getnum(a[1])
    print(ret)

if __name__=="__main__":
    main()

Submission status: Accepted

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

n = int(input())
ans = 0
if n == 1:
    ans = 0
else:
    bunkai = factorization(n)
    for i in bunkai:
        if i[1] < 3:
            ans += 1
        elif i[1] < 6:
            ans += 2
        elif i[1] < 10:
            ans += 3
        elif i[1] < 15:
            ans += 4
        elif i[1] < 21:
            ans += 5
        elif i[1] < 28:
            ans += 6
        elif i[1] < 36:
            ans += 7
        elif i[1] < 45:
            ans += 8
        else:
            ans += 9

print(ans)

Submission status: Accepted

Solution code:
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]
n = int(input())
l = make_divisors(n)
ans = 0
for i in range(1, len(l)):
    cnt = 0
    while n % l[i] == 0:
        cnt += 1
        n //= l[i]
    i = 1
    while True:
        if cnt - i >= 0:
            ans += 1
            cnt -= i
            i += 1
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())

def trial_division(n):
    prime_factors = list()
    while n % 2 == 0:
        prime_factors.append(2)
        n //= 2
    p = 3
    while p * p <= n:
        if n % p == 0:
            prime_factors.append(p)
            n //= p
        else:
            p += 2
    if n != 1:
        prime_factors.append(n)
    return prime_factors

C = Counter(trial_division(N))
ans = 0
for key,value in C.items():
    check = 0
    for i in range(1,value+1):
        check = (i * (i + 1))//2
        if value >= check:
            ans += 1
        else:
            break
print(ans)

Submission status: Accepted

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

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
if N==1:
  print(0)
else: 
	count=0  
	k=[1,3,6,10,15,21,28,36,45,55]
	l=factorization(N)
	#print(l)
	for i in l:
  		q=bisect.bisect(k,i[1])
  		count+=q
  
	print(count)

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors = {}
    tmp = n
    for div in range(2, int(n**0.5)+1):
        if n % div == 0:
            divisors[div] = 0
        while n % div == 0:
            n //= div
            divisors[div] += 1
        div += 1
    if n > 1:
        divisors[n] = 1
    return divisors

def resolve():
    n = int(input())
    div = make_divisors(n)
    ans = 0
    for k,v in div.items():
        cnt = 1
        while v >= cnt:
            ans += 1
            v -= cnt
            cnt += 1
    print(ans)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
from sys import stdin
from copy import deepcopy
from functools import reduce
from fractions import gcd
import math
import itertools
from collections import Counter
from itertools import chain  ##list(chain.from_iterable(l)) ##flatten
from heapq import heappush, heappop
import bisect

"""
N = int(input())
A, B = map(int,input().split())
A = list(map(int,input().split())) ## 横一列
A = [int(input()) for _ in range(N)] ## 縦一列
lst = [list(map(int,input().split())) for i in range(M)] ## 二次元
"""

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

div = factorization(N)
#print(div)

ans = 0
for i in range(len(div)):
  x = div[i][1]
  var = int((-1 + math.sqrt(1 + 8*x)) / 2)
  ans += var
  #print(x, var)
  

print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
if N <= 1:
    print(0)
    exit()

L = math.ceil(math.sqrt(N)) + 1
isPrime = [True] * L
isPrime[0] = isPrime[1] = False
primes = []
for n in range(2, L):
    if isPrime[n]:
        primes.append(n)
        isPrime[2*n::n] = [False] * ((L-n-1) // n)

ans = 0
for p in primes:
    d = p
    while N % d == 0:
        ans += 1
        N //= d
        d *= p
    while N % p == 0:
        N //= p

if N != 1:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import collections
n=int(input())

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

c = collections.Counter(prime_factorize(n))

def cnt(n,c):
    ans=0
    a=1
    for i in c.keys():
        b=1
        while c[i]-b>=0:
            ans+=1
            c[i]-=b
            b+=1
    return ans

print(cnt(n,c))

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

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)
    exit(0)
factors = factorization(n)

ans = 0
for pair in factors:
    p = pair[0]
    num = pair[1]
    cnt = 1
    while True:
        num -= cnt
        if num < 0:
            break
        cnt += 1
    ans += (cnt-1)
print(ans)

Submission status: Accepted

Solution code:
def factor(n):
    table = []
    i = 2
    while i * i <= n:
        if n % i == 0:
            cnt = 0
            while n % i == 0:
                n //= i
                cnt += 1
            table.append((i, cnt))
        i += 1
    if n > 1:
        table.append((n, 1))
    return table

N = int(input())

F = factor(N)

ans = 0
for _, e in F:
    x = 1
    while not (x * (x + 1) <= 2 * e < (x + 1) * (x + 2)):
        x += 1
    ans += x

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N == 1:
  print(0)

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

      if temp!=1:
          arr.append(1)

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

      return arr

  f = factorization(N)
  ans = 0

  for i in range(1,100):
    f = list(map(lambda x:x-i,f))
    ans += len([j for j in f if j >= 0])

  print(ans)

Submission status: Accepted

Solution code:
N=int(input())
# https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8
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 test(a):
    ret=0
    c=1
    while True:
        if a<ret+c:
            break
        else:
            ret+=c
            c+=1
    return c-1

if N==1:
    print(0)
    exit()

a=factorization(N) 
ans=0
for p,q in a:
    ans+=test(q)
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
from bisect import bisect_right

def prime_decompose(x):
    decomposed = []
    for i in range(2,int(pow(x,0.5))+1):
        while x % i == 0:
            x //= i
            decomposed.append(i)
    if x > 1:
        decomposed.append(x)
    return decomposed

N = int(input())
d = prime_decompose(N)
cnt = Counter(d)
ref = [0] * 50
for i in range(len(ref)):
    ref[i] = sum(range(1,i+2))

ans = 0
for i in cnt:
    ans += bisect_right(ref, cnt[i])

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if n==1:
    print(0)
else:
    def fac(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(cnt)
        if temp!=1:
            arr.append(1)
        if arr==[]:
            arr.append(1)
        return arr
    anss=fac(n)
    dic={}
    ans=0
    for i in anss:
        if i in dic:
            ans+=dic[i]
        elif i==1:
            dic[i]=1
            ans+=1
        else:
            j=i
            ansss=0
            cou=1
            while j>=cou:
                ansss+=1
                j-=cou
                cou+=1
            ans+=ansss
            dic[i]=ansss
    print(ans)

Submission status: Accepted

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

soi = soinsu(n)
cand=[ s[1] for s in soi]

aida = [(i)*(i+1)//2 for i in range(1,45)]
import bisect

print(sum(bisect.bisect(aida,c) for c in cand) )

Submission status: Accepted

Solution code:
def fanction(n):
    listIn = []
    tmp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if tmp % i == 0:
            cnt_in = 0
            while tmp % i ==0:
                cnt_in += 1
                tmp //= i
            listIn.append([i, cnt_in])

    if tmp != 1:
        listIn.append([tmp, 1])

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

    return listIn

N = int(input())

arr = fanction(N)

tmp = 1
count = 0
for a, b in arr:
    if a <= 1:
        continue
    while 'true':
        if b >= tmp:
            b -= tmp
            count += 1
            tmp += 1
        else:
            tmp = 1
            break

print(count)

Submission status: Accepted

Solution code:
m = int(input())
if m==1:
    print(0)
    exit()
pf={}
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
key=list(pf.keys())
used=[0]*len(key)
#print(pf)
cnt=0
for i in range(len(key)):
    k=key[i]
    tmp=0
    while pf[k]>used[i]+tmp:
        tmp+=1
        used[i]+=tmp
        cnt+=1
        #print(used,tmp)
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

if n == 1:
    print(0)
    exit()

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

arr = factorization(n)



l = []

for a, b in arr:
   temp = 1
   for i in range(1,b+1):
       temp *= a
       l.append(temp)

cnt = 0
for i in l:
    if n % i == 0:
        n = int(n/i)
        cnt += 1
    
   
print(cnt)

Submission status: Accepted

Solution code:
def make_divisors(n):
    lower_divisors = []
    upper_divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)

    upper_divisors.reverse()
    return lower_divisors + upper_divisors

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

ans = []
used_list = []

def solve(n, used_list):
  if n == 1:
    return len(used_list)
  div_list = make_divisors(n)[1:]
  for i in div_list:
    z_kouho = factorization(i)
    if i not in used_list and len(z_kouho) == 1:
      used_list.append(i)
      return solve(int(n/i),used_list)
  
  return len(used_list)
      
print(solve(n, used_list))

Submission status: Accepted

Solution code:
n = 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

if n == 1:
  print(0)
else:
  arr = factorization(n)
  c = 0
  for e in arr:
    now = 0
    while e[1] > now:
      now += 1
      e[1] -= now
    c += now
  print(c)

Submission status: Accepted

Solution code:
N=int(input())
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

X=factorization(N)
ans=0
for p,n in X:
  _n=0
  while n>0:
    _n+=1
    if n-_n<=_n:
      n=0
    else:
      n-=_n
    ans+=1
print(ans)

Submission status: Accepted

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

    if temp!=1:
        arr.append(1)

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

    return arr

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

    if N == 1:
        print(0)
        return

    e_num = []
    for i in range(0, 40):
        for k in range(0, i+1):
            e_num.append(i)
    #print(e_num)

    e_list = factorization(N)

    ans = 0
    for e in e_list:
        ans += e_num[e]
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
import collections

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


N = int(input())

counter = collections.Counter(prime_factorize(N))
#print(counter)

ans = 0
for key in counter.keys():
    num = counter[key]
    i = 1
    while num >= i:
        num -= i
        ans += 1
        i += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
from math import log2,floor,ceil,sqrt
# import bisect
# from collections import deque

# from types import GeneratorType
# def bootstrap(func, stack=[]):
#     def wrapped_function(*args, **kwargs):
#         if stack:
#             return func(*args, **kwargs)
#         else:
#             call = func(*args, **kwargs)
#             while True:
#                 if type(call) is GeneratorType:
#                     stack.append(call)
#                     call = next(call)
#                 else:
#                     stack.pop()
#                     if not stack:
#                         break
#                     call = stack[-1].send(call)
#             return call
#     return wrapped_function

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
 
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7
N = 10**6 +1


# def seive():
#     for i in range(2*2,N+1,2):
#         prime[i] = False
#     # for j in range(divceil(l,2)*2 ,r+1,2):
#     #         divisor[j-l].append(2)
    
#     p= 3
#     while(p*p <= N):
#         if prime[p]:
#             for i in range(p*p,N+1,p):
#                 prime[i]  = False
#             # for j in range(divceil(l,p)*p ,r+1,p):
#             #     # if j == 18:
#             #     #     print("fs")
#             #     divisor[j-l].append(p)
#         p+=2

def solve(cnt):
    val = (-1+sqrt(1+8*cnt))/2
    return floor(val)


# prime = [True]*(N+1)
n = int(ri())

ans = 0
if n == 1:
    print(0)
else:
    p = 2
    while p*p <= n:
        cnt = 0
        while(n%p == 0):
            cnt+=1
            n= n//p
        if cnt != 0:
            # print(p)
            ans+=solve(cnt)
        p+=1
    if n != 1:
        ans +=1

    print(ans)

Submission status: Accepted

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

    def f(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(cnt)

        if temp != 1:
            arr.append(1)

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

        return arr
    if n==1:
        print(0)
    else:
        a=f(n)
        ans=0
        for i in a:
            k=1
            while i>=k:
                i-=k
                k+=1
            ans+=k-1
        print(ans)
resolve()

Submission status: Accepted

Solution code:
n = int(input())
cnt = 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)
c = 0
for i in a:
	k = 1
	x = i[1]
	while x >= 0:
		x -= k
		if x < 0:
			break
		c += 1
		k += 1
if n == 1:
	print (0)
else:
	print (c)

Submission status: Accepted

Solution code:
import collections

N = int(input())

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

res = collections.Counter(prime_factorize(N))
keys = list(res.keys())

length = len(keys)
ans = 0
for i in range(length):
    temp = 1
    num = res[keys[i]]
    while(num >= temp):
        ans += 1
        num -= temp
        temp += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
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

n = int(input())
if n == 1:
    print(0)
else:
    count = prime_factorize(n)
    count_dict = defaultdict(int)
    for c in count:
        count_dict[c] += 1
    ans = 0
    for key,value in count_dict.items():
        tmp = value
        m = 1
        while tmp >= m:
            tmp -= m
            m += 1
            ans += 1
    print(ans)

Submission status: Accepted

Solution code:
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 main():
    N = int(input())
    import collections
    p = collections.Counter(prime_factorize(N))
    l = list(p.values())
    ans = 0
    for i in range(len(l)):
        c = l[i]
        if(c == 1 or c == 2):
            ans += 1
            continue
        for j in range(c):
            if ((j * (j + 1)) // 2 == c):
                ans += j
                break
            elif ((j * (j + 1)) // 2 > c):
                ans += j - 1
                break
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
now = 2
counter = 0
k = []
ans = 0
while N != 1:
    if N % now == 0:
        N = N // now
        counter += 1
    else:
        now += 1
        if N < now ** 2:
            k.append(counter)
            counter = 1
            break
        if counter != 0:
            k.append(counter)
            counter = 0
k.append(counter)
for i in range(len(k)):
    counter = 2
    while k[i] > 0:
        k[i] -= counter
        counter += 1
    ans += counter - 2
print(ans)