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 itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)  
    accum = tuple(accumulate(range(1, 42)))  

    def facs(n):
        yield 2
        for x in range(3, int(pow(n, 0.5)) + 1, 2):
            yield x

    for fac in facs(n):
        while n % fac == 0:
            n //= fac
            prime_counter[fac] += 1
            
            
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for accum_count, accum_value in enumerate(accum):
            if c < accum_value:
                break
        ans += accum_count
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)  
    acc = tuple(accumulate(range(1, 42)))  

    def facs(n):
        yield 2
        for x in range(3, int(pow(n, 0.5)) + 1, 2):
            yield x

    for fac in facs(n):
        while n % fac == 0:
            n //= fac
            prime_counter[fac] += 1
            
            
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)  
    acc = tuple(accumulate(range(1, 42)))  

    def facs(n):
        yield 2
        for x in range(3, int(n ** 0.5) + 1, 2):
            yield x

    for fac in facs(n):
        while n % fac == 0:
            n //= fac
            prime_counter[fac] += 1
            
            
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)  
    acc = tuple(accumulate(range(1, 42)))  

    def facs(n):
        yield 2
        max_x = int(n ** 0.5)
        for x in range(3, max_x+1, 2):
            yield x

    for fac in facs(n):
        while n % fac == 0:
            n //= fac
            prime_counter[fac] += 1
            
            
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)  
    acc = tuple(accumulate(range(1, 42)))  

    def facs(n):
        yield 2
        max_x = int((n ** 0.5 - 3) / 2 + 1)
        for x in range(max_x):
            yield x * 2 + 3

    for fac in facs(n):
        while n % fac == 0:
            n //= fac
            prime_counter[fac] += 1
            
            
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)  
    acc = tuple(accumulate(range(1, 42)))  

    def facs():
        yield 2
        for x in range(10 ** 5 * 5):
            yield x * 2 + 3

    for fac in facs():
        count = 0
        while n % fac == 0:
            n //= fac
            count += 1
            
        prime_counter[count] += 1
    if n != 1:
        prime_counter[1] += 1

    ans = 0
    for prime_count, count_count in prime_counter.items():
        for i, x in enumerate(acc):
            if prime_count < x:
                tmp = i
                break
        ans += tmp * count_count
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter


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 = prime_factorize(int(input()))

counter = Counter(res)
keys = counter.keys()

result = 0
for key in keys:
    items = counter.get(key)

    start = 1

    while items - start >= 0:
        items = items - start
        result += 1
        start += 1

print(result)

Solution (Python):
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)  
    acc = tuple(accumulate(range(1, 42)))  

    def facs():
        yield 2
        for x in range(10 ** 5 * 5):
            yield x * 2 + 3

    for fac in facs():
        while n % fac == 0:
            n //= fac
            prime_counter[fac] += 1
            
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)
    acc = tuple(accumulate(range(1, 42)))  

    def facs():
        yield 2
        for x in range(10 ** 6):
            yield x * 2 + 3

    for fac in facs():
        while n % fac == 0:
            n //= fac
            prime_counter[fac] += 1
        if fac * fac > n:
            break
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)
    acc = tuple(accumulate(range(1, 42)))  

    def facs():
        yield 2
        for x in range(10 ** 6):
            yield x * 2 + 3

    for fac in facs():
        while fac * fac <= n:
            if n % fac == 0:
                n //= fac
                prime_counter[fac] += 1
            else:
                break
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()

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


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


pf = prime_factorize(n)

import collections
c = collections.Counter(pf)

for i in sorted(set(pf)):
    res = c[i]
    for j in range(1,50):
        res -= j
        
        if res >= 0:
            ans += 1
            
        else:
            break
            
print(ans)

Solution (Python):
import math

n = int(input())
list = {}
flag = True
while flag:
    flag = False
    for i in range(2,int(math.sqrt(n)+2)):
        if n%i==0:
            if i in list:
                list[i] = list[i]+1
            else:
                list[i] = 1
            n /= i
            flag = True
            break
if n>1:
    if n in list:
        list[n] = list[n]+1
    else:
        list[n] = 1
ans = 0
for i in list.keys():
    m = list[i]
    for j in range(1,m+1):
        if not j>m:
            ans += 1
            m -= j
        else:
            break
print(ans)

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

n=int(input())
ans=0
for i in factorize(n):
  count=1
  while i>=count:
    ans+=1
    i-=count
    count+=1
print(ans)

Solution (Python):
import math


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())
ans = 0
howmany = []
nums = sorted(prime_factor(N))
if len(nums)>0:
    count = 1
else:
    count = 0
for one, two in zip(nums,nums[1:]):
    if one != two:
        howmany.append(count)
        count = 1
    else:
        count += 1
else:
    howmany.append(count)


for i in howmany:
    for j in range(1,20):
        if j * (j + 1) // 2 > i:

            ans += j - 1
            break

print(ans)

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

n = int(input())
ans = 0
for i,j in factorize(n):
    ans += -(-int(((1 + 8*j)**(1/2) - 1 )/ 2))
print(ans)

Solution (Python):
import sys
import math


input = sys.stdin.readline
 

def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))



n=inp()

i=2
fact=[]

while i*i<=n:
	cnt=0
	while n%i==0:
		n//=i
		cnt+=1
	if cnt:
		fact.append(cnt)
	
	i+=1

if n>1:
	fact.append(1)

ans=0

def koyta(n):
	i=1
	curr=0
	while i<=n:
		n-=i
		curr+=1
		i+=1
	
	return curr 

for num in fact:
	ans+=koyta(num)

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(1000000)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
from collections import defaultdict
n = I()
def primes(n):
    cnt = defaultdict(int)
    for i in range(2,int(n**0.5)+1): 
        while n % i == 0:
            cnt[i] += 1 
            n //= i 
    if n > 1: 
        cnt[n] += 1
    return cnt
prs = primes(n) 
ans = 0
for key in prs.keys(): 
    v = prs[key]
    for i in range(100):
        
        if (i * (i + 1)) // 2 > v: 
            ans += (i-1)
            break
print(ans)

Solution (Python):
from collections import Counter
N = int(input())
 
def prime_factorization(n):
    table = []
    for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table
 
T = prime_factorization(N)
C = Counter(T)
 
cnt = 0
for v in C.values():
    next = 1
    while v >= next:
        v -= next
        cnt += 1
        next += 1
 
print(cnt)

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


n = int(input())

fct = factorize(n)

ans = 0
for i in fct:
    nokori = i[1]
    count = 1
    while nokori >= count:
        nokori -= count
        count += 1
        ans += 1

print(ans)

Solution (Python):
n=int(input())
ans=0
for i in range(2,1000010):
	power=0
	j=1
	if(n%i==0):
		while(n%i==0):
			power+=1
			n=(n//i)
		while(power>=j):
			power-=j
			j+=1
			ans+=1
if(n>1):
	ans+=1
print(ans)

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



for i in range(2,1000010):
	power=0
	j=1
	if(n%i==0):
		while(n%i==0):
			power+=1
			n=(n//i)
		while(power>=j):
			power-=j
			j+=1
			ans+=1
if(n>1):
	ans+=1
print(ans)

Solution (Python):
import math

N = int(input())


def prime_factorization(n):
    from collections import Counter
    counter = Counter()

    if n < 2:
        return counter

    for i in range(2, int(n ** 0.5) + 1):
        if i * i > n:
            break

        while n % i == 0:
            counter[i] += 1
            n //= i

    if n > 1:
        counter[n] += 1

    return counter


p_fact = prime_factorization(N)

cnt = 0
for _, e in p_fact.items():
    val = math.sqrt(2 * e + 0.25) - 0.5
    val = int(val)
    cnt += val

print(cnt)

Solution (Python):
import numpy as np
import time

def get_sieve(n):
  
  f = np.ones(n+1, dtype=bool)
  f[0] = f[1] = False
  rn = np.sqrt(n)
  for i in range(2, int(rn)+1):
    if f[i]:
      
      j = 2
      while 1:
        ij = i * j
        if ij > n:
          break
        f[ij] = False
        j += 1
  return f


N = int(input())

rn = np.sqrt(N)
S = get_sieve(int(rn)+1)

count = 0
primes = []
newN = N
for p, s in enumerate(S):
  if s:
    e = 1
    while 1:
      z = p**e
      if z > newN:
        break
      if newN % z == 0:
        
        newN = newN // z
        count += 1
      e += 1
if newN > rn:
  count += 1
print(count)

Solution (Python):
import sys
import itertools

import time
import math

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(input())

facts = []
for i in range(2, int(math.sqrt(n)) + 1):
    count = 0
    while n % i == 0:
        n = n // i
        count += 1
    if count > 0:
        facts.append((i, count))
if n != 1:
    facts.append((n, 1))

ans = 0
for p in facts:
    count = p[1]
    cur = 1
    while count - cur >= 0:
        count -= cur
        ans += 1
        cur += 1

print(ans)

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

def sieve(x):
  p=[2]
  b=[1]*x
  for i in range(2,x,2):  b[i]=0
  for i in range(3,x,2):
    if b[i]:
      p+=[i]
      for j in range(2*i,x,i): b[j]=0
  return p
def prime_factor(x):
  d={}
  for i in sieve(int(x**0.5)+1):
    while x%i<1:  x//=i;  d[i]=d.get(i,0)+1
    if x<2: break
  if x>1: d[x]=1
  return d

d=prime_factor(n)
a=0
for i in d.values():
  t=c=0
  while t+c<i: c+=1; t+=c
  a+=c
print(a)

Solution (Python):
import math
n = int(input())
div = 2
res = 0
m = int(math.sqrt(n))
while div < m:
    cnt = 0
    if ((n // div) * div != n):
        div += 1
        continue
    while (n // div) * div == n:
        cnt += 1
        n = n // div
    
    tmp = 1
    while tmp <= cnt:
        res += 1
        cnt -= tmp
        tmp += 1
    if (n == 1):
        div = m
    div += 1
print(res+1*(n != 1))

Solution (Python):
import collections
n=int(input())
if n==1:
  print(0)
  exit()
b=int(n**0.5)
i=2
l=[]
while i<=b:
  if n%i==0:
    l.append(i)
    n=n//i
  else:
    i+=1
if n>b:
  l.append(n)
c=collections.Counter(l)
v=list(c.values())

ans=0
for vv in v:
  wa=1
  s=1
  while True:
    if vv<wa:
      break
    s+=1
    wa+=s
  ans+=(s-1)
print(ans)

Solution (Python):
n = int(input())
 
def prime_factorise(n):
    a = []
    tmp = n
    for i in range(2, int(n**0.5//1 + 1)):
        if tmp % i == 0:
            index = 0  
            while tmp % i == 0:
                index += 1
                tmp //= i
            a.append([i, index])
 
    if tmp != 1:
        a.append([tmp, 1])

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

    return a
 
x = prime_factorise(n)
count = 0
 
 
for i in range(len(x)):
    if x[0][0] == 1:
        break
 
    k = x[i][1]  
    for j in range(k):
        if n % (x[i][0] ** (j+1)) == 0:
            n //= x[i][0] ** (j+1)
            count += 1
            k -= (j+1) 
 
        elif n % (x[i][0]**(j+1)) != 0:
            break
        
        if k <= 0:
            break
 
print(count)

Solution (Python):
"""
- Nを素因数分解する
- N = p[i]^1*p[i]^2...*p[k]^1*p[k]^2...
"""
from collections import Counter
N = int(input())
factors = []
i = 2

while N > 1:
  if N < i * i:
    factors.append(N)
    break
  while N % i == 0:
    factors.append(i)
    N //= i
  i += 1

ans = 0


for count in Counter(factors).values():
  i = 1
  while count >= i:
    count -= i
    i += 1
    ans += 1
print(ans)

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

n = int(input())
p_f_l = p_f(n) 
ans = 0
for i in p_f_l:
    p = i[0] 
    ex = i[1] 
    for j in range(1,ex+1):
        if n % p**j == 0:
            n //= p**j
            ans += 1
print(ans)

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

def prime_factorise(n):
    a = []
    tmp = n
    for i in range(2, int(n**0.5//1 + 1)):
        if tmp % i == 0:
            index = 0  
            while tmp % i == 0:
                index += 1
                tmp //= i
            a.append([i, index])

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

    return a

x = prime_factorise(n)
count = 0


for i in range(len(x)):
    if x[0][0] == 1:
        break

    k = x[i][1]  
    for j in range(k):
        if n % (x[i][0] ** (j+1)) == 0:
            n //= x[i][0] ** (j+1)
            count += 1
            k -= (j+1) 

        elif n % (x[i][0]**(j+1)) != 0:
            break
        
        if k <= 0:
            break

print(count)

Solution (Python):
N = int(input())
ans = 0
n = N
counter = []
for i in range(2, int(N**0.5) + 2):
  if n % i == 0:
    counter.append(1)
    n = n // i
    while n % i == 0:
      counter[-1] += 1
      n = n // i
if n != 1:
  counter.append(1)
for c in counter:
  a = 1
  while c >= a:
    c -= a
    a += 1
    ans += 1
print(ans)

Solution (Python):
from bisect import bisect_left

def sieve(n):
    srn = int(n ** 0.5)
    f = [False] * (srn + 1)
    res = []
    for i in range(2, srn+1):
        if f[i]:
            continue
        res.append(i)
        for j in range(2*i, srn+1, i):
            f[j] = True
    return res

def trial_division(n):
    res = dict()
    pn = sieve(n)
    for i in pn:
        while n % i == 0:
            res[i] = res.get(i, 0) + 1
            n //= i
    if n > 1:
        res[n] = 1
    return res

N = int(input())
pf = trial_division(N)
res = [i for i in range(10)]
for i in range(1, 10):
    res[i] = res[i-1] + i
ans = 0
for i in pf.values():
    idx = bisect_left(res, i)
    if i < res[idx]:
        idx -= 1
    ans += idx
print(ans)

Solution (Python):


n = int(input())

def factorization(n):
    arr = []
    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

f_list = factorization(n)
cnt = 0
for i in range(len(f_list)):
    _tmp = f_list[i][1]
    j = 1
    while _tmp >= 0:
        _tmp -= j
        j += 1
        cnt += 1
    cnt -= 1

print(cnt)

Solution (Python):
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())
fs = factorization(N)

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

ans = 0
for f in fs:
  for e in range(1, f[1] + 1):
    z = f[0] ** e
    if N % z == 0:
      N //= z
      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

ans = 0
n= int(input())
if n==1:
    print(0)
else:
    for a,b in factorization(n) :
        for i in range(1,10**12):
            if b < i:
                break
            else:
                b -= i
                ans += 1
    print(ans)

Solution (Python):
from functools import reduce
from bisect import bisect

def soinsuu_bunkai(n):
    ret = {}
    p = 2
    while p * p <= n:
        while n % p == 0:
            ret[p]= ret[p]+1 if p in ret else 1
            n //= p
        p += 1
    if n != 1:
        ret[n] = 1
    return ret   
    
def make_triangle(n):
    cnt = 0
    sum_ = 0
    for i in range(1,n+1):
        sum_ += i
        if sum_ > n:
            break
        else:
            cnt += 1
    return cnt    

dic = soinsuu_bunkai(int(input()))
ans = 0
for k,v in dic.items():
    ans += make_triangle(v)  
print(ans)

Solution (Python):
def factor(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
    fs = factor(n)
    ans = 0
    for f in fs:
        for e in range(1, f[1]+1):
            z = f[0] ** e
            if n % z == 0:
                n //= z
                ans += 1
    print(ans)

main()

Solution (Python):
from math import sqrt
pf={}
m=int(input())
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


cnt = 0
calc = lambda n: (sqrt(8 * n + 1) - 1) // 2
for i in pf:
    v = pf[i]
    n = 1
    while v >= n:
        v -= n
        cnt += 1
        n += 1

print(int(cnt))

Solution (Python):
from sys import stdin

def waru(a,b):
  if a%b != 0:
    return 0
  if a/b == 1:
    return b
  return waru(a/b,b)
  

def main():
  s = []
  read = stdin.readline
  N =int(read())
  if N == 1:
    print(0)
    exit()
  i = 2
  table = []
  ap = table.append
  while i * i <= N:
    while N%i == 0:
      ap(i)
      N //= i
    i += 1
  if N > 1:
    ap(N)
  set_table = sorted(list(set(table)))
  kaisu = [0] * len(set_table)
  num = 0
  for i in table:
    if i == set_table[num]:
      kaisu[num] += 1
    else:
      num += 1
      kaisu[num] += 1
  maxk = max(kaisu)
  j = 1
  k = 0
  count = 0
  while j <= maxk:
    count += len([i for i in kaisu if i >= j])
    k += 1
    j = j + k + 1
  print(count)
    
      
      

  
  
  
if __name__ == "__main__":
  main()

Solution (Python):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()

def factor(x):
    i = 2
    l = []
    while i**2 <= x:
        y = 0
        while x%i == 0:
            x/=i
            y+=1
        if y != 0:
            l.append([i,y])
        i+=1
    
    if x != 1:
        l.append([x,1])
    return l

l = factor(n)


ans = 0
for i in l:
    p = i[0]
    c = i[1]
    b = 1
    while c >= b:
        ans += 1
        c -= b
        b += 1

print(ans)

Solution (Python):
from itertools import groupby

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

def main():
    N = int(input())
    P = fact(N)
    ans = 0
    for v, g in groupby(P):
        n = len(list(g))
        for i in range(1, 100000):
            n -= i
            if(n >= 0):
                ans += 1
            else:
                break
    print(ans)
    
main()

Solution (Python):
n = int(input())
if n == 1:
    print(0)
    exit()

from collections import Counter
def factorize(n):    
    d = Counter()
    if n < 2:
        return d
    
    while n%2 == 0:
        n //= 2
        d[2] += 1

    m = 3
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 2
    if n > 1:
        d[n] += 1
    return d
 
fac = factorize(n)
ans = 0
for v in fac.values():
    n = 1
    while v >= n:
        v -= n
        ans += 1
        n += 1
print(ans)

Solution (Python):
n = int(input())
if n == 1:
    print(0)
    exit()

from collections import Counter
def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d
 
fac = factorize(n)
ans = 0
for v in fac.values():
    n = 1
    while v >= n:
        v -= n
        ans += 1
        n += 1
print(ans)

Solution (Python):
from math import sqrt
pf={}
m=int(input())
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


cnt = 0
calc = lambda n: (sqrt(8 * n + 1) - 1) // 2
for i in pf:
    cnt += calc(pf[i])
print(int(cnt))

Solution (Python):
def prime_factorize(n):
    result = []
    if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    return result

N = int(input())

result = 0
for p, e in prime_factorize(N):
    i = 1
    while e >= i:
        result += 1
        e -= i
        i += 1
print(result)

Solution (Python):



def run_prime_factorization(max_number: int) -> dict:
    '''Run prime factorization.
    Args:
        max_number: Int of number (greater than 1).
    Returns:
        A dictionary's items ((base, exponent) pairs).
    Landau notation: O(log n)
    '''

    from math import sqrt

    ans = dict()
    remain = max_number

    for base in range(2, int(sqrt(max_number)) + 1):
        if remain % base == 0:
            exponent_count = 0

            while remain % base == 0:
                exponent_count += 1
                remain //= base

            ans[base] = exponent_count

    if remain != 1:
        ans[remain] = 1

    return ans


def main():
    import sys
    input = sys.stdin.readline
    n = int(input())

    p = run_prime_factorization(n)
    ans = 0

    for _, value in p.items():
        count = 0

        for i in range(1, 40):
            if (i * (i + 1)) <= 2 * value:
                count += 1

        ans += count

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import math

def prime_factrization(n):
    factor = []
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)

    if not factor:
        return 0
    else:
        if n != 1:
            factor.append(n)
        return list(factor)

ans = 0
N = int(input())
factor = prime_factrization(N)
if N == 1:
    print(0)
elif factor == 0 and N != 1:
    print(1)
else:
    for i in list(set(factor)):
        num = factor.count(i)
        j = 1
        a = 1
        while j <= num:
            ans += 1
            a += 1
            j += a
    print(ans)

Solution (Python):
N=int(input())
NN = N
i = 2
ans = 0
while i*i <= NN:
  if N%i==0:
    j = 0
    while N%i==0:
      N /= i
      j+=1
    k = 1
    while j>0:
      if j - k < 0: break
      ans += 1

      j -= k
      k += 1
  i += 1
if N != 1:
  ans += 1
print(ans)

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


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

factorized_N = factorize_dict(N)


z_list = []

for f_dict in factorized_N.items():
    prime_number = f_dict[0]
    how_many = f_dict[1]
    z_list += [prime_number**i for i in range(1,how_many+1)]
    
z_list.sort(reverse=False)


ans = 0
for z in z_list:
    if N%z == 0:
        ans += 1
        N /= z
        if N == 1:
            break
        
print(ans)

Solution (Python):
def main():
    def factorization(n):
        arr = []
        tmp = n
        for i in range(2, int(-(-tmp**0.5//1))):
            if tmp%i == 0:
                cnt = 0
                while tmp%i == 0:
                    cnt += 1
                    tmp //= i
                arr.append([i, cnt])
        if tmp != 1:
            arr.append([tmp, 1])
        if tmp == []:
            arr.append([n, 1])
        return arr
    n = int(input())
    fn = factorization(n)
    x = [fn[i][1] for i in range(len(fn))]
    b = 1
    res = 0
    for i in x:
        while b <= i:
            i -= b
            b += 1
            res += 1
        b = 1
    print(res)   

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


N = int(input())
div = factorization(N)


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

ans = 0

for d in div:
    c = d[1]
    i = 1

    while c >= 0:
        c -= i
        if c >= 0:
            ans += 1
        i += 1

print(ans)