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])

    return arr

N=int(input())

ls=factorization(N)

cnt=0

for l in ls:
    cc=0
    for i in range(1,l[1]+1):
        cc+=i
        if cc<=l[1]:
            cnt+=1
        else:
            break

print(cnt)

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
fa = factorization(n)
ans = 0
rui = [0]*20
for i in range(1,20):
    rui[i] = i+rui[i-1]


for so,si in fa:
    for i in range(1,20):
        if rui[i]<= si <rui[i+1]:
            ans+= i
            break
print(ans)

Submission status: Accepted

Solution code:
n = int(input())


def prime_factorization(n):
    pmax = int(n ** 0.5 // 1) + 1

    factors = {}
    for p in range(2, pmax + 1):
        while n % p == 0:
            factors[p] = factors.get(p, 0) + 1
            n //= p
    if n != 1:
        factors[n] = factors.get(n, 0) + 1

    return factors


factors = prime_factorization(n)

answer = 0
for power in factors.values():
    n = 1
    while (n + 1) * (n + 2) // 2 <= power:
        n += 1
    answer += n



print(answer)

Submission status: Accepted

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

import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    ps = []
    i = 2
    ret = 0
    def _is_p(n):
        if n < 2:
            return False
        i = 2
        while i * i <= n:
            if n % i == 0:
                return False
            i += 1
        return True

    ret = 0
    while i * i <= N:
        #if not _is_p(i):
        #    continue
        t = 0
        while N % i == 0:
            t += 1
            N //= i
        if t > 0:
            #print(i, t, N)
            j = 1
            s = 0
            while s + j <= t:
                s += j
                ret += 1
                j += 1
        i += 1

    if _is_p(N):
        ret += 1
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def d_div_game():
    N=int(input())

    def prime_factorization_dict(n):
        """nを素因数分解したときの素数とその指数の辞書"""
        from collections import defaultdict
        if n == 1:
            return {2: 0}  # 1は素数の0乗の積とみなす
        i, table = 2, defaultdict(int)
        while i**2 <= n:
            while n % i == 0:
                table[i] += 1
                n //= i
            i += 1
        if n > 1:
            table[n] = 1
        return table

    d = prime_factorization_dict(N)
    ans = 0
    for v in d.values():
        tmp = 1
        total = 0
        count = 0
        while total <= v:
            total += tmp
            tmp += 1
            count += 1
        ans += count - 1
    return ans

print(d_div_game())

Submission status: Accepted

Solution code:

N = int(input())

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

ans = 0
if N == 1:
    print(0)
    quit()
for i in fact(N):
    temp = i[1]
    x = 1
    while temp > 0:
        x += 1
        temp -= x
        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

div = factorization(int(input()))

cnt = 0
for d in div:
    if d[0] == 1: continue
    loo = d[1]
    i = 1
    while loo >= i:
        loo -= i
        i += 1
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
def prime_factorize(n):
    # Return list of prime factorized result
    # O(sqrt(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)
cnt = Counter(l)

ans = 0
for key in cnt.keys():
    cur = 1
    while True:
        if cnt[key] >= cur:
            cnt[key] -= cur
            ans += 1
            cur += 1
        else:
            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())
if n ==1:
  print(0)
  exit()
arr = factorization(n)
ans=0
for p,i in arr:
  j = 0
  while i>j:
    j += 1
    i -= j
  ans += j
print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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())
dankai=[1]*50
for i in range(1,50):
    dankai[i]=dankai[i-1]+i+1

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

ans=0
for v in c:
    i=0
    while v>=dankai[i]:
        i+=1
    ans+=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))
ans = 0
for k, v in c.items():
  i = 1
  while True:
    v -= i
    if v < 0:
      break
    ans += 1
    i += 1

print(ans)

Submission status: Accepted

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

import sys
import pprint
import math

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)

def prime_fact(n):
	p = {}
	for i in range(2, int(-(-n**0.5//1))+1):
		if n % i == 0:
			while n % i == 0:
				n //= i
				p[i] = p.get(i, 0) + 1
	if n != 1:
		p[n] = p.get(n, 0) + 1
	return p
# s = n(n+1)/2 

def main():
	log = Logger(0)
	n = int(sys.stdin.readline())
	if n == 1:
		print(0)
		exit()
	p = prime_fact(n)
	ans = 0
	if len(p.keys()) == 0:
		print(1)
		exit(0)
	keys = list(p.keys())
	key = keys[0]
	i = 1
	j = 0
	while 1:
		if p[key] < i:
			j += 1
			if len(keys) == j:
				break
			key = keys[j]
			i = 1
			continue
		log.print(p, n, key)
		z = key ** i
		n /= z
		p[key] -= i
		ans += 1
		i += 1
	print(ans)


main()

Submission status: Accepted

Solution code:
n = int(input())

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

def is_prime(num):
    if num == 1:
        raise ValueError("error!")
    d = 2
    while d * d <= num:
        if num % d == 0:
            return False, d
        d += 1
    return True, -1


x = n
yakusuu = {}
while True:
    x_is_prime, div = is_prime(x)
    if x_is_prime:
        yakusuu[x] = yakusuu.get(x, 0) + 1
        break
    else:
        yakusuu[div] = yakusuu.get(div, 0) + 1
        x = x // div

# print(yakusuu)
ans = 0
for v in yakusuu.values():
    for p in range(1, 10000):
        if p*(p+1)//2 <= v < (p+2)*(p+1)//2:
            ans += p
            break
print(ans)

Submission status: Accepted

Solution code:
N = int(input())


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

cnt = [0] * 100
now = 1
tmp = 0
for i in range(1, 100):
    if tmp >= now+1:
        now += 1
        tmp = 0
    cnt[i] = now
    tmp += 1

primes = prime_factorize(N)
ans = 0
for p, i in primes:
    ans += cnt[i]

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math

MOD = 10 ** 9 + 7
# MOD = 998244353

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())
prime = Counter(prime_factorize(n))
# print(prime)

ans = 0
for p, v in prime.items():
    c = 1
    while v >= c:
        ans += 1
        v -= c
        c += 1

print(ans)

Submission status: Accepted

Solution code:
from heapq import heappop, heappush
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def prime_factorization(n):
    d = {}
    i = 2
    while i * i <= n:
        if n % i == 0:
            d[i] = 1
            n //= i
            while n % i == 0:
                n //= i
                d[i] += 1
        i += 1
    if n > 1:
        d[n] = 1
    return d

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

    d = prime_factorization(N)
    queue = []
    for k, v in d.items(): 
        for i in range(1, v+1):
            heappush(queue, (pow(k, i), k, i))
    
    cnt = dict()
    ans = 0
    while queue:
        z, p, e = heappop(queue)
        if p in cnt:
            if cnt[p] + e <= d[p]:
                cnt[p] += e
                ans += 1
            else:
                continue
        else:
            cnt[p] = e
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict


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 main():
    N = int(input())

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

    a = prime_factorize(N)

    l = [1, 3, 6, 10, 15, 21, 28, 36, 45]

    dic = defaultdict(int)
    for aa in a:
        dic[aa] += 1

    ans = 0
    for d in dic:
        tmp = dic[d]
        count = 0
        for ll in l:
            if ll > tmp:
                break
            count += 1
        ans += count

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
n = int(input())
#a, b = map(float, sys.stdin.readline().split())
#n = input()
#a = list(map(int, sys.stdin.readline().split()))

if n == 1:
    print(0)
    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

l = factorization(n)


x = [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]

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

print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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

    return res


def resolve():
    n = int(input())
    L = prime_factorization(n)
    res = 0
    for v, ex in L:
        i = 1
        while ex >= 0:
            if ex - i < 0:
                break
            ex -= i
            res += 1
            i += 1

    print(res)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys

input = lambda: sys.stdin.readline().rstrip()


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


def solve():
    N = int(input())
    prime_list = factorize(N)

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

    ans = 0
    for p, num in prime_list.items():
        i = 1
        m = 1
        while True:
            if num >= m:
                ans += 1
            else:
                break
            i += 1
            m += i

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
n = int(input())
import math
from bisect import bisect
ps = {}
for i in range(2,math.ceil(math.sqrt(n))):
  while n % i == 0:
    n //= i
    if i in ps:
      ps[i] += 1
    else:
      ps[i] = 1
  if n == 1:
    break
if n > 1:
  ps[n] = 1

ss = [i*(i+1)//2 for i in range(1,42)]

ans = 0
for p in ps:
  ans += bisect(ss, ps[p])
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = 2
ans = 0
while n > 1:
    if p > 10 ** 6:
        ans += 1
        break
    e = 1
    while n % (p ** e) == 0:
        n = n // (p ** e)
        e += 1
        ans += 1
    while n % p == 0:
        n = n // p
    p += 1
    
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
from bisect import bisect_right

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 main():
    N = int(input())

    nums = [0] * 42
    nums[1] = 1
    for i in range(1, 41):
        nums[i+1] = nums[i] + (i+1)
    
    factor = prime_factorize(N)
    c = Counter(factor)
    ans = 0

    for val in c.values():
        idx = bisect_right(nums, val)
        ans += idx - 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache  # @lru_cache(None)
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return (int(x) for x in input().split())
def LI(): return list(Is())
def TI(): return tuple(Is())
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(S())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

n = I()

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

def prime_factorize_tuple(n):
    ret = []
    tmp = n
    for i in range(2, ceil(sqrt(n))):
        if tmp % i == 0:
            count = 0
            while tmp % i == 0:
                count += 1
                tmp //= i
            ret.append((i, count))

    if tmp != 1:
        ret.append((tmp, 1))

    if not ret:
        ret.append([n, 1])  # n is prime

    return ret

def check(n, x):
    return n*(n+1)//2 <= x

def meguru_bisect(ng, ok, x):
    """
    初期値のng,okを受け取り, check=>Trueを満たす最大値(最小値)を返す
    条件を満たす最大値を求める場合、初期値は(ng:上限の外, ok:下限の外)   例) 10**9+1, -1
    条件を満たす最小値を求める場合、初期値は(ng:下限の外, ok:上限の外)   例) -1, 10**9+1
    上限の外や下限の外が返ってくる場合は条件を満たす値が範囲内になかったことを示すので、例外処理が必要
    """
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid, x):
            ok = mid
        else:
            ng = mid
    return ok

ans = 0
for p, x in prime_factorize_tuple(n):
    ans += meguru_bisect(10**13, 0, x)

print(ans)

Submission status: Accepted

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


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


def divide(N):
    ret = {}
    p = 2
    tn = int(N**0.5)
    while N != 1:
        if N % p == 0:
            if p not in ret:
                ret[p] = 1
            else:
                ret[p] += 1
            N //= p
        elif p > tn:
            p = N
        else:
            p += 1

    return ret


def solve(N):
    p_dict = divide(N)
    ans = 0
    for v in p_dict.values():
        ans += int(((1 + 8 * v)**0.5 - 1) * 0.5)
    return ans


def main():

    N = int(input())
    print(solve(N))

    return


if __name__ == '__main__':
    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
  
## 素因数分解 素因数の個数を辞書で取得
import collections
c = collections.Counter(prime_factorize(n))
#print(c)

ans = 0
for k,v in c.items():
  cnt = 1
  while(v >= cnt):
    v -= cnt
    ans += 1
    cnt += 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])

    return arr


n = int(input())
factors = factorization(n)

ans = 0
for factor, count in factors:
    use = 1
    possible = count
    while possible >= use:
        possible -= use
        use += 1
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
#from decimal import *

#素因数分解
def factorization(n):
	arr = []
	tmp = n
	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])

	return arr
	
N = INT()

arr = factorization(N)
lis = []
for i, j in arr:
	for k in range(1, j+1):
		lis.append(i**k)

lis.sort()
#print(arr)
#print(lis)

cnt = 0
for x in lis:
	if N%x == 0:
		cnt += 1
		N //= x

print(cnt)

Submission status: Accepted

Solution code:
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 main():
    N = int(input())
    l = prime_factorize(N)
    c = Counter(l)
    r = 0
    ll = [0]
    for i in range(1, 100):
        ll.append(ll[-1] + i)
    for i in c.values():
        for j in range(100):
            if ll[j] > i:
                r += j - 1
                break
    return r

print(main())

Submission status: Accepted

Solution code:
import math
#試し割法
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return [n]
    else:
        factor.append(n)
        return factor
A = trial_division(int(input()))
from collections import Counter
C = Counter(A)
ans=0
for k,i in C.items():
  if k==1:
    continue
  for j in range(1,40):
    i = i-j
    if i>=0:
      ans +=1
print(ans)

Submission status: Accepted

Solution code:
# nを素因数分解
# 2以上の整数n => [[素因数, 指数], ...]の2次元リスト
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


t = factorization(n)
# print(t)
ans = 0
for (p, i) in t:
    c = 0
    while True:
        c += 1
        if i >= c:
            i -= c
        else:
            break
    ans += (c-1)
print(ans)

Submission status: Accepted

Solution code:
import math
def primes(N):
    P = []
    for i in range(2,N):
        sieve = 1
        for p in P:
            if p*p > i:
                break
            elif i % p == 0:
                sieve = 0
                break
        if sieve == 0:
            continue
        else:
            P.append(i)
    return P
def factorize(n, P=None):
    if P is None:
        P = primes(int(math.sqrt(n))+1)
    factor = []
    power = []
    for p in P:
        if p * p > n:
            break
        elif n % p == 0:
            k = 0
            while n % p == 0:
                n //= p
                k += 1
            factor.append(p)
            power.append(k)
    if n > 1:
        factor.append(n)
        power.append(1)
    return factor, power

N = int(input())
factor, power = factorize(N)
ans = sum(int((math.sqrt(1+8*x)-1)/2) for x in power)
print(ans)

Submission status: Accepted

Solution code:
import sys
import math 
from collections import defaultdict
input = lambda : sys.stdin.readline().strip()
n = int(input())
factors = defaultdict(int)
while n%2==0:
    factors[2]+=1
    n = n//2
for i in range(3,int(n**0.5)+1,2):
    while n%i==0:
        factors[i]+=1
        n = n//i 
if n>2:
    factors[n]+=1
ans = 0
for k in factors:
    ans += (-1+int((1+8*(factors[k]))**0.5))//2
print(ans)

Submission status: Accepted

Solution code:
def primelist(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        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]]

def factorization(n):
    plist = primelist(int(n**0.5))
    factor = []
    for p in plist:
        k = 0
        while n%p==0:
            k+=1
            n//=p
        if k>0:
            factor.append((p,k))
        if n==1:
            break
    if n!=1:
        factor.append((n,1))

    return factor

def 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 main():
    n = int(input())
    
    factors = factorization(n)

    ans = 0
    for _,e in factors:
        a_e = int(((1+8*e)**0.5-1)/2)
        ans += a_e

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

def main():
    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
    
    c = factorization(N)
    
    can = []
    for i in range(1,50):
        can.append((i*(i+1))//2)

    ans = 0
    for _,cnt in c:
        ind = bisect.bisect_right(can,cnt)
        ans += ind
    
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

x=fact(n)
ans=0
for i in range(len(x)):
  for j in range(1,1000):
    if x[i][1]>=j:
      ans+=1
      x[i][1]-=j
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

c = collections.Counter(prime_factorize(n))
res = 0
for key,value in c.items():
    i = 1
    while value >= i :
        value -= i
        res+=1
        i+=1
print(res)

Submission status: Accepted

Solution code:
import sys
from bisect import bisect_right

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


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 not arr:
        arr.append([n, 1])
    
    return arr


def solve():
    N = int(rl())
    
    if N == 1:
        print(0)
        return
    
    acc = [1]
    for i in range(2, 100):
        acc.append(acc[-1] + i)
    
    facts = factorization(N)
    ans = 0
    for fact, exp in facts:
        ans += bisect_right(acc, exp)
    print(ans)


if __name__ == '__main__':
    solve()

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
for a, b in A:
    if a == 1:
        continue
    cnt = b
    for i in range(1, b+1):
        if cnt < i:
            break
        cnt -= i
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(1000000)

import bisect
import math
import collections
import heapq

def factrization(N):
    k = 2
    ret = {}
    L = N ** 0.5
    while k < L:
        if N % k == 0:
            ret.setdefault(k, 0)
            ret[k] += 1
            N //= k
        else:
            k += 1
    if N > 1:
        ret.setdefault(N, 0)
        ret[N] += 1
    return ret
#
# print(factrization(64))
# print(factrization(24))
# print(factrization(1000000007))
# print(factrization(997764507000))

def solve(N):
    f = factrization(N)
    ans = 0
    for n in f.values():
        i = 1
        while i <= n:
            n -= i
            i += 1
            ans += 1
    return ans
#
# print(solve(64))
# print(solve(24))
# print(solve(1))
# print(solve(1000000007))
# print(solve(997764507000))

if __name__ == "__main__":
    N = int(input())
    print(solve(N))