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):
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N = NI()
    d = {}
    for i in range(2,int(math.sqrt(N))+1):
        while N % i == 0:
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
            N //= i
    if N > 1:
        d[N] = 1

    ans = 0
    for i in d.values():
        n = int((-1+math.sqrt(1+4*2*i))/2)
        ans += n
    print(ans)
if __name__ == '__main__':
    main()

Solution (Python):
from bisect import bisect_left, bisect_right

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()
Fact = factorization(N) 

Counter=[1]
for i in range(2,10):
  Counter.append(Counter[-1]+i)


ans = 0
tmp = 0
for i in range(len(Fact)):
  tmp = Fact[i][1]
  ans += bisect_right(Counter, tmp)

print(ans)

Solution (Python):
from collections import Counter
from itertools import count


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 index_counter(e):
    c = 0
    for i in count(start=1):
        e -= i
        if e >= 0:
            c += 1
        else:
            break
    return c


N = int(input())
prime_factors = Counter(prime_factorize(N))
ans = 0
for key, value in prime_factors.items():
    ans += index_counter(value)
print(ans)

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

P = prime_factorize(n)

import collections
C = collections.Counter(P)


L = [0]
for i in range(1, 1000):
    L.append(L[-1] + i)

import bisect


ans = 0

for k, v in C.items():
    i = bisect.bisect(L, v) - 1
    ans += i
print(ans)

Solution (Python):
from math import ceil, sqrt

n = int(input())

p_map= {}
for i in range(2, ceil(sqrt(n))+1):
    while n % i == 0:
        n /= i
        if i not in p_map:
            p_map[i] = 1
        else:
            p_map[i] += 1
if n > 2:
    p_map[n] = 1

res = 0
for i, v in p_map.items():
    prev = 0
    for i in range(1, 41):
        current = prev+1
        if v < current:
            break
        v -= current
        res += 1
        prev = current
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

if(N == 1):
  print(0)
else:
  result = factorization(N)
  ans = 0
  for i in range(len(result)):
    count = 1
    temp = 0
    while(result[i][1] - count >= 0):
      result[i][1] -= count
      count += 1
      temp += 1
    ans += temp
  print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
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=I()
u=prime_factorize(n)
c=Counter(u)
ans=0
lis=[0 for i in range(15)]
for i in range(14):
    lis[i+1]=lis[i]+i+1

mans=[]
for x in c.keys():
    y=c[x]
    man=-1
    for i in range(15):
        if y>=lis[i]:
            man+=1
    mans.append(man)
print(sum(mans))

Solution (Python):
import sys
from collections import Counter

input = sys.stdin.readline


def calc_prime_factors(n, count=False):
    """Trial division"""
    factors = []
    
    while n % 2 == 0:
        factors.append(2)
        n //= 2
    
    f = 3
    while f ** 2 <= n:
        if n % f == 0:
            factors.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        factors.append(n)
    if count:
        factors = Counter(factors).items()
    return factors


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

    factors = calc_prime_factors(N, count=True)
    ans = 0
    for _, count in factors:
        n = 1
        while True:
            if n * (n + 1) // 2 <= count:
                n += 1
            else:
                break
        ans += (n - 1)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
from collections import defaultdict
import math

n = int(input())

primes = defaultdict(int)
t = n
for i in range(2, int(math.sqrt(n)) + 1):
    while t % i == 0:
        primes[i] += 1
        t //= i
if t != 1:
    primes[t] += 1

count = 0
for cn in primes.values():
    count += int((-1 + math.sqrt(1 + 8 * cn)) / 2)

print(count)

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

def prime_factorization(n):
    dct = {}
    tmp = n
    for i in range(2, int(n**0.5)+1):
        if tmp == 1:
            break
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            dct[i] = cnt
    if tmp != 1:
        dct[tmp] = 1
    if len(dct) == 0:
        dct[n] = 1

    return dct

if N == 1:
    print(0)
else:
    pf = prime_factorization(N)
    ans = 0
    for p in pf:
        num = pf[p]
        k = 1
        while num >= k:
            ans += 1
            num -= k
            k += 1
    print(ans)

Solution (Python):
N = int(input())
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
c = collections.Counter(prime_factorize(N))
ans = 0
for i in c.values():
    k = i
    j = 1
    while(k>=j):
        k = k-j
        j += 1
        ans += 1
print(ans)

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

n = int(input())
ass = prime_factor(n)
cnt = {}
for x in ass:
    if x not in cnt:
        cnt[x] = 1
    else:
        cnt[x] += 1

ass = set(ass)
ans = 0
for x in ass:
    i = 1
    c = cnt[x]
    while c >= i:
        c -= i
        ans += 1
        i += 1

print(ans)

Solution (Python):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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
tmp=factorization(n)

lst=list(accumulate(range(1,1000)))

ans=0
for i in range(len(tmp)):
    so,num=tmp[i]
    ans+=bisect.bisect_right(lst,num)
    
print(ans)

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

def prime_pair(n):
    pairs = {}
    tmp = n
    for i in range(2, n):
        if i * i > n:
            break
        if tmp % i != 0:
            continue
        ex = 0
        while tmp % i == 0:
            ex += 1
            tmp /= i
        pairs[i] = ex
    if tmp != 1:
        pairs[int(tmp)] = 1
    return pairs

pp_n = prime_pair(N)
res = 0
for k in pp_n.keys():
    val = pp_n[k]
    power = 1
    while val >= power:
        val -= power
        power += 1
        res += 1

print(res)

Solution (Python):
from collections import defaultdict

D = defaultdict(int)
N = int(input())

a = 2
while a * a <= N:
    if N % a:
        a += 1
    else:
        N //= a
        D[a] += 1

if N != 1:
    D[N] += 1

ans = 0
for k,v in D.items():
    i = 0
    while i*(i+1) <= v * 2:
        i += 1
    ans += i-1

print(ans)

Solution (Python):
import math

def isprime(n):
    for k in range(2,math.floor(math.sqrt(n))+1):
        if n%k == 0:
            return False
    return True

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

P = [N]
for k in range(2,math.floor(math.sqrt(N))+1):
    if N % k == 0:
        P.append(k)
        P.append(N//k)
P = sorted(P)
Q = []
for k in range(len(P)):
    if isprime(P[k]) == True:
        temp = 0
        while N%P[k] == 0:
            N //= P[k]
            temp += 1
        Q.append(temp)

ans = 0
for e in Q:
    if e > 0:
        t = 0
        for k in range(1,100):
            t += k
            if t <= e:
                ans += 1
            else:
                break
print(ans)

Solution (Python):


n=int(input())

ans=0
p=2
for p in range(2, int((n+0.5)**0.5)+1):
    if n%p==0:
        cnt=0
        while n%p==0:
            cnt+=1
            n//=p
        k=1
        while cnt>=k:
            cnt-=k
            k+=1
            ans+=1

if n>1:
    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


N = int(input())
primes = factorization(N)
ans = 0
for p in primes:
    num = p[1]
    for i in range(1, N):
        if num >= i:
            num -= i
            ans += 1
        else:
            break
print(ans)

Solution (Python):
from collections import Counter
from itertools import accumulate
from bisect import bisect_right

def prime_factorization(n):
    '''
    Trial division.
    Input: 
        n : a positive integer
    Output:
        a dictionary of 
    '''
    result = []
    app = result.append
    if n < 2: return Counter()
    while n % 2 == 0:
        app(2)
        n //= 2
    p = 3
    while p*p <= n:
        while n % p == 0:
            app(p)
            n //= p
        p += 2
    if n > 1: app(n)
    return Counter(result)

cumsum = list(accumulate(range(1, 50)))

N = int(input())
factors = prime_factorization(N)
ans = 0
for _, n in factors.items():
    ans += bisect_right(cumsum, n)
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(200000)
from collections import defaultdict


def read():
    N = int(input().strip())
    return N,


def sieve(n):
    """
    n以下の素数を昇順に列挙する
    """
    is_prime = [True for i in range(n+1)]
    primes = []
    for i in range(2, n+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(i+i, n+1, i):
                is_prime[j] = False
    return primes


def prime_factorization(n, primes):
    """
    nの素因数分解を求める
    """
    prime_factors = defaultdict(int)
    if n < 2:
        return prime_factors
    for p in primes:
        if p * p > n:
            break
        while n % p == 0:
            prime_factors[p] += 1
            n //= p
    if n > 1:
        prime_factors[n] = 1
    return prime_factors


def solve(N, INF = 10**8):
    primes = sieve(10**6+1)
    factors = prime_factorization(N, primes)
    ans = 0
    for c in factors.values():
        m = 0
        for i in range(1, 63):
            if m + i <= c:
                m += i
                ans += 1
            else:
                break
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Solution (Python):
import sys
from functools import lru_cache
 

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())
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=read()
ls=factorization(n)
res=0

for num in ls:
    k=num[1]
    if num[0]==1:
      break
    i=1
    while True:
        k-=i
        if k>=0:
            res+=1
        else:break
        i+=1
print(res)

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())
a = factorization(n)
ans = 0
for i in a:
    t = i[1]
    b = 1
    while (b*(b+1))//2  <= t:
        b += 1
    ans += b-1
if n==1:
    print(0)
    exit()
print(ans)

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


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

def unique_count(n):
    res = 0
    while n>=0:
        res += 1
        n -= res
    
    return res-1

Cnt = Counter(prime_decomposition(N))

ans = 0
for c in Cnt.values():
    ans += unique_count(c)
print(ans)

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

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

import math
def div(m):
    d = {}
    temp = int(math.sqrt(m))+1
    for i in range(2, temp):
        while m%i== 0:
            m //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[m] = 1
    else:
        if m in d:
            d[m] += 1
        elif m != 1:
            d[m] =1
    return d

d = div(n)

ans = 0
for k, v in d.items():
    temp = 0
    i = 1
    while True:
        temp += i
        if temp > v:
            break
        i += 1
    
    ans += (i-1)
print(ans)

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
c = Counter(prime_factorize(N))

ans = 0
for v in c.values():
    n = 1
    while n <= v:
        v -= n
        ans += 1
        n+=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

  
def count(n):
  ans = ((1 + 8 * n) ** (1 / 2) - 1) // 2
  return int(ans)
  
N = int(input())
ans = 0
X = factorization(N)
if N == 1:
  print("0")
  quit()
for i in range(len(X)):
  ans += count(X[i][1])
  
print(ans)

Solution (Python):
import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline



def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def prime_factors(n):
    ret = dict()

    i = 2
    tmp = n
    while i * i <= n:
        e = 0
        while tmp % i == 0:
            tmp //= i
            e += 1
        if e > 0:
            ret[i] = e

        i += 1

    if tmp > 1:
        ret[tmp] = 1

    return ret


def main():
    n = gete(int)
    d = prime_factors(n)

    ans = 0
    for p in d:
        e = d[p]
        tmp = e
        for i in range(1, e + 1):
            tmp -= i
            if tmp < 0: break
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
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
primes = prime_factorize(int(input()))
prime_set = set(primes)
count = 0
for p in prime_set:
    cnt = primes.count(p)
    count += 1
    i = 2
    while cnt>i:
        cnt -= i
        count += 1
        i = i + 1
print(count)

Solution (Python):
import collections
N = int(input())
if N < 2:
  print(0)
  exit()

def fact(n):  

  arr = []
  temp = n

  for i in range(2, int(n**(1/2))+1):
    if temp % i == 0:
      while temp % i == 0:
        temp //= i
        arr.append(i)

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

  return collections.Counter(arr)

c = fact(N).most_common()

ans = 0
for i in range(len(c)):
  for j in range(1, 1000):
    if  j*(j-1)//2 <= c[i][1] < j*(j+1)//2:
      ans += j-1
      
print(ans)

Solution (Python):
import numpy as np
from bisect import bisect_right
N = int(input())
U = 10**6
pls = np.zeros(U,np.int32)
pls[2] = 1
pls[3::2] = 1
for i in range(3,U,2):
  if pls[i]==1:
    pls[i*i::2*i] = 0
t = list(np.where(pls)[0])
dic = {}
ls = [i*(i-1)//2 for i in range(1,10**6)]
for p in t:
  cnt = 0
  while N%p==0:
    N //= p
    cnt += 1
  dic[p] = cnt
if N!=1:
  dic[N] = 1
ans = 0
for k in dic.keys():
  i = bisect_right(ls,dic[k])
  if i!=0:
    ans += i-1
print(ans)

Solution (Python):
from collections import defaultdict
d = defaultdict(int)
import math
def trial_division(n):
    a = [1]
    for i in range(2,int(math.sqrt(n)) + 1):
        while n % i == 0:
            n //= i
            a.append(i)
    a.append(n)
    return a
def calc(n):
    res = 0
    cnt = 1
    while True:
        if n - cnt < 0:
            return res
        n -= cnt
        res += 1
        cnt += 1
N = int(input())
for i in trial_division(N):
    if i != 1:
        d[i] += 1
ans = 0
for i in d.values():
    ans += calc(i)
print(ans)

Solution (Python):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
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


def main():
    N = int(input())
    if N == 1:
        print(0)
        return
    fact = factorization(N)
    counter = []
    cnt = 0
    for i in range(1, 41):
        cnt += i
        counter.append(cnt)
    answer = 0
    for f in fact:
        for j in range(40):
            c = counter[j]
            if c > f[1]:
                answer += j
                break
            else:
                continue
    print(answer)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]



def make_adjlist_d(n, edges):
    res = [[] for _ in range(n + 1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
        res[edge[1]].append(edge[0])
    return res


def make_adjlist_nond(n, edges):
    res = [[] for _ in range(n + 1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
    return res



def cmb(n, r):
    return math.factorial(n) // math.factorial(r) // math.factorial(n - r)


def prime_fact(n):
    root = int(math.sqrt(n))
    prime_dict = {}
    for i in range(2, root+1):
        cnt = 0
        while n % i == 0:
            cnt += 1
            n = n // i
        if cnt:
            prime_dict[i] = cnt
    if n != 1:
        prime_dict[n] = 1
    return prime_dict


def main():
    N = NI()
    L = list(prime_fact(N).values())
    ans = 0
    for l in L:
        if 1 <= l < 3:
            ans += 1
        elif 3 <= l < 6:
            ans += 2
        elif 6 <= l < 10:
            ans += 3
        elif 10 <= l < 15:
            ans += 4
        elif 15 <= l < 21:
            ans += 5
        elif 21 <= l < 28:
            ans += 6
        elif 28 <= l < 36:
            ans += 7
        elif 36 <= l:
            ans += 8
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
import heapq
import random
import collections
import math





def prime_factors(nr):
    i = 2
    factors = []
    while i <= nr:
        if i > math.sqrt(nr):
            i = nr
        if (nr % i) == 0:
            factors.append(i)
            nr = nr / i
        else:
            i = i + 1
    return factors


def solve(nums):  

    c = collections.Counter(prime_factors(nums))
    res = 0
    for _,v in c.items():
        res += int((-1+math.sqrt(1+4*2*v))//2)    
    return res

def console(*args):  
    print('\033[36m', *args, '\033[0m', file=sys.stderr)
    return



    
    

    
inn = int(input())














res = solve(inn)  





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

total = 0
arr = factorization(n)
for [insu, num] in arr:
  if insu == 1:
    break
  i = 1
  while num >= 0:
    num -= i
    total += 1
    i += 1
  total -= 1
print(total)

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


from collections import defaultdict
def getprime(n):
    if not isinstance(n, int):
        raise TypeError("Input int")
    prime = []
    
    data = [i+1 for i in range(1,n)]
    while True:
        p = data[0]
        if p >= int(n**0.5):
            return prime+data
        prime.append(p)
        
        data = [d for d in data if d%p != 0]

def factorization(n):
    
    factors = defaultdict(int)
    if n == 1:
        return {}
    if int(n**0.5) == 1:
        return {n:1} 
    primes = getprime(int(n**0.5))
    for prime in primes:
        while n % prime == 0:
            factors[prime] += 1
            n //= prime
            
    if n != 1:
        factors[n] += 1
    return factors

x = factorization(n)
ans = 0
for k in x.keys():
    n = 1
    while n*(n+1)//2 < x[k]:
        n += 1
        if n*(n+1)//2 > x[k]:
            n -= 1
            break
    ans += n
print(ans)

Solution (Python):
def factorization(n):
    if n == 1:
        return []

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

pes = factorization(N)

ans = 0
for p, e in pes:
    i = 1
    t = 1

    while t <= e:
        i += 1
        t += i

    ans += i - 1

print(ans)

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

N = factorization(n) 
t = [1]
ans = 0
if N == [[1,1]]:
  print(ans)
else:
  for i in range(2,10**5):
    t.append(t[i-2]+i)
  for j in range(len(N)):
    s = bisect.bisect_right(t, N[j][1])
    ans += s
  print(ans)

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

import math
from collections import Counter


prime_count = Counter()
for i in range(2, math.ceil(math.sqrt(n))+1):
  while n % i == 0:
    n /= i
    prime_count[i] += 1
if n > 1:
  prime_count[int(n)] += 1

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

z = 0
zz = 0
cnt = 0
for k, v in prime_count.items():
  for i in range(1, v+1):
    if nn % pow(k, i) == 0:
      cnt += 1
      nn = nn // pow(k, i)
    else:
      break

print(cnt)

Solution (Python):
def factor(n):
    res = []
    last = -1
    i = 2
    while i ** 2 <= n:
        while n % i == 0:
            if i != last:
                res.append([i,1])
                last = i
            else:
                res[-1][1] += 1
            n //= i
        i += 1
    if n != 1:
        res.append([n,1])
    return res


n = int(input())

ls = factor(n)
ans=0
for p,cnt in ls:
    i=0
    while 1:
        cnt-=i
        if cnt<(i+1):
            break
        else:
            i+=1
    ans+=i

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
if n==1:
    print(0)
else:
    ans=0
    l=factorization(n)
    for t in l:
        i=1
        while t[1]>=i:
            t[1]-=i
            ans+=1
            i+=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(0)

ar = factorization(N)
ans = 0
for i in range(len(ar)):
    tmp = 0
    for j in range(1, 100):
        tmp += j
        if tmp > ar[i][1]:
            ans += j-1
            break

print(ans)

Solution (Python):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()


def getPrimeList(n):
  l=[]
  t=int(math.sqrt(n))+1
  
  for a in range(2,t):
    while n%a==0:
      n//=a
      l.append(a)
  
  if n!=1:
    l.append(n)
  
  return l



def summarize_list(l):
  sl=sorted(l)

  a=sl[0]
  c=1
  res=[]

  for x in sl[1:]:
    if x==a:
      c+=1
    else:
      res.append([a,c])
      a=x
      c=1
  res.append([a,c])

  return res


def main():
  n=I()
  if n==1:
    return 0
  l=getPrimeList(n)
  a=summarize_list(l)

  
  

  ans=0
  for x,y in a:
    st=1
    while True:
      if st>y:
        break

      ans+=1
      y-=st
      st+=1

  return ans


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


n=int(input())
import bisect

p=factorization(n)
anli=[0,2,5,9,14,20,27,35,44,54]
ans=0
for li in p:
  s=li[1]
  ans+=bisect.bisect_left(anli,s)
print(ans if n>1 else 0)

Solution (Python):
"""
これは、Nを構成する素因数の種類の数はいくつか？という問題と等価では？
いや、ちょっと違うな。
2の素因数が3つあれば、2,4で割れる。
Nを素因数分解して、各素因数の数をカウント。
"""
from collections import Counter
N = int(input())
primes = []
d = 2
while d**2 <= N:
    if N%d == 0:
        primes.append(d)
        N //= d
    else:
        d += 1
if N != 1:
    primes.append(N)
count = Counter(primes)


ans = 0
for v in count.values():
    f = 1
    while v >= f:
        ans += 1
        v -= f
        f += 1

print(ans)