Problem:


Score : 400 points

Problem Statement

Given is a positive integer N. Consider repeatedly applying the operation below on N:

First, choose a positive integer z satisfying all of the conditions below:

z can be represented as z=p^e, where p is a prime number and e is a positive integer;

z divides N;

z is different from all integers chosen in previous operations.

Then, replace N with N/z.

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

Constraints

All values in input are integers.

1 \leq N \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

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

Sample Input 1

24

Sample Output 1

3

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

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

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

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

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

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

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

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

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

Sample Input 4

1000000007

Sample Output 4

1

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

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

Sample Input 5

997764507000

Sample Output 5

7



Sample input:
24


Sample output:
3

Submission status: Accepted

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

n = int(input())
ans = factorization(n)
cnt = 0
if n == 1:
    print("0")
    exit()
for i in ans:
    num = i[1]
    j = 1
    while num - j >= 0:
        num = num - j
        j +=1
        cnt +=1
print(cnt)

Submission status: Accepted

Solution code:
#入力
N = input()
N = int(N)

#素因数分解
Num = []
n = N
for i in range(2, int(-(-N**0.5//1))+1):
    if n%i==0:
        j=0
        while n%i==0:
            j+=1
            n //= i
        Num.append(j)

if n!=1:
    Num.append(1)

if Num==[]:
    if N == 1:
        Num.append(0)
    else:
        NUm.append(1)

#階差数列
P = []
p = 0
l = max(Num)
for i in range(1,l+1):
    p += i
    P.append(p)

#計算
Answer = 0

l = len(Num)

if Num[0] != 0:
    for i in range(l):
        q = Num[i]
        while not(q in P):
            q -= 1
        Index = P.index(q)
        Index = int(Index)
        Index += 1
        Answer += Index

print(Answer)

Submission status: Accepted

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

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

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

    return arr
N=int(input())
ans=factorization(N)
cnt=0
if N==1:
  print("0")
  exit()
for i in ans:
  num=i[1]
  j=1
  while num-j>=0:
    num=num-j
    j+=1
    cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

def factorization(n):
    arr = []
    if n == 1:
        return arr
    tmp = n
    for i in range(2,int(n**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 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]
    e = 1
    while _tmp - e >= 0:
        cnt += 1
        _tmp -= e
        e += 1
print(cnt)

Submission status: Accepted

Solution code:
#入力
N = input()
N = int(N)

#素因数分解
L = []
M = []
Nu = N
for i in range(2, int(-(-N**0.5//1))+1):
    if Nu % i == 0:
        j = 0
        while Nu % i == 0:
            j += 1
            Nu //= i
        #L.append(i)
        M.append(j)

if Nu != 1:
    #L.appnend(Nu)
    M.append(1)

if M == []:
    if N != 1:
        #L.append(N)
        M.append(1)
    else:
        M.append(0)

#階差数列
l = max(M)
p = 0
P = []
for i in range(1,l+1):
    p += i
    P.append(p)

#計算
Answer = 0
l = len(M)
for i in range(l):
    m = M[i]
    if m != 0:
        while not(m in P):
            m -= 1
        Index = P.index(m)
        Index += 1
        Answer += Index

print(Answer)

Submission status: Accepted

Solution code:
import math


# 素数の判定
def is_prime(n):
    if n == 1:
        return 0

    for k in range(2, int(math.sqrt(n)) + 1):
        chk = False
        while (n % k == 0):
            chk = True
            n /= k
            if k not in check:
                check[k] = 1
            else:
                check[k] += 1
        if chk:
            return n
    if n in check:
        return 0
    else:
        check[n] = 1
        return 1


check = {}
n = int(input())
if n == 1:
    print(0)
else:
    while (1):
        n = is_prime(n)
        if n == 0:
            break
    ans = 0
    for k, v in check.items():
        for i in range(1, 50):
            v -= i
            if v < 0:
                break
            else:
                ans += 1
    # print(check)
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())

fact = {}
for i in range(2, int(n**.5)+1):
  cnt = 0
  if n % i == 0: fact.setdefault(i, 0)
  while n % i == 0:
    fact[i] += 1
    n //= i
    
if n != 1: fact[n] = 1

res = 0
for p, cnt in fact.items():
  i = j = 1
  while j <= cnt:
    res += 1
    i += 1
    j += i

print(res)

Submission status: Accepted

Solution code:
n = int(input())

def pFact(n):
    l=[]
    if(n==1):
        return [1]
    while(n%2==0):
        l.append(2)
        n//=2
    
    f=3
    while(f*f <= n):
        if(n%f==0):
            l.append(f)
            n//=f
        else:
            f += 2
    
    if(n!=1):
        l.append(n)
    return l

l = pFact(n)
dic = {}
div_l = []

for x in l:
    if(dic.get(x) is None):
        dic[x] = 1
    else:
        dic[x] += 1
cnt = 0
for x,y in dic.items():
    if(x==1):
        continue
    e = 1
    while((y-e)>=0):
        y -= e
        e += 1
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import collections
def factorization(n):
    if n < 2:
        return []

    prime_factor = []

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

    #素因数分解した結果、1か√n 以上のものが残る。
    if n > 1 :
        prime_factor.append(n)

    return prime_factor
n = int(input())
#print(factorization(n))

count = 0

c = collections.Counter(factorization(n))
#print(c)
d = list(c.values())
#指数部分を取り出すpqr
#print(d)
for v in c.values():
    for i in range(1,n):
        v -= i
        if v >= 0:
            count += 1
        else:break 

print(count)

Submission status: Accepted

Solution code:
n = int(input())

s = []
for i in range(2, int(n**0.5)+1):
  t = 0
  while n%i == 0:
    n //= i
    t += 1
  s.append(t)
  if n == 1: break

if n > 1: s.append(1)
  
ans = 0
for i in s:
  for j in range(1, i+1):
    if i >= j:
      i -= j
      ans += 1
    else:
      break
print(ans)

Submission status: Accepted

Solution code:
import numpy as np

MAX = 10**6
is_prime = [True] * MAX
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(MAX):
    if is_prime[i]:
        primes.append(i)
        for j in range(2*i, MAX, i):
            is_prime[j] = False

a = np.cumsum([i+1 for i in range(100)])

def decomp(n):
    res = {}
    for p in primes:
        while n % p == 0:
            if not p in res:
                res[p] = 0
            res[p] += 1
            n //= p
    if n > 1:
        res[n] = 1
    return res

def solve(n):
    ans = 0
    for num in decomp(n).values():
        k = 0
        while a[k] <= num:
            k += 1
        ans += k
    return ans

n = int(input())
print(solve(n))

Submission status: Accepted

Solution code:
import math
N = int(input())
temp = N
total = 0
for n in range(2,int(-(-math.sqrt(N)//1))+1):
  count1 = 1
  count2 = 0
  while temp%n==0:
    temp = temp//n
    count2+=1
    if count2 == count1:
      count2 = 0
      count1 += 1
      total += 1
if temp != 1:
  total += 1
print(total)

Submission status: Accepted

Solution code:
from typing import List
from collections import Counter


def prime_factorize(n: int) -> List[int]:
    factor_list = []
    while n % 2 == 0:
        factor_list.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            factor_list.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        factor_list.append(n)
    return factor_list


def count_answer(counter):
    ans = 0
    for count in counter.values():
        i = 1
        while count >= i:
            ans += 1
            count -= i
            i += 1
    return ans


if __name__ == "__main__":
    prime_factors = Counter(prime_factorize(int(input())))
    print(count_answer(prime_factors))

Submission status: Accepted

Solution code:
n = int(input())
r = 0
for p in range(2, int(n**0.5)+1):
    e = 0
    while n%p == 0:
        e += 1
        n /= p
    i = 1
    while e >= i:
        e -= i
        r += 1
        i += 1
if n != 1:
    r += 1
print(r)

Submission status: Accepted

Solution code:
n=int(input())
d={2:0}
if n==1: print(0);exit()
nc=n
while n%2==0:
    d[2]+=1
    n=n//2
for i in range(3,int(nc**0.5)+1,2):
    if n==1: break
    if n%i!=0:continue
    d[i]=0
    while n%i==0:
        d[i]+=1
        n=n//i
if n!=1: d[n]=1 
sm=0
for x in d:
    if d[x]==0: continue
    y=1
    ywork=3
    while ywork<=d[x]:
        y+=1
        ywork+=y+1
    sm+=y
print(sm)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

# 素因数分解(試し割り法)
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())
ans = 0
for p, e in prime_factorize(n):
    i = 1
    while e >= i:
        ans += 1
        e -= i
        i += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
c = 0
for p in range(2, int(n**0.5)+1): #nが合成数
  e = 0
  while n%p == 0:
    n //= p
    e += 1
  i = 1
  while e >= i:
    e -= i
    c += 1
    i += 1
if n != 1: #nが素数 or nがn^0.5より大きい素数を因数に持つ合成数
  c += 1
print(c)

Submission status: Accepted

Solution code:
n = int(input())
c = 0
for p in range(2, int(n**0.5)+1): #nが合成数
  e = 0
  while n%p == 0:
    n //= p
    e += 1
  i = 1
  while e >= i:
    e -= i
    c += 1
    i += 1
if n != 1: #nが素数
  c += 1
print(c)

Submission status: Accepted

Solution code:
n = int(input())

i = 2
memo = []
while( i*i <= n ):
    x = 0
    while(n % i == 0):
        #print("n % i == 0 =",n,i,"n/i=",n/i,x+1)
        n = int(n / i);
        x = x + 1
    memo.append([i,x])
    i = i + 1

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

ans = 0
for i in memo:
    x = i[1]
    b = 1
    while b <= x:
        x = x - b
        b = b + 1
        ans = ans + 1

print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
n = int(input())
cnt = 0
for i in range(2, int(sqrt(n))):
    if n % i == 0:
        div = i
        while n % div == 0:
            n /= div
            div *= i
            cnt += 1
        while n % i == 0:
            n /= i
if n > 1:
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
p = {}
a = N
r = 0

while a-1:
  for i in range(2,int(a**0.5)+10):
    if a%i == 0:
      p[i] = 0
      a //= i
      break
  else:
    break
    
if a != 1:
  p[a] = 0
  
a = N

while a-1:
  for i in range(2,int(a**0.5)+10):
    if a%i == 0:
      p[i] += 1
      a //= i
      break
  else:
    break
    
if a != 1:
  p[a] += 1
  
for el in p:
  a = p[el]
  i = 1
  while a >= i:
    a -= i
    i += 1
    r += 1
    
print(r)

Submission status: Accepted

Solution code:
n = int(input())
r = 0
for p in range(2, int(n**0.5)+1):
    e = 0
    while n%p == 0:
       e += 1
       n /= p
    i = 1
    while e >= i:
        e -= i
        r += 1
        i += 1
if n != 1:
    r += 1
print(r)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def main():
    n = int(input())
    primes = factorize(n)
    ans = 0
    for prime in primes:
        i = 1
        cnt = 0
        while True:
            if cnt + i > prime[1]:
                break
            else:
                cnt += i
                i += 1
        ans += (i - 1)
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

    return arr

N = int(input())
if N ==1:
  print(0)
  exit()
N_list = factorization(N)
cnt_1 = 0
for i in range(len(N_list)):
  x = 1
  y = N_list[i][1]
  cnt = 0
  while True:
    y -= x
    x += 1
    if y >= 0:
      cnt += 1
    else:
      break
  cnt_1 += cnt 
print(cnt_1)

Submission status: Accepted

Solution code:
n=int(input())

import math

def factorization(n): #nを素因数分解する
    arr = []
    temp = n
    for i in range(2, int(math.sqrt(n))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(cnt)

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

#    if arr==[]:
#        arr.append([n, 1])  #n=1でarr=[1,1]としたいとき

    return arr

z=factorization(n)

ans=0
for i in range(len(z)):
    for j in range(1,z[i]+1):
        if (z[i]-j)>=0:
            z[i]-=j
            ans+=1
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
def get_prime_factorized(N):
    result    = []
    base, exp = 2, 0
    while base ** 2 <= N:
        while N % base == 0:
            N    = N // base
            exp += 1
        if exp > 0:
            result.append([base, exp])
        base, exp = base + 1, 0
    if N > 1:
        result.append([N, 1])
    return result


N = int(input())

L = get_prime_factorized(N)
R = 0

for p, e in L:
    sum = 1
    num = 1
    while True:
        if e >= sum + num + 1:
            num += 1
            sum += num
        else:
            break
    R += num

print(R)

Submission status: Accepted

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

def Alifac(arr):
    aarry = []
    for i in arr:
        for j in range(1, i[1] + 1, 1):
            aarry.append([i[0], j])
    return aarry

if __name__ == "__main__":
    n = int(input())
    arr = Alifac(factorization(n))
    arr.sort(key = lambda x: x[1])

    rem = 0
    for i in arr:
        j = i[0]**i[1]
        if n != 1:
            if n % j == 0:
                n = n / j
                rem += 1
    print(rem)

Submission status: Accepted

Solution code:
def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))


from collections import defaultdict, deque, Counter
from sys import exit
import math
import copy
from bisect import bisect_left, bisect_right
from heapq import *
import sys

# sys.setrecursionlimit(1000000)
INF = 10 ** 17
MOD = 1000000007

from fractions import *


def inverse(f):
    # return Fraction(f.denominator,f.numerator)
    return 1 / f


def combmod(n, k, mod=MOD):
    ret = 1
    for i in range(n - k + 1, n + 1):
        ret *= i
        ret %= mod

    for i in range(1, k + 1):
        ret *= pow(i, mod - 2, mod)
        ret %= mod

    return ret

MOD = 10 ** 9 + 7

def yaku(n):
    res = []
    for i in range(2, int(math.sqrt(n)) + 2):
        tmp = 0
        while(True):
            if n % i == 0:
                tmp += 1
                n //= i
            else:
                break
        if tmp != 0:
            res.append((tmp, i))
    if n != 1:
        res.append((1, n))
    return res

def solve():
    n = getN()
    acc = [0]
    tmp = 0
    for i in range(1, 10**6):
        tmp += i
        acc.append(tmp)

    res = yaku(n)
    ans = 0
    for y in res:
        ans += bisect_right(acc, y[0]) - 1
    # print(res)
    print(ans)

def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
def primes(N):
    p = [False, False] + [True] * (N - 1)
    for i in range(2, int(N ** 0.5) + 1):
        if p[i]:
            for j in range(i * 2, N + 1, i):
                p[j] = False
    return [i for i in range(N + 1) if p[i]]


def prime_factors(N):
    ret = {}
    for p in primes(int(N ** 0.5) + 1):
        while N % p == 0:
            ret[p] = ret.get(p, 0) + 1
            N //= p
    if N > 1:
        ret[N] = ret.get(N, 0) + 1
    return ret


N = int(input())
ans, ps = 0, prime_factors(N)
for p in ps:
    d = 1
    while ps[p] >= d:
        ps[p] = ps[p] - d
        d += 1
        ans += 1
print(ans)

Submission status: Accepted

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

def Pf(n):#nの素因数分解(prime:素数リスト)

    #if prime==None: prime=[True]*(n+1)

    ret=[]
    tmp=n

    for i in range(2,int(n**0.5)+1):
        #if not prime[i]: continue
        if tmp%i==0:
            cnt=0
            while tmp%i==0:
                #ret.append(i)
                cnt+=1
                tmp//=i
            ret.append((i,cnt))
    if ret==[] or tmp!=1: ret.append((tmp,1))

    return ret

N=int(input().rstrip())
if N==1:
    print(0)
    exit()
a=Pf(N)
#print(a)
ans=0
for i in a:
    n,x=i
    cnt=1
    while x-cnt>=0:
        ans+=1
        x-=cnt
        cnt+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
import math
n = int(math.sqrt(N)) + 1
p = []
for i in range(2,n):
  if N % i == 0:
    a = 0
    while N % i == 0:
      N //= i
      a += 1
    p.append([i,a])
if N != 1:
  p.append([N,1])
ans = 0
l = len(p)
for i in range(l):
  a = p[i][1]
  j = 1
  while a-j >= 0:
    a -= j
    j += 1
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors


ans = []
cnt = 0
X = make_divisors(n)[1:]
for x in X:
    if is_prime(x):
        ans.append(x)
        n //= x
        cnt += 1
        e = 2
        while x**e < n:
            ans.append(x**e)
            e += 1
    elif x in ans:
        if n%x==0:
            n //= x
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *

def factorize(n):
    fct = []
    
    for i in range(2, int(n**0.5)+1):
        c = 0
        
        while n%i==0:
            n //= i
            c += 1
            
        if c>0:
            fct.append((i, c))
    
    if n>1:
        fct.append((n, 1))
    
    return fct

N = int(input())
fct = factorize(N)
ans = 0

for _, c in fct:
    sub = 1
    
    while c-sub>=0:
        c -= sub
        ans += 1
        sub += 1

print(ans)

Submission status: Accepted

Solution code:
import sys

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):
		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)):
	if a[i][1]!=0:
		cnt=1
		while a[i][1]-cnt>=0:
			a[i][1]-=cnt
			ans+=1
			cnt+=1
print(ans)

Submission status: Accepted

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

    if not arr:
        arr.append(1)

    return arr


def main():
    n = int(input())
    if n == 1:
        print(0)
    else:
        arr = factorization(n)
        cnt = 0
        for e in arr:
            if 1 <= e < 3:
                cnt += 1
            elif 3 <= e < 6:
                cnt += 2
            elif 6 <= e < 10:
                cnt += 3
            elif 10 <= e < 15:
                cnt += 4
            elif 15 <= e < 21:
                cnt += 5
            elif 21 <= e < 28:
                cnt += 6
            elif 28 <= e < 36:
                cnt += 7
            elif 36 < e:
                cnt += 8
        print(cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
##########################################################
# from collections import Counter
# from fractions import Fraction
# s=iter(input())
# for _ in range(int(input())):
# from collections import deque
from itertools import permutations as pmt

# n=int(input())
# arr=list(map(int,input().split()))
# ls=list(map(int,input().split()))
# for i in range(m):
# for i in range(int(input())):
# arr = list(map(int, input().split()))
# for  i in range(int(input())):
# for  _ in range(int(input())):
# n, k = map(int, input().split())
#for _ in range(int(input())):
#from decimal import Decimal
import math
def factors(n):
    cn=n
    cnt=0
    ans=[]
    while n%2==0:
        n=n//2
        cnt+=1
    ans.append(cnt)
    #print(ans)
    #print('n', n)
    for i in range(3, int(math.sqrt(cn)) + 1, 2):
        cnt=0
        while n%i==0:
            n = n / i
            cnt+=1
        if cnt>0:
            ans.append(cnt)
            #print(ans)
    if n>2:
        ans.append(1)
    #print(ans)
    return ans






n=int(input())
p=factors(n)
if n==1:
    print(0)
elif len(p)==0:
    print(1)
else:
    f=0
    #print(p)
    for ex in p:
        i=1
        while ex>0:
            ex-=i
            if ex<0:
                break
            i+=1
            f+=1
    print(f)

Submission status: Accepted

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

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

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

    return arr
ans = 0
if n == 1:
  print(0)
  quit()
for f in factorization(n):
  count = 0
  for i in range(1,f[1]+1):
    count += i
    if count <= f[1]:
      ans += 1
    else:
      break
print(ans)

Submission status: Accepted

Solution code:
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(ex)
    if n != 1:
        res.append(1)
    return res


def resolve():
    n = int(input())
    div = prime_factorization(n)

    res = 0
    for ex in div:
        i = 1
        while ex > 0:
            ex -= i
            if ex < 0:
                break
            i += 1
            res += 1
    print(res)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
n = int(input())


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


fac = prime_factorize(n)

from collections import Counter

ctr = Counter(fac)

ans = 0
for val in ctr.values():
    cnt = 1
    while val - cnt >= 0:
        ans += 1
        val -= cnt
        cnt += 1


print(ans)

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
from collections import defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
def soinsu(n):
    dic = defaultdict(int)
    i = 2
    while i*i <= n:
        if n%i == 0:
            dic[i] += 1
            n //= i
        else:
            i += 1
    if n!= 1:
        dic[n] += 1
    return dic
n = I()
dic = soinsu(n)
#print(dic)
cnt = 0
for k,v in dic.items():
    num = 1
    while v - num >= 0:
        cnt += 1
        v -= num
        num += 1
print(cnt)

Submission status: Accepted

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

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

x = make_divisors(n)[1:]
if len(x) == 1:
    print(1)
    exit()

cnt = 0
numbers = []
for a in x:
    if is_prime(a):
        n //= a
        e = 2
        cnt += 1
        while n%(a**e)==0:
            numbers.append(a**e)
            e += 1
    if a in numbers:
        if n%a == 0:
            n //= a
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys
from bisect import bisect

def solve():
    input = sys.stdin.readline
    N = int(input())
    sum = [0] * 41
    for i in range(1, 41):
        sum[i] = sum[i-1] + i
    count = 0
    k = N
    for i in range(2, N + 1):
        if i ** 2 > k: break
        if k % i == 0:
            d = 0
            while k % i == 0:
                d += 1
                k //= i
            count += bisect(sum, d) - 1
    if k > 1: count += 1
    print(count)

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
P = [1 for _ in range(10**6)]
P[0]=0
P[1]=0
for i in range(2,10**3):
    for j in range(i*i,10**6,i):
        P[j]=0
Q = []
for j in range(2,10**6):
    if P[j]==1:
        Q.append(j)
N = int(input())
E = []
for p in Q:
    if N%p==0:
        k = 0
        while N%p==0:
            N = N//p
            k += 1
        E.append(k)
if N>1:
    E.append(1)
cnt = 0
for e in E:
    n=1
    while (n*(n+1))//2<=e:
        n += 1
    cnt += n-1
print(cnt)

Submission status: Accepted

Solution code:
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            a=n//i 
            if (a+1)*i<=n:
              a+=1
            n=a
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
N=int(input())
a=prime_factors(N)
current=0
index=0
anslist=[]
for i in a:
  if i!=current:
    current=i
    anslist.append(1)
  else:
    anslist[-1]+=1
ans=0
for i in anslist:
  k=1
  while (k*(k+1))<=2*i:
    k+=1
  k-=1
  ans+=k
print(ans)

Submission status: Accepted

Solution code:
def prime_factorize(n):
    dic = {}
    while n % 2 == 0:
        if 2 in dic:
            dic[2] += 1
        else:
            dic[2] = 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            if f in dic:
                dic[f] += 1
            else:
                dic[f] = 1
            n //= f
        else:
            f += 2
    if n != 1:
        if n in dic:
            dic[n] += 1
        else:
            dic[n] = 1
    return dic

n = int(input())

dic = prime_factorize(n)
ans = 0
for value in dic.values():
    left = 1
    right = value
    while left+1 < right:
        mid = (left+right) // 2
        if mid*(mid+1)//2 <= value:
            left = mid
        else:
            right = mid
    ans += left
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
def prime_factor(n):
  ass=[]
  for i in range(2,int(n**0.5)+1):
    while n%i==0:ass.append(i);n//=i
  if n!=1:ass.append(n)
  return ass
p=prime_factor(n)
from collections import Counter
c=Counter(p)
ans=0
for i in c:
  m=c[i]
  for j in range(1,10**20):
    if j>m:break
    ans+=1
    m-=j
print(ans)