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 sys
from io import StringIO
import unittest

def xxx(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 resolve():
    readline=sys.stdin.readline

    h=int(readline())
    if h==1:
        print(0)
        return
    arr=xxx(h)
    ans=0
    for a in arr:
        n=a[1]
        i=1
        cnt=0
        while n>0:
            n-=i
            i+=1
            cnt+=1
        if n<0:
            cnt-=1
        ans+=cnt
    print(ans)
    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

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

def solve():
    if N == 1:
        print(0)
        return 0
    
    ans = 0
    lst = factorization(N)
    for ps in lst:
        es = ps[1]

        tmp = 1
        while es >= tmp:
            es -= tmp
            ans += 1
            tmp += 1
    
    print(ans)
    return 0




solve()

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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 = I()
if n == 1:
    print(0)
    quit()
f = factorization(n)
ans = 0
for i, j in f:
    tmp = 1
    while j >= tmp:
        ans += 1
        j -= tmp
        tmp += 1
print(ans)

Submission status: Accepted

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

import array
import collections
import math
import sys


def sieve_of_eratosthenes(end, typecode="L"):
    assert end > 1
    is_prime = array.array("B", (True for i in range(end)))
    is_prime[0] = False
    is_prime[1] = False
    primes = array.array(typecode)
    for i in range(2, end):
        if is_prime[i]:
            primes.append(i)
            for j in range(2 * i, end, i):
                is_prime[j] = False
    return primes


def factorize_trial_division(n, typecode="L"):
    factors = array.array(typecode)
    if n < 2:
        return factors
    for p in sieve_of_eratosthenes(math.ceil(math.sqrt(n)) + 1):
        if p * p > n:
            break
        while n % p == 0:
            factors.append(p)
            n //= p
    if n > 1:
        factors.append(n)
    return factors


def solve(n):
    if n < 2:
        return 0
    pf = collections.Counter(factorize_trial_division(n))
    # print(pf, file=sys.stderr)
    res = 0
    trigs = [i * (i + 1) // 2 for i in range(20)]
    num_trigs = len(trigs)
    for _, v in pf.items():
        for i in range(num_trigs - 1):
            if trigs[i] <= v < trigs[i + 1]:
                res += i
                break
    return res


def main():
    n = int(input())
    res = solve(n)
    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 10 ** 9 + 7
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rf(): return float(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
def rf_(): return [float(_) for _ in rs().split()]
def divisors(n, sortedresult=True):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    if sortedresult:
        div.sort()
    return div
# endregion

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 = ri()
D = factorization(N)
L = []
tmp = 0
for i in range(1, 41):
    tmp += i
    L.append(tmp)
ans = 0
for d in D:
    if d[0] == 1:
        continue
    ans += bisect_right(L, d[1])
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

import math

N_tmp = N
cnt = {}
for p in range(2, int(math.sqrt(N)) + 1):
    i_p = 0
    while N_tmp % p == 0:
        i_p += 1
        N_tmp //= p
    #
    if i_p < 1: continue
    cnt[str(p)] = i_p
else:
    if N_tmp > 1: cnt[str(N_tmp)] = 1

ans = 0
for p in cnt.keys():
    for i in range(64):
        if (i + 1) * (i + 2) // 2 > cnt[p]: break
    #
    ans += i

print(ans)

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

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 do():
    ans=0
    n=INT()
    s=factorization(n)
    for a,b in s:
        temp=0
        for i in range(10):
            temp+=(i+1)
            #print(a,b,temp,ans)
            if temp<=b:
                ans+=1
            else:
                break
    if n==1:
        ans=0
    
    print(ans)

                
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
n = int(input())
res = 0
from bisect import bisect_right
aa = [j*(j+1)//2 for j in range(1,22)]
    
for i in range(2,10**6):
    if n%i==0:
        cnt = 0
        while n%i==0:
            n = n//i
            cnt += 1
#        print(i, cnt)
        res += bisect_right(aa, cnt)
    if n == 1:
        break
else:
    res += 1
print(res)

Submission status: Accepted

Solution code:
from bisect import bisect_right
import sys

n = int(input())

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

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

l = []
tmp = n
for i in range(2, int(n**0.5)+1):
    if tmp % i == 0:
        cnt = 0
        while tmp % i == 0:
            tmp //= i
            cnt += 1
        l.append([i, cnt])
if tmp != 1:
    l.append([tmp, 1])
if l == []:
    l.append([n, 1])

res = 0
for v, c in l:
    res += bisect_right(x, c)

print(res)

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

N=int(input())
if N == 1:
  print(0)
  exit()
ps = prime_factorize(N)

cnt = 0
for p in ps:
  c = ps[p]
  i = 1
  while c >= i:
    cnt += 1
    c -= i
    i += 1
print(cnt)

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:
  ans = 0
else:
  ans = 0
  a = factorization(n)
  for j in a:
    t = j[1]
    if t <= 2:
      ans += 1
    elif t <= 5:
      ans += 2
    elif t <= 9:
      ans += 3
    elif t <= 14:
      ans += 4
    elif t <= 20:
      ans += 5
    elif t <= 27:
      ans += 6
    elif t <= 35:
      ans += 7
    else:
      ans += 8
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
def prime(n):
    p = []
    flag = [True] * (n - 1)
    for i in range(n - 1):
        if flag[i] == True:
            p.append(i + 2)
            num = i
            while num <= n - 2:
                flag[num] = False
                num += i + 2
    return p
p =prime(int(n ** 0.5 + 1))
p2 = {}
for i in p:
    while True:
        if n % i == 0:
            p2.setdefault(i, 0)
            p2[i] += 1
            n //= i
        else:
            break
if n != 1:
    p2[n] = 1
if not p2:
    print(0)
else:
    ans = 0
    for i in p2.values():
        num = 1
        while i >= num:
            ans += 1
            i -= num
            num += 1
    print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())

def prime_factorization(n):
    table = []
    for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table


T = prime_factorization(N)
C = Counter(T)

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

print(ans)

Submission status: Accepted

Solution code:
import math
n=int(input())
tmp = int(math.sqrt(n)) + 1
ans=0
for num in range(2,tmp):
  count=0
  while n % num == 0:
    n //= num
    count+=1
  ans+=int(math.sqrt(2*count+0.25)-0.5)
if n!=1:
  ans+=1
print(ans)

Submission status: Accepted

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

import math
import collections
N = int(input())
tmp = prime_factorize(N)
C = collections.Counter(tmp)
S = set()
for k, v in C.items():
    for i in range(v):
        S.add(k**(i+1))
ans = 0
for s in sorted(S):
    if N%s == 0:
        N = N//s
        ans += 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
for p,c in factorization(N):
    if p==1:
        continue
    n=1

    while n*(n+1)<=2*c:
        n+=1
    n-=1
    ans+=n

print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
from collections import defaultdict

N = int(input())

f = defaultdict(int)
for p in [2] + list(range(3, int(sqrt(N)) + 1, 2)):
    while N % p == 0:
        N //= p
        f[p] += 1
    if N == 1:
        break
if N != 1:
    f[N] += 1

ans = 0
for e in f.values():
    ans += int((sqrt(1 + 8 * e) - 1) / 2)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

if N > 1:
  p_dic[N] = 1
  
def foo(x):
  r = 0
  base = 1
  while x >= base:
    x -= base
    r+=1
    base += 1
  return r

ans = 0
for v in p_dic.values():
#  print(v, foo(v))
  ans += foo(v)

print(ans)

Submission status: Accepted

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

arr = defaultdict(int)
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[i] = cnt

if temp!=1:
    arr[temp] = 1

if arr==[]:
    arr[n] = 1

ans = 0

for i in arr:
    c = 1
    while arr[i]-c>=0:
        arr[i] -= c
        c += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
I = lambda:list(map(int,input().split()))
n,=I()
k=int(n**0.5)
i=2;l=[]
while i<=k and n>1:
  c=0
  while n%i==0:
    n//=i;c+=1
  if c!=0:
    l.append(c)
  i+=1
if n!=1:
  l.append(1)
an=0
for i in l:
  d=int((2*i)**0.5)
  x=d if (d*d+d)//2<=i else d-1
  an+=x
print(an)

Submission status: Accepted

Solution code:
import collections

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

n=int(input())
c=collections.Counter(prime_factorize(n))
ans=0
for x in c:
    num=c[x]
    for i in range(1,num+2):
        if i*(i+1)/2>num:
            ans+=i-1
            break
print(ans)

Submission status: Accepted

Solution code:
import sys, math,os
from io import BytesIO, IOBase
#from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(Decimal, data().split()))
def outl(var) : sys.stdout.write(' '.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1e9)+7
from decimal import Decimal


def main():

    n=int(data())
    cnt=0
    i=2
    while i<(int(n**0.5)+1):
        if n%i==0:
            t=i
            while n%t==0:
                cnt+=1
                n//=t
                t*=i
            t//=i
            while t>1:
                if n%t==0:
                    n//=t
                else:
                    t//=i
        i+=1
    if n!=1:
        cnt+=1
    out(cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
def factorization(n):
    D = {}
    a = n
    p = 2
    while a != 1:
        cnt = 0
        while a % p == 0:
            cnt += 1
            a //= p
        if cnt != 0:
            D[p] = cnt
        p += 1
        if p * p > n and a != 1:
            D[a] = 1
            break
    return D
f = factorization(N)
X = [0 for _ in range(101)]
for i in range(101):
    X[i] = i*(i+1)//2
p = 0
for i in f:
    x = f[i]
    for j in range(100):
        if X[j] <= x < X[j+1]:
            p += j
            f[i] -= X[j]
            break
print(p)

Submission status: Accepted

Solution code:
import sys
import math
def input():
    return sys.stdin.readline()[:-1]

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

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

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

li = factorization(n)
if n==1:
    print(0)
else:
    cnt = 0
    for x in li:
        cnt += math.floor((math.sqrt(1+8*x)-1)/2)
    print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
if n==1:
    print(0)
    exit()
d=dict()
for i in range(2,int(n**0.5)+1):
    while n%i==0:
        n//=i
        if i in d:
            d[i]+=1
        else:
            d[i]=1
if n!=1:
    d[n]=1
#print(d)
p=0
for i in d.values():
    e=0
    j=1
    while True:
        e+=j
        p+=1
        #print(i,e,p)
        j+=1
        if e>i:
            p-=1
            break
print(p)

Submission status: Accepted

Solution code:
n = int(input())

prime = list()

i = 2
while i * i <= n:
  if n % i == 0:
    cnt = 0
    while n % i == 0:
      cnt += 1
      n //= i
    prime.append(cnt)
  i += 1
  
if n != 1:
  prime.append(1)
  
ans = 0
for x in prime:
  a = 1
  while a * (a+1) // 2 <= x:
    a += 1
  ans += a-1
  
print(ans)

Submission status: Accepted

Solution code:
from math import sqrt

N = int(input())

res = 0
for i in range(2, int(sqrt(N)) + 1):
    a = set()
    b = 1
    while True:
        if N % i == 0:
            N = N // i
            b *= i
            if b not in a:
                a.add(b)
                res += 1
                b = 1
        else:
            break

if N != 1:
    res += 1

print(res)

Submission status: Accepted

Solution code:
from sys import stdin
from sys import setrecursionlimit
import math
from collections import Counter
setrecursionlimit(10 ** 7)

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

li = Counter(prime_factorize(n))
count = li.items()

now = 0
lis = []
for i in range(1000):
    lis.append(now+i)
    now += i

lis = lis[1:]

import bisect
point = 0
for i in count:
    a,b = i
    point += bisect.bisect_right(lis,b)

print(point)

Submission status: Accepted

Solution code:
# coding: utf-8

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

P=factorization(N)
ans=0
for i in range(len(P)):
    k=P[i][1]
    c=1
    while k>0:
        ans+=1
        k-=c
        c+=1
        if k<0:
            ans-=1

if N==1:
    print(0)
else:
    print(ans)

Submission status: Accepted

Solution code:
import numpy as np
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


soi = factorization(n)

ans = 0

for fac in soi:
    if fac[0] == 1:
        break
    num = 1
    rem = fac[1]
    while 1:
        if rem >= num:
            ans += 1
            rem -= num
            num += 1
        else:
            break

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

U = 10 ** 7 + 10
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

M = 10 ** 6
small_primes = np.where(is_prime[:M])[0].tolist()

N = ir()
answer = 0
used = set([1])
for p in small_primes:
    d = p
    while N%d == 0:
        answer += 1
        N //= d
        used.add(d)
        d *= p
    while N%p == 0:
        N //= p

if N > 1 and N not in used:
    answer += 1

print(answer)

Submission status: Accepted

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

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

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

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

    return arr

def solve(N: int):
    # print(factorization(N))
    factors = factorization(N)
    r = 0
    for p,e in factors:
        if p == 1: continue
        # print(p,e)
        c = 1
        while c <= e:
            r += 1
            e -= c
            c += 1
    print(r)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
if n==1:
  print(0)
  exit()
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
su = 0
#print(fac(n))
for j,k in fac(n):
  n = int(0.5*(-1+(1+8*k)**0.5))
  su += n
 # print(k,n)
print(su)

Submission status: Accepted

Solution code:
def prime(n,p):
    iteral = 0
    while n%p == 0:
        n //= p
        iteral += 1
    return iteral,n
def ok(n,target):
    if n*(n+1)//2<=target<(n+1)*(n+2)//2:return True
    else:
        return False
N = int(input())
from collections import defaultdict
d = defaultdict(int)
for i in range(2,int(N**0.5)):
    if N%i==0:
        t,N = prime(N,i)
        d[i] = t
if N != 1:
    d[N] = 1
ans = 0
for n in d:
    k = 1
    while not ok(k,d[n]):
        k += 1
    ans += k

print(ans)

Submission status: Accepted

Solution code:
# 素因数分解 O(√N)
def prime_decomposition(n):
    i = 2
    prime2exponent = {}  # key:prime --> value:its exponent
    while i*i <= n:
        while n % i == 0:
            n //= i
            if i in prime2exponent:
                prime2exponent[i] += 1
            else:
                prime2exponent[i] = 1
        i += 1
    if n > 1:
        if n in prime2exponent:
            prime2exponent[n] += 1
        else:
            prime2exponent[n] = 1
    return prime2exponent

N = int(input())
p2e = prime_decomposition(N)


def calc_elem(n):
    res = 1
    while res * (res + 1) // 2 <= n:
        if (res+1)*(res+2)//2 > n:
            break
        else:
            res += 1
    return res

ans = 0
for v in p2e.values():
    ans += calc_elem(v)
print(ans)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

#素因数分解
def prime_factorize(n):
    a = []
    a.append(1)
    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)
    
    b = [[],[]]
    cnt = 1
    for i in range(len(a)+1):
        if i > 0 and i < len(a):
            if a[i] == a[i-1]:
                cnt += 1
            else:
                b[0].append(a[i-1])
                b[1].append(cnt)
                cnt = 1
        if i == len(a) and i > 0:
            b[0].append(a[i-1])
            b[1].append(cnt)
        elif i == len(a) and i == 0:
            b[0].append(a[i])
            b[1].append(cnt)
    return b

n = INT()
a = prime_factorize(n)
ans = 0
for i in range(1, len(a[0])):
    #print(a[i][1], int(sqrt(1 + 8 * a[1][i]) - 1) // 2)
    ans += int(sqrt(1 + 8 * a[1][i]) - 1) // 2
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

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

def support(n):
    counter = 0
    temp = 1
    while n - temp >= 0:
        n -= temp
        temp += 1
        counter += 1
    return counter

def main():
    n = int(input())
    factors_counter = Counter(prime_factorize(n))
    answer = 0
    for factor in factors_counter.keys():
        factor_count =factors_counter[factor]
        answer += support(factor_count)
    print(answer)





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
    
ans = 0

n = int(input())

x = factorization(n)

for i in x:
    cnt = 0
    k = 1
    while i[1]>=k:
        cnt += 1
        k += (cnt+1)
    ans += cnt
    
if n == 1:
    ans = 0
    
print(ans)

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()

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

from collections import Counter
import bisect

c = Counter(res)

tt = [i for i in range(1,60)]
for j in range(1,len(tt)):
    tt[j] += tt[j-1]

ans = 0
for v in c.values():
    ans += bisect.bisect_right(tt,v)

print(ans)

Submission status: Accepted

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

    if N == 1:
        print(0)
        return

    M = N

    ps = []

    d = 2
    cnt = 0
    while N % d == 0:
        N //= d
        cnt += 1
    if cnt:
        ps.append(cnt)
        # ps.append((d, cnt))

    d = 3
    while d * d <= M:
        cnt = 0
        while N % d == 0:
            N //= d
            cnt += 1
        if cnt:
            ps.append(cnt)
            # ps.append((d, cnt))
        d += 2

    if N > 1:
        ps.append(1)
        # ps.append((N, 1))

    ans = 0
    for x in ps:
        t = 1
        while x >= t:
            x -= t
            t += 1
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

Submission status: Accepted

Solution code:
from collections import defaultdict

n = int(input())
dd = defaultdict(int)
for i in range(2, int(n ** (1 / 2) + 2)):
    while n % i == 0:
        dd[i] += 1
        n //= i
if n != 1:
    dd[n] += 1
ans = 0
cnt = {}
for i in range(20):
    tmp = i * (i + 1) // 2
    cnt[tmp] = i
for i, j in dd.items():
    for num in cnt:
        if j >= num:
            continue
        ans += cnt[num] - 1
        break
print(ans)

Submission status: Accepted

Solution code:
from math import sqrt

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

f = factorization(n)
ans = 0
for p in f:
    ans += (-1 + int(sqrt(1 + 8 * p[1]))) // 2
print(ans)