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())
pair = dict()
ans = 0
for a in range(2, int(N**(1/2))):
    if N % a != 0:
        continue
    ex = 0
    while N % a == 0:
        ex += 1
        N = N//a
    pair[a] = ex
if N != 1:
    pair[N] = 1
for k in pair.values():
    i = 1
    while k >= i:
        ans += 1
        k -= i
        i += 1
print(ans)

Submission status: Accepted

Solution code:
import math
import bisect
n = int(input())
saidai = math.ceil(n**0.5)

ruisekiwa = [1]
for i in range(2,100):
    ruisekiwa.append(ruisekiwa[-1]+i)

#%%
so_factors = [0 for _ in range(saidai)]

for i in range(2,saidai+1):
    while n%i == 0:
        so_factors[i]+=1
        n = n//i

if n != 1:
    count = 1
else:
    count =0
    
for i in range(len(so_factors)):
    if so_factors[i] > 0:
        count+=bisect.bisect_right(ruisekiwa, so_factors[i])

print(count)

Submission status: Accepted

Solution code:
from collections import Counter
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())
a = prime_factorize(n)
count = Counter(a)

ans = 0
for cnt in count.values():
    fib = 0
    for i in range(1, 41):
        fib += i
        if cnt < fib:
            ans += i - 1
            break
print(ans)

Submission status: Accepted

Solution code:
import bisect

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

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

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

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

    return arr

kosu=[i*(i+1)//2 for i in range(60)]
#print(kosu)
n=int(input())
pnum=factorization(n) 
ans=0
for i in range(len(pnum)):
  kata=pnum[i][1]
  tmp=bisect.bisect_left(kosu,kata)-1
  if kata in kosu:
    tmp+=1
  ans+=tmp
  #print("tmp",tmp,ans)
if n==1:
  ans=0
print(ans)

Submission status: Accepted

Solution code:
def abc169_d():

    def prime_factorize(n: int) -> list:
        ''' nの素因数分解 '''
        arr = []
        while n % 2 == 0:
            arr.append(2)
            n = n // 2
        f = 3
        while f * f <= n:
            if n % f == 0:
                arr.append(f)
                n = n // f
            else:
                f += 2
        if n != 1:
            arr.append(n)
        return arr

    N = int(input())
    primes = prime_factorize(N)
    ans = 0

    from collections import Counter
    for _, v in Counter(primes).items():
        u = 1
        while True:
            tmp = (u+2) * (u+1) // 2
            if tmp <= v: u += 1
            else: break
        ans += u
    print(ans)

abc169_d()

Submission status: Accepted

Solution code:
N = int(input())
from collections import Counter
from bisect import bisect
def prime_factorization(n):
    factor = []
    f = 2
    while f ** 2 <= n:
        if n % f == 0:
            factor.append(f)
            n //= f
        else:
            f += 1
    if n > 1:
        factor.append(n)
    return factor

p = prime_factorization(N)
c = Counter(p)

ans = 0
L = [0]
i = 1
while L[-1] < 10**12:
    L.append(i + L[-1])
    i += 1

for a in c.keys():
    b = c[a]
    i = bisect(L, b)
    ans += i-1
print(ans)

Submission status: Accepted

Solution code:

N = int(input())
def divisor(n):
    fac = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            fac.append(i)
            if i * i != n:
                fac.append(n // i)
    return sorted(fac)
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 = divisor(N)
count = 0
for i in L[1::]:
    if len(factorization(i))==1:
        if N % i == 0:
            N = N/i
            count+=1
print(count)

Submission status: Accepted

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

def is_prime(x):
    if x == 2: return True
    if x == 1 or not x % 2: return False
    for i in range(3, int(x**0.5)+1, 2):
        if not x % i: return False
    else: return True
if is_prime(n): print(1); exit()

def get_primes(lim):
    table = [True] * (lim+1)
    table[0:2] = False, False
    for i in range(2, int(lim**0.5)+1):
        if not table[i]: continue
        for j in range(i*2, lim+1, i):
            table[j] = False
    return [i for i in range(lim+1) if table[i]]

def factorize(x, primes):
    res = []
    for p in primes:
        if p ** 2 > x: break
        cnt = 0
        while not x % p:
            x //= p
            cnt += 1
        if cnt: res.append(cnt)
    if x > 1: res.append(1)
    return res

p = get_primes(10**6*2)
f = factorize(n, p)
ans = 0
for x in f:
    for i in range(1, 100):
        if i <= x:
            x -= i
            ans += 1
        else: break

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
import collections
import math
cnt = 0
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))
v = c.values()
for i in v:
	cnt += math.floor((math.sqrt(8*i+1)-1)/2)
print(cnt)

Submission status: Accepted

Solution code:
from math import sqrt, floor
N = int(input())

def factorize(n):
    a = []
    count = 0
    temp = n
    if temp % 2 == 0:
        while temp % 2 == 0:
            count += 1
            temp //= 2
        a.append(count)
    for i in range(3,floor(sqrt(n)) + 1,2):
        if temp % i == 0:
            count = 0
            while temp % i == 0:
                count += 1
                temp //= i
            a.append(count)
    if temp != 1: a.append(1)
    #if a == []: a.append(1)
    return a

ans = 0
for i in factorize(N):
    ans += int((-1 + sqrt(1 + 8 * i)) / 2)
print(ans)

Submission status: Accepted

Solution code:
import collections
n = int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
c =  collections.Counter(prime_factorize(n))
a = c.values()
# print(a)
count =0
for i in a:
    k=1
    for j in range(n):
        if (i==1):
            count+=1
            break
        i-=k
        k +=1
        # print(i,k-1)
        count +=1
        if (i<=k-1):
            break
    
print(count)

Submission status: Accepted

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

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

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

  return arr


N=int(input())
ans=0
A=fac(N)
for i in range(len(A)):
  p=2*A[i][1]
  q=p**0.5
  if A[i][0]==1:
    ans+=0
  elif type(q)=="int":
    ans+=q-1
  else:
    q=q//1
    if q*(q+1)<=p:
      ans+=q
    else:
      ans+=q-1
print(int(ans))

Submission status: Accepted

Solution code:
n = int(input())
dic = {}
def f(num):
    while(num%2==0):
        num //= 2
        if(dic.get(2) is None):
            dic[2] = 1
        else:
            dic[2] += 1
    s = 3
    while((s*s) <= num):
        if((num % s)==0):
            if(dic.get(s) is None):
                dic[s] = 1
            else:
                dic[s] += 1
            num //= s
        else:
            s += 2

    
    if num != 1:
        if(dic.get(num) is None):
            dic[num] = 1
        else:
            dic[num] += 1


f(n)

l = []
for x,y in dic.items():
    cnt = 1
    if(y==1):
        l.append(x)
        continue
    while(y >= cnt):
        l.append((x**cnt))
        y -= cnt
        cnt += 1

print(len(l))

Submission status: Accepted

Solution code:
from math import gcd
def factorization(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 == [] and n != 1:
        arr.append([n, 1])
    return arr

n = int(input())
fact_n = factorization(n)
cnt = 0
for _, e in fact_n:
    for i in range(1, 10**3):
        if i*(i + 1) // 2 <= e < (i + 1)*(i + 2) // 2:
            cnt += i
            break
print(cnt)

Submission status: Accepted

Solution code:
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    arr = factorization(n)

    res = 0

    for i in arr:
        res += sankaku(i[1])

    if n == 1:
        res = 0

    return res

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 sankaku(n):
    res = 1

    while True:
        if res * (res + 1) // 2 <= n < (res + 1) * (res + 2) // 2:
            break

        res += 1

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["n"] = [int(i) for i in cin][0]

    cout = main(kwargs)
    print(cout)

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
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

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret


# ここから書き始める
n = int(input())
primes = factorization(n)
# print(primes)
ans = 0
# if len(primes) == 0:
    # print(0)
    # sys.exit()
for i in primes:
    if i[0] == 1:
        continue
    a = i[1]
    cnt = 0
    total = 0
    while total + cnt < a:
        total += cnt + 1
        cnt += 1
    ans += cnt
print(ans)

Submission status: Accepted

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

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

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

    return arr
ans = factorization(N)
index = [ans[i][1] for i in range(len(ans))]
k = 0
if N == 1:
  print('0')
else:
  
  for i in range(len(ans)):
    a = index[i]
    j = 1
    while a - j >=0:
      k += 1
      a -= j
      j += 1
  print(k)

Submission status: Accepted

Solution code:

N = int(input())


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

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

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

    return arr

if N==1:
    print(0)
else:
    s=0
    d=factorization(N)
    for p in range(len(d)):
        i=1
        while(d[p][1]>0):
            if d[p][1]-i<0:
                d[p][1]=-1
            else:
                d[p][1]=d[p][1]-i
                s=s+1
                i=i+1
    print(s)

Submission status: Accepted

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

def keisan(n):
    s = 1
    cnt = 0
    while n > 0:
        n -= s
        cnt += 1
        s += 1

    if n < 0: return cnt-1
    else: return cnt

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

F = factorization(N)

ans = 0
for f in F:
    ans += keisan(f[1])

print(ans)

Submission status: Accepted

Solution code:
N = int(input())


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

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

    return arr


res = factorization(N)
sum = 0

steps = [1]

for i in range(2, 300):
    steps.append(steps[-1] + i)

if len(res) == 0:
    print(0)
else:
    for fact in res:
        num = fact[-1]
        count = 0
        for s in steps:
            if s > num:
                break
            count += 1
            
        sum += count

    print(sum)

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

def check(j):
    if j <= 2:
        return 1
    else:
        tmp = int((j * 2) ** 0.5)
        while 1:
            if tmp * (tmp + 1) <= j * 2:
                return tmp
            else:
                tmp -= 1
        # return int((j * 2) ** 0.5)


N = int(input())
ans = 0
for i, j in prime_factorize(N).items():
    ans += check(j)
print(ans)

Submission status: Accepted

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

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

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

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

    return arr

N = int(input())
if N ==1:
    print(0);exit()
A = factorization(N)
ans = 0
for p,n in A:
    for k in range(1,100):
        if n >= k:
            ans += 1
            n -= k
        else:break

print(ans)

Submission status: Accepted

Solution code:
A = int(input())

import sys

if A ==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(cnt)

    if temp!=1:
        arr.append(1)

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

    return arr

def counting(x):
    i = 1
    result = 0
    while i<=x:
        result +=1
        x -=i
        i +=1
    return result

arr = factorization(A)

result = 0
for i in range(len(arr)):
    result += counting(arr[i])

print(result)

Submission status: Accepted

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

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

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

    return arr

def main():
    N = int(input())
    if N==1:
        print(0)
        exit()
    
    ret = factorization(N)
    ans = 0
    already = set()
    while len(ret) > 0:
        #print(ret)
        x = ret.pop()
        #print(x)
        e = 1
        while e <= x[1]:
            p = x[0]**e
            if not p in already:
                already.add(p)
                break
            e += 1
        else:
            continue
        y = [x[0], x[1]-e]
        ans += 1
        if y[1] > 1:
            ret.append(y)
    print(ans)



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

ele = factorization(n)
cnt = 0
for i in range(len(ele)):
    for j in range(1, ele[i][1]+1):
        if j*(j+1)/2 <= ele[i][1]:
            cnt += 1
        else:
            break
            
if n == 1:
    cnt = 0

print(cnt)

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

X = factorization(N)
#print(X)
ans = 0
for a,b in X:
    tmp = 0
    for i in range(1,100):
        if b < i:
            break
        else:
            b -= i
            ans += 1
if N == 1:
    ans = 0
print(ans)

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

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

X=[]
for a in c.values():
    X.append(a)
def count(a):
    if 1<=a<=2:
        return 1
    elif 3<=a<=5:
        return 2
    elif 6<=a<=9:
        return 3
    elif 10<=a<=14:
        return 4
    elif 15<=a<=20:
        return 5
    elif 21<=a<=27:
        return 6
    elif 28<=a<=35:
        return 7
    elif 36<=a<=40:
        return 8

ans=0
for i in range(len(X)):
    ans+=count(X[i])
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

i = 2
cur_n = n
cnt = []
while i * i <= n:
    z = 0
    while cur_n % i == 0:
        z += 1
        cur_n //= i
    if z:
        cnt.append(z)
    i += 1

if cur_n != 1:
    cnt.append(1)

'''
ans_table = [0]
for i in range(40):
    ans_table[i // 2] + 1

[0, 1, 2
'''


def get_ans(power):
    i = 1
    res = 0
    while res + i <= power:
        res += i
        i += 1
    return i - 1


ans = 0
for v in cnt:
    ans += get_ans(v)


print(ans)

Submission status: Accepted

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

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

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

    return arr
fact = factorization(n)


ans = 0
for a,b in fact:
    count = 0
    while True:
        count +=1
        if count*(count+1)/2>b:
            count-=1
            break
    ans += count
if n ==1:
    print(0)
else: 
    print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
from collections import defaultdict
N = int(input())
factors = defaultdict(int)

upper = int(sqrt(N))
for p in range(2, upper + 1):
    while N % p == 0:
        factors[p] += 1
        N //= p
if N != 1:
    factors[N] = 1

# print(factors)
result = 0
for p in factors:
    fp = factors[p]
    ti = 1
    while True:
        # print(p, fp, ti)
        if fp >= ti:
            fp -= ti
            ti += 1
            result += 1
        else:
            break

print(result)

Submission status: Accepted

Solution code:
import math
N = int(input())
pf={}
m = N
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

total = 0
for v in pf.values():
    val = int((-1 + math.sqrt(1 + 8 * v))/2)
    total += val
print(total)

Submission status: Accepted

Solution code:
N = int(input())

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 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
alr = set()
while True:
    divisors = set(make_divisors(N))
    diff = divisors.difference(alr)
    pos = list(diff)
    pos.sort()
    for num in pos:
        fact = prime_factorize(num)
        if len(set(fact)) == 1:
            alr.add(num)
            ans += 1
            N = N // num
            break
    else:
        break

print(ans)

Submission status: Accepted

Solution code:
from  collections import defaultdict

n=int(input())

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

u=prime_factorize(n) 
cnt=0
for key,value in u.items():
    r=10**12
    l=0 
    while r-l>1:
        mid=(r+l)//2
        if mid*(mid+1)//2<=value:
            l=mid 
        else:
            r=mid
    cnt+=l
print(cnt)

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

lst = factorization(n)
res = 0
for elem1, elem2 in lst:
    cnt = 1
    if elem1 == 1:
        continue
    while elem2 >= cnt:
        elem2 -= cnt
        cnt += 1
        res += 1
print(res)

Submission status: Accepted

Solution code:
N = int(input())
num = []
import collections
for i in range(2,int(N**0.5)+1):
    while N%i==0:
        num.append(i)
        N //= i
if N != 1:
    num.append(N)
A = collections.Counter(num)
lis = []
num = 0
for i in range(1,10):
    num += i
    lis.append(num)
from bisect import bisect_left,bisect_right
ans = 0
num = 0
for v in A.values():
    num = bisect_right(lis,v)
    ans += num
print(ans)

Submission status: Accepted

Solution code:
def factorization(n):
    if(n == 1):
        return []
    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):
    ans = 0
    arr_list = factorization(N)
    for arr in arr_list:
        prime = arr[0]
        times = arr[1]
        count = 1
        while True:
            times -= count
            if(times < 0):
                break
            ans += 1
            count += 1
    return ans

#print(solve(24))
#print(solve(1))
#print(solve(64))
#print(solve(1000000007))
#print(solve(997764507000))

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

main()

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

K = factorization(N)
cnt = 0
for k in K:
    x = k[1]
    i = 1
    while True:
        if i * (i - 1) // 2 <= x < i * (i + 1) // 2:

            cnt += i-1
            break
        i += 1
print(cnt)

Submission status: Accepted

Solution code:
import collections
import itertools

def prime_factor(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())
if N == 1:
    print(0)
    exit()
PP = prime_factor(N)
#print(PP)
Pri = collections.Counter(PP)
values, counts = zip(*Pri.most_common())
#print("counts = ",counts)
#print("values = ",values)
L = max(counts)

num = range(L+1)
acu = list(itertools.accumulate(num))
#print(acu)

ans = 0
for i in counts:
    for k in range(L+1):
        if acu[k] == i:
            ans += k
            break
        elif acu[k] > i:
            ans += k-1
            break
print(ans)

Submission status: Accepted

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

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

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

    return arr
  
n = int(input())
ans = 0
if n == 1:
    print(0)
else:
    for i in range(len(factorization(n))):
        ch = 1
        loop = 1
        while ch <= factorization(n)[i][1]:
            ans += 1
            loop += 1
            ch = ch + loop

    print(ans)