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 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
count = 0
N = int(input())
c = collections.Counter(prime_factorize(N))

for i in c:
    p = i
    while (N%i==0):
        N /= i
        i *= p
        count += 1
#         print(N,i)
    if (N == 1):
        break
        
print(count)

Submission status: Accepted

Solution code:
import itertools

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())
n_list = factorization(n)
cnt = 0
cnt_list = range(100)
cnt_list = list(itertools.accumulate(cnt_list))
for i in n_list:
    tmp = 0
    if i[0] != 1:
        for j in range(1, 100):
            if cnt_list[j] <= i[1]:
                tmp = j
            else:
                cnt += tmp
                break
print(cnt)

Submission status: Accepted

Solution code:
def factorize(n):
    ans = 0 
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            ans += int((-1 + (1+8*e)**(1/2))/2)
        b, e = b + 1, 0
    if n > 1:
        ans += 1
    return ans

N = int(input())
print(factorize(N))

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

l=factorization(n)

ans=0
now=n
if n==1:
  print(0)
else:
  for i,e in l:
    for j in range(1,e+1):
      if now%(i**j)==0:
        now=now//(i**j)
        ans+=1
  print(ans)

Submission status: Accepted

Solution code:
import sys

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([i, cnt])

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

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

    return arr

def func1(lst, value):
    return [i for i, x in enumerate(lst) if x <= value]

if N == 1:
	print(0)
else:
	
	ans_ = factorization(N)
	nums = []
	index_list = []
	
	ans = 0
	for i in range(1, 100):
		ans += i
		index_list.append(ans)
		
	for a in ans_:
		#nums.append(int(format(a[1], 'b')))
		nums.append(a[1])
		
		#print(nums)
			
	ans = 0
	for i in nums:
		index = func1(index_list, i)
		#print(max(index)+1)
		ans += max(index)+1
	
	print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import deque
import collections
import numpy as np

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

def hantei(n):
    i = 0
    if n == 1 or n==2:
        return 1
    while (i+1)*i/2<=n:
        i+=1
    return i-1

c = collections.Counter(prime_factorize(n))
ans = 0
#print(c)

for i in c.values():
    #print("val=",i)
    ans += hantei(i)
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())
numlist = factorization(n)
result = 0
for i in numlist:
    k = 0
    for j in range(n):
        if(k*(k+1)/2 > i[1]):
            k-=1
            break
        else:
            k+=1
    result+=k
if(n == 1 ):
    result = 0
print(result)

Submission status: Accepted

Solution code:
from collections import deque

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

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

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

    return arr

x=0
count=0
for i,j in fa(m):
    # print(i,j)
    for k in range(10**12):
        if j<k*(k+1)//2:
            x=k-1
            break
        elif j==k*(k+1)//2:
            x=k
            break
    count+=x


print(count)

Submission status: Accepted

Solution code:
import collections

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

countdict = {}
counter = 0

for i in range(1, 10):
    a = int(i*(i+1)/2)
    b = int((i+1)*(i+2)/2)
    for j in range(a, b):
        countdict[j] = i

N = int(input())
primelist = prime_decomposition(N)
primedic = collections.Counter(primelist)
result = 0

for i in primedic.values():
    result += countdict[i]
print(result)

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

    return arr

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

Submission status: Accepted

Solution code:
def main():
    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())
    A = factorization(N)
    count = 0
    if A[0][0] != 1:
        for a in A:
            for i in range(a[1]):
                if a[1] - (i+1) >= 0:
                    a[1] = a[1] - (i+1)
                    count += 1
                else:
                    break
            
    print(count)
    
if __name__ == '__main__':
    main()

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))
def getCount(w):
    i = 1
    n = 1
    while n <= w:
        i+=1
        n+=i
    return i - 1
cnt = 0
for v in c.values():
    cnt += getCount(v)
print(cnt)

Submission status: Accepted

Solution code:
#import itertools #import *

def factorization(input):
    arr = []
    temp = input
    for i in range(2, int(-(-input**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([input, 1])

    return arr

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

element = []

for i in lst:
    for j in range(i[1]):
        element.append(i[0]**(j+1))

element = set(element)
element = sorted(list(element))
#element = list(itertools.permutations(element))
#print(element)

cnt = 0
for k in element:
    if (n % k !=0):
        #print(cnt)
        #exit()
        continue
    n = n/k
    cnt += 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())
fact = factorization(n)

cnt = 0
for f in fact:
    fact_num = f[-1] # 何乗か
    tmp = 1  # 1ずつ増やす。
    while True:
        fact_num -= tmp
        #print("fact_num:%d, tmp:%d" % (fact_num,tmp))
        if fact_num >= 0:
            cnt += 1
        else:
            break
        tmp += 1

if n == 1:
    print(0)
else:
    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())
flag = 0
if N == 1:
    flag = -1
M = len(factorization(N))
num = [1,3,6,10,15,21,28,36]
ans = 0
for i in range(M):
    for j in range(len(num)):
        if num[j] <= factorization(N)[i][1]:
            ans += 1
        else:
            break

if flag == -1:
    print(0) 
else:
    print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
divs = []
for i in range(1, int(math.sqrt(n)) + 1):
    if n % i == 0:
        j = n // i
        if i != j:
            divs.append(j)
        divs.append(i)
divs.sort()

m = len(divs)
ans = 0
for i in range(1, m):
    z = divs[i]
    z2 = z
    prime = True
    for j in divs[1:i]:
        if z2 % j == 0:
            while z2 % j == 0:
                z2 //= j
            if z2 != 1:
                prime = False
    if prime:
        if n % z == 0:
            n //= z
            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
  
N = int(input())
ans = factorization(N)
count = 0
for i in ans:
  if i[0] == 1:
    break
  for j in range(2,40):
    if i[1] < j*(j+1)/2:
      count += j-1
      break
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

def check(S):
    if S ==1:
      return 1
    elif S == 2:
      return 1
    elif S == 3:
      return 2
    else:
      for i in range(S):
        if i <= S:
          S -= i
        else:
          return i-1

if N != 1:
  result = factorization(N) 

  a = 0
  for r in result:
    b = check(r[1])
    a += b
  print(a)

else:
  print(0)

Submission status: Accepted

Solution code:
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

def countNewZ(count, countZ):
  current = (countZ * (countZ + 1)) / 2
  if(current <= count):
    countZ += 1
    return countNewZ(count, countZ)
  else:
    return countZ - 1

n = int(input())
primeFactors = prime_factors(n)
unique = set(primeFactors)
z = 0
for prime in unique:
  count = primeFactors.count(prime)
  z += countNewZ(count, 0)
print(z)

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

def getCount(w):
    i = 1
    n = 1
    while n <= w:
        i+=1
        n+=i
    return i - 1

cnt = 0

for v in c.values():
    cnt += getCount(v)

print(cnt)

Submission status: Accepted

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

def count_n(x):
    n=1
    while True:
        m=(1+n)*n/2
        if m>x:
            n-=1
            break
        n+=1
    return n


c = collections.Counter(prime_factorize(N))
d = c.values()
co=0
for i in d:
    co+=count_n(i)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys,math
input = sys.stdin.readline
n = int(input())

a = []
tmp = n
for i in range(2, int(n**0.5//1)+1):
  if tmp%i==0:
    count = 0
    while tmp%i==0:
      count += 1
      tmp //=i
    a.append([i, count])
if tmp!=1:
  a.append([tmp,1])
if a==[]:
  if n==1:
    print(0)
    sys.exit()
  else:
    # a.append([n,1])
    print(1)
    sys.exit()
  
# print(a)

r = [k[1] for k in a]
ans = 0
for i in r:
  j = 1
  t = i
  while t>=j:
    ans += 1
    t -= j
    j += 1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np

def is_prime(a):
  if a == 1:
    return False
  
  for i in range(2, 1+int(a**0.5)):
    if a % i == 0:
      return False
  return True

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = int(input())

ans = 0
divisors = make_divisors(n)
for d in divisors[1:]:
  if d > n:
    break
  if is_prime(n):
    ans += 1
    break
    
  tmp_divisors = make_divisors(d)
  for p in tmp_divisors[1:]:
    if not is_prime(p):
      continue
    tmp = np.log(d)/np.log(p)
    if tmp > 0 and tmp == int(tmp) and n % d == 0:
      n = n/d
      ans += 1
      break

print(ans)

Submission status: Accepted

Solution code:
import math
def main():

    N = int(input())
    primes = []
    def isprime(n):
        if n == 1: return False
        for i in range(2, int(math.sqrt(n))+1):
            if n % i == 0:
                return False
        return True

    primes = set()
    for i in range(1, int(math.sqrt(N))+1):
        if N % i == 0:
            if isprime(i):
                primes.add(i)
            if isprime(N//i):
                primes.add(N//i)
    if isprime(N):
        primes.add(N)

    ans = 0
    for p in primes:
        q = p
        while N % q == 0:
            ans += 1
            N //= q
            q *= p
        if N == 1:
            break
    return ans


if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

def fact(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(cnt)
    if tmp!=1:
        a.append(1)
    if a==[]:
        a.append(1)
    return a

def solve(N: int):
    if N==1:
        print(0)
        sys.exit()

    a=fact(N)

    ans=0
    for i in a:
        nz=i
        k=1
        while True:
            if nz>=k:
                nz-=k
                k+=1
                ans+=1
            else:
                break

    print(ans)
    return


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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8


# def prime_set(limit=10**5):
#     """
#     2020/04/10
#     https://atcoder.jp/contests/abc084/tasks/abc084_d
#     """

#     ret = [2]
#     for x in range(3, limit+1, 2):
#         is_prime = True
#         sqrtx = int(pow(x, 0.5))

#         for p in ret:
#             if p > sqrtx:
#                 break

#             if x % p == 0:
#                 is_prime = False
#                 break

#         if is_prime:
#             ret.append(x)

#     return ret


def soinsubunkai(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:
        return 0
    # N = 148
    N_ = N

    # primes = prime_set(int(N**0.5)+1)
    # print(primes)

    # primes = prime_set(10**6)  # 1.3 sec
    # print(len(primes))  # 78498

    # soinsu = {}
    # for p in primes:
    #     print("="*10)
    #     print(p)
    #     if N == 1:
    #         break

    #     if N % p == 0:
    #         soinsu[p] = 1
    #         N = N // p
    #         while True:
    #             print(N)
    #             if N % p == 0:
    #                 soinsu[p] += 1
    #                 N = N // p
    #             else:
    #                 break

    soinsu_ = soinsubunkai(N)
    soinsu = {}
    for k, v in soinsu_:
        soinsu[k] = v
    
    # if len(soinsu.keys()) == 0 and N_ != 1:
    #     soinsu[N_] = 1
    # print(soinsu)

    counts = {}
    for cnt in soinsu.values():
        if cnt not in counts:
            counts[cnt] = 1
        else:
            counts[cnt] += 1
    # print(counts)

    ans = 0
    for k, v in counts.items():
        for n in range(int((2*k+0.25)**0.5) + 1, -1, -1):
            if n*(n+1) <= 2*k < (n+1)*(n+2):
                ans += n*v
                break
    
    return ans


print(main())

Submission status: Accepted

Solution code:

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
#print(pf)

cnt = 1
ans = 0
for i in pf.values():
    tmp = i
    while tmp >= cnt: 
        ans += 1
        tmp = tmp - cnt
        cnt += 1
    cnt = 1
print(ans)

Submission status: Accepted

Solution code:
inp = list(map(int, input().split()))


def factorize(n):
    arr = []
    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
            arr.append([i, cnt])

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

    if not arr and n != 1:
        arr.append((n, 1))

    return arr


re = 0

for _, c in factorize(inp[0]):
    tmp1 = c
    tmp2 = 1
    while tmp1 >= tmp2:
        re += 1
        tmp1 -= tmp2
        tmp2 += 1


print(re)

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) 
sum = 0
for i in a:
  m = i[1]
  s = 1
  while(m >= s):
    sum += 1
    m -= s
    s += 1
    
print(sum)

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

if __name__ == "__main__":
    N = int(input())
    c = collections.Counter(prime_factorize(N))
    l = list(c.values())
    counter = 0
    for f in l:
        num = 1
        while f >= num:
            f -= num
            num += 1
            counter += 1
    print(counter)

Submission status: Accepted

Solution code:
from sys import stdin
import math

a=int(stdin.readline())
PP=0
K=0

if a==1:
    print(0)
    K=1
L=list()


for b in range(2,int(math.floor(math.sqrt(a)))+1):
    count=0
    if a%b==0:
        while a%b==0:
            count+=1
            a=a/b
    if count>0:
       L.append(count)


if len(L)==0 and K==0:
    print(1)
    PP=1

if a!=1:
    L.append(1)

sum=0

for k in range(0,len(L)):
    p=L[k]
    sum+=int(math.floor((-1+math.sqrt(1+8*p))/2))


if PP==0 and K==0:
   print(sum)

Submission status: Accepted

Solution code:
def p(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a
n=int(input())
a=p(n)
d={}
for i in a:
  d[i]=d.get(i,0)+1
b=list(d.values())
ans=0
d=[0]*50
for i in range(1,50):
    d[i]=d[i-1]+i
for i in b:
    c=sum(j<=i for j in d)-1
    ans+=c    
print(ans)

Submission status: Accepted

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

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

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

    return arr
if n == 1:
    print(0)
elif len(prime_factorization(n)) == 1 and prime_factorization(n)[0][1] == 1:
    print(1)
else:
    ans = 0
    prime_list = prime_factorization(n)
    # print(prime_list)
    for i in prime_list:
        a = i[1]
        sub = 1
        j = 0
        while True:
            if a < sub:
                break
            a -= sub
            sub += 1
            j += 1
            
        #     print(a, sub, j)
        # print(j, i[1])
        ans += j
        
    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())
from collections import Counter

def check(v):
    an = 0
    i = 1
    subsum = 0
    while v - subsum >= i:
        subsum += i
        i += 1
        an += 1
    return an

# print(check(16))

def Main(N):
    p = prime_factorize(N)
    c = Counter(p)
    ans = 0
    for v in c.values():
        ans += check(v)
    return ans

print(Main(N))

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())
count = 0
j = 1

c = collections.Counter(prime_factorize(N))
factor_sets = list(c.items())

fac_num = len(factor_sets)

for i in range(fac_num):
    while True:
        if (j + 1) * (j + 2) / 2 <= factor_sets[i][1]:
            j += 1
        else:
            count += j
            j = 1
            break

print(count)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0

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

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

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

    return arr
if n == 1:
    print(0)
    exit()
li = factorization(n)
for i in li:
    ii = i[0]
    loop = True
    while(loop):
        if n % ii == 0:
            n = n / ii
            cnt += 1
            ii *= i[0]
        else:
            loop = False
print(cnt)

Submission status: Accepted

Solution code:
a=int(input())
ans =0


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
b = factorization(a)
for i in range(len(b)):
    count=0
    c = b[i][1]

    for j in range(1,40):
        if c - j >= 0:
            c -= j
            count += 1
        else:
            ans += count
            break
if a ==1:
    print(0)
else:
    print(ans)

Submission status: Accepted

Solution code:
from collections import deque

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

    if N == 1:
        print(0)
        return

    kasuus = [f[0] for f in fact]
    sisuus = [f[1] for f in fact]
    ks = deque(kasuus)
    ss = deque(sisuus)

    while ss:
        sisuu = ss.popleft()
        cnt = 1
        while True:
            sisuu -= cnt
            if sisuu < 0:
                break
            else:
                ans += 1
                cnt += 1

    print(ans)

    


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict


def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            lower_divisors.append(i)
            n=n//i
  #          if i != n // i:
  #              upper_divisors.append(n//i)
        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return lower_divisors + nokori # upper_divisors[::-1]

def main():
    n=int(input())
 #   n=2**40
    yaku=make_divisors(n)
    memo = defaultdict(int)
    for i in range(len(yaku)):
        memo[yaku[i]]+=1
    ans=0
    for b in memo.values():
        if b<=2:
            ans+=1
        elif b>=3 and b<=5:
            ans+=2
        elif b>=6 and b<=9:
            ans+=3
        elif b >= 10 and b <= 14:
            ans += 4
        elif b >= 15 and b <= 20:
            ans += 5
        elif b >= 21 and b <= 27:
            ans += 6
        elif b >= 28 and b <= 35:
            ans += 7
        elif b >= 36 and b <= 44:
            ans += 8
        elif b>=45:
            ans+=9


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


 #   print(memo)
 #   print(yaku)








if __name__ == "__main__":

    main()

Submission status: Accepted

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

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

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

    return arr

F = factorization(N)
import math
f = []
if F[0][0] != 1:
  for i in range(len(F)):
    f.append(int((math.sqrt(8*F[i][1]+1) - 1)/2))

print(sum(f))