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

A = factorization(N)

if len(A)==0 or N==1:
    print(0)
else:    
    c = 0
    for a in A:
        x = a[1]
        s = 0
        for j in range(1, x+1):
            if s + j <= x:
                c +=1
                s += j
            else:
                break
    print(c)

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
pf={}

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

value_ = Counter(list(pf.values()))
result = 0
for k,v in value_.items():
    if k == 1:
        result += v
    else:
        for i in range(k+1):
            if i * (i+1) / 2 > k:
                result += (i-1) * v
                break
print(result)

Submission status: Accepted

Solution code:
from collections import defaultdict
def factorize(M):
  res=defaultdict(int)
  for i in range(2,int(M**0.5)+1):
    if M==1:
      break
    while M%i==0:
      M//=i
      res[i]+=1  
  if M!=1:
    res[M]=1
  return res

N=int(input())
fact=factorize(N)
#print(fact)

def times(n):
  ret=1
  for i in range(2,10**9):
    if n<i*(i+1)//2:
      return ret
    else:
      ret+=1

answer=0
for v in fact.values():  
  #print(v,times(v))
  answer+=times(v)
  
print(answer)

Submission status: Accepted

Solution code:
import math
import os
ans = 0
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())
arr = factorization(n)
if n==1:
    print(0)
    exit()

for i in range(len(arr)):
    arfa = arr[i][1]
    ans += math.floor((-1+math.sqrt(1+8*arfa))/2)
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
a = int(input())
if a == 1:
    print(0)
    exit()
a = factorization(a)
ans = 0
for i in range(len(a)):
    check = 3
    j = 1
    while True:
        if a[i][1] < check:
            ans += j
            break
        else:
            j += 1
            check += j + 1
print(ans)

Submission status: Accepted

Solution code:
import math
def prime_factorization(n):
    # s * s <= n
    s = math.floor(math.sqrt(n)) # 平方根を小数点切り捨て

    ans = [] # [素数, 指数]のリスト

    # 2からsまでの素因数を求める
    for i in [2] + list(range(3, s + 1, 2)):
        if n < i:
            break
        if n % i == 0:
            r = 0 # 指数カウンタクリア
            while n % i == 0:
                r += 1
                n //= i
            ans.append([i, r])

    # 残った素数を追加
    # if n > s:
    if n >= s:  # n = 1でもよいように
        ans.append([n, 1])

    return(ans)

N = int(input())
pf = prime_factorization(N)
# print(pf)
ans = 0
for p, e in pf:
    if p == 1: break
    for i in range(1, 50):
        if e < i: break
        e -= i
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = dict()
for i in range(2, 10**6+1):
	if n%i == 0:
		p[i] = 1
		n //= i
		while n%i == 0:
			p[i] += 1
			n //= i
if n != 1:
	p[n] = 1

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

Submission status: Accepted

Solution code:
def f(i,n):
  ans =0
  cnt = i
  while n%cnt == 0:
    n//=cnt
    cnt*=i
    ans +=1
  while n%i ==0:
    n//=i
  return n,ans

n = int(input())
i = 2
ans = 0
while i <= int(n**0.5)+1:
  if n%i ==0:
    n,a = f(i,n)
    ans += a
  i += 1
  
if n >1:
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
def prime_factorize(N): #素因数分解
    exponent = 0
    while N%2 == 0:
        exponent += 1
        N //= 2
    if exponent: factorization = [[2,exponent]]
    else: factorization = []
    i=1
    while i*i <=N:
        i += 2
        if N%i: continue
        exponent = 0
        while N%i == 0:
            exponent += 1
            N //= i
        factorization.append([i,exponent])
    if N!= 1: factorization.append([N,1])
    assert N != 0, "zero"
    return factorization

N = int(input())

pr = prime_factorize(N)


l = len(pr)
s = sum((i for _,i in pr))
ans = 0

ans = 0
for p,e in pr:
    tmp = 1
    ttmp = e
    res = 0
    for i in range(100000):
        if ttmp - tmp < 0:
            break
        res += 1
        ttmp -= tmp
        tmp += 1
    ans += res

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

import collections

N = int(input())
val = collections.Counter(prime_factorize(N))
val = {key:cnt for key,cnt in val.most_common()} 
if val=={}:
    print(0)
else:
    prev_ans = -1
    cnt = 1
    ans = 0
    while ans!=prev_ans:
        prev_ans = ans
        for key in val:
            if val[key]>=cnt:
                val[key]-=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])

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

    return arr
      
n = int(input())
n_list = factorization(n)
oh = []
for i in range(len(n_list)):
  num = n_list[i][0] #2の
  kata = n_list[i][1] #3乗
  for i in range(1, kata+1):
    oh.append(num ** i)
oh.sort()
ans = 0
z = []
for i in range(len(oh)):
  if oh[i] == 1:
    break
  else:
    if n % oh[i] == 0 and oh[i] not in z:
      z.append(oh[i])
      n = n / oh[i]
      ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
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

array = factorization(n)
if array[0][0] == 1:
    print(0)
    sys.exit()
e_point = 1
count = 0
for i in range(len(array)):
    e = array[i][1]

    while e > 0:
        count += 1
        e -= e_point
        if e < 0:
            count -= 1
            break
        e_point += 1
    e_point = 1
print(count)

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

def sankaku(n):
    i = 1

    while not (n < i*(i+1) / 2):
        i += 1
    
    return i - 1

N = int(input())

delist = prime_factorize(N)

counter = collections.Counter(delist)

count = 0

for key, value in counter.items():
    count = count + sankaku(value)

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

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

    return arr

N = int(input())
F = factorization(N)
f = len(F)
answer = 0
for i in range(f):
    count = 1
    if F[i][0] == 1:
        break
    if F[i][1] == 1:
        answer += 1
    else:
        while True:
            if F[i][1] < count:
                break
            else:
                F[i][1] = F[i][1] - count
                count += 1
                answer += 1

print(answer)

Submission status: Accepted

Solution code:
N = int(input())
if N == 1:
  print(0)
else:
  d = {}
  n = N
  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
  ans = 0
  for i in d.values():
    ok = 1
    ng = 50
    while ng-ok > 1:
      mid = (ok+ng)//2
      if mid*(mid+1)//2 <= i:
        ok = mid
      else:
        ng = mid
    ans += ok
  print(ans)

Submission status: Accepted

Solution code:
import math
def div(n):
    q=[]
    num=[]
    new=1
    while(new):
        orin=n
        for i in range(2,int(math.sqrt(n))):
            if n%i==0:
                q.append(i)
                num.append(0)
                curp = len(num)-1
                new=1
            while(n%i==0):
                n=n//i
                num[curp]+=1
        if orin==n:
            if n!=1:
                q.append(n)
                num.append(1)
            break
    return q,num

def check(num):
    i=1
    count=0
    while(num>=i):
        num-=i
        count+=1
        i+=1
    return count

n=int(input())
q,num=div(n)
if n==1:
    print(0)
else:
    total=0
    for i in range(len(num)):
        total+=check(num[i])
    print(total)

Submission status: Accepted

Solution code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

from math import sqrt 
def count(n):
    return (-1 + sqrt(1 + 8 * n)) // 2
def pfact(num):
    from math import sqrt
    dt = {}
    while num%2==0:
        dt[2] = dt.get(2,0) + 1
        num //= 2
    for i in range(3,int(sqrt(num))+1,2):
        while num%i==0:
            dt[i] = dt.get(i,0) + 1
            num //= i
    if num>2:
        dt[num] = dt.get(num,0) + 1
    return dt
n = inp()
dt = pfact(n)
ctr = 0
for i in list(dt.values()):
    ctr += int(count(i))
print(ctr)

Submission status: Accepted

Solution code:
import sys
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


fn = factorization(n)

memo = {}
def f(a):
    fa = a
    if a in memo:
        return memo[a]
    if a == 1:
        memo[1] = 1
        return 1
    else: # a>1
        i = 1
        ret = 0
        while a >= i:
            a-=i
            i+=1
            ret+=1
        memo[fa] = ret
        return ret

ans = 0
for u, v in fn:
    ans+=f(v)
if n == 1:
    print(0)
else:
    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, radians
from itertools import accumulate, permutations, combinations, product
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

N = INT()

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table
p = prime_decomposition(N)
# print(p)
c = Counter(p)
# print(c)
ans = 0
for p, e in c.items():
    i = 0
    cnt = 1
    while cnt <= e:
        e -= cnt
        cnt += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict

def main():
    n = int(input())
    d = prime_factorize(n)
    cnt = 0
    for k in d.keys():
        cnt_tmp = 1
        while cnt_tmp <= d[k]:
            d[k] -= cnt_tmp
            cnt_tmp += 1
            cnt += 1
    print(cnt)

    

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

if __name__ == '__main__':
    main()

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

cnt = 0

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

if n == 1:
    print(0)
else:
    print(cnt)

Submission status: Accepted

Solution code:
import sys
import copy
from collections import Counter
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
n = ni()

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 count(p):
    cnt = 0
    now = 1
    while p>0:
        if p < now:
            break
        p -= now
        cnt += 1
        now += 1
    return cnt

c = Counter(prime_factorize(n))
res = 0
for v in c.values():
    res += count(v)

print(res)

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)

cnt = 0

for p, e in A:
    if p == 1:
        cnt = 0
        break
    for i in range(1, 10**12):
        e -= i
        if e < 0:
            break
        else:
            cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
import math

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

l=prime_factorize(n)
c=0
ls=set(l)

ln=[]
for i in iter(ls):
    s=0
    for j in l:
        if i==j:
            s+=1
    ln.append(s)



for i in range(len(ln)):
    c+=int((math.sqrt(1+8*ln[i])-1)/2)

print(c)

Submission status: Accepted

Solution code:
import collections

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


n = int(input())

ls = prime_factorize(n)
c = collections.Counter(ls)

if len(c) == 0:
    print(0)
else:
    ans = 0
    for ci in c.values():
        num = 1
        cnt = 1
        while ci >= num:
            ans += 1
            cnt += 1
            num += cnt
    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())
d = factorization(n)
ans = 0


for i, j in d:
    for k in range(1, 100000):
        if i == 1:
            break
        if j >= k:
            ans += 1
            j -= k
        else:
            break

print(ans)

Submission status: Accepted

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


def solve(N: int):
    L = factorization(N)
    sm = 0
    for l in L:
        if l[0] == 1:
            continue
        n = l[1]
        ct = 1
        while (ct + 1) * ct / 2 <= n:
            ct += 1
        sm += ct - 1

    print(sm)
    return


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

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
ans = 0
N = int(input())
L = [0] * 10**6
ans = 0
for i in range(2,10**6):
    while N%i == 0:
        N = N//i
        L[i] += 1
if N != 1:
    L[10**6 - 1] = 1
L.sort(reverse=True)
for i in range (10**6):
    if L[i] == 0:
        break
    k = 1
    while L[i] > 0:
        L[i] -= k
        if L[i] >= 0:
            k += 1
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
from bisect import bisect_left

def prime_factor(n):
    d = defaultdict(int)
    for i in range(2, n + 1):
        if i * i > n:
            break
            
        while n % i == 0:
            d[i] += 1
            n //= i
            
    if n != 1:
        d[n] += 1
            
    return d

N = int(input())
d = prime_factor(N)

x = [0] * 10 ** 5
x[0] = -1
for i in range(1, 10 ** 5):
    x[i] = x[i - 1] + i

ans = 0
for v in d.values():
    ans += bisect_left(x, v) - 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

huga=[1]
for i in range(100):
  huga.append(huga[-1]+i+2)
n=int(input())
hoge=factorization(n)
ans=0
for i in range(len(hoge)):
  for j in range(len(huga)):
    if(hoge[i][1]>=huga[j]):
      ans+=1
      
if(n==1):
  print(0)
else:
  print(ans)

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


n = int(input())
p = prime_factorize(n)
c = Counter(p)

ans = 0
for key, value in c.most_common():
    x = 1
    while x <= c[key]:
        ans += 1
        c[key] -= x
        x += 1

print(ans)

Submission status: Accepted

Solution code:
import collections
num = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,34,35,36,37]
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
ans = 0    
a = prime_factorize(N)
cor = collections.Counter(a)
for v in cor.values():
    tmp = 0
    for nn in num:
        v -= nn
        if v >= 0:
            ans += 1
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
import math
def f(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()

f = f(N)
ans = 0
for i in range(len(f)):
    ans += (math.sqrt(1+8*f[i][1]) - 1)//2

print(int(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
  
##############################################  
from math import factorial
N=int(input())
if N==1:
  print(0)
else:
  ans=0
  a=factorization(N)
  for b in a:
    p=1
    for i in range(1,10**18):
      if i*(i+1)//2 <=b[1]:
        p=i
      else:
        break
    #print(p)
    ans +=p
  print(ans)

Submission status: Accepted

Solution code:
def is_Prime(i):
    if i == 2:
        return True
    if i % 2 == 0 or i == 1:
        return False
    s = int(i ** (1 / 2))
    while True:
        if s == 1:
            return True
        if i % s == 0:
            return False
        s -= 1

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

n = int(input())
if n == 1:
    print(0)
    exit()
s = prime_factorize(n)
x = s[0]
t = []
c = 0
for i in s:
    if i == x:
        c += 1
    else:
        t.append(c)
        c = 1
        x = i
t.append(c)
ans = 0
for i in t:
    j = 1
    while True:
        if i - j < 0:
            break
        i -= j
        j += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

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

    return arr


fact_list = factorization(N)

res = 0
for k, v in fact_list:
    cnt = 1
    while True:
        v -= cnt

        if v == 0:
            res += 1
            break

        if v < 0:
            break

        cnt += 1
        res += 1

print(res)

Submission status: Accepted

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

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

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

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

    return arr


def solve(N: int):
    if N == 1:
        print(0)
        return
    divs = factorization(N)
    ans = 0
    for d in divs:
        k = d[1]
        i = 1
        while k-i >= 0:
            k -= i
            ans+=1
            i+=1
    print(ans)



    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
import sys
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
MAX_INT = int(10e25)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return 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

N = I()
a = prime_factorize(N)

d = {}
for i in a:
  if i in d:
    d[i] += 1
  else:
    d[i] = 1

ruiseki = [0]
tmp = 0
for i in range(1,200):
  ruiseki.append(ruiseki[-1]+i)

ans = 0
for i in d.values():
  tmp = bisect.bisect_right(ruiseki, i) -1
  ans += tmp
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 check(n):
    ans=1
    c=0
    for i in range(1,100):
        c+=i
        if(n<c):
            break
        ans=i
    return ans

N=int(input())
if(N>1):
    arr=factorization(N)
    ans=0
    for i in range(len(arr)):
        ans+=check(arr[i][1])
    print(ans)
else:
    print(0)

Submission status: Accepted

Solution code:
import bisect
def factorization(n):
  m = {}
  _n = n
  for i in range(2, int(n ** (1/2)) + 1):
    if _n % i == 0:
      cnt = 0
      while _n % i == 0:
        _n //= i
        cnt += 1
      m[i] = cnt
  if _n != 1:
    m[_n] = 1
  return m

n = int(input())
m = factorization(n)

ans = 0
for _m in m:
  p = m[_m]
  _tri = 0
  _cnt = 0
  while p >= _tri:
    _cnt += 1
    _tri += _cnt
  ans += _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])

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

    return arr

n = int(input())

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

prime = factorization(n)

ans = 0


for i in range(len(prime)):
    s = 0
    for j in range(1, prime[i][1]+1):
        if j*(j+1)/2 <= prime[i][1]:
            s = max(s, j)
    ans += s

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if n==1:
    print(0)
    exit()
def sosuu(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
if sosuu(n):
    print(1)
    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

 


ff=factorization(n) 
d=[]
ans=0
for i,j in ff:
    tmp=0
    while j>0:
        tmp+=1
        j-=tmp

        if j<0:
            break
        ans+=1
print(ans)

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

    n=int(input())
    fact = dict(Counter(prime_factorize(n)))
    cal={}
    ans=0
    for i in fact.values():
        if i not in cal.keys():
            cal[i]=int(((1+8*i)**(1/2)-1)//2)
        ans+=cal[i]
    print(ans)

if __name__ == '__main__':
    resolve()

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
arr=factorization(n)
sumarr=[]
ans=0
for i in range(42):
    sumarr.append(i*(i+1)//2)
for i in arr:
    for j in range(1,41):
        if sumarr[j]<=i[1]<sumarr[j+1]:
            ans+=j
print(ans)