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

Solution (Python):
from collections import defaultdict as dd
from sys import exit
n = int(input())
if n == 1:
    print(0)
    exit()

counter = dd(int)
for num in range(2, int(n**0.5) + 3):
    while n % num == 0:
        n //= num
        counter[num] += 1
if n != 1:
    counter[n] += 1

total = 0
for key, val in counter.items():
    for i in range(1, 10**10):
        if i * (i + 1) // 2 > val:
            total += i-1
            break
print(total)

Solution (Python):
from collections import Counter

n = int(input())

def factorize(n):
    b = 2
    factor = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            factor.append(b)
        b += 1
    if n > 1:
        factor.append(n)
    return factor

f = factorize(n)
c = Counter(f)

a = 0
for v in c.values():
    i = 1
    while v >= i:
        v -= i
        i += 1
        a += 1

print(a)

Solution (Python):
def prime_factorization(n):
    if n == 1:
        return []
    ret = []
    tmp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if tmp%i==0:
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            ret.append([i, cnt])
    if tmp!=1:
        ret.append([tmp,1])
    if ret==[]:
        ret.append([n,1])
    ret.sort()
    return ret

N = int(input())
P = prime_factorization(N)
ans = 0

for prime in P:
    cnt = 1
    while cnt <= prime[1]:
        ans += 1
        prime[1] -= cnt
        cnt += 1
print(ans)

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


res = 0
for p, e in factorization(N):
    if p == 1:
        continue
    i = 1
    E = e
    while E > 0:
        i += 1
        E = E - i
    res += i - 1

print(res)

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


ans = 0
prime = factorization(N)
if N == 1:
    print(0)
    exit()
for li in prime:
    check = li[1]
    i = 1
    while check > 0:
        if check >= i:
            ans += 1
        check -= i
        i += 1
print(ans)

Solution (Python):

import math
from collections import defaultdict

def prime_fact(n):
    count = defaultdict(int)
    for p in range(2, math.ceil(math.sqrt(n)) + 1):
        while n % p == 0:
            count[p] += 1
            n //= p
    if n != 1:
        count[n] += 1
    return count


def submit():
    n = int(input())
    primes = prime_fact(n)

    ans = 0
    for p, c in primes.items():
        pw = 1
        while c - pw >= 0:
            c -= pw
            ans += 1            
            pw += 1
    print(ans)
            


if __name__ == "__main__":
    submit()

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

x = factorization(n)
ans = 0

for i, j in x:
    cnt = 1
    while j >= 1:
        if j == 1:
            ans += 1
            j -= 1
        elif j > 1:
            ans += 1
            j -= cnt
        cnt += 1
        if cnt > j:
            break

print(ans)

Solution (Python):
import sys
import math
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def prime_factorize(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 main():
    N = int(readline())
    if N==0 or N==1:
        print('0')
        sys.exit()
    sosu = prime_factorize(N)
    L = len(sosu)
    count = 0
    for i in range(L):
        _, a = sosu[i]
        count += math.floor((math.sqrt(1+8*a)-1)/2)
    print(count)

if __name__ == '__main__':
    main()

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

import bisect

n=int(input())
arr=factorization(n) 


ans=0
li=[1,3,6,10,15,21,28,36,45]

for ar in arr:
    e=ar[1]
    ans+=bisect.bisect(li,e)
if n==1:
    print('0')
else:    
    print(ans)

Solution (Python):
def fac(n):  
    a=[]
    t=n
    if t%2==0:
        count=0
        while t%2==0:
            count+=1
            t//=2
        a.append([2,count])

    for i in range(3,n+1,2):
        if i*i>n:
            break
        if t%i==0:
            count=0
            while t%i==0:
                count+=1
                t//=i
            a.append([i,count])

    if t!=1:
        a.append([t,1])
    
    return a


from sys import stdin
def main():
    
    readline=stdin.readline
    n=int(readline())
    li=fac(n)
    ans=0
    for i in range(len(li)):
        p=li[i][0]
        cnt=1
        while li[i][1]>=cnt:
            ans+=1
            n//=(p**cnt)
            li[i][1]-=cnt
            cnt+=1

    print(ans)

if __name__=="__main__":
    main()

Solution (Python):

import sys
import math

N = int(input())

prime = {}
p = 2
while N>=p**2:
  count = 0
  while N%p==0:
    count += 1
    N = N//p
  if count>0:
    prime[p] = count
  p += 1

if N>1:
  prime[N] = 1

answer = 0
for p,v in prime.items():
  minus = 1
  while v>=minus:
    answer += 1
    v -= minus
    minus += 1

print(answer)

Solution (Python):
def main():
    n = int(input())
    dic = {}
    x = 2
    while n % x == 0:
        if x in dic:
            dic[x] += 1
        else:
            dic[x] = 1
        n //= x
    x = 3
    while x**2 <= n:
        while n % x == 0:
            if x in dic:
                dic[x] += 1
            else:
                dic[x] = 1
            n //= x
        x += 1
    if n > 1:
        if n in dic:
            dic[x] += 1
        else:
            dic[x] = 1
    ans = 0
    for v in dic.values():
        p = 1
        while p <= v:
            ans += 1
            v -= p
            p += 1
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
import sys

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')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

def factorize(num: int) -> dict:
    """ 素因数分解 """
    from math import sqrt
    from collections import Counter

    d = Counter()
    for i in range(2, int(sqrt(num))+1):
        while num % i == 0:
            num //= i
            d[i] += 1
        if num == 1:
            break
    if num != 1:
        d[num] += 1
    return d

N = INT()

fact = factorize(N)
used = set()
for k in fact.keys():
    cnt = 1
    while fact[k] >= cnt:
        if (k, cnt) not in used:
            used.add((k, cnt))
            fact[k] -= cnt
        cnt += 1
ans = len(used)
print(ans)

Solution (Python):
x=int(input())
def cal(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
num=cal(x)
numset=sorted(list(set(num)))
cnt=[0]*len(numset)
now=0
for i in range(len(num)):
    if numset[now]==num[i]:
        cnt[now]+=1
    else:
        now+=1
        cnt[now]+=1
ans=0
for j in range(len(cnt)):
    s=1
    plu=2
    c=0
    flag=0
    while flag!=1:
        if s<=cnt[j]:
            c+=1
            s+=plu
            plu+=1
        else:
            ans+=c
            flag=1
print(ans)

Solution (Python):
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()
factors = factorization(n)
ans = 0
for f, num in factors:
    i = 1
    while num >= i:
        num -= i
        i += 1
        ans += 1
print(ans)

Solution (Python):
def factorize(n):
    fact = dict()
    k = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if k % i == 0:
            c = 0
            while k % i == 0:
                c += 1
                k //= i
            fact[i] = c
    if k != 1:
        fact[k] = 1
    if not fact:
        fact[n] = 1
    return fact


def main():
    n = int(input())
    if n == 1:
        print(0)
        return
    c = sum([[i for _ in range(i + 1)] for i in range(9)], [])
    print(sum(c[f] for f in factorize(n).values()))


if __name__ == '__main__':
    main()

Solution (Python):
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
a = factorization(N)
ans = 0
for i in range(len(a)):
  tmp = a[i][1]
  for j in range(10**10):
    if tmp < j*(j+1)//2:
      break
  ans += (j-1)
if N == 1:
  ans = 0
print(ans)

Solution (Python):
n=int(input())

sisu=[]
yakusu=[]
gen=n
soinsu=2
for i in range(n):
    if(soinsu**2>gen):
        if(gen!=1):
            yakusu.append(gen)
        break
    if(gen%soinsu==0):
        yakusu.append(soinsu)
        gen//=soinsu
    else:
        soinsu+=1



kosu=len(yakusu)

if(kosu==1):
    sisu.append(1)
elif(kosu>1):
    sisu=[1]
    for i in range(1,kosu):
        if(yakusu[i]==yakusu[i-1]):
            sisu[-1]+=1
        else:
            sisu.append(1)


ans=0

for s in sisu:
    now=0
    for i in range(1,s+100):
        now+=i
        if(now>s):
            
            ans+=i-1
            break

print(ans)

Solution (Python):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

INF = float("inf")











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)
else:
    li = factorization(N)
    ans = 0
    for arr in li:
        num = arr[1]
        cur = 1
        while num >= (cur)*(cur+1) // 2:
            cur += 1
        ans += cur-1
    print(ans)

Solution (Python):
from collections import Counter

def get_prime_factors(x):
    out = []
    if x < 1:
        return out
    while not x%2:
        out.append(2)
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            out.append(i)
            x //= i
        else:
            i += 2
    if x != 1:
        out.append(x)
    return out

def main():
    n = int(input())
    ans = 0
    primes = Counter(get_prime_factors(n))
    for k, v in primes.items():
        num = 1
        while v >= num:
            v -= num
            ans += 1
            num += 1
    print(ans)
        

if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
l=[0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666, 703, 741, 780, 820] 
ans=0
from bisect import bisect_right as bl
from math import floor
for i in range(2,floor(n**(1/2))+1):
    if n%i:continue
    cnt=0
    while n%i==0:
        cnt+=1
        n//=i
    ind=bl(l,cnt)
    if ind==1:ans+=1
    else:
        ans+=ind-1
if n!=1:
    ans+=1
print(ans)

Solution (Python):
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
a = prime_factorize(n)

c = collections.Counter(a)

ans = 0
for v in c.values():
    x = 1
    while True:
        v -=x
        x += 1
        if (v<x):
            ans += (x-1)
            break
print(ans)

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

def calc(n):
    ans=0
    tmp=0
    c=1
    while(1):
        tmp+=c
        if tmp>n:
            break
        ans=c
        c+=1
    return ans

L=factorization(N)
if N==1:
    print(0)
    exit()
ans=0
for i in range(len(L)):
    val=L[i][0]
    cnt=L[i][1]
    ans+=calc(cnt)

print(ans)

Solution (Python):
import math
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

n = int(input())
if n == 1:
	print(0)
else:
	arr = factorization(n)
	max_count = max([x[1] for x in arr])
	binomial_count = [1]
	k = 1
	i = 1
	while True:
		i += 1
		k += i
		binomial_count.append(k)
		if k > max_count:
			break

	ans = 0
	for x in arr:
		ans += bisect.bisect_right(binomial_count, x[1])
	
	
	print(ans)

Solution (Python):

import sys
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

def solve(N: int):
    factors = defaultdict(int)
    res = prime_factorize(N)
    for f in res:
        factors[f]+=1
    r=0
    for key in factors:
        for c in range(1,10**10):
            if factors[key] >= c:
                factors[key]-= c
                r+=1
            else:
                break
    print(r)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
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])

    return arr

N=int(input())

ls=factorization(N)

cnt=0

for l in ls:
    cc=0
    for i in range(1,l[1]+1):
        cc+=i
        if cc<=l[1]:
            cnt+=1
        else:
            break

print(cnt)

Solution (Python):
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
fa = factorization(n)
ans = 0
rui = [0]*20
for i in range(1,20):
    rui[i] = i+rui[i-1]


for so,si in fa:
    for i in range(1,20):
        if rui[i]<= si <rui[i+1]:
            ans+= i
            break
print(ans)

Solution (Python):
n = int(input())


def prime_factorization(n):
    pmax = int(n ** 0.5 // 1) + 1

    factors = {}
    for p in range(2, pmax + 1):
        while n % p == 0:
            factors[p] = factors.get(p, 0) + 1
            n //= p
    if n != 1:
        factors[n] = factors.get(n, 0) + 1

    return factors


factors = prime_factorization(n)

answer = 0
for power in factors.values():
    n = 1
    while (n + 1) * (n + 2) // 2 <= power:
        n += 1
    answer += n



print(answer)

Solution (Python):


import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    ps = []
    i = 2
    ret = 0
    def _is_p(n):
        if n < 2:
            return False
        i = 2
        while i * i <= n:
            if n % i == 0:
                return False
            i += 1
        return True

    ret = 0
    while i * i <= N:
        
        
        t = 0
        while N % i == 0:
            t += 1
            N //= i
        if t > 0:
            
            j = 1
            s = 0
            while s + j <= t:
                s += j
                ret += 1
                j += 1
        i += 1

    if _is_p(N):
        ret += 1
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
def d_div_game():
    N=int(input())

    def prime_factorization_dict(n):
        """nを素因数分解したときの素数とその指数の辞書"""
        from collections import defaultdict
        if n == 1:
            return {2: 0}  
        i, table = 2, defaultdict(int)
        while i**2 <= n:
            while n % i == 0:
                table[i] += 1
                n //= i
            i += 1
        if n > 1:
            table[n] = 1
        return table

    d = prime_factorization_dict(N)
    ans = 0
    for v in d.values():
        tmp = 1
        total = 0
        count = 0
        while total <= v:
            total += tmp
            tmp += 1
            count += 1
        ans += count - 1
    return ans

print(d_div_game())

Solution (Python):

N = int(input())

def fact(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
if N == 1:
    print(0)
    quit()
for i in fact(N):
    temp = i[1]
    x = 1
    while temp > 0:
        x += 1
        temp -= x
        ans += 1
print(ans)

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

div = factorization(int(input()))

cnt = 0
for d in div:
    if d[0] == 1: continue
    loo = d[1]
    i = 1
    while loo >= i:
        loo -= i
        i += 1
        cnt += 1
print(cnt)

Solution (Python):
from collections import Counter
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
l = prime_factorize(n)
cnt = Counter(l)

ans = 0
for key in cnt.keys():
    cur = 1
    while True:
        if cnt[key] >= cur:
            cnt[key] -= cur
            ans += 1
            cur += 1
        else:
            break
print(ans)

Solution (Python):
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()
arr = factorization(n)
ans=0
for p,i in arr:
  j = 0
  while i>j:
    j += 1
    i -= j
  ans += j
print(ans)

Solution (Python):
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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())
dankai=[1]*50
for i in range(1,50):
    dankai[i]=dankai[i-1]+i+1

c = list(Counter(prime_factorize(N)).values())

ans=0
for v in c:
    i=0
    while v>=dankai[i]:
        i+=1
    ans+=i
print(ans)

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

c = collections.Counter(prime_factorize(n))
ans = 0
for k, v in c.items():
  i = 1
  while True:
    v -= i
    if v < 0:
      break
    ans += 1
    i += 1

print(ans)

Solution (Python):


import sys
import pprint
import math

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)

def prime_fact(n):
	p = {}
	for i in range(2, int(-(-n**0.5//1))+1):
		if n % i == 0:
			while n % i == 0:
				n //= i
				p[i] = p.get(i, 0) + 1
	if n != 1:
		p[n] = p.get(n, 0) + 1
	return p


def main():
	log = Logger(0)
	n = int(sys.stdin.readline())
	if n == 1:
		print(0)
		exit()
	p = prime_fact(n)
	ans = 0
	if len(p.keys()) == 0:
		print(1)
		exit(0)
	keys = list(p.keys())
	key = keys[0]
	i = 1
	j = 0
	while 1:
		if p[key] < i:
			j += 1
			if len(keys) == j:
				break
			key = keys[j]
			i = 1
			continue
		log.print(p, n, key)
		z = key ** i
		n /= z
		p[key] -= i
		ans += 1
		i += 1
	print(ans)


main()

Solution (Python):
n = int(input())

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

def is_prime(num):
    if num == 1:
        raise ValueError("error!")
    d = 2
    while d * d <= num:
        if num % d == 0:
            return False, d
        d += 1
    return True, -1


x = n
yakusuu = {}
while True:
    x_is_prime, div = is_prime(x)
    if x_is_prime:
        yakusuu[x] = yakusuu.get(x, 0) + 1
        break
    else:
        yakusuu[div] = yakusuu.get(div, 0) + 1
        x = x // div


ans = 0
for v in yakusuu.values():
    for p in range(1, 10000):
        if p*(p+1)//2 <= v < (p+2)*(p+1)//2:
            ans += p
            break
print(ans)

Solution (Python):
N = int(input())


def prime_factorize(n):
    res, a = [], 2
    while a*a <= n:
        if n % a == 0:
            ex = 0
            while n % a == 0:
                ex += 1
                n //= a
            res.append([a, ex])
        a += 1
    if n != 1:
        res.append([n, 1])
    return res

cnt = [0] * 100
now = 1
tmp = 0
for i in range(1, 100):
    if tmp >= now+1:
        now += 1
        tmp = 0
    cnt[i] = now
    tmp += 1

primes = prime_factorize(N)
ans = 0
for p, i in primes:
    ans += cnt[i]

print(ans)

Solution (Python):
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math

MOD = 10 ** 9 + 7


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())
prime = Counter(prime_factorize(n))


ans = 0
for p, v in prime.items():
    c = 1
    while v >= c:
        ans += 1
        v -= c
        c += 1

print(ans)

Solution (Python):
from heapq import heappop, heappush
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def prime_factorization(n):
    d = {}
    i = 2
    while i * i <= n:
        if n % i == 0:
            d[i] = 1
            n //= i
            while n % i == 0:
                n //= i
                d[i] += 1
        i += 1
    if n > 1:
        d[n] = 1
    return d

def main():
    N = int(readline())

    d = prime_factorization(N)
    queue = []
    for k, v in d.items(): 
        for i in range(1, v+1):
            heappush(queue, (pow(k, i), k, i))
    
    cnt = dict()
    ans = 0
    while queue:
        z, p, e = heappop(queue)
        if p in cnt:
            if cnt[p] + e <= d[p]:
                cnt[p] += e
                ans += 1
            else:
                continue
        else:
            cnt[p] = e
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

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


def main():
    N = int(input())

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

    a = prime_factorize(N)

    l = [1, 3, 6, 10, 15, 21, 28, 36, 45]

    dic = defaultdict(int)
    for aa in a:
        dic[aa] += 1

    ans = 0
    for d in dic:
        tmp = dic[d]
        count = 0
        for ll in l:
            if ll > tmp:
                break
            count += 1
        ans += count

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
n = int(input())




if n == 1:
    print(0)
    sys.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

l = factorization(n)


x = [1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,9]

ans = 0
for i in range(len(l)):
    ans += x[l[i][1]-1]

print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def prime_factorization(n):
    res = []
    for i in range(2, int(pow(n, 0.5)) + 1):
        if n % i == 0:
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.append([i, ex])
    if n != 1:
        res.append([n, 1])

    return res


def resolve():
    n = int(input())
    L = prime_factorization(n)
    res = 0
    for v, ex in L:
        i = 1
        while ex >= 0:
            if ex - i < 0:
                break
            ex -= i
            res += 1
            i += 1

    print(res)


if __name__ == '__main__':
    resolve()

Solution (Python):
import sys

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


def factorize(n):
    b = 2
    fct = dict()
    while b * b <= n:
        while n % b == 0:
            n //= b
            if b in fct:
                fct[b] += 1
            else:
                fct[b] = 1
        b = b + 1
    if n > 1:
        if n in fct:
            fct[n] += 1
        else:
            fct[n] = 1
    return fct


def solve():
    N = int(input())
    prime_list = factorize(N)

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

    ans = 0
    for p, num in prime_list.items():
        i = 1
        m = 1
        while True:
            if num >= m:
                ans += 1
            else:
                break
            i += 1
            m += i

    print(ans)


if __name__ == '__main__':
    solve()