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

temp = factorization(N)

ans = 0

def counter(num):
    count = 0
    time = 1
    while num > 0:
        num = num - time
        count += 1
        time += 1
        
    if num == 0:
        return count
    if num < 0:
        return count - 1

for i in range(len(temp)):
    ans += counter(temp[i][1])
    
print(ans)

Submission status: Accepted

Solution code:
import math


inf = 10**12

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

def get_count(k):
    for i in range(inf):
        k -= i
        if k < 0:
            return i-1

def solve(N):
    result = 0
    
    current_count = 0
    while N % 2 == 0:
        current_count += 1
        N //= 2
    result += get_count(current_count)

        
    d = 3
    sqrt = math.sqrt(N)
    while N > 1:
        current_count = 0
        # print(f'd: {d}')
        # print(f'N: {N}')
        if d > sqrt:
            # print("hello")
            if N > 1:
                result += 1
                N = 1
        while N % d == 0:
            current_count += 1
            N //= d
            # print(N)
        if current_count:
            result += get_count(current_count)
            sqrt = math.sqrt(N)
        # print(f'N: {N}')
        d += 2

    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import collections

N = int(input())

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


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

ans = 0
for i in values:
    value = i
    l = 1
    while((value - l) >= 0):
        ans += 1
        value -= l
        l += 1

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())
tmp = prime_factorize(N)
import collections
C = collections.Counter(tmp)
count = 0
for key in C.keys():
    tmp = C[key]
    i = 0
    while True:
        i += 1
        if tmp >= i:
            tmp -= i
            count += 1
        else:
            break
print(count)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    if n == 1:
        print(0)
        return
    def eratos(n):
        flag = [True] * (n + 1)
        for i in range(2, int(n**0.5) + 1):
            if flag[i]:
                for j in range(2*i, n + 1, i):
                    flag[j] = False
        return [i for i, x in enumerate(flag) if x and i >= 2]
    p = eratos(10**6)
    work = []
    for i in p:
        piyo = 0
        while n % i == 0:
            n //= i
            piyo += 1
        if piyo > 0:
            work.append(piyo)
        if n == 1:
            break
    if len(work) == 0:
        print(1)
        return
    else:
        result = 0
        for i in work:
            for j in range(1, 10**6):
                i -= j
                if i <0:
                    break
                result += 1
    if n != 1:
        result += 1
    print(result)
main()

Submission status: Accepted

Solution code:
from collections import Counter

n = int(input())

divisors = []
e = int(n ** 0.5) + 1
for a in range(2, e):
    while n % a == 0:
        divisors.append(a)
        n //= a
    if n == 1:
        break
if n != 1:
    divisors.append(n)

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

ans = 0
ctr = Counter(divisors)
for d, n in ctr.items():
    x = 1
    while n >= x:
        n -= x
        x += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(IN())
mod=1000000007

#+++++

def main():
	a = int(input())
	#b , c = tin()
	#s = input()
	dd = defaultdict(lambda :0)
	for i in range(2, a):
		while a % i == 0:
			dd[i]+=1
			a = a // i
		if i ** 2 > a:
			if a != 1:
				dd[a]+=1
			break
	
	ret = 0
	for key in dd:
		v = dd[key]
		for i in range(1, 100):
			if v < i:
				break
			v -= i
			ret += 1
	print(ret)
		
			
	
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
from sys import stdin
import collections

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

N = int(stdin.readline().rstrip())
res = 0
if N>=2:
  c = collections.Counter(prime_factorize(N))
  for v in c.values():
    for n in range(1,10):
      if v < n:
        break
      else:
        v -= n
        res += 1
print(res)

Submission status: Accepted

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

A = 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

prim = factorization(A) 
#print(prim)
## [[2, 3], [3, 1]] 
##  24 = 2^3 * 3^1

def count_parts(N):
    #整数Nを引数として、それが何このパーツに分解できるか返す
    #N=1~40
    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

ans = 0
#40乗まで考えれば良い
for i in range(len(prim)):
    s = prim[i][1]
    ans += count_parts(s)

if(A == 1):
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N == 1:
  print(0)
  import sys
  sys.exit()

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

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

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

    return arr
  
insu = factorization(N)
sum = 0
for i in insu:
  k = i[1]
  tmp = 0
  while True:
    if tmp*(tmp+1)/2 <= k and k < (tmp+2)*(tmp+1)/2:
      break
    tmp += 1
  sum += tmp
    
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
d = {}
while n % 2 == 0:
    d[2] = 1 if 2 not in d else d[2] + 1
    n //= 2
f = 3
while f * f <= n:
    if n % f == 0:
        d[f] = 1 if f not in d else d[f] + 1
        n //= f
    else:
        f += 2
if n != 1:
    d[n] = 1 if n not in d else d[n] + 1
cnt = 0
for k, v in d.items():
    i = 1
    while i <= v:
        cnt += 1
        v -= i
        i += 1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
_n=n
if n==1:
    print(0)
    exit()
ans=0
for i in range(2,10**6+9):
    c=i
    while(n%c==0):
        n//=c
        ans+=1
        c*=i
    while(n%i==0):
        n//=i
    if n==1:
        break
if i<n:
    ans+=1
print(ans)

Submission status: Accepted

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

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

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

list = []
number = 1

cnt = 2
while len(list) < 100:
    for j in range(cnt):
        list.append(number)
    number += 1
    cnt += 1

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

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

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

    ans = 0
    for v in pf.values():
        for i in range(1, 100000000):
            if i > v:
                break
            ans += 1
            v -= i

    print(ans)


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

main()

Submission status: Accepted

Solution code:
n = int(input())

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

l = prime_factorize(n)

import collections
count = collections.Counter(l)

total = 0
for dup in count.items():
    total += 1
    appear = dup[1]
    if appear > 1:
        ite = 1
        accu = 1
        while accu < appear:
            ite += 1
            accu += ite
            if accu > appear:
                continue
            total += 1

print(total)

Submission status: Accepted

Solution code:
import sys
#import time
import copy
#from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**20
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n = ri()
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
acu=[0]*101
acu[0]=0
for i in range(100):
    acu[i+1]=acu[i]+(i+1)

li=factorization(n)
ans=0
for i in li:
    ans+=bisect.bisect_right(acu,i[1])-1
if n==1:
    print(0)
else:
    print(ans)

Submission status: Accepted

Solution code:

primes = {}
N = int(input())
A = [N]
for val in A:
    p = 2
    while val >= p * p:
        if val % p == 0:
            # 割り切れるならそこから話が始まる
            cnt = 0
            while val % p == 0:
                cnt += 1
                val //= p
            if p not in primes:
                primes[p] = cnt
            else:
                primes[p] = max(cnt, primes[p])
        p += 1
    if val != 1:
        if val not in primes:
            primes[val] = 1

ans = 0
for k, v in primes.items():
    now = 1
    while v > 0:
        if v >= now:
            v -= now
            now += 1
            ans += 1
        else:
            v = 0
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
#素因数分解
def prime_factorize(N):
    f = []
    i = 2
    while i * i <= N:
        if N % i != 0:
            i += 1
            continue
        #指数
        exp = 0
        #割れる限り割り続ける
        while N % i == 0:
            exp += 1
            N //= i
        #結果をpush
        f.append([i, exp])
        #次の素数へ: 合成数は順次消されている
        i += 1
    #最後残った数について
    if N != 1:
        f.append([N, 1])
    return f

#main
N = int(input())
F = prime_factorize(N)

cnt = 0
for i in range(len(F)):
    a = F[i][1] - 1
    j = 1
    while a >= 0:
        cnt += 1
        j += 1
        a -= j
print(cnt)

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 rui(x):
  if x<3:
    return 1
  elif x<6:
    return 2
  elif x<10:
    return 3
  elif x<15:
    return 4
  elif x<21:
    return 5
  elif x<28:
    return 6
  elif x<36:
    return 7
  else:
    return 8
  
N=int(input())
A=factorization(N) 
ans=0
for i in range(len(A)):
  ans+=rui(A[i][1])
if N==1:
  print(0)
else:
  print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


input = sys.stdin.readline
def IS(cb): return cb(input().strip())
def IL(cb): return [cb(s) for s in input().strip().split()]
def IR(cb, rows): return [IS(cb) for _ in range(rows)]
def ILL(cb, rows): return [IL(cb) for _ in range(rows)]


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 bit_count(i):
    i = i - ((i >> 1) & 0x55555555)
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
    i = (i + (i >> 4)) & 0x0f0f0f0f
    i = i + (i >> 8)
    i = i + (i >> 16)
    return i & 0x3f


def solve():
    N = IS(int)
    facts = factorization(N)
    ans = 0
    for p, e in facts:
        if p == 1:
            continue

        ans += int(((1 + 8 * e) ** 0.5 - 1) // 2)

    print(ans)

solve()

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

if N == 1:
    print(0)
else:
    fact = factorization(N) 
    res = 0
    import math 
    for pe in fact:
        add = math.floor((math.sqrt(1+8*pe[1])-1) /2)
        res += add
    print(res)

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
a = Counter(prime_factorize(n))
ans = 0
for i in a.values():
  for j in range(1,1000):
    di = j*(j+1)/2
    if di > i:
      ans += j-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


def main():
    n_ans = [0]*50
    n = int(input())
    if n==1:
        print(0)
        return
        
    facs = factorization(n)

    curr_n = 1
    for i in range(41):
        curr_sum = (curr_n+1)*(curr_n+2)//2
        if i < curr_sum:
            n_ans[i] = curr_n
        else:
            curr_n+=1
            n_ans[i] = curr_n
    # print(n_ans)
            
    ans = 0
    for fac in facs:
        cnt = fac[1]
        ans += n_ans[cnt]
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# D - Div Game
import bisect

N = int(input())

arr = [1] * 50
for i in range(2, 50):
    arr[i-1] = arr[i-2]+i

def prime_factorization(n):
    prime_factors = []
    if n < 2:
        return 0
    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
            prime_factors.append((i, ex))
    if n!=1:
        prime_factors.append((n,1))
    return prime_factors

primes = prime_factorization(N)

ans = 0
if N != 1:
    for p, ex in primes:
        ans += bisect.bisect_right(arr, ex)

print(ans)

Submission status: Accepted

Solution code:
import sys
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2

    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2

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

    a = collections.Counter(a)
    return a

def main():
    N = int(input())
    
    fct = prime_factorize(N)
    ans = 0
    for i_fct in fct:
        m = fct[i_fct]
        if m == 1:
            ans += 1
            continue

        sum = 0
        add = 1
        while True:
            sum += add
            if sum > m:
                break
            add += 1
            ans += 1

    print(ans)
    return


if __name__ == "__main__":
    main()
    sys.exit(0)

Submission status: Accepted

Solution code:
import sys
import math
import collections
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
N=int(input())
a=0
if N==1:
  print(0)
  sys.exit()
c = collections.Counter(prime_factorize(N))
L=c.values()
L=list(map(int,L))
for i in range(len(L)):
  q=int(math.sqrt(L[i]))
  for j in range(q,N+1):
    if j*(j+1)//2>L[i]:
      t=(j-1)
      break
    elif j*(j+1)//2==L[i]:
      t=j
      break
  a+=t
print(a)

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 main():
  import collections
  N = int(input())
  if N == 1:
    print(0)
  else:
    K = factorization(N)
    Count = 0
    for i in range(len(K)):
      A = K[i][0]
      B = K[i][1]
      C = 1
      D = 2
      while B >= C:
        C += D
        D += 1
        Count += 1
    print(Count)
main()

Submission status: Accepted

Solution code:
def fac(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, 0])

    return arr
n = int(input())
p = fac(n)
ans = 0
for i in range(len(p)):
    for j in range(1,10001):
        if j*(j-1)/2 <= p[i][1] < j*(j+1)/2:
            ans += j-1
            break
        else:
            continue
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
import collections
from collections import defaultdict

import heapq


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
facts = factorization(N)
# print(facts)
for fact in facts:
    p = fact[0]
    if (p == 1):
        continue
    num = fact[1]
    if (num == 1):
        # print(p, 1)
        ans += 1
        continue
    i = 1
    while True:
        # print('num', num)
        num = num-i
        if (num < 0):
            break
        else:
            i += 1
    # print(p, i-1)
    ans += (i-1)
print(ans)

Submission status: Accepted

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

import sys
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
import math
import bisect
from itertools import accumulate
input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

N = int(input())

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

    if temp!=1:
        arr[temp] = 1

    if arr==[]:
        arr[n] = 1

    return arr

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

d = factorization(N)
# print(d)
max_d = max(d.values())
# print(max_d)

ref = [i for i in range(1, max_d+1)]
ref = list(accumulate(ref))
# print(ref)

ans = 0
for k, v in d.items():
    # print(k, v, bisect.bisect_right(ref, v))
    ans += bisect.bisect_right(ref, v)
print(ans)

Submission status: Accepted

Solution code:
# D
N = int(input())
lis = []
if N == 1:
    print(0)
else:
    n = N
    while n % 2 == 0:
        lis.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            lis.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        lis.append(n)
    
    cnt = 0
    for i in range(1, len(lis)):
        if lis[i] == lis[i-1]:
            cnt +=1
            lis.append(lis[i] ** cnt)
        else:
            cnt = 0
    
    set_lis = set(lis)
    sorted_set = sorted(set_lis)
    
    ans = 0
    for i in range(len(sorted_set)):
        if N % sorted_set[i] == 0:
            N //= sorted_set[i]
            ans += 1 
    print(ans)

Submission status: Accepted

Solution code:
import sys
#import numpy as np
import math
#from fractions import Fraction
#import itertools
#from collections import deque
#import heapq
#from fractions  import gcd
input=sys.stdin.readline
n=int(input())
def factorize(n):
    fct={}
    temp=n
    if temp<4:
        fct[temp]=1
    else:
        e=0
        while temp%2==0:
            temp=temp//2
            e+=1
        if e>0:
            fct[2]=e
    
    for b in range(3,int(n**0.5)+1,2):
        e=0
        while temp%b == 0:
            temp=temp//b
            e+=1
        if e>0:
            fct[b]=e
    if temp!=1:
        fct[temp]=1
    return fct

p=factorize(n)
ans=0
if n==1:
  print(0)
  exit()
for d in p.keys():
    e=p[d]
    i=1
    while True:
        if e-i>=0:
            ans+=1
            e-=i
            i+=1
            
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
import math
import sys
import bisect

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

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

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

    return arr
N=int(input())
if N==1:
  print(0)
  sys.exit()
L=(factorization(N))
#print(L)
L_ans = [1,3,6,10,15,21,28,36,45,55,66,78]
L_2 = [bisect.bisect(L_ans,L[i][1]) for i in range(len(L))]
#print(L_2)
print(sum(L_2))

Submission status: Accepted

Solution code:
from collections import Counter
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct+=b,
        b = b + 1
    if n > 1:
        fct+=n,
    return Counter(fct).values()
a = 0
n = int(input())
if n == 1:exit(print(0))
for i in factorize(n):
  c = s = 0
  while s <= i:
    c += 1
    s = (c+1)*c//2
  a += c - 1
print(a)

Submission status: Accepted

Solution code:
import bisect
# from collections import Counter, deque, OrderedDict
# from copy import copy, deepcopy # pythonのみ．copyは1次元，deepcopyは多次元．
# from functools import reduce
# from heapq import heapify, heappop, heappush
from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)


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


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

    import math

    # cf. https://qiita.com/suecharo/items/14137fb74c26e2388f1f

    def make_prime_list_2(num):
        if num < 2:
            return []

        # 0のものは素数じゃないとする
        prime_list = [i for i in range(num + 1)]
        prime_list[1] = 0  # 1は素数ではない
        num_sqrt = math.sqrt(num)

        for prime in prime_list:
            if prime == 0:
                continue
            if prime > num_sqrt:
                break

            for non_prime in range(2 * prime, num, prime):
                prime_list[non_prime] = 0

        return [prime for prime in prime_list if prime != 0]

    def prime_factorization_2(num):
        """numの素因数分解
        素因数をkeyに乗数をvalueに格納した辞書型dict_counterを返す"""

        if num <= 1:
            # 例えば1を食ったときの対処の仕方は問題によって違うと思うのでそのつど考える。
            # cf. https://atcoder.jp/contests/abc110/submissions/12688244
            return False
        else:
            num_sqrt = math.floor(math.sqrt(num))
            prime_list = make_prime_list_2(num_sqrt)

            dict_counter = {}  # 何度もこの関数を呼び出して辞書を更新したい時はこれを引数にして
            # cf. https://atcoder.jp/contests/arc034/submissions/12251452

            for prime in prime_list:
                while num % prime == 0:
                    if prime in dict_counter:
                        dict_counter[prime] += 1
                    else:
                        dict_counter[prime] = 1
                    num //= prime
            if num != 1:
                if num in dict_counter:
                    dict_counter[num] += 1
                else:
                    dict_counter[num] = 1

            return dict_counter
    d = prime_factorization_2(N)
    num = [i for i in range(1, 40)]

    # 累積和を格納したリスト．A[l:r]の総和はB[r] - B[l]
    num = list(accumulate(num))
    cnt = 0
    if not d:
        print(0)
    else:
        for v in d.values():
            cnt += bisect.bisect_right(num, v)
        print(cnt)


resolve()

Submission status: Accepted

Solution code:
n=int(input())

import math

def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def prime_factorization_2(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        dict_counter = {}
        for prime in prime_list:
            while num % prime == 0:
                if prime in dict_counter:
                    dict_counter[prime] += 1
                else:
                    dict_counter[prime] = 1
                num //= prime
        if num != 1:
            if num in dict_counter:
                dict_counter[num] += 1
            else:
                dict_counter[num] = 1

        return dict_counter

l=prime_factorization_2(n)
ans=0

if l==False:pass
else:

    for div,nums in l.items():
        num=nums
        num-=1
        i=2
        while num>=0:
            ans+=1
            num-=i
            i+=1


print(ans)

Submission status: Accepted

Solution code:
def factrize(x):
    # 試し割りによるxの素因数分解
    f = {}
    tmp = x
    i = 2
    while i**2 <= tmp:
        cnt = 0
        while tmp % i == 0:
            cnt += 1
            tmp = tmp // i
        if cnt > 0:
            f[i] = cnt
        i += 1
    if tmp != 1 or f == {}:
        f[tmp] = 1
    return f


C = []
c = 0
for i in range(50):
    if i in (1, 3, 6, 10, 15, 21, 28, 36, 45):
        c += 1
    C.append(c)

n = int(input())
if n == 1:
    print(0)
else:
    f = factrize(n)
    ans = 0
    for i in f.keys():
        ans += C[f[i]]
    print(ans)

Submission status: Accepted

Solution code:
import collections

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

N = int(input())

c = collections.Counter(prime_factorize(N))

output = 0
for k, v in c.items():
    num = 1
    cnt = 0
    while num <= v:
        cnt += 1
        v -= num
        num += 1
    output += cnt
    
print(output)