Problem:


Score : 400 points

Problem Statement

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

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

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

z divides N;

z is different from all integers chosen in previous operations.

Then, replace N with N/z.

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

Constraints

All values in input are integers.

1 \leq N \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

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

Sample Input 1

24

Sample Output 1

3

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

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

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

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

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

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

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

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

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

Sample Input 4

1000000007

Sample Output 4

1

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

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

Sample Input 5

997764507000

Sample Output 5

7



Sample input:
24


Sample output:
3

Submission status: Accepted

Solution code:
n=int(input())
def prime_factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f**2<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return(a)
import collections
A=collections.Counter(prime_factorize(n))
ans=0
import math
for v in A.values():
    x=math.floor(v**0.5)
    while x*(x+1)<=v*2:
        x+=1
    ans+=x-1
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
import math
dt = defaultdict(int)
def primeFactors(n): 
      
    while n % 2 == 0: 
        dt[2]+=1 
        n = n // 2
    for i in range(3,int(math.sqrt(n))+1,2): 
          
        while n % i== 0: 
            dt[i]+=1 
            n = n //i 
              
    if n > 2: 
        dt[n]+=1
def how(n):
    i=1 
    while (i*(i+1))//2 <= n:
        i+=1 
    i-=1
    return i
        
n = int(input())
primeFactors(n)
ans = 0 
#print(dt)
for key in dt.keys():
    ans+= how(dt[key])
    #print(how(dt[key]))
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

divs = factorization(N)

n = len(divs)
ans = 0

for i in range(n):
    div,num = divs[i]
    cnt = 0
    now = 1
    while 1:
        if num >= now:
            num -= now
            now += 1
            cnt += 1
        else:
            break
    ans += cnt
if N == 1:
    print(0)
    exit()
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()
pfs = factorization(n)

cs = 0
for p, f in pfs:
    c = 0
    for i in range(10**12):
        f -= i
        if f < 0:
            c = i-1
            break
    # print(p,c)
    cs += c
print(cs)

Submission status: Accepted

Solution code:
#[(素因数, 指数)]の2次元リスト(1を含まない)

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

N = int(input())
if N == 1:
    print(0)
else:
    L = factorize(N)
    count = 0
    for a in L:
        i = 1
        while True:
            a[1] = a[1] - i
            if a[1] < 0:
                break
            else:
                count += 1
                i += 1
    print(count)

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

count = 0
trial = factorization(n)
for i in range(len(trial)):
    p = 1
    while trial[i][1] > 0:
        trial[i][1] -= p
        p += 1
        if trial[i][1] >= 0:
            count += 1

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

Submission status: Accepted

Solution code:
def prime_factorize(n):
    a = []
    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
            a.append([i, cnt])
    if tmp != 1:
        a.append([tmp, 1])
    if not len(a) and n != 1:
        a.append([n, 1])
    return a


N = int(input())

ans = prime_factorize(N)
count = 0
for ls in ans:
    target = ls[1]
    tmp = 1
    while True:
        if target - tmp >= 0:
            target = target - tmp
            tmp += 1
            count += 1
        else:
            break
print(count)

Submission status: Accepted

Solution code:
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 renzoku(n):
    i = 0
    while n - (i+1) >= 0:
        n = n-(i+1)
        i += 1
    return i
      
N = int(input())
if N == 1:
  print("0")
  sys.exit()
oriN = N*1
A = factorization(N)
#print(A)
M = len(A)

ans = 0
for i in range(M):
  temp = A[i][1]
  f = renzoku(temp)
  ans += f
print(ans)

Submission status: Accepted

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

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


prime = prime_factor(n)
#print(prime)
c = Counter(prime)
count = 0
already = []
for p in prime:
    if p not in already:
        already.append(p)
        x = c[p]
        i = 1
        while x >= i:
            x -= i
            i += 1
            count += 1

print(count)

Submission status: Accepted

Solution code:
from collections import Counter as ct

N = int(input())
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)

res = ct(res)
cnt = 0
for i in res.values():
    tmp = 1
    for j in range(1, i + 1):
        i -= j
        if i >= 0:
            cnt += 1
        else:
            break
print(cnt)

Submission status: Accepted

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

import collections
c = collections.Counter(prime_factorize(N))
sosu = list(c.values())
answer = 0
for i in range(len(sosu)):
    if sosu[i]==1:
        answer += 1
    else:
        answer += int(-1/2+((1+8*(sosu[i]))**(1/2))/2)
print(answer)

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())
bunkai = factorization(n)
ans = 0
for i in bunkai:
    a = i[1]
    b = 1
    cnt = 0
    while a > 0:
        a -= b
        b += 1
        if a >= 0:
            cnt += 1
        else:
            pass
    ans += cnt
if n == 1:
    print(0)
else:
    print(ans)

Submission status: Accepted

Solution code:
def main():
    A = int(input())
    T = prime_decomposition(A)
    TV = list(set(T))
    cnt = 0
    #if(A==1):
    #    print(0)
    #    return

    for d in TV:
        D = T.count(d)
        cc = 0
        while True:
            cc +=1
            if D >=cc:
                D-=cc
                cnt +=1
            else:
                break

    print(cnt)




def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

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

    return arr

N = int(input())

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

fact = factorization(N)

ans = 0

for _,i in fact:
    cnt = 0
    j = 0
    while(True):
        if(cnt + j + 1 > i ):
            ans += j
            break
        j += 1
        cnt += j 
        
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict as dd
from math import sqrt
d=dd(int)
def pr(n): 
    while n % 2 == 0:
        d[2]+=1
        n = n / 2
    for i in range(3,int(sqrt(n))+1,2): 
        while n % i== 0: 
            d[i]+=1
            n = n / i 
    if n > 2: 
        d[n]+=1

n=int(input())
pr(n)
ans=0
for i in d:
    ans+=(sqrt(1+8*d[i])-1)//2
print(int(ans))

Submission status: Accepted

Solution code:
N=int(input())
l=[1,3,6,10,15,21,28,36,45]
a=0
for i in range(2,1000001):
    t=0
    while N%i==0:
        t+=1
        N//=i
    if t:
        for i in range(9):
            if t<l[i]:
                a+=i
                break
if N>1000000:
    a+=1
print(a)

Submission status: Accepted

Solution code:
def div(c,n):
    d={}
    while(n%2==0):
        n=n//2
        if(2 in d):
            d[2]+=1
        else:
            d[2]=1
    for i in range(3,int(n**0.5)+1):
        while(n%i==0):
            n=n//i
            if(i in d):
                d[i]+=1
            else:
                d[i]=1
    if(n>1):
      d[n]=1
      if(n==c):
          return 1
    su=0
    for i in d:
        f=d[i]*2
        su+=(-1+(int((1+4*f)**0.5)))//(2)
    return su
            
n=int(input())
c=n
print(div(c,n))

Submission status: Accepted

Solution code:
#素因数分解(1に対しては空のリストを返す)
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import collections

n=int(input())

x=prime_factorize(n)
x=collections.Counter(x)
x=x.most_common()
ans=0

for i in range(len(x)):
    v=0
    for j in range(1,31):
        v+=j
        if x[i][1]>=v:
            ans+=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])

    return arr

fact = factorization(N)
s = 0
for p, e in fact:
    s += int(pow(e * 2 + 0.25, 0.5) - 0.5)
print(s)

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

def prime_factorize(N):
    res = []
    for i in range(2, int(math.sqrt(N)) + 1):
        if N % i != 0:
            continue

        num = 0
        while N % i == 0:
            N /= i
            num += 1
        
        res.append([i, num])

    if N != 1:
        res.append([N, 1])

    return res


N = I()
P = prime_factorize(N)

ans = 0
for p in P:
    p = p[1]
    tmp = 0

    for i in range(1, 10**12):
        if p >= i:
            p -= i
            tmp += 1
        else:
            break
    
    ans += tmp

print(ans)

Submission status: Accepted

Solution code:
def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))


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

u = factorization(n)
ans = 0
if n == 1:
    print(0)
    exit()
for i in range(len(u)):
    tar = u[i][1]
    c = 0
    t = 0
    while True:
        if c+t+1 > tar:
            break
        t += 1
        c += t
    ans += t
print(ans)

Submission status: Accepted

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

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

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

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

    return arr

ans = 0

for p,e in factorization(n):
    tmp = 1
    for i in range(2,60):
        tmp += i
        if e < tmp:
            ans += i-1
            break

print(ans)

Submission status: Accepted

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

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

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

    return arr
A = int(input())

if A == 1:
    print(0)
else:
    ls = factorization(int(A)) 
    ans = 0
    for n in range(len(ls)):
        ans += int((ls[n][1]*2 +1/4)**(1/2)-(1/2))
    print(ans)

Submission status: Accepted

Solution code:
n = int(input().strip())

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

prefix=[1]*40
for i in range(1,40):
    prefix[i]=prefix[i-1]+i+1

ans=0
prime_table=prime_decomposition(n)
i=0
while i <len(prime_table):
    length=1
    while i<len(prime_table)-1 and prime_table[i+1]==prime_table[i]:
        length+=1
        i+=1
    i+=1
    for j in range(40):
        if prefix[j]>length:
            break
    ans+=j
print(ans)

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors


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


n=int(input())
prime=make_divisors(n)
prime=[i for i in prime if len(set(prime_factorize(i)))==1]
A=set()
for i in prime:
    if i==1:continue
    num,e=i,1
    while num<=n:
        A.add(num)
        e +=1
        num=i**e
cnt=0
for i in sorted(A):
    if n%i==0:
        cnt +=1
        n //=i
print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
munou=[]
count=0
sumi=set()
if N==1:
    print(0)
    exit()
def factorization(n):
    def sieve(n):
        is_prime = [True for _ in range(n+1)]
        is_prime[0] = False

        for i in range(2, n+1):
            if is_prime[i-1]:
                j = 2 * i
                while j <= n:
                    is_prime[j-1] = False
                    j += i
        table = [ i for i in range(1, n+1) if is_prime[i-1]]
        return table
    arr = []
    temp = n
    for i in sieve(int(n**0.5)):
        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
kari=factorization(N)
for i in range(len(kari)):
    for j in range(1,kari[i][1]+1):
        z=kari[i][0]**j
        if N%z==0 and z not in sumi:
            sumi.add(z)
            N=N/z
            count+=1
print(count)
#print(kari)

Submission status: Accepted

Solution code:
import sys

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

#eが何個のzに分けられるかを返す
def aiueo(e):
    i = 1
    Sum = 3
    while Sum <= e:
        i += 1
        Sum += i+1

    return i

hoge1 = prime_factorize(N)
hoge2 = list(set(hoge1))

num = 0
for i in range(len(hoge2)):
    a = hoge1.count(hoge2[i])
    num += aiueo(a)
    #print(hoge2[i],a,aiueo(a))

print(num)

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 solve(N):
    fact = factorization(N)
    ans = 0

    if N == 1:
        print(0)
        return

    for f in fact:
        s, c = f
        i = 1
        while True:
            if c >= i:
                c -= i
                ans += 1
            else:
                break
            i += 1
    print(ans)


if __name__ == '__main__':
    N = int(input())
    solve(N)

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

fact = factorization(N)
ans = 0
for _, y in fact:
    for i in range(y):
        y -= i+1
        ans += 1
        if y < i+2:
            break

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
N = int(input())
import collections
import math
lst = prime_factorize(N)
c = collections.Counter(lst)
count = 0
for _, n in c.items():
    x = (-1+math.sqrt(1+8*n))//2
    count += x
print(int(count))

Submission status: Accepted

Solution code:
import math
n = int(input())
lis = []
for i in range(2,math.ceil(math.sqrt(n))+1):
    cnt = 0
    while n % i == 0:
        n //= i
        cnt += 1
    if cnt:lis.append(cnt)
if n != 1:
    lis.append(1)
ans = 0

if lis == []:
    if n == 1:
        print(0)
        exit()
    else:
        print(1)
        exit()
for num in lis:
    go = 1
    while num >= go:
        ans += 1
        num -= go
        go += 1
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import Counter
import math

def make_prime_list(N):
    prime_list = [2]
    for i in range(3,int(N**0.5)+1,2):
        flag = True
        for j in range(3,int(i**0.5)+1):
            if i % j == 0:
                flag = False
                break
        if flag:
            prime_list.append(i)
    return prime_list

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 main():
    N = int(input())
    C = Counter(prime_factorize(N))
    # print(C)
    ans = 0
    for c in C.values():
        tmp = c
        i = 1
        while tmp >= i:
            tmp -= i
            ans += 1
            i += 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit
from bisect import bisect_right


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[i] = cnt

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

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

    return arr


def main():
    input = stdin.buffer.readline
    n = int(input())

    a1 = [0]
    for i in range(10 ** 4):
        a1.append(a1[i] + i + 1)

    ans = 0
    a2 = factorization(n)
    for k in a2:
        ans += bisect_right(a1, a2[k]) - 1

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    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

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

a = factorization(n)
#print(a)

ans = 0
for i in range(len(a)):
    check = 1
    while a[i][1] >= check:
        a[i][1] = a[i][1] - check
        ans = ans + 1
        check = check + 1

print(ans)

Submission status: Accepted

Solution code:
import sys
import collections

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
#read = sys.stdin.buffer.read

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 main():
    N = int(input())
    pf = prime_factorize(N)
    if len(pf) == 0:
        print(0)
        return
    pfitems = list(zip(*collections.Counter(pf).items()))
    cnt = 0
    for i in pfitems[1]:
        tmp = i
        for j in range(1, i+1):
            tmp -= j
            if tmp < 0:
                break
            cnt += 1

    print(cnt)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from math import sqrt
n = int(input())
ans = 0
for i in range(2, 1 + int(sqrt(n))):
    c = 0
    while n % i == 0:
        n //= i
        c += 1
    ans += int((-1 + sqrt(1 + 8 * c)) / 2)
if n != 1:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
n = int(input())
d = defaultdict(int)
for i in range(2, int(n**0.5)+1):
    while(n%i == 0):
        n//=i
        d[i]+=1
if n > 1:
    d[n]+=1
ans = 0
for i in d.values():
    val = 1
    while i >= val:
        i-=val
        ans+=1
        val+=1
print(ans)

Submission status: Accepted

Solution code:
def LI():return list(map(int,input().split()))
def yes():return print("Yes")
def no():return print("No")
from collections import deque, defaultdict, Counter
# from heapq import heappop, heappush
# import math
# from decimal import Decimal

# def divisors(x):
#     ret=[]
#     for i in range(1,int(x**.5)+1):
#         if x%i==0:
#             ret.append(i)
#             if x//i==i:continue
#             ret.append(x//i)
#     return sorted(ret)

# print(divisors(64),2**6)            

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

n=int(input())
pf=prime_factor(n)
pf=Counter(pf)
# print(pf)

def cng(x):
    le=2*x
    ret=-1
    mi=int(le**0.5)
    for i in range(mi-1,mi+10000):
        # print((i+1)*(i+2),le,i*(i+1))
        if (i+1)*(i+2)>le>=i*(i+1):
            ret=i
            # print((i+1)*(i+2),le,i*(i+1))
            break
        
    return ret

mp=[]   
for i in range(2*10**5):
    mp.append(cng(i))
# print(-1 in mp)

ans=0
for i in pf.values():
    ans+=mp[i]
    
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict

def fctr1(n): 
    d = defaultdict(int)
    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:
            d[i] = c
            c=0
    if n!=1:
        d[n] = 1
    return d

def main():
    N = int(input())
    primes = fctr1(N)
    d = defaultdict(int)
    ans = 0
    for i, j in primes.items():
        cnt = 1
        while True:
            if j - cnt < 0:
                d[i] = j
                break
            ans += 1
            j -= cnt
            cnt += 1

    print(ans)





if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

import math
# isprime, prime_division

def isprime(x):
    q = int(math.sqrt(x))  # int() rounds to zero
    for i in range(2,q+1):   # upto q
        if x%i == 0:
            return False
    return True

def prime_division(x):
    q = int(math.sqrt(x))
    a = []
    for i in range(2,q+1):
        ex = 0
        while x%i == 0:
            ex += 1
            x //= i
        if ex>0:
            a.append([i,ex])
    if x>q:
        a.append([x,1])
    return a

def prime_division2(x):
    q = int(math.sqrt(x))
    h = {}
    for i in range(2,q+1):
        ex = 0
        while x%i == 0:
            ex += 1
            x //= i
        if ex>0:
            h[i] = ex
    if x>q:
        h[x] = 1
    return h

def divisorlist(z): # z : output of prime_division
    if len(z)==1:
        return [z[0][0]**i for i in range(z[0][1]+1)]
    y = divisorlist(z[1:])
    s = []
    for i in range(z[0][1]+1):
        for j in y:
            s.append((z[0][0]**i)*j)
    return s

n = inn()
sm = 0
pes = prime_division(n)
for p,e in pes:
    for i in range(1,50):
        if e<2*i+1:
            break
        sm += 1
        e -= i
    sm += 1
print(sm)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# map(int, input().split())
import math

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

factors = factorization(N)

result = 0
for fact in factors:
    result += int((-1+math.sqrt(8*fact[1]+1))/2)

print(result)

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
l=[0]
ii=0
for i in range(1,11):
    ii+=i
    l.append(ii)

n=int(input())
import collections
c=collections.Counter(prime_factorize(n))
count=0
for i in c.values():
    for j in range(10):
        if i>=l[j] and i<l[j+1]:
            count+=j
print(count)

Submission status: Accepted

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

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

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

    return arr

def count_sums(n):
    c = 1    
    while True:
        if n - c < 0:
            break
        n -= c
        c += 1
    return c - 1

N = int(input())
if N == 1:
    print(0)
else:
    # p_N : 素因数分解の結果
    p_N = factorization(N)
    if p_N == [N, 1]:
        print(1)
    else:
        count = 0
        for arr in p_N:
            count += count_sums(arr[1])
        print(count)

Submission status: Accepted

Solution code:
import math
input = raw_input

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([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    return f

def find_max(x):
    n0 = int(math.sqrt(2*x))

    if 2 * x < n0 * (n0+1):
        while True:
            n1 = n0 - 1
            if 2 * x >= n1 * (n1+1):
                return n1
            n0 = n1 
    else:
        while True:
            n1 = n0 + 1
            if 2 * x < n1 * (n1+1):
                return n0
            n0 = n1 

    #n0 = (-1 + math.sqrt(1+9*x)) // 2
    #n0 = int(n0)
    #return n0

n = int(input())

pairs = fctr1(n)

out = 0
for p, num in pairs:
    x0 = find_max(num)
    out += x0
print(out)