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 sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
ans = 0
d = 2
while d**2 <= n:
    if n % d != 0:
        d += 1
        continue
    dd = d
    while n % d == 0:
        n //= d
        d *= dd
        ans += 1
    while n % dd == 0:
        n //= dd
    d = dd + 1
    
if n != 1:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

def get_prime_factors(x):
    out = []
    if x < 1:
        return out
    while not x%2:
        out.append(2)
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            out.append(i)
            x //= i
        else:
            i += 2
    if x != 1:
        out.append(x)
    return out

def main():
    n = int(input())
    primes = Counter(get_prime_factors(n))
    ans = 0
    for k, v in primes.items():
        num = 1
        while v >= num:
            ans += 1
            v -= num
            num += 1
    print(ans)
    

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

def factrization_prime(number):
    factor = {}
    div = 2
    s = math.sqrt(number)
    while div < s:
        div_cnt = 0
        while number % div == 0:
            div_cnt += 1
            number //= div
        if div_cnt != 0:
            factor[div] = div_cnt
        div += 1
    if number > 1:
        factor[number] = 1
    return factor

number = int(input())
factor = factrization_prime(number)
ans = 0
for i in factor.values():
  n = 0
  while n*(n+1)//2 <= i:
    n +=  1
  ans += n-1
print(ans)

Submission status: Accepted

Solution code:
import glob
import math


# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\169\\D'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    alph = []

    def rec(self, result, now, max, N):

        if now == N:
            res = ""
            for i in result:
                res += self.alph[i]
            print(res)
            return

        if now == 0:
            result[0] = 0
            self.rec(result, now+1, 0, N)
            return

        for i in range(0, max+2):
            if i == N:
                return
            result[now] = i
            if i > max:
                self.rec(result, now+1, i, N)
            else:
                self.rec(result, now+1, max, N)

    def resolve(self):

        count = 0

        N = int(self.input_data())
        # 現実的に割れるかの確認をすれば十分な最大値
        n = int(math.sqrt(N))

        result = 0
        now = 2
        while now <= N:
            count = 0
            while True:
                if N % now == 0:
                    N = int(N / now)
                    count += 1
                else:
                    break
            for i in range(1,10000):
                if i <= count:
                    result += 1
                    count -= i
                else:
                    break

            now += 1

            if now > n:
                result += 1
                break



        print(str(result))

solver = Solver(REL_PATH)
solver.exec_resolve()

Submission status: Accepted

Solution code:
n = int(input())

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

div = trial_division(n)
c = 0
for d in div:
    k = d[1]
    i = 1
    while k-i >= 0:
        c += 1
        k -= i
        i += 1
print(c)

Submission status: Accepted

Solution code:
#約数は使わず、素因数分解のみ

#素因数分解
def soinsu_bunkai(m):
    pf={}

    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:
        pf[m]=1
    return pf

#初期入力
N = int(input())
xx =[]
prime_factorization =soinsu_bunkai(N)
count =0
for i in prime_factorization.keys():
    x=1
    while x <= prime_factorization[i]:
        if N % i**x ==0:
            xx.append(i**x)
            count +=1
            N //= i**x
        x +=1
print(count)

Submission status: Accepted

Solution code:
import numpy as np
import sys

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

d = int(N ** .5)

def eratosthenes(N):
	is_prime = [True] * (N + 1)
	is_prime[0], is_prime[1] = False, False
	for i in range(2, int(N**(1/2)) + 1):
		if is_prime[i]:
			for j in range(i * 2, N + 1, i):
				is_prime[j] = False
	return [i for i in range(N+1) if is_prime[i]]

p_num = eratosthenes(d+1)
MAX_p = p_num[-1]
ans = 0
used = []
for p in p_num:
    t_p = p
    while N % p == 0:
        N //= p
        ans += 1
        p *= t_p
    while N % t_p == 0:
        N //= t_p

if N > MAX_p:
    dd = int(N ** .5)
    cond = 1
    for i in range(2, dd+1):
        if N % i == 0:
            cond = 0
            break
    if cond:
        ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
import sys

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

d = int(N ** .5)

def eratosthenes(N):
	is_prime = [True] * (N + 1)
	is_prime[0], is_prime[1] = False, False
	for i in range(2, int(N**(1/2)) + 1):
		if is_prime[i]:
			for j in range(i * 2, N + 1, i):
				is_prime[j] = False
	return [i for i in range(N+1) if is_prime[i]]

p_num = eratosthenes(d+1)
MAX_p = p_num[-1]
ans = 0
used = []
for p in p_num:
    t_p = p
    while N % p == 0:
        N //= p
        ans += 1
        p *= t_p
    if p != t_p:
        used.append(t_p)

for p in used:
    while N % p == 0:
        N //= p

if N > MAX_p:
    dd = int(N ** .5)
    cond = 1
    for i in range(2, dd+1):
        if N % i == 0:
            cond = 0
            break
    if cond:
        ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
#約数
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 soinsu_bunkai(m):
    pf={}

    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:
        pf[m]=1
    return pf

#初期入力
N = int(input())
div =make_divisors(N) #Nの約数
div.sort()
div_1_except=div[1:]
count =0
for i in div_1_except:
    q,mod= divmod(N,i)
    if mod ==0:
        ii =soinsu_bunkai(i) #Nの約数を素因数分解
        if len(ii) ==1 :
            count +=1
            N =q   

print(count)

Submission status: Accepted

Solution code:
#約数
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 soinsu_bunkai(m):
    pf={}

    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:
        pf[m]=1
    return pf

# 初期入力
import sys
input = sys.stdin.readline
N = int(input())
div =make_divisors(N)
div.sort()
div_2 =div[1:]

count =0
for i in div_2:
    i2 = soinsu_bunkai(i)
    if len(i2) ==1:
        q,mod =divmod(N,i)
        if mod ==0:
            count +=1
            N =q
print(count)

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)

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

    return arr

ans = 0
X = int(input())
Y = factorization(X)
Y.sort()
Z = X
for i in range(len(Y)):
  if X % Y[i] == 0:
    ans += 1
    X /= Y[i]
    
if Z == 1:
  print(0)
else:
  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())
A = factorization(N)
if N == 1:
  print(0)
  exit()
ans = 0
for a,b in A:
    if b < 3:
        ans += 1
    elif b < 6:
        ans += 2
    elif b < 10:
        ans += 3
    elif b < 15:
        ans += 4
    elif b < 21:
        ans += 5
    elif b < 28:
        ans += 6
    elif b < 36:
        ans += 7
    elif b < 45:
        ans += 8
    else:
        ans += 9
print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

x = N
n = math.floor(math.sqrt(N))
p = {}
i = 2

while i <= n:
    while x % i == 0:
        p.setdefault(i, 0)
        p[i] += 1
        x //= i
    i += 1

if x != 1:
    p.setdefault(x, 1)

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
limit = n**0.5
q = 2

if n == 1:
    print(0)
else:
    ans = 0
    while q < limit:
        cnt = 0
        while n % q == 0:
            cnt += 1
            n /= q
        if cnt > 0:
            ans += int((2*cnt + 0.25)**0.5 - 0.5)
            limit = n**0.5
        q += 1
    if n > 1:
        ans += 1
    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())
a = factorization(n)
ans = 0
if n == 1:
    ans = -1
for i in a:
    ans += 1
    k = 2
    l = i[1] - 1
    while l >= k:
        ans += 1
        l -= k
        k += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
 
def prime_factorization(N):
  n = int(N**0.5)+1
  numList = [i if i != 1 else 2 for i in range(1, n, 2) ]
  primeList = [2]
  ansDict = {}
  idx = 0
  for data in numList:
    for x in primeList:
      if (data%x != 0 or x == 2):
        count = 0
        while N%data == 0:
          count += 1
          N //= data
        if count > 0:
          ansDict[data] = count
        if N == 1:
          return ansDict
        if x != 2:
          primeList.append(data)
        break
  if N != 1:
    ansDict[N] = 1
  
  return ansDict 

if N <= 1:
  print(0)
  exit()
  
ansDict = prime_factorization(N)
ansCount = 0
for p,v in ansDict.items():
  e = 1
  while e <= v:
    ansCount += 1
    v -= e 
    e += 1  

print(ansCount)

Submission status: Accepted

Solution code:
target = int(input())
num = target
waru = 2
exp = []
while waru ** 2 <= target and num > 1:
    rep = 0
    while num % waru == 0:
        num /= waru
        rep += 1
    waru += 1
    if rep > 0:
        exp.append(rep)
if num > 1:
    exp.append(1)
ans = 0
for item in exp:
    hiku = 1
    while item - hiku >= 0:
        item -= hiku
        ans += 1
        hiku += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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


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

tmp = []
for i in range(1,40):
    tmp.append((1+i)*i//2)
import bisect
ans = 0
for i in list(c.values()):
    ans += bisect.bisect_right(tmp,i)
print(ans)

Submission status: Accepted

Solution code:
import collections


# 素因数分解（試し割り法）
def prime_factorize(n: int) -> list:
    """
    整数 n を素因数分解する
    :param n: 整数
    :return a:リスト
    """
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f <= n ** 0.5:
        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))
count = 0
for i in c.values():
    if i == 1:
        count += 1
    else:
        s = 1
        while i > 0:
            i = i - s
            s += 1
            if i < 0:
                break
            count += 1

print(count)

Submission status: Accepted

Solution code:
N = int(input())

i = 2
tmp = N

ans = 0
while i*i <= N:
    cnt = 0
    while tmp % i == 0:
        tmp //= i
        cnt += 1
    if cnt > 0:
        k = 1
        while cnt - k >= 0:
            cnt -= k
            ans += 1
            k += 1
    i += 1
if tmp != 1:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

def prime_factorize(n):
    n_origin=n+0
    primelist=[]
    a=2
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist

def countf(e):
    v=0
    count=0
    while True:
        if v+(count+1)>e:
            break
        count+=1
        v+=count
    return count

primel=prime_factorize(n)
ans=0

for l in primel:
    p,e=l
    ans+=countf(e)

print(ans)

Submission status: Accepted

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


def prime_factor_count(n):
    def count(n, p):
        cnt = 0
        while n % p == 0:
            n //= p
            cnt += 1
        np_cnt = 1
        while (cnt := cnt - np_cnt) >= 0:
            np_cnt += 1
        return n, np_cnt - 1

    n, cnt = count(n, 2)

    if n == 1:
        return cnt

    for i in range(3, int(n ** 0.5) * 1, 2):
        n, tmp_cnt = count(n, i)
        cnt += tmp_cnt
        if n == 1:
            break
    else:
        cnt += 1

    return cnt


def main():
    n = int(input())
    ans = prime_factor_count(n)
    print(ans)


if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
import numpy as np

def seachPrimeNum(MAX):
    prime = np.zeros(MAX, np.bool_)
    prime[2] = 1
    prime[3::2] = 1
    for p in range(3, MAX, 2):
        if p * p >= MAX:
            break
        if prime[p]:
            prime[p * p::p + p] = 0
    
    return prime.nonzero()[0]

N = int(input())
n = N
s = 0

prime = np.array(seachPrimeNum(int(np.sqrt(10**12))))
prime = prime[N % prime == 0]

for p in prime:
    e = 1
    while n % p == 0:
        if n % p ** e == 0:
            n = n / p ** e
            e = e + 1
            s += 1
        else:
            n = n / p

if n != 1:
    s += 1

print(s)

Submission status: Accepted

Solution code:
def my_prime(n:int):
    if n <= 1:
        return {}
    fac = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            fac.append(i)
    if temp!=1:
        fac.append(temp)
    if fac==[]:
        fac.append(n)
    return fac
n = int(input())
temp = n
cnt = 0
for x in my_prime(n):
    i=1
    while x**i <= n:
        if temp % x**i == 0:
            cnt += 1
            temp = temp // x**i
        i += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
#文字列として取得
def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)
import math

def isPrime(num):
    for i in range(3,math.floor(math.sqrt(num))+1,2):
        if num%i==0:
            return False
    return True


N = I()
cnt = 0
ans = 0
while N%2==0:
    N /= 2
    cnt += 1
power = 1
while cnt-power>=0:
    cnt -= power
    ans += 1
    power += 1
while True:
    if N==1:
        break
    if isPrime(N):
        ans += 1
        break
    else:
        for i in range(3,math.floor(math.sqrt(N))+1,2):
            cnt = 0
            if isPrime(i) and N%i==0:
                while N%i==0:
                    N /= i
                    cnt += 1
                power = 1
                while cnt-power>=0:
                    cnt -= power
                    ans += 1
                    power += 1

print(ans)

Submission status: Accepted

Solution code:
from subprocess import*
p=run(('factor',input()),stdout=PIPE).stdout.split()
print(sum(int((8*p.count(i)+1)**.5/2-.5)for i in set(p))-1)

Submission status: Accepted

Solution code:
from subprocess import*
p=run(('factor',input()),stdout=PIPE).stdout.split()[1:]
print(sum(int((8*p.count(i)+1)**.5/2-.5)for i in set(p)))

Submission status: Accepted

Solution code:
def resolve():
	from collections import Counter

	def prime_factorize(n):
		a = []
		i = 2
		while i < n**(1/2) + 1:
			if n%i == 0:
				n //= i
				a.append(i)
			else:
				i += 1
		if n != 1:
			a.append(n)
		return a
	
	def cnt(x):
	    ans = 0
	    i = 1
	    while True:
	        ans += i
	        if ans > x:
	            return i-1
	        i += 1
	        
	n = int(input())
	ans = 0

	a = Counter(prime_factorize(n))
	for i in a.values():
	    ans += cnt(i)

	print(ans)

resolve()

Submission status: Accepted

Solution code:
def resolve():
	from collections import Counter

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

	def cnt(x):
	    ans = 0
	    i = 1
	    while True:
	        ans += i
	        if ans > x:
	            return i-1
	        i += 1
	        
	n = int(input())
	ans = 0

	a = Counter(prime_factorize(n))
	for i in a.values():
	    ans += cnt(i)

	print(ans)
	
resolve()

Submission status: Accepted

Solution code:
from subprocess import*
p=run(('factor',input()),capture_output=1).stdout.split()[1:]
print(sum(int(((8*p.count(i)+1)**.5-1)/2)for i in set(p)))

Submission status: Accepted

Solution code:
from collections import Counter


class Factorize:
    def __init__(self):
        self.primes = Counter()

    def add_target(self, n):
        for i in range(2, int(n**0.5)+1):
            while n%i==0:
                self.primes[i] += 1
                n //= i
            if not n:
                break
        if n>1:
            self.primes[n] += 1
    
    def get_result(self):
        return dict(self.primes)


N = int(input())
f = Factorize()
f.add_target(N)

d = f.get_result()
ans = 0
for i in d.values():
    for j in range(i+1):
        if j*(j+1)//2>i:
            j-=1
            break
    ans += j
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

from collections import Counter

factors = []
i = 2
while n > 1:
   if n < i * i:
      factors.append(n)
      break
   while n % i == 0:
      factors.append(i)
      n //= i
   i += 1

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

Submission status: Accepted

Solution code:
n=int(input())

def primes_factraizar(n):
    rn = int(n**0.5)
    is_prime = [True] * (rn+1) #まずは[1]*n^0.5を用意
    is_prime[0] = False 
    is_prime[1] = False
    for i in range(2, rn + 1): #素数の判定√nまでで十分
        if not is_prime[i]: #非素数は無視
            continue            #continue分はループ中の後続の命令をスキップする
        for j in range(i * 2, rn + 1, i): #i*2~nまでのiの倍数を順番に消す
            is_prime[j] = False
    return [i for i in range(rn + 1) if is_prime[i]]
primes = primes_factraizar(n)

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



div = []
for i in primes:
    for j in range(1000):
        if n%i==0:
            n=n//i
        else:
            if j == 0:
                break
            div.append(j)
            break
if n != 1:
    div.append(1) 

if div == []:
    print(1)
    exit()
ans = 0
for i in div:
    c = 0
    for j in range(1,10**9):
        if i >= c+j:
            c+=j
        else:
            ans += j-1
            break
print(ans)

Submission status: Accepted

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

while N > 1:
  if N < i * i:
    factors.append(N)
    break
  while N % i == 0:
    factors.append(i)
    N //= i
  i += 1
# N == 1
ans = 0
# print(factors)
for count in Counter(factors).values():
  i = 1
  while count >= i:
    count -= i
    i += 1
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
def factorize(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

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

f = factorize(N)
ans = 0
for p, i in f:
    j = 0
    while i > j:
        j += 1
        i -= j
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
from math import gcd
from collections import Counter

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

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

count = Counter(factorize(n))
ans=0
for key in count:
    sum=0
    for i in range(1,100000):
        sum+=i
        if count[key] >= sum and count[key] < sum+i+1:
            ans+=i
            break
        else:
            continue
print(ans)

Submission status: Accepted

Solution code:
import math
import sys
def input():
    return sys.stdin.readline().rstrip('\n')

def get_e(x):
    l = []
    i = 2
    m = math.floor(math.sqrt(x))
    while i <= m and i <= x:
        if x % i == 0:
            x = x // i
            l += [i]
        else:
            i += 1
    if x != 1:
        l += [x]
    return l

def calc(N):
    d = {}
    for i in get_e(N):
        d[i] = 1 + (d[i] if i in d else 0)
    result = 0
    for i in d:
        result += math.floor((math.sqrt(1 + 8 * d[i]) - 1) / 2)
    return result
    

N = int(input())
print(calc(N))

Submission status: Accepted

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

N=int(input())
a=func(N)
ans=0
if a[0][0]==1:
        print(0)
        exit()
        
b=[1,3,6,10,15,21,28,36,45]
for i in a:
    for j in range(len(b)):
       if  i[1]<b[j]:
          ans+=j
          break
print(ans)

Submission status: Accepted

Solution code:
def func(N):
    tmp=N
    arr=[]
    for i in range(2,int((N**0.5//1))+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([tmp,1])
   
    return arr

N=int(input())
a=func(N)
ans=0
if a[0][0]==1:
        print(0)
        exit()
        
b=[1,3,6,10,15,21,28,36,45]
for i in a:
    for j in range(len(b)):
       if  i[1]<b[j]:
          ans+=j
          break
print(ans)

Submission status: Accepted

Solution code:
def func(N):
    tmp=N
    arr=[]
    for i in range(2,int(-(-N**0.5//1))+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([tmp,1])
   
    return arr

N=int(input())
a=func(N)
ans=0
if a[0][0]==1:
        print(0)
        exit()
        
b=[1,3,6,10,15,21,28,36,45]
for i in a:
    for j in range(len(b)):
       if  i[1]<b[j]:
          ans+=j
          break
print(ans)

Submission status: Accepted

Solution code:
def factorization(n):
    m=n
    counter_map={}
    i=2
    tmp=1
    flag=True
    while n!=1:
        #因数に持つか判定
        if n%i==0:
            flag=False
            n=n//i
            #素数判定
            for j in range(2,int(i**(1/2))+1):
                if i%j==0:
                    break
            else:
                tmp*=i
                if i not in counter_map:
                    counter_map[i]=1
                    tmp=1
                else:
                    if tmp not in counter_map:
                        counter_map[tmp]=1
                        tmp=1
        else:
            i+=1
            tmp=1
            flag=True
        if i>int(n**(1/2))+1 and n!=1 and flag:
            counter_map[n]=1
            break
        #print(i,n,counter_map)
    return counter_map


a=int(input())
b=factorization(a)
#print(b)
# sum=0

# for i in b.keys():
#     counter=0
#     for j in range(1,41):
#         if b[i]>=1+(j+2)*(j-1)//2:
#             counter=j
#         else:
#             break
#     sum+=counter

# print(sum)

print(len(b))

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
  
from collections import Counter
n=int(input())
s=Counter(prime_factorize(n))
t=list(s.values())
cnt=0
#print(s)
#print(t)
for i in t:
  if i==1:
    cnt+=1
    
  else:
    s=1
    while i>0:
      i=i-s
      s+=1
      if i<0:
        break
      cnt+=1
      
print(cnt)

Submission status: Accepted

Solution code:
def factorization(n):
    m=n
    counter_map={}
    i=2
    tmp=1
    while n!=1:
        #因数に持つか判定
        if n%i==0:
            n=n//i
            #素数判定
            for j in range(2,int(i**(1/2))+1):
                if i%j==0:
                    break
            else:
                tmp*=i
                if i not in counter_map:
                    counter_map[i]=1
                    tmp=1
                else:
                    if tmp not in counter_map:
                        counter_map[tmp]=1
                        tmp=1
        else:
            i+=1
            tmp=1
        if i>int(m**(1/2)) and n!=1:
            counter_map[n]=1
            break
    return counter_map


a=int(input())
b=factorization(a)
sum=0

for i in b.keys():
    counter=0
    for j in range(1,41):
        if b[i]>=1+(j+2)*(j-1)//2:
            counter=j
        else:
            break
    sum+=counter

print(sum)