Problem:


Score : 400 points

Problem Statement

Given is a positive integer N. Consider repeatedly applying the operation below on N:

First, choose a positive integer z satisfying all of the conditions below:

z can be represented as z=p^e, where p is a prime number and e is a positive integer;

z divides N;

z is different from all integers chosen in previous operations.

Then, replace N with N/z.

Find the maximum number of times the operation can be applied.

Constraints

All values in input are integers.

1 \leq N \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

Print the maximum number of times the operation can be applied.

Sample Input 1

24

Sample Output 1

3

We can apply the operation three times by, for example, making the following choices:

Choose z=2 (=2^1). (Now we have N=12.)

Choose z=3 (=3^1). (Now we have N=4.)

Choose z=4 (=2^2). (Now we have N=1.)

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

We can apply the operation three times by, for example, making the following choices:

Choose z=2 (=2^1). (Now we have N=32.)

Choose z=4 (=2^2). (Now we have N=8.)

Choose z=8 (=2^3). (Now we have N=1.)

Sample Input 4

1000000007

Sample Output 4

1

We can apply the operation once by, for example, making the following choice:

z=1000000007 (=1000000007^1). (Now we have N=1.)

Sample Input 5

997764507000

Sample Output 5

7



Sample input:
24


Sample output:
3

Submission status: Accepted

Solution code:
import collections
N = int(input())
if N < 2:
  print(0)
  exit()

def fact(n):  # O(√N)で素因数のリストを作成　n >= 2

  arr = []
  temp = n

  for i in range(2, int(n**(1/2))+1):
    if temp % i == 0:
      while temp % i == 0:
        temp //= i
        arr.append(i)

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

  return collections.Counter(arr)

c = fact(N).most_common()

ans = 0
for i in range(len(c)):
  for j in range(1, 1000):
    if  j*(j-1)//2 <= c[i][1] < j*(j+1)//2:
      ans += j-1
      
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
from bisect import bisect_right
N = int(input())
U = 10**6
pls = np.zeros(U,np.int32)
pls[2] = 1
pls[3::2] = 1
for i in range(3,U,2):
  if pls[i]==1:
    pls[i*i::2*i] = 0
t = list(np.where(pls)[0])
dic = {}
ls = [i*(i-1)//2 for i in range(1,10**6)]
for p in t:
  cnt = 0
  while N%p==0:
    N //= p
    cnt += 1
  dic[p] = cnt
if N!=1:
  dic[N] = 1
ans = 0
for k in dic.keys():
  i = bisect_right(ls,dic[k])
  if i!=0:
    ans += i-1
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
d = defaultdict(int)
import math
def trial_division(n):
    a = [1]
    for i in range(2,int(math.sqrt(n)) + 1):
        while n % i == 0:
            n //= i
            a.append(i)
    a.append(n)
    return a
def calc(n):
    res = 0
    cnt = 1
    while True:
        if n - cnt < 0:
            return res
        n -= cnt
        res += 1
        cnt += 1
N = int(input())
for i in trial_division(N):
    if i != 1:
        d[i] += 1
ans = 0
for i in d.values():
    ans += calc(i)
print(ans)

Submission status: Accepted

Solution code:
import sys


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


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


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)
        return
    fact = factorization(N)
    counter = []
    cnt = 0
    for i in range(1, 41):
        cnt += i
        counter.append(cnt)
    answer = 0
    for f in fact:
        for j in range(40):
            c = counter[j]
            if c > f[1]:
                answer += j
                break
            else:
                continue
    print(answer)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


#隣接リスト 1-order
def make_adjlist_d(n, edges):
    res = [[] for _ in range(n + 1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
        res[edge[1]].append(edge[0])
    return res


def make_adjlist_nond(n, edges):
    res = [[] for _ in range(n + 1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
    return res


#nCr
def cmb(n, r):
    return math.factorial(n) // math.factorial(r) // math.factorial(n - r)


def prime_fact(n):
    root = int(math.sqrt(n))
    prime_dict = {}
    for i in range(2, root+1):
        cnt = 0
        while n % i == 0:
            cnt += 1
            n = n // i
        if cnt:
            prime_dict[i] = cnt
    if n != 1:
        prime_dict[n] = 1
    return prime_dict


def main():
    N = NI()
    L = list(prime_fact(N).values())
    ans = 0
    for l in L:
        if 1 <= l < 3:
            ans += 1
        elif 3 <= l < 6:
            ans += 2
        elif 6 <= l < 10:
            ans += 3
        elif 10 <= l < 15:
            ans += 4
        elif 15 <= l < 21:
            ans += 5
        elif 21 <= l < 28:
            ans += 6
        elif 28 <= l < 36:
            ans += 7
        elif 36 <= l:
            ans += 8
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import heapq
import random
import collections
import math

# available on Google, not available on Codeforces
# import numpy as np
# import scipy

def prime_factors(nr):
    i = 2
    factors = []
    while i <= nr:
        if i > math.sqrt(nr):
            i = nr
        if (nr % i) == 0:
            factors.append(i)
            nr = nr / i
        else:
            i = i + 1
    return factors


def solve(nums):  # fix inputs here

    c = collections.Counter(prime_factors(nums))
    res = 0
    for _,v in c.items():
        res += int((-1+math.sqrt(1+4*2*v))//2)    
    return res

def console(*args):  # the judge will not read these print statement
    print('\033[36m', *args, '\033[0m', file=sys.stderr)
    return


# for case_num in range(int(input())):
    # read line as a string
    # strr = input()

    # read line as an integer
inn = int(input())

# read one line and parse each word as a string
# lst = input().split()

# read one line and parse each word as an integer
# lst = list(map(int,input().split()))

# read matrix and parse as integers (after reading read nrows)
# lst = list(map(int,input().split()))
# nrows = lst[0]  # index containing information, please change
# grid = []
# for _ in range(nrows):
#     grid.append(list(map(int,input().split())))

res = solve(inn)  # please change

# Google - case number required
# print("Case #{}: {}".format(case_num+1, res))

# Codeforces - no case number required
print(res)

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

total = 0
arr = factorization(n)
for [insu, num] in arr:
  if insu == 1:
    break
  i = 1
  while num >= 0:
    num -= i
    total += 1
    i += 1
  total -= 1
print(total)

Submission status: Accepted

Solution code:
n = int(input())


from collections import defaultdict
def getprime(n):
    if not isinstance(n, int):
        raise TypeError("Input int")
    prime = []
    # 約数はsqrt(N)まで調べればOK
    data = [i+1 for i in range(1,n)]
    while True:
        p = data[0]
        if p >= int(n**0.5):
            return prime+data
        prime.append(p)
        # pで割り切れないものだけを残す
        data = [d for d in data if d%p != 0]

def factorization(n):
    # n >= 1を想定
    factors = defaultdict(int)
    if n == 1:
        return {}
    if int(n**0.5) == 1:
        return {n:1} 
    primes = getprime(int(n**0.5))
    for prime in primes:
        while n % prime == 0:
            factors[prime] += 1
            n //= prime
            # print(factors,n)
    if n != 1:
        factors[n] += 1
    return factors

x = factorization(n)
ans = 0
for k in x.keys():
    n = 1
    while n*(n+1)//2 < x[k]:
        n += 1
        if n*(n+1)//2 > x[k]:
            n -= 1
            break
    ans += n
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

N = int(input())

pes = factorization(N)

ans = 0
for p, e in pes:
    i = 1
    t = 1

    while t <= e:
        i += 1
        t += i

    ans += i - 1

print(ans)

Submission status: Accepted

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

N = factorization(n) 
t = [1]
ans = 0
if N == [[1,1]]:
  print(ans)
else:
  for i in range(2,10**5):
    t.append(t[i-2]+i)
  for j in range(len(N)):
    s = bisect.bisect_right(t, N[j][1])
    ans += s
  print(ans)

Submission status: Accepted

Solution code:
n = int(input())
nn = n
def divisor(n): #nの約数を全て求める
  i = 1
  table = []
  while i * i <= n:
    if n%i == 0:
      table.append(i)
      table.append(n//i)
    i += 1
  table = list(set(table))
  return table

import math
from collections import Counter


prime_count = Counter()
for i in range(2, math.ceil(math.sqrt(n))+1):
  while n % i == 0:
    n /= i
    prime_count[i] += 1
if n > 1:
  prime_count[int(n)] += 1

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

z = 0
zz = 0
cnt = 0
for k, v in prime_count.items():
  for i in range(1, v+1):
    if nn % pow(k, i) == 0:
      cnt += 1
      nn = nn // pow(k, i)
    else:
      break

print(cnt)

Submission status: Accepted

Solution code:
def factor(n):
    res = []
    last = -1
    i = 2
    while i ** 2 <= n:
        while n % i == 0:
            if i != last:
                res.append([i,1])
                last = i
            else:
                res[-1][1] += 1
            n //= i
        i += 1
    if n != 1:
        res.append([n,1])
    return res


n = int(input())

ls = factor(n)
ans=0
for p,cnt in ls:
    i=0
    while 1:
        cnt-=i
        if cnt<(i+1):
            break
        else:
            i+=1
    ans+=i

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
if n==1:
    print(0)
else:
    ans=0
    l=factorization(n)
    for t in l:
        i=1
        while t[1]>=i:
            t[1]-=i
            ans+=1
            i+=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(0)

ar = factorization(N)
ans = 0
for i in range(len(ar)):
    tmp = 0
    for j in range(1, 100):
        tmp += j
        if tmp > ar[i][1]:
            ans += j-1
            break

print(ans)

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# Factoring by trial split -- START --
def getPrimeList(n):
  l=[]
  t=int(math.sqrt(n))+1
  
  for a in range(2,t):
    while n%a==0:
      n//=a
      l.append(a)
  
  if n!=1:
    l.append(n)
  
  return l
# Factoring by trial split --- END ---

# Summarize count of factor within list -- START --
def summarize_list(l):
  sl=sorted(l)

  a=sl[0]
  c=1
  res=[]

  for x in sl[1:]:
    if x==a:
      c+=1
    else:
      res.append([a,c])
      a=x
      c=1
  res.append([a,c])

  return res
# Summarize count of factor within list --- END ---

def main():
  n=I()
  if n==1:
    return 0
  l=getPrimeList(n)
  a=summarize_list(l)

  # print(l)
  # print(a)

  ans=0
  for x,y in a:
    st=1
    while True:
      if st>y:
        break

      ans+=1
      y-=st
      st+=1

  return ans

# main()
print(main())

Submission status: Accepted

Solution code:
#素因数分解
#factorization(2016)=[[2, 5], [3, 2], [7, 1]]の形で出力
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())
import bisect

p=factorization(n)
anli=[0,2,5,9,14,20,27,35,44,54]
ans=0
for li in p:
  s=li[1]
  ans+=bisect.bisect_left(anli,s)
print(ans if n>1 else 0)

Submission status: Accepted

Solution code:
"""
これは、Nを構成する素因数の種類の数はいくつか？という問題と等価では？
いや、ちょっと違うな。
2の素因数が3つあれば、2,4で割れる。
Nを素因数分解して、各素因数の数をカウント。
"""
from collections import Counter
N = int(input())
primes = []
d = 2
while d**2 <= N:
    if N%d == 0:
        primes.append(d)
        N //= d
    else:
        d += 1
if N != 1:
    primes.append(N)
count = Counter(primes)


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

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict as dd
from sys import exit
n = int(input())
if n == 1:
    print(0)
    exit()

counter = dd(int)
for num in range(2, int(n**0.5) + 3):
    while n % num == 0:
        n //= num
        counter[num] += 1
if n != 1:
    counter[n] += 1

total = 0
for key, val in counter.items():
    for i in range(1, 10**10):
        if i * (i + 1) // 2 > val:
            total += i-1
            break
print(total)

Submission status: Accepted

Solution code:
from collections import Counter

n = int(input())

def factorize(n):
    b = 2
    factor = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            factor.append(b)
        b += 1
    if n > 1:
        factor.append(n)
    return factor

f = factorize(n)
c = Counter(f)

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

print(a)

Submission status: Accepted

Solution code:
def prime_factorization(n):
    if n == 1:
        return []
    ret = []
    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
            ret.append([i, cnt])
    if tmp!=1:
        ret.append([tmp,1])
    if ret==[]:
        ret.append([n,1])
    ret.sort()
    return ret

N = int(input())
P = prime_factorization(N)
ans = 0

for prime in P:
    cnt = 1
    while cnt <= prime[1]:
        ans += 1
        prime[1] -= cnt
        cnt += 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])

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

    return arr


res = 0
for p, e in factorization(N):
    if p == 1:
        continue
    i = 1
    E = e
    while E > 0:
        i += 1
        E = E - i
    res += i - 1

print(res)

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 = 0
prime = factorization(N)
if N == 1:
    print(0)
    exit()
for li in prime:
    check = li[1]
    i = 1
    while check > 0:
        if check >= i:
            ans += 1
        check -= i
        i += 1
print(ans)

Submission status: Accepted

Solution code:

import math
from collections import defaultdict

def prime_fact(n):
    count = defaultdict(int)
    for p in range(2, math.ceil(math.sqrt(n)) + 1):
        while n % p == 0:
            count[p] += 1
            n //= p
    if n != 1:
        count[n] += 1
    return count


def submit():
    n = int(input())
    primes = prime_fact(n)

    ans = 0
    for p, c in primes.items():
        pw = 1
        while c - pw >= 0:
            c -= pw
            ans += 1            
            pw += 1
    print(ans)
            


if __name__ == "__main__":
    submit()

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

x = factorization(n)
ans = 0

for i, j in x:
    cnt = 1
    while j >= 1:
        if j == 1:
            ans += 1
            j -= 1
        elif j > 1:
            ans += 1
            j -= cnt
        cnt += 1
        if cnt > j:
            break

print(ans)

Submission status: Accepted

Solution code:
import sys
import math
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def prime_factorize(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(readline())
    if N==0 or N==1:
        print('0')
        sys.exit()
    sosu = prime_factorize(N)
    L = len(sosu)
    count = 0
    for i in range(L):
        _, a = sosu[i]
        count += math.floor((math.sqrt(1+8*a)-1)/2)
    print(count)

if __name__ == '__main__':
    main()

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

import bisect

n=int(input())
arr=factorization(n) 
#print(arr)

ans=0
li=[1,3,6,10,15,21,28,36,45]

for ar in arr:
    e=ar[1]
    ans+=bisect.bisect(li,e)
if n==1:
    print('0')
else:    
    print(ans)

Submission status: Accepted

Solution code:
def fac(n):  #nは2以上
    a=[]
    t=n
    if t%2==0:
        count=0
        while t%2==0:
            count+=1
            t//=2
        a.append([2,count])

    for i in range(3,n+1,2):
        if i*i>n:
            break
        if t%i==0:
            count=0
            while t%i==0:
                count+=1
                t//=i
            a.append([i,count])

    if t!=1:
        a.append([t,1])
    
    return a


from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    li=fac(n)
    ans=0
    for i in range(len(li)):
        p=li[i][0]
        cnt=1
        while li[i][1]>=cnt:
            ans+=1
            n//=(p**cnt)
            li[i][1]-=cnt
            cnt+=1

    print(ans)

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math

N = int(input())

prime = {}
p = 2
while N>=p**2:
  count = 0
  while N%p==0:
    count += 1
    N = N//p
  if count>0:
    prime[p] = count
  p += 1

if N>1:
  prime[N] = 1

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

print(answer)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    dic = {}
    x = 2
    while n % x == 0:
        if x in dic:
            dic[x] += 1
        else:
            dic[x] = 1
        n //= x
    x = 3
    while x**2 <= n:
        while n % x == 0:
            if x in dic:
                dic[x] += 1
            else:
                dic[x] = 1
            n //= x
        x += 1
    if n > 1:
        if n in dic:
            dic[x] += 1
        else:
            dic[x] = 1
    ans = 0
    for v in dic.values():
        p = 1
        while p <= v:
            ans += 1
            v -= p
            p += 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x=int(input())
def cal(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
num=cal(x)
numset=sorted(list(set(num)))
cnt=[0]*len(numset)
now=0
for i in range(len(num)):
    if numset[now]==num[i]:
        cnt[now]+=1
    else:
        now+=1
        cnt[now]+=1
ans=0
for j in range(len(cnt)):
    s=1
    plu=2
    c=0
    flag=0
    while flag!=1:
        if s<=cnt[j]:
            c+=1
            s+=plu
            plu+=1
        else:
            ans+=c
            flag=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()
factors = factorization(n)
ans = 0
for f, num in factors:
    i = 1
    while num >= i:
        num -= i
        i += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def factorize(n):
    fact = dict()
    k = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if k % i == 0:
            c = 0
            while k % i == 0:
                c += 1
                k //= i
            fact[i] = c
    if k != 1:
        fact[k] = 1
    if not fact:
        fact[n] = 1
    return fact


def main():
    n = int(input())
    if n == 1:
        print(0)
        return
    c = sum([[i for _ in range(i + 1)] for i in range(9)], [])
    print(sum(c[f] for f in factorize(n).values()))


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
a = factorization(N)
ans = 0
for i in range(len(a)):
  tmp = a[i][1]
  for j in range(10**10):
    if tmp < j*(j+1)//2:
      break
  ans += (j-1)
if N == 1:
  ans = 0
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

sisu=[]
yakusu=[]
gen=n
soinsu=2
for i in range(n):
    if(soinsu**2>gen):
        if(gen!=1):
            yakusu.append(gen)
        break
    if(gen%soinsu==0):
        yakusu.append(soinsu)
        gen//=soinsu
    else:
        soinsu+=1

#print(yakusu)

kosu=len(yakusu)

if(kosu==1):
    sisu.append(1)
elif(kosu>1):
    sisu=[1]
    for i in range(1,kosu):
        if(yakusu[i]==yakusu[i-1]):
            sisu[-1]+=1
        else:
            sisu.append(1)


ans=0

for s in sisu:
    now=0
    for i in range(1,s+100):
        now+=i
        if(now>s):
            #print(s,i)
            ans+=i-1
            break

print(ans)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())[:-1]
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [list(input())[:-1] for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
def factorization(n): #2以上の整数n => [[素因数, 指数], ...]の2次元リストを返す
    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)
else:
    li = factorization(N)
    ans = 0
    for arr in li:
        num = arr[1]
        cur = 1
        while num >= (cur)*(cur+1) // 2:
            cur += 1
        ans += cur-1
    print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
l=[0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666, 703, 741, 780, 820] 
ans=0
from bisect import bisect_right as bl
from math import floor
for i in range(2,floor(n**(1/2))+1):
    if n%i:continue
    cnt=0
    while n%i==0:
        cnt+=1
        n//=i
    ind=bl(l,cnt)
    if ind==1:ans+=1
    else:
        ans+=ind-1
if n!=1:
    ans+=1
print(ans)

Submission status: Accepted

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
a = prime_factorize(n)
#print(a)
c = collections.Counter(a)
#print(c)
ans = 0
for v in c.values():
    x = 1
    while True:
        v -=x
        x += 1
        if (v<x):
            ans += (x-1)
            break
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

def calc(n):
    ans=0
    tmp=0
    c=1
    while(1):
        tmp+=c
        if tmp>n:
            break
        ans=c
        c+=1
    return ans

L=factorization(N)
if N==1:
    print(0)
    exit()
ans=0
for i in range(len(L)):
    val=L[i][0]
    cnt=L[i][1]
    ans+=calc(cnt)

print(ans)

Submission status: Accepted

Solution code:
import math
import bisect

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

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

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

    return arr

n = int(input())
if n == 1:
	print(0)
else:
	arr = factorization(n)
	max_count = max([x[1] for x in arr])
	binomial_count = [1]
	k = 1
	i = 1
	while True:
		i += 1
		k += i
		binomial_count.append(k)
		if k > max_count:
			break

	ans = 0
	for x in arr:
		ans += bisect.bisect_right(binomial_count, x[1])
	# print(arr)
	# print(binomial_count)
	print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
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 solve(N: int):
    factors = defaultdict(int)
    res = prime_factorize(N)
    for f in res:
        factors[f]+=1
    r=0
    for key in factors:
        for c in range(1,10**10):
            if factors[key] >= c:
                factors[key]-= c
                r+=1
            else:
                break
    print(r)
    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()