Problem:


Score : 400 points

Problem Statement

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

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

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

z divides N;

z is different from all integers chosen in previous operations.

Then, replace N with N/z.

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

Constraints

All values in input are integers.

1 \leq N \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

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

Sample Input 1

24

Sample Output 1

3

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

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

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

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

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

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

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

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

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

Sample Input 4

1000000007

Sample Output 4

1

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

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

Sample Input 5

997764507000

Sample Output 5

7



Sample input:
24


Sample output:
3

Submission status: Accepted

Solution code:
def factorization(n):
    d = {}
    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
            d[i] = cnt
    
    if temp!=1:
        d[temp] = 1
    
    if len(d) == 0:
        d[n] = 1
    
    return list(d.values())


def calc(n):
    res = 1
    n -= 1
    while n >= res+1:
        res += 1
        n -= res
    return res

N = int(input())
if N == 1:
    print(0)
    quit()

e = factorization(N)
ans = 0
for ei in e:
    ans += calc(ei)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

a = []
ans = 0
for i in range(2,int(n**0.5)+1):
    count = 0
    while n%i==0:
        n/=i
        count+=1
    if count!=0:
        for j in range(1,count+10):
            if j*(j+1)/2>count:
                ans+=j-1
                break
if n!=1:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
import sys
from bisect import bisect

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(i) + 1 for i in range(40)]
    B = [0] * 41
    for i, a in enumerate(A):
        B[i+1] = B[i] + a
    count = 0
    k = N
    for i in range(2, N+1):
        if i ** 2 > N: break
        if N % i == 0:
            d = 0
            while k % i == 0:
                d += 1
                k //= i
            count += bisect(B, d) - 1
    if k > 1: count += 1
    print(count)

    return 0

if __name__ == "__main__":
    solve()

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 == [] and n != 1:
        arr.append([n, 1])

    return arr


factors = factorization(N)

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

print(ans)

Submission status: Accepted

Solution code:
import sys
from math import floor
def input(): return sys.stdin.readline().strip()
mod = 10**9+7

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
    
    arr = factorization(N)
    ans = 0
    for p, i in arr:
        num = 0
        while num * (num + 1) // 2 <= i: num += 1
        ans += num - 1
    print(ans)

    

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

def factorize(n):
    if n == 1: return []
    res = []
    x, y = n, 2
    while y * y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res

from collections import Counter

F = factorize(N)
C = Counter(F)


res = 0

if N == 1:
    print(0)
else:
    for k, v in C.items():
        tmp = 0
        while True:
            if (tmp + 1) * (tmp + 2) // 2 > v:
                res += tmp
                break
            tmp += 1

    print(res)

Submission status: Accepted

Solution code:
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
from collections import deque
inf = 10 ** 18
mod = 10 ** 9 + 7

def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    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())
tmp = factorization(n)
ans=0
judge = [(i*(i+1))//2 for i in range(1,10)]
def getC(x):
    ind = bisect.bisect_left(judge, x)
    if judge[ind] == x:
        return ind+1
    else:
        return ind
for a,b in tmp:
    ans+=getC(b)
print(ans)

Submission status: Accepted

Solution code:
from math import gcd, sqrt, cos, radians, pi
from collections import defaultdict as d
from itertools import combinations as c

n = int(input())
#a, b = map(float, input().split())
#x, y, z = map(int, input().split())
#a, b, h, m = map(int, input().split())
#arr = list(map(int, input().split()))

div = []
tmp = n
if n % 2 == 0:
	div.append(2)
	while n % 2 == 0:
		n //= 2
for i in range(3, int(n**.5)+2, 2):
	if n % i == 0:
		div.append(i)
		while n % i == 0:
			n //= i

if n > 1:
	div.append(n)

s = 0
exp = 1
n = tmp
while n > 1:
	f = 0
	for v in div:
		if n > 1:
			if n % (v**exp) == 0:
				s += 1
				f = 1
				n //= (v**exp)
	exp += 1
	if not f:
		break
	
print(s)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *

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

N = int(input())
fs = factorize(N)
ans = 0

for _, C in fs:
    c = 1
    
    while C-c>=0:
        ans += 1
        C -= c
        c += 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):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

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

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

    return arr
if n==1:
    print(0)
    exit()
a=factorization(n)
ans=0
for i in a:
    k=i[1]
    ans+=int((-1+(1+8*k)**(0.5))/2)
print(ans)

Submission status: Accepted

Solution code:
"""素因数分解
Returns:
    list -- [[prime, index], ...]
"""

def factorization(n):
    res = []
    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
            res.append([i, cnt])
    if tmp != 1:
        res.append([tmp, 1])
    if res == []:
        res.append([n, 1])
    return res

N = int(input())

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

res = factorization(N)

ans = 0

for r in res:
    m = 1
    while (m*(m+1)//2 <= r[1]):
        m += 1
    ans += m-1

print(ans)

Submission status: Accepted

Solution code:
import math
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
n = int(input())
if n== 1:
  print(0)
  exit()
x = factorization(n)
c = 0
for xi in x:
  s = 0
  i = 1
  while True:
    if s+i <=xi:
      s += i
      c += 1
    else:
      break
    i += 1    
print(c)

Submission status: Accepted

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

sys.setrecursionlimit(1000000)
ACMOD = 1000000007
INF = 1 << 62


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):
    ans = 0
    d = collections.Counter(prime_factorize(N))
    for p, count in d.items():
        tmp = 1
        while count > 0:
            count -= tmp
            if count >= 0:
                ans += 1
            tmp += 1

    print(ans)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

p = []
cnt = 0
while N % 2 == 0:
	cnt += 1
	N = N // 2
if cnt > 0:
	p.append(cnt)

t = 3
while N >= t and t <= 10**6:
	cnt = 0
	while N % t == 0:
		cnt += 1
		N = N // t
	if cnt > 0:
		p.append(cnt)
	t += 2

if N > 10**6:
	p.append(1)

ans = 0
for c in p:
	a = int((-1 + pow(1+8*c, 0.5))/2)
	ans += a
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

f = {}
p = 2
while p*p<=N:
    if N%p==0: f[p]=0
    while N%p==0:
        N//=p
        f[p]+=1
    p+=1

if N>1: f[N]=1

ans = 0
for v in f.values():
    n = s = 0
    while s<=v:
        n+=1
        s+=n
    ans += n-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
ans = 0
if n == 1:
    print(0)
else:
    for i in range(len(factorization(n))):
        s = factorization(n)[i][1]
        ans +=  int((-1+(1+8*s)**(1/2))/2)




    print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


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 = Scanner.int()
    if N == 1:
        print(0)
        return
    fact = factorization(N)
    ans = 0
    for f in fact:
        t = f[1]
        i = 1
        while t - i >= 0:
            ans += 1
            t -= i
            i += 1
    print(ans)


def main():
    # sys.stdin = open("sample.txt")
    # print('YNEOS'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from bisect import bisect as bisect
l = [0]*100000
for i in range(len(l)):
    l[i] = (i*(i+1))//2

N = int(input())
def prime_decomposition(n):
  i = 2
  d = {}
  while i * i <= n:
    while n % i == 0:
      n //= i
      if i not in d:
          d[i] = 0
      d[i] += 1
    i += 1
  if n > 1:
    if n not in d:
        d[n] = 1
  return d

d = prime_decomposition(N)
ans = 0
for i in d:
    ans += bisect(l,d[i])-1
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')

def factorize(n):
    """
    nの値を素因数分解し、素因数とその指数をtupleにまとめたリストを返す
    e.g.
    factorize(20)
    [(2, 2), (5, 1)]
    """
    b = 2
    fct = []
    while b * b <= n:
        cnt = 0
        while n % b == 0:
            cnt += 1
            n //= b
        if cnt > 0:
            fct.append((b, cnt))
        b += 1
    if n > 1:
        fct.append((n, 1))
    return fct


N = I()
ans = 0
for p, e in factorize(N):
    if p == 1:
        continue
    i = 1
    cnt = 0
    while e - i >= 0:
        e = e - i
        i = i + 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

ansNums = factorization(N)
ans = 0

for a in ansNums:
    if a[0] == 1:
        break
    cnt = 1
    while a[1] >= cnt:
        a[1] -= cnt
        ans += 1
        cnt += 1

print(ans)

Submission status: Accepted

Solution code:
def factoring(k): #kを因数分解し、素因数とその個数を辞書に入れて返す。
    import math
    dic = dict()
    n = int(math.sqrt(k))+2
    for i in range(2, n):
        count = 0
        while k%i == 0:
            count += 1
            k = k//i
        if count != 0:
            dic[i] = count
    if k != 1: #sqrt(k)までチェックしてもkが1になっていない --> kが素因数
        dic[k] = 1
    return dic

N = int(input())

dic = factoring(N)

def calc(x):
    k = 0
    while True:
        if k * (k + 1) // 2 > x:
            return k - 1
        k += 1


ans = 0
for i in dic:
    tmp = dic[i]
    ans += calc(tmp)

print (ans)

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

# print(c)
ans = 0
for key in c.keys():
    i = 1
    while True:
        c[key] -= i
        ans += 1
        i += 1
        if c[key] < i:
            break

print(ans)

Submission status: Accepted

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

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)
from collections import Counter
c = Counter(a)
ans = 0
for i in c.keys():
    cnt = 1
    while c[i] >= cnt:
        ans += 1
        c[i] -= cnt
        cnt += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


def factorization(n: int):
    if n == 1:
        return []  # 1は素数ではない
    # 素因数分解
    arr = []
    temp = n
    for i in range(2, int(n**0.5) + 1):  # ここにバグがないか心配
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append((i, cnt))

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

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

    return arr


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

N = read_a_int()

# どれとも異なるという条件がなければ、簡単(肩の数を足し合わせるだけ)

# 以前のどの整数とも異なるという条件はどう管理する？
# あるpについてeは1,2,3と取って行ったほうがよい

fact = factorization(N)
# print(fact)
ans = 0
for p, e in fact:
    sub = 1  # いくつ引くか
    while sub <= e:
        ans += 1
        e -= sub
        sub += 1
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

n, = map(int,input().split())

x = [0,1,3,6,10,15,21,28,36,45,55,66]

from bisect import bisect_right
ans = 0
N = 10**6
for i in range(2,N):
    r = 0
    while n%i==0:
        n//=i
        r += 1
        
    if r>0:
        ans += bisect_right(x,r)-1        
        #print(i,r,ans)

if n!=1:
    #print(n)
    ans += 1    
    
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
num = int(input())
def pr(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
if num == 1:
   print(0)
   quit()
prm = Counter(pr(num)).items()
ans = 0
for el,nm in prm:
   x = 1
   while True:
      if nm >= x:
         nm -= x
         ans += 1
         x += 1
      else:
         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

li = factorization(N) 
ans = 0
for l in li:
    n = l[0]
    if n == 1:
        continue
    count = l[1]
    ans += 1
    now = 1
    count -= 1
    while count > 0:
        now += 1
        count -= now
        if count >= 0:
            ans += 1

print(ans)

Submission status: Accepted

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

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

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

    return arr


def calc(num):
    ret = 0
    left = num
    count = 1
    while True:
        if left >= count:
            ret = count
            left -= count
            count += 1
        else:
            break
    return ret


n = int(input())

ret = factorization(n)

val = 0

for tmp, num in ret:
    if tmp == 1:
        continue
    val += calc(num)

print(val)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


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


def factorization(n):
    d = {}
    tmp = n
    for i in range(2, int(n ** 0.5) + 1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            d[i] = cnt

    if tmp != 1:
        d[tmp] = 1

    return d


def main():
    N = int(input())
    d = factorization(N)
    ans = 0
    for k, v in d.items():
        i = 1
        while v - i >= 0 and N % (k ** i) == 0:
            v -= i
            ans += 1
            N //= k ** i
            i += 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
input=lambda: sys.stdin.readline().rstrip()
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
ans=0
for p in pf.keys():
  d=pf[p]
  tot=1
  cur=1
  ct=0
  while tot<=d:
    ct+=1
    if tot+cur+1>d:
      break
    else:
      cur+=1
      tot+=cur
  ans+=ct
print(ans)

Submission status: Accepted

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

cnt = 0
for k, v in pf.items():
    t = 1
    while v>0:
        v += -1*t
        if v<0:
            break
        cnt += 1
        t+= 1
print(cnt)

Submission status: Accepted

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

def factor_iter(n):
    from itertools import takewhile
    m = n
    for p in range(2, int(n**0.5)+2):
        while m % p == 0:
            yield p
            m //= p
        if m == 1:
            return
    if m != 1:
        yield m

def f(c):
    ret = 0
    tmp = 1
    while c >= tmp:
        c -= tmp
        ret += 1
        tmp += 1
    return ret

def solve(N: int):
    from collections import Counter
    p = Counter(factor_iter(N))
    return sum(map(f, p.values()))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
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
    print(solve(N))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Submission status: Accepted

Solution code:
import bisect
n = int(input())
def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(int(i))
        i += 1
    if n > 1: table.append(int(n))
    table.sort()
    return table
ans = 0
d = prime_decomposition(n)
for i in list(set(d)):
    index_l = bisect.bisect_left(d, i)
    index_r = bisect.bisect_right(d, i)
    i = 1
    res = index_r-index_l
    while True:
        res -= i
        ans += 1
        if res == 0:
            break
        if res < 0:
            ans -= 1
            break
        i += 1
print(ans)

Submission status: Accepted

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


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


n = int(input())

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

a = fctr1(n)

res = 0
d = dict()

for e in a:
    c = 1
    while e:
        if e >= c:
            res += 1
            e -= c
            c += 1
        else:
            break
print(res)

Submission status: Accepted

Solution code:
N = int(input())

from collections import defaultdict
def factorize(n):
    dd = defaultdict(int)
    for i in range(2,int(n**0.5)+1):
        while n%i==0 and n>0:
            dd[i]+=1
            n//=i
    if n>1:
        dd[n]+=1
    return dd

dd = factorize(N)

def check(num):
    count = 0
    for i in range(1,101):
        if count > num:
            break
        count += i
    return i-2

ans = 0
for key in dd:
    ans +=check(dd[key])

print(ans)

Submission status: Accepted

Solution code:
def factorize(n):
    ## 素因数分解
    # arr = factorize(20)
    # arr == [[2, 2], [5, 1]]
    
    result = []
    tmp = n
    for k in range(2, int(n ** 0.5) + 1):
        cnt = 0
        while tmp % k == 0:
            cnt += 1
            tmp //= k
        if cnt > 0:
            result.append([k, cnt])
    if tmp != 1:
        result.append([tmp, 1])
    return result


def hantei(n, m):
    if n * (n + 1) // 2 <= m:
        return False
    else:
        return True
def binary_search(l, r, m, hantei):
    ## hanteiはTrue or Falseを返すfunction
    while True:
        if r - l <= 1:
            break
        now = (r + l) // 2
    #     print(l, now, r)
        if hantei(now, m):
            r = now
        else:
            l = now
    return l


n = int(input())
f = factorize(n)

s = 0
for ff in f:
    s += int(binary_search(0, ff[1] + 1, ff[1], hantei))

print(s)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
f = 2
while True:
  if N%f==0:
    c = 0
    while N%f==0:
      N /= f
      c += 1
    n = 1
    while n*(n+1)//2<=c:
      n += 1
    ans += n-1
  if f*f>N:
    break
  f += 1
if N>1:
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(read())

U = 10**6
is_prime = np.zeros(U, np.bool_)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
    if p * p >= U:
        break
    if is_prime[p]:
        is_prime[p * p::p + p] = 0

primes = is_prime.nonzero()[0]

def factor(N):
    div = primes[N % primes == 0]
    for p in div:
        e = 0
        while N % p == 0:
            e += 1
            N //= p
        yield (p, e)
    if N != 1:
        yield (N, 1)

A = np.zeros(100, np.int32)
for i in range(14):
    k = i * (i + 1) // 2
    A[k] = i
np.maximum.accumulate(A, out=A)

x = 0
for p, e in factor(N):
    x += A[e]
print(x)

Submission status: Accepted

Solution code:
from collections import defaultdict
def primeFact(n):
    factors = defaultdict(int)
    i = 2
    while i*i <= n:
        if n % i == 0:
            n //= i
            factors[i]+=1
        else:
            i += 1
    if n > 1:
        factors[n]+=1
    return factors

N = int(input())

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

ans=0
primes = primeFact(N)

for val in primes.values():
    i=1
    while val>=i:
        val-=i
        i+=1
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
dic1 = defaultdict(int)
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
"""素因数分解"""
def factrize(n):
    b = 2
    fct = []
    while b*b <= n:
        while n % b == 0:
            n //= b
            #もし素因数を重複させたくないならここを加えてfct.append(b)を消す
            """
            if not b in fct:
                fct.append(b)
            """
            fct.append(b)
        b = b+1
    if n > 1:
        fct.append(n)
    return fct #リストが帰る

lst1 = factrize(n)

for i in lst1:
    dic1[i] += 1
ans = 0
for i in dic1.values():
    ct = 1
    while i:
        i -= ct
        if i < 0:
            break
        ans += 1
        ct += 1

print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

primes = {}
i = 2
sqrt_N = math.floor(math.sqrt(N))
while i <= sqrt_N:
	if N % i == 0:
		if i in primes:
			primes[i] += 1
		else:
			primes[i] = 1
		N //= i
		sqrt_N = math.floor(math.sqrt(N))
	else:
		i += 1

if N != 1:
	if N in primes:
		primes[N] += 1
	else:
		primes[N] = 1

count = 0
for c in primes.values():
	i = 1
	while i <= c:
		count += 1
		c -= i
		i += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())

def prime_factorize(N):
    #素因数分解
    from collections import defaultdict
    factorize = defaultdict(int)
    while N%2 == 0:
        factorize[2]+=1
        N //= 2
    i=1
    while i*i <=N:
        i += 2
        if N%i: continue
        while N%i == 0:
            factorize[i] += 1
            N //= i
    if N!=1:factorize[N]=1
    return factorize

n_primes = prime_factorize(n)
ret = 0

for k,v in n_primes.items():
    cnt = 1
    while cnt <= v:
        ret+=1
        v -= cnt
        cnt+=1

print(ret)

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))
val = list(c.values())

# print(val)
ans = 0
for v in val:
    i = 1
    c = 1
    while v >= c:
        # print(v, c)
        ans += 1
        i += 1
        c += i
print(ans)