Problem:


Score : 400 points

Problem Statement

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

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

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

z divides N;

z is different from all integers chosen in previous operations.

Then, replace N with N/z.

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

Constraints

All values in input are integers.

1 \leq N \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

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

Sample Input 1

24

Sample Output 1

3

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

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

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

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

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

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

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

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

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

Sample Input 4

1000000007

Sample Output 4

1

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

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

Sample Input 5

997764507000

Sample Output 5

7



Sample input:
24


Sample output:
3

Submission status: Accepted

Solution code:
# import queue
def main():
    N = int(input())
    if N == 1:
        print(0)
        return
    n = N
    prime = [True for i in range(10**6+1)]
    prime[0] = False
    prime[1] = False
    for i in range(2, len(prime)):
        if prime[i] == True:
            for j in range(i*2, len(prime), i):
                prime[j] = False

    ans = 0
    for i in range(len(prime)):
        if prime[i] == True and n % i == 0:
            p = i
            flag = False
            while n % p == 0:
                ans += 1
                n = n//p
                p *= i
            while n % i == 0:
                n = n//i
    if 1 < n:
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
pri_cnt = {}
n = N
i = 2

while i ** 2 <= N:
  while n % i == 0:
    if i not in pri_cnt:
      pri_cnt[i] = 1
    else:
      pri_cnt[i] += 1
    n = n / i
  if (i == 2):
    i += 1
  else:
    i += 2

if n > 1:
  pri_cnt[int(n)] = 1

ans = 0
for pri, cnt in pri_cnt.items():
  count = 1
  remain = cnt
  while remain >= count:
    ans += 1
    remain -= count
    count += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
res = {}
ans = 0
i = 2
 
for i in range(2,int(N**(1/2))+1) :
    while(N%i == 0) :
        if(i not in res) :
            res[i] = 1
        else :
            res[i] += 1
        N /= i
if(N != 1) :
    res[N] = 1
 

for i in res :
    b = 1
    s = res[i]
    while(b <= s) :
        ans += 1
        s -= b
        b += 1
print(ans)

Submission status: Accepted

Solution code:
def prime_factors(n):
    i = 2
    factors = []
    while i**2 <= n:
        if n % i != 0:
            i += 1
        else:
            factors.append(i)
            n = n // i
    if n > 1:
        factors.append(n)
    return factors

def resolve():
    N = int(input())
    import collections
    factors = collections.Counter(prime_factors(N))
    numbers = [0,1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9]
    cnt = 0
    for k, v in factors.items():
        cnt += numbers[v]
    print(cnt)


if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())

def factorize(N):
    factors = defaultdict(int)
    i = 2
    while i * i <= N:
        factor = 0
        while N % i == 0:
            N //= i
            factor += 1
        if factor > 0:
            factors[i] = factor
        i += 1
    if N > 1:
        factors[N] = 1
    return factors

def to_cnt(n):
    i = 0
    while n >= i+1:
        n-=(i+1)
        i += 1
    return i

ans = 0
for _, n in factorize(N).items():
    ans += to_cnt(n)
print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

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

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

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

    return arr
  
def divcount(n):
  cnt=0
  while n>=0:
    n-=cnt+1
    cnt+=1
  return cnt-1

s=factorization(N)
t=[i[1] for i in s]
ans=0
for i in t:
  ans+=divcount(i)
print(ans)

Submission status: Accepted

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

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

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

    return arr
N = int(input())
fac = factorization(N)
Answer = 0
for i in range(len(fac)):
    faci = fac[i][1]
    An = 1
    while faci >= An:
        Answer += 1
        faci -= An
        An +=1
if N == 1:
    Answer = 0
print(Answer)

Submission status: Accepted

Solution code:
a,n=0,int(input())
for i in range(2,10**6):
  x=j=0
  while n%i<1:n//=i;x+=1
  while x>j:a+=1;j+=1;x-=j
print(a+(n>1))

Submission status: Accepted

Solution code:
a,n=0,int(input())
for i in range(2,int(n**0.5+1)):
  x=0
  while(n%i==0):n//=i;x+=1
  j=1
  while(x>=j):a+=1;x-=j;j+=1
print(a+(n>1))

Submission status: Accepted

Solution code:
import bisect
n=int(input())
if n==1:
    print(0)
    exit()
def 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 ra(a):
    ll,l=[],1
    for i in range(len(a)-1):
        if a[i]==a[i+1]:
            l+=1
        else:
            ll.append(l)
            l=1
    ll.append(l)
    return ll
l=ra(factorize(n))
c=[1]
for i in range(2,10**4):
    c.append(i+c[-1])
ans=0
for i in l:
    ans+=bisect.bisect_left(c,i)
    if i in set(c):
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
# ==================================================-
# 高速素因数分解
# """2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

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

def get_times(n):
    if n<3:
        return 1
    elif n<6:
        return 2
    elif n<10:
        return 3
    elif n<15:
        return 4
    elif n<21:
        return 5
    elif n<28:
        return 6
    elif n<36:
        return 7
    elif n<45:
        return 8
    else:
        return 9
ans=0
for i in soinnsuu:
    sisuu=i[1]
    ans+=get_times(sisuu)
if n==1:
    print(0)
else:
    print(ans)

Submission status: Accepted

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

n = int(input())
np = set(prime_factorize(n))
npl = []
for i in np:
    j = 1
    j *= i
    while j <= n:
        npl.append(j)
        j *= i
npl.sort()

cz = 2
ans = 0
for cz in npl:
    # print(n, cz)
    if cz > n:
        break
    if n % cz == 0:
        ans += 1
        n //= cz
print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
d = n
m = {}

for i in range(2, int(math.sqrt(n)) + 1):
    m[i] = 0
    while (d % i == 0):
        d //= i
        m[i]+=1
res = 0
for i in m.values():
    res+=int(math.sqrt(i*2+0.25)-0.5)

if d > 1:
    res += 1
print(res)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0

## execute
d = 2
while d*d <= N:
  if N % d == 0:
    z = d
    while N % z == 0:
      N /= z
      ans += 1
      z *= d
    while N % d == 0:
      N /= d
  d += 1

if N > 1: ans += 1 # N is prime
print(ans)

Submission status: Accepted

Solution code:
def factorize(N):
  fCount = []
  d = 2
  while d*d <= N:
    if N % d == 0:
      cnt = 0
      while N % d == 0:
        N //= d;
        cnt += 1
      fCount.append(cnt)
    d += 1

  if N > 1: ## N is prime
    fCount.append(1)
    N = 1

  return fCount
## ----------------------
N = int(input())
arr = factorize(N)
arr.sort()  ## 2 2 3 3 3 4

def triangle(k):
  return k * (k+1)//2

smallerTriangle = [0]*45 # 2**45 > 10**12
for i in range(45):
  for j in range(1, 10000):
    if triangle(j) > i:
      smallerTriangle[i] = j-1
      break

ans = 0
for expo in arr:
  ans += smallerTriangle[expo]
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
from itertools import chain
import numpy as np
import math

# from itertools import combinations as comb
# form bisect import bisect_left, bisect_right, insort_left, insort_right
# from collections import Counter
# import numpy as np


def factorize(n: int):
    """nを素因数分解する"""
    # 2
    count = 0
    while n % 2 == 0:
        count += 1
        n = n // 2
    if count > 0:
        arr = [(2, count)]
    else:
        arr = []

    # 3 以降
    for facter in range(3, n + 1, 2):
        if facter * facter > n:
            if n > 1:
                arr.append((n, 1))
            break
        count = 0
        while n % facter == 0:
            count += 1
            n = n // facter
        if count > 0:
            arr.append((facter, count))

    return arr


def case(n):
    t = 0
    i = 1
    while True:
        t += i
        if t > n:
            return i - 1
        i += 1


def solve(N: int):
    factors = factorize(N)
    answer = 0
    for f, count in factors:
        answer += case(count)
    return answer


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    # N = map(int, line.split())
    N = int(next(tokens))  # type: int
    answer = solve(N)
    print(answer)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

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()
a = factorization(n)
#print(a)
ans = 0
for i in a:
  t = i[1]
  c=1
  tmp = 0
  while(tmp<=t):
    tmp+=c
    c+=1
  ans+=(c-2)
print(ans)

Submission status: Accepted

Solution code:
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

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

l_2d = factorization(N)

cnt = 0
for l in l_2d:
    p = l[0]
    e = l[1]
    if p == 1:
        continue
    for i in range(1, 10 ** 7):
        if e < i:
            break
        cnt += 1
        e -= i
print(cnt)

Submission status: Accepted

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

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

def counter(n):
  i = 1
  while n > 0.5*(i+1)*(i+2)-1:
    i += 1
  return i

cnt = 0
numbers = prime_decomposition(N)
set_number = set(numbers)

for i in set_number:
  cnt += counter(numbers.count(i))
  
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

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

Primes = Prime_Factorize(N)
cnt = 0
for p in Primes:
    e = 1
    z = p
    while (N%z == 0) and (N >= z):
        N //= z
        e += 1 
        z = p**e
        cnt += 1
    while N%p == 0:
        N //= p
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(2, N):
    if i * i > N:
        break
    e = 0
    while N % i == 0:
        e += 1
        N //= i
    if e > 0:
        for j in range(1, 10):
            if e >= j:
                e -= j
                ans += 1
            else:
                break
if N > 1:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
def divideprime(n):
    ret = []
    i = 2
    while i*i <= n:
        cnt = 0
        if(n%i != 0):
            i += 1
            continue
        
        while n % i == 0:
            cnt += 1
            n //= i
        
        ret.append([i,cnt])
        
        i += 1
    
    if n != 1:
        ret.append([n,1])
    
    return ret
    
N = int(input())

divp = divideprime(N)

ans = 0
for t in divp:
    cnt = 0
    e = 0
    s = set([])
    while (t[1]-e > 0) and (t[1]-e not in s):
        ans += 1
        cnt += 1
        e += cnt
        s.add(cnt)

print(ans)

Submission status: Accepted

Solution code:
def prime_factorize(n):
    '''
    素因数分解のリストを返す。n == 1のとき[]になるので注意。
    :param n:int
    素因数分解する自然数
    :return: list
    素因数分解した結果。

    例
    n : 10
    primes : [[2, 1], [5, 1]]
    '''
    primes = []
    for i in range(2, int(n ** (1 / 2)) + 1):
        if n % i != 0:
            continue
        num = 0
        while n % i == 0:
            num += 1
            n //= i
        primes.append([i, num])
    if n != 1:
        primes.append([n, 1])
    return primes

N = int(input())
prime_list = prime_factorize(N)
ans = 0
for _, e in prime_list:
    now = 1
    work = e
    while work >= now:
        work -= now
        now += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import math
 
N = int(input())
 
M = int(math.sqrt(N))

ans = 0 
check = [True for _ in range(M + 1)]
e = [0 for _ in range(M + 1)]

for p in range(2, M + 1):
    if check[p] == True:
        for j in range(2, M // p + 1):
            check[p * j] = False

        while N % p == 0:
            N = N // p
            e[p] += 1
        
        ans += int((math.sqrt(1 + 8 * e[p]) - 1)/2)

if N > 1:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

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

    return arr

def p_num(m):
  ret = 0
  for j in range(1,10**12):
    ret += j
    if ret <= m < ret+(j+1):
      ans = j
      break
  return ans

p = factorization(N)

cnt = 0
for k in range(len(p)):
  cnt += p_num(p[k][1])
print(cnt)

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
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())
def main():
    n = I()
    def prime_factor(n):
        lst = []
        while n%2 == 0:
            n //= 2
            lst.append(2)
        f = 3
        while f**2 <= n:
            if n%f == 0:
                n //= f
                lst.append(f)
            else:
                f += 2
        if n != 1:
            lst.append(n)
        return lst
    dic = collections.Counter(prime_factor(n))
    ans = 0

    for key,value in dic.items():
        cnt = 0
        while value>=cnt+1:
            cnt += 1
            value -= cnt

        ans += cnt
    # print(dic)
    print(ans)
        
main()

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
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())
def main():
    n = I()
    dic = collections.defaultdict(int)

    while n != 1:
        prime = 0
        limit = int(n**(1/2))
        for i in range(2,limit+1):
            if n%i == 0:
                prime = i
                break
        else:
            prime = n

        while n%prime == 0:
            n //= prime
            dic[prime] += 1

    ans = 0

    for key,value in dic.items():
        cnt = 0
        while value>=cnt+1:
            cnt += 1
            value -= cnt

        ans += cnt
    # print(dic)
    print(ans)
        
main()

Submission status: Accepted

Solution code:
import math
N = int(input())
max_D = int(2 + math.sqrt(N))
count = []
ans = 1
for i in range(2, max_D):
   if N % i == 0:
      count.append(0)
      while N % i == 0:
         N = N // i
         count[-1] += 1
   if N < i:
      ans = 0
      break
l = len(count)
for i in range(l):
   E = 2*count[i]
   j = 0
   while j * (j + 1) <= E:
      j += 1
   ans += j - 1
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

from collections import defaultdict

def main():
	n=II()
	d=defaultdict(int)

	while n%2==0:
		d[2]+=1
		n//=2

	f=3
	while f*f<=n:
		if n%f==0:
			d[f]+=1
			n//=f
		else:
			f+=2

	if n!=1:
		d[n]+=1

	#print(d)

	ans=0

	for _,v in d.items():
		for i in range(1,10000):
			if (i*(i+1))//2>v:
				ans+=i-1
				break
	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()

factors = factorization(N)

ans = 0
for factor in factors:
    num = factor[1]
    x = 1
    for i in range(num+1):
        if i**2 + i > 2*num:
            x = i-1
            break
#    print(num,x)                                                                                      
    ans += x

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
from itertools import accumulate
from bisect import bisect_right


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


num = [i for i in range(1, 65)]
num = list(accumulate(num))

N = int(input())
primes = Counter(factor(N))
ans = 0
for v in primes.values():
    ans += bisect_right(num, v)
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

#素因数分解
def prime_factorize(n):
    if n == 1:
        return [1]
    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 = inp()
c = Counter(prime_factorize(n))
res = 0
# print(c)
for k,v in c.items():
    if k == 1: continue
    cnt = 0
    for now in range(1,150000):
        cnt += now
        if cnt > v:
            res += now-1
            break
print(res)

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 i in range(2,10**6):
    if P[i]==1:
        Q.append(i)
N = int(input())
C = {}
for q in Q:
    if N%q==0:
        C[q] = 0
        while N%q==0:
            N = N//q
            C[q] += 1
if N>1:
    C[N] = 1
cnt = 0
for q in C:
    k = C[q]
    n = 1
    while k>(n*(n+1))//2:
        n += 1
    if k==(n*(n+1))//2:
        cnt += n
    else:
        cnt += n-1
print(cnt)

Submission status: Accepted

Solution code:
import collections
import bisect
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())
c = collections.Counter(prime_factorize(N))
sums = []
s=1
ans = 0
for v in c.values():
  count = 0
  for i in range(1,v+1):
    if count+i > v:
      break
    else:
      count += i
      ans += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
import math
N = int(input())
Nso = []
Nruto = math.sqrt(N)
Nruto = math.floor(Nruto)
for i in range(2, Nruto+1):
    while N % i == 0:
        N = N//i
        Nso.append(i)
    if N == 1:
        break
    Nruto = math.sqrt(N)
    Nruto = math.floor(Nruto)
Nso.append(N)
if 1 in Nso:
    Nso.remove(1)
Nso = Counter(Nso)
ans = 0
for v in Nso.values():
    count = 0
    for i in range(1, v+1):
        if count+i > v:
            break
        else:
            count += i
            ans += 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,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math

#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
n = I()
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
dic = soinsu(n)
ans = 0
for k,v in dic.items():
    i = 1
    while True:
        if v >= i:
            ans += 1
            v -= i
            i += 1
        else:
            break
print(ans)

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 i in range(2,10**6):
    if P[i]==1:
        Q.append(i)
N = int(input())
C = {}
for q in Q:
    if N%q==0:
        C[q] = 0
        while N%q==0:
            N = N//q
            C[q] += 1
if N>1:
    C[N] = 1
cnt = 0
for q in C:
    k = C[q]
    n = 1
    while k>(n*(n+1))//2:
        n += 1
    if k==(n*(n+1))//2:
        cnt += n
    else:
        cnt += n-1
print(cnt)

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:
from collections import defaultdict
n = int(input())

d = defaultdict(int)

i = 2
while i * i <= n:
    while n % i == 0:
        d[i] += 1
        n /= i
    i += 1
if n != 1:
    d[n] += 1

ans = 0
for v in d.values():
    # x * (x + 1) // 2 <= vとなる最大のx
    x = 0
    while (x + 1) * (x + 2) // 2 <= v:
        x += 1
    ans += x
print(ans)

Submission status: Accepted

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

from itertools import groupby
from collections import Counter
import sys
input = sys.stdin.readline

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

    ans = 0
    table = prime_decomposition(N)
    for _, cnt in table:
        i = 1
        while cnt >= i:
            cnt -= i
            i += 1
            ans += 1

    print(ans)

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


def abc169d_div_game():
    n = int(input())
    arr = factorization(n)
    cnt = 0
    for p, e in arr:
        if p == 1: continue
        for i in range(1, e+1):
            if e >= i:
                cnt += 1
                e -= i
            else:
                break
    print(cnt)

abc169d_div_game()

Submission status: Accepted

Solution code:
import math
import collections
def prime_diviation(n):
    factors = []
    i = 2
    while i <= math.floor(math.sqrt(n)):
        if n%i == 0:
            factors.append(int(i))
            n //= i
        else:
            i += 1
    if n > 1:
        factors.append(n)
    return factors

N = int(input())
if N == 1:
  print(0)
  exit()
#pr:素因数分解 prs:集合にしたやつ prcnt:counter
pr = prime_diviation(N)
prs = set(pr)
prcnt = collections.Counter(pr)
#print(pr, prs, prcnt)
ans = 0

for a in prs:
  i = 1
  cnt = 2*prcnt[a]
  #2*prcnt >= n(n+1)となる最大のnを探すのが楽そう
#  print(cnt)
  while cnt >= i*(i+1):
    i += 1
  ans += i - 1 
  
print(ans)

Submission status: Accepted

Solution code:
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())
if n==1:
    print(0)
    sys.exit()
l=factorization(n)
ans =0
for x in l:
    a=x[0] #素数
    b=x[1] #素数の個数
    k=0
    t=0
    while(True):
        t += 1
        k += t
        if k==b:
            ans += t
            break
        elif k > b:
            ans += t-1
            break
print(ans)

Submission status: Accepted

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

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

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

    return arr

n=int(input())
ans=0
cnt=[0]
for i in range(1,9):
    for _ in range(i+1):
        cnt.append(i)
lis=factorization(n)


for a,b in lis:
    ans+=cnt[b]
if n==1:
    print(0)
else:print(ans)

Submission status: Accepted

Solution code:
n = int(input())
n1 = n
pn = []
cnt = 2
ans = 0
while cnt <= int(n ** 0.5):
    while n1 % cnt == 0:
        n1 = n1 // cnt
        pn.append(cnt)
    cnt += 1
pns = list(set(pn))
ansa = []
for i in pns:
    ansa.append(pn.count(i))
for i in ansa:
    x = 1
    while i > 0:
        i -= x
        if i < 0:
            break
        x += 1
        ans += 1
print(ans + 1 if n1 != 1 else ans)

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

soinsu_list = factorization(N)
#print(soinsu_list)
for i in range(len(soinsu_list)):
    cnt = 0
    while soinsu_list[i][0] != 1:
        cnt += 1
        soinsu_list[i][1] -= cnt
        if soinsu_list[i][1] < 0:
            cnt -= 1
            break
    ans += cnt
print(ans)