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:
from collections import Counter

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


c1 = Counter(prime_factorize(N))
count = 0

for key in c1.keys():
    v = c1[key]
    for i in range(1, v + 1):
        if c1[key] < i:
            break
        c1[key] -= i
        count += 1

print(count)

Submission status: Accepted

Solution code:
from collections import defaultdict

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


def main():
    n = int(input())
    pfactor = prime_factorize(n)
    d = defaultdict(int)
    for p in pfactor:
        d[p] += 1
    hoge = []
    a = 0
    for i in range(100):
        tmp = 1 + i
        a += tmp
        hoge.append(a)
    cnt = 1
    score = []
    for i, j in zip(hoge[:-1], hoge[1:]):
        for _ in range(j - i):
            score.append(cnt)
        cnt += 1
    res = 0
    for v in d.values():
        res += score[v-1]
    print(res)

     

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

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

result = 0
factList = factorization(n)
for fact in factList:
  count = math.floor(math.sqrt(2 * fact[1] + 0.25) - 0.5)
  result += count
print(result)

Submission status: Accepted

Solution code:
from collections import defaultdict


def prime_factorization(n):
    divs = defaultdict(int)

    while n % 2 == 0:
        divs[2] += 1
        n //= 2

    i = 3
    while i <= int(n ** .5) + 1:
        while n % i == 0:
            divs[i] += 1
            n //= i
        i += 2
    if n != 1:
        divs[n] += 1

    return divs

import bisect
N = int(input())
divs = prime_factorization(N)

MAX_VAL = 13
table = [n * (n + 1) // 2 for n in range(1, MAX_VAL)]
ans = 0
for key, value in divs.items():
    idx = bisect.bisect_left(table, value)
    ans += idx + 1 if table[idx] == value else idx

print(ans)

Submission status: Accepted

Solution code:
import sys
def factorization(n):
    arr = []
    temp = n
    ele = 1
    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 __name__ == "__main__":
    n = int(input())
    if n == 1:
        print(0)
        sys.exit(0)
    ar = factorization(n)
    ans = 0
    for ele in ar:
        cnt = ele[1]
        num = 1
        while True:
            if cnt - num < 0:
                break
            else:
                cnt -= num
                num += 1
        ans += num - 1
    print(ans)

Submission status: Accepted

Solution code:
import math

n=int(input())

kotae=[]
temp=n

for i in range(2,int(math.sqrt(n)//1)+1):
  if temp%i==0:
    count=0
    while temp%i==0:
      temp=temp/i
      count+=1
    kotae.append([i,count])
if temp!=1:
  kotae.append([n,1])

answer=0
for i in range(len(kotae)):
  kaisuu=0
  taisyo=kotae[i][1]
  while taisyo>=0:
    kaisuu+=1
    taisyo-=kaisuu
  answer+=kaisuu-1

print(answer)

Submission status: Accepted

Solution code:

import math
N = int(input())
n = N
ans = 0


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


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


d = set()

for x, a in factorization(N):
    tmp = 1
    if x == 1:
        continue
    for i in range(a):
        tmp *= x
        d.add(tmp)

d = list(d)
d.sort()
for i in d:
    if N % i == 0:
        N = N // i
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
k=n
dic={}
import math
for i in range(2,math.floor(math.sqrt(n))):
  for j in range(10**10):
    if n%i==0:
      if i in dic:
        dic[i]+=1
      else:
        dic[i]=1
      n=n//i
    else:
      break

count=0
if k!=1:
  if not dic or n!=1:
    count+=1

while dic:
  keep=1
  x=dic.popitem()
  num=x[1]
  for i in range(1000):
    if num>=keep:
      num-=keep
      count+=1
      keep+=1
    else:
      break
print(count)

Submission status: Accepted

Solution code:
import sys, collections
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N = I()

    def sieve(n):
        is_prime = [True for _ in range(n+1)]
        is_prime[0] = False
        is_prime[1] = False
        for i in range(2, int(n**0.5)+1):
            if is_prime[i]:
                for j in range(i*2, n+1, i):
                    is_prime[j] = False
        return [i for i in range(n+1) if is_prime[i]]

    primes = sieve(int(N**0.5))

    ans = []
    temp = N
    for i in primes:
        j = i
        while j<int(N**0.5)+1:
            if temp%j == 0:
                ans.append(j)
                temp //= j
            j *= i
    if temp > int(N**0.5):
        ans.append(temp)

    # print(ans)
    print(len(ans))

if __name__ == '__main__':
    resolve()

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

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

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

    return arr
n = int(input())
if n == 1:
  print(0)
else:
  arr = factorization(n)
  arr_len = len(arr)
  count = 0
  for i in range(arr_len):
    arr_i = arr[i]
    if arr_i < 3:
      count += 1
    elif arr_i < 6:
      count += 2
    elif arr_i < 10:
      count += 3
    elif arr_i < 15:
      count += 4
    elif arr_i < 21:
      count += 5
    elif arr_i < 28:
      count += 6
    elif arr_i < 36:
      count += 7
    else:
      count += 8
  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


N = int(sys.stdin.readline().strip())

decomposed = factorization(N)
# print(decomposed)

if decomposed == [[1, 1]]:
	print(0)
	sys.exit()

ans = 0
for factor, count in decomposed:
	for i in range(10000):
		if count < i*(i+1) // 2:
			ans += i-1
			break

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

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

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

    return arr

yakusu = factorization(n)

ans = 0

for i in range(len(yakusu)):
    l = yakusu[i]
    a,b = l[0],l[1]
    j = 1
    k = 2
    if a != 1:
        while b>=j:
            ans += 1
            j += k
            k += 1
if n==1:
    print(0)
else:
    print(max(ans,1))

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(cnt)
    if temp != 1:
        arr.append(1)

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

N = int(input())
fact = factorization(N)
ans = 0

for i in fact:
    if i == -1: break
    tmp = i
    for j in range(1, i+1):
        if tmp >= j:
            tmp -= j
            ans += 1
print(ans)

Submission status: Accepted

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

    l = factorization(n)



    if all(l[i][1] == 1 for i in range(len(l))):
        ans = len(l)
    else:
        ans = 0
        for i in range(len(l)):
            if l[i][1] == 1:
                ans += 1
            else:
                ans += int(( -1 + math.sqrt(1 + 8 * l[i][1]) ) / 2)
    print(ans)

Submission status: Accepted

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

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

f = prime_factors(N)
f_dict = defaultdict(int)
for i in f:
    f_dict[i] += 1

def triangle_map(m):
    # return math.ceil((-1+math.sqrt(1+8*m))/2)
    i = 1
    while i*(i+1) <= 2*m:
        i += 1
    return i-1

ans = 0
for i in f_dict:
    ans += triangle_map(f_dict[i])

print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

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

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

    return arr


#何通りあるか
def tori(A):
    cn=A
    k=1
    while cn>0:
        k+=1
        cn-=k
    return k-1

bunkai=factorization(N)

result=0
if N==1:
    print(0)
else:
    for j in range(len(bunkai)):
        result+=tori(bunkai[j][1])
    print(result)

Submission status: Accepted

Solution code:
n = int(input())

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

count = 0

if n == 1:
  print(0)
else:
  for i in range(len(arr)):
    temp = 1
    temp2 = arr[i][1]
    while temp2 > 0:
      count += 1
      temp += 1
      temp2 -= temp
  print(count)

Submission status: Accepted

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

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


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


T = prime_factorize(N)


q = defaultdict(int)
p = set(T)

for t in T:
    q[t] += 1

ans = 0

for pp in list(p):
    count = 0
    tmp = 0
    while True:
        tmp += 1
        count += tmp + 1
        if count >= q[pp]:
            break
    ans += tmp

print(ans)

Submission status: Accepted

Solution code:
def fa(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=fa(n)
ans=0
for i in range(len(A)):
  x=int((2*A[i][1])**(0.5))
  if (x-2)*(x-1)<=2*A[i][1]<x*(x-1):
    a=x-2
  if (x-1)*x<=2*A[i][1]<x*(x+1):
    a=x-1
  if (x+1)*x<=2*A[i][1]<(x+2)*(x+1):
    a=x
  if (x+1)*(x+2)<=2*A[i][1]<(x+2)*(x+3):
    a=x+1
  if (x+3)*(x+2)<=2*A[i][1]<(x+4)*(x+3):
    a=x+2
  ans=ans+a
print(ans)

Submission status: Accepted

Solution code:
import math
def solve():
    N = int(input())
    divisors = calc_divisors(N)
    divisors.sort()

    now = N
    i = 1
    ans = 0
    while i != len(divisors):
        if isPrime(divisors[i]) and now % divisors[i] == 0:
            now /= divisors[i]
            ans += 1
        else:
            if len(set(prime_factorize(divisors[i]))) == 1 and now % divisors[i] == 0:
                now /= divisors[i]
                ans += 1
        i += 1
    
    print(ans)

def isPrime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

def sieve(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False

    p = 0
    for i in range(2,n+1):
        if is_prime[i]:
            p = i
            for j in range(p+p, n+1, p):
                is_prime[j] = False
        
        if p * p > n:
            break
    
    primes = []
    for i in range(2,n+1):
        if is_prime[i]:
            primes.append(i)

    return primes

def prime_factorize(n):
    prime_numbers = []
    for p in range(2, int(math.sqrt(n)+1)):
        if n % p != 0:
            continue
        while n % p == 0:
            n /= p
            prime_numbers.append(p)

    if n != 1:
        prime_numbers.append(n)
    return prime_numbers

def calc_divisors(n):
    divisors = []
    for i in range(1,int(math.sqrt(n)+1)):
        if n % i == 0:
            divisors.append(i)
            if (i*i != n):
                divisors.append(n//i)

    return divisors
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf
# @pysnooper.snoop()
#import pysnooper # debug

import math
from collections import defaultdict
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect


# 50 まで
def survey():
    v = 1
    k = 2
    i = 0
    while not (v > 10 ** 12):
        v = k ** i
        print(i)
        i += 1

def survey2():
    v = 1
    s = 0
    while not (s > 50):
        #print('s', s) # debug
        s += v
        v += 1

def diff_selectable(v):
    l = [1, 3, 6, 10, 15, 21, 28, 36, 45, ]
    for i, t in enumerate(l):
        if v < t:
            return i
    raise ValueError

"""
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 prime_factorize(n):
    a = defaultdict(lambda: 0)
    while n % 2 == 0:
        a[2] += 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a[f] += 1
            n //= f
        else:
            f += 2
    if n != 1:
        a[n] += 1
    return a

if __name__ == '__main__':
    ans = 0
    data = int(input())
    primes = prime_factorize(data)
    for pc in primes.values():
        ans  += diff_selectable(pc)
    #print('ans') # debug
    print(ans)

    #print('\33[32m' + 'end' + '\033[0m') # debug

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())
ans = 0
det = []
if N ==1:
    ans = 0
else:
    for (i, j) in factorization(N):
        max_x = pow(i, j)
        #print(max_x)
        v = i
        temp = 1
        for k in range(j):
            x = pow(v, k+1)
            #print(x)
            if x not in det and temp*x <= max_x:
                temp *= x
                ans += 1
                det.append(x)
    #print("")
print(ans)

Submission status: Accepted

Solution code:
from math import gcd
def prime_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()
l = prime_factorization(n)
cnt = 0
for i in l:
    for j in range(1,i[1]+1):
        if n >= i[0]**j and n % i[0]**j == 0:
            n//=i[0]**j
            cnt+= 1
print(cnt)

Submission status: Accepted

Solution code:
def prime(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 list(set(a))
x=int(input())
p=prime(x)
s=0

for j in p:
    i=1
    while x%(j**i)==0:
        x=x//(j**i)
        s+=1
        i+=1
print(s)

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())
li=factorization(n)
ans=0
for i in range(len(li)):
    k=1
    while True:
        if li[i][1]-k>=0:
            li[i][1]-=k
            ans+=1
        else:
            break
        k+=1
if n<=1:
    print(0)
else:
    print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import bisect
import numpy as np
import math
from collections import deque
from collections import defaultdict
from math import gcd

"""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)
else:
    fact = factorization(N)

    ans = 0
    for p, r in fact:
        index = 0
        cum_sum = 1
        cnt = 1
        while cum_sum <= r:
            index += 1
            cum_sum += cnt + 1
            cnt += 1

        ans += index
    print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n = II()
    ans = 0
    N = int(sqrt(n))+2
    d = defaultdict(int)
    d[1] = 1 
    for i in range(2, int(sqrt(n - 1)) + 2):
        if d[i] == 0:
            x = i
            while 1:
                if n % x == 0 and d[x] != 1:
                    ans += 1
                    n //= x
                    d[x] = 1
                else:
                    break
                x *= i
            l = i
            j = 1
            while l < N:
                d[l] = 1
                j += 1
                l = i * j
    if d[n]:
        print(ans)
    else:
        print(ans + 1)
    return


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

Submission status: Accepted

Solution code:
n = int(input())
m = n

exp = []

cnt = 0
while n%2 == 0:
    cnt += 1
    n //= 2
if cnt > 0:
    exp.append(cnt)

i = 3
while i*i <= n:
    cnt = 0
    while n%i == 0:
        cnt += 1
        n //= i
    exp.append(cnt)
    i += 2

if n != 1:
    exp.append(1)

opr = 0
for x in exp:
    opr += int((-1+(8*x+1)**(1/2))/2)

print(opr)

Submission status: Accepted

Solution code:
n = int(input())
i = 2
ans = 0
while True:
  if i * i > n:
    break
  if n % i == 0:
    cnt = 0
    while n % i == 0:
      n /= i
      cnt += 1
    k = 1
    while cnt >= k:
      cnt -= k
      k += 1
    ans += k - 1
  i += 1
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

def calc(n):
    ret = 0
    for i in range(1, 1000):
        n -= i
        if n == 0:
            ret = i
            break
        elif n < 0:
            ret = i-1
            break
    return ret

N = int(input().rstrip())
d = {}
for x in prime_factorize(N):
    if x not in d.keys():
        d[x] = 1
    else:
        d[x] += 1
ret = 0
for x in d.values():
    ret += calc(x)
print(ret)

Submission status: Accepted

Solution code:
N = int(input())
pf={}
m=N
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
X = list(pf.values())
ans = 0
for i in X:
    temp = 1
    while i>=temp:
        i -= temp
        temp += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import itertools

def factorize(n):
    """素因数分解を行う

    Args:
        n (int): 素因数分解したい数

    Returns:
        fct (list[int]): 素因数分解した結果

    Examples:
        >>> factorize(1000)
        [2, 2, 2, 5, 5, 5]
    """
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


def resolve():
    N = int(input())

    ans = 0
    factorize_N = factorize(N)

    if len(factorize_N) == 0:
        print(0)
        return

    for key, value in itertools.groupby(factorize_N):
        tmp = len(list(value))
        for i in range(1, tmp + 1):
            tmp -= i
            if (tmp < 0):
                break
            ans += 1

    print(ans)

resolve()

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

    return arr

A=factorization(N)
P=[row[1] for row in A]
if A[0][0]==1:
    print(0)
    exit()

ans=0

for i in range(len(P)):
    c=1
    while P[i]>=c:
        P[i]-=c
        c+=1
        ans+=1

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

n = int(input())
p = prime_factorize(n)
c = Counter(p)
ans = 0
for i in c.keys():
    ans += 1
    x = c[i]
    y = 3
    i = 3
    if x > 2:
        while True:
            if x < y:
                break
            else:
                ans += 1
                y += i
                i += 1
print(ans)

Submission status: Accepted

Solution code:
from bisect import bisect_right
from collections import defaultdict
import numpy as np


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

primes = factorization(N)

A = np.arange(1, 100)
cumsum_A = A.cumsum()
# print(cumsum_A)

if len(primes) == 0:
    print(1)
    exit()

ans = 0
for _, value in primes:
    idx = bisect_right(cumsum_A, value)
    ans += idx
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())
n_fact = factorization(n)
ans=0
for i in n_fact:
    a = i[1]
    cnt=0
    while a > cnt:
        cnt += 1
        a -= cnt
        ans += 1
if n == 1:
    ans = 0
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N == 1:
    print("0")
    exit()
def f(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

temp = f(N)
ans = 0
for x in temp:
    i = 0
    temp2 = x[1]
    while(temp2 > 0):
        i += 1
        temp2 -= i
        if temp2 >= 0:
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
import math


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

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

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

    return arr


n = int(input())
total = 0
if n == 1:
    print("0", end="")
    exit()

ps = factorization(n)
for p in ps:
    c = int((-1 + math.sqrt(1+8*p[1]))/2)
    total += c
print(total, end="")

Submission status: Accepted

Solution code:
n = int(input())

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

aoinsu = factorize(n)

kaijo = [1]
b = 1
for i in range(2,10):
    b = b+i
    kaijo.append(b)

#print(kaijo)    

#print(aoinsu)

ans = 0
for i in range(len(aoinsu)):
    a = aoinsu[i][1]
    for j in range(10):
        if a < kaijo[j]:
            ans += j
            break


print(ans)

Submission status: Accepted

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

n = int(input())

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

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

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

    return arr

m = 0

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

Submission status: Accepted

Solution code:
n = int(input())

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

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
  
list = fac(n)
count = 0
for l in list:
  c = 0
  sum = 0
  while True:
    c += 1
    sum += c
    if l[1]<sum:
      break
    count += 1

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