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:
x = 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(x)
l = sorted(l)
ans = 0
for i in range(len(l)):
  if l[i][0] == 1:
    continue
  else:
    s = 0
    num = l[i][1]
    if num == 1:
      j = 1
    else:
      for j in range(1, num):
        s += j
        if s == num:
          break
        elif s > num:
          j -= 1
          break
    ans += j
    
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
  
A=0
z=1
q=factorization(N)
if N==1:
    print(0)
else:  
    for i in range(len(q)):
        for j in range(1,101):
            z=q[i][0]**j
            if N%z==0:
                A+=1
                N=N/z
            else:
                break
    print(A)

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

temp_list = c.values()
ans = 0

if n == 1:
    print(0)
else:
    for i in temp_list:
        temp_num = i
        temp = 1
        while temp_num >= temp:
            temp_num = temp_num - temp
            ans += 1
            temp += 1
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
dp=[1,1]+[0 for _ in range(int(n**0.5)-1)]

if n == 1:
  print("0")
  exit()
for i in range(2,int(n**0.5)+1):
  if dp[i] == 1:
    continue
  A,j=0,1
  while n % i == 0:
    n //= i
    A += 1    
  while j*(j+1)//2 <= A:
    ans += 1
    j += 1
  for k in range(i,int(n**0.5)+1,i):
    dp[k] = 1

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict
def input(): return sys.stdin.readline().rstrip()

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

    ans = 0
    MAX_N = math.ceil(math.sqrt(N)) + 1

    div = defaultdict(int)
    for i in range(2, MAX_N):
        while N % i == 0:
            N //= i
            div[i] += 1
            if N == 1:
                break
    for i, v in div.items():
        key = 1
        while True:
            v -= key
            ans += 1
            if v <= key:
                break
            key += 1

    if N > 1:
        ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    import copy
    n = int(input())
    if n==1:
        print(0)
        return
    k = copy.deepcopy(int(n**0.5)+2)
    ans = 0
    for i in range(2,k):
        if n%i==0:
            m = 1
            ans += 1
            n = n//i
            cnt = 0
            while n%i==0:
                n = n//i
                cnt += 1
                if cnt > m:
                    m = m+1
                    cnt = 0
                    ans += 1
        if n==1:
            break
    if ans==0:
        print(1)
        return
    if n!=1:
        print(ans+1)
        return
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

l = [0] + [1]*2+[2]*3+[3]*4+[4]*5+[5]*6+[6]*7+[7]*8+[8]*9+[9]*10
ls = fact(n)
ans = 0
for v in ls:
    ans += l[v]
print(ans)

Submission status: Accepted

Solution code:
import collections
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:
    ans = 0
    c = factorization(n)
    for arr in c:
        m = arr[1]
        i = 1
        for _ in range(m):
            if i > m:
                break
            ans += 1
            m -= i
            i += 1
    print(ans)

Submission status: Accepted

Solution code:
from bisect import bisect_right
import sys

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


S = [0]
now = 0
for i in range(1, 60):
    S.append(i * (i + 1) // 2)
# print(S)

fact_list = factorization(N)
# fact_list = sorted(fact_list, reverse=True)
# print(fact_list)
if fact_list == [[1, 1]]:
    print(0)
    sys.exit()
ans = 0
while fact_list:
    now_fact = fact_list.pop()
    idx = bisect_right(S, now_fact[1])
    ans += idx - 1

print(ans)

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest
from collections import Counter

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

def resolve():
    # s = input()
    n = int(input())
    # a, b = map(int, input().split())
    # l = [list(map(int, input().split())) for _ in range(n)]

    n_list = Counter(prime_factorize(n))
    cnt = 0

    for key, v in n_list.items():
        tmp = 1
        while 1:
            if n_list[key] - tmp >= 0:
                n_list[key] -= tmp
                cnt += 1
                tmp += 1
            else:
                break

    print(cnt)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """24"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """1"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """64"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """1000000007"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_5(self):
        input = """997764507000"""
        output = """7"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

Solution code:
trs = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171,
       190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435,
       465, 496, 528, 561, 595, 630, 666, 703, 741, 780]

n = int(input())

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

D = {}

i = 2
while i * i <= n:
    # print(i, n)
    if n % i == 0:
        n = n // i
        if i in D:
            D[i] += 1
        else:
            D[i] = 1
    else:
        i += 1

if n in D:
    D[n] += 1
else:
    D[n] = 1

# print(D)

ans = 0
for one in D:
    for ntr, tr in enumerate(trs):
        if tr > D[one]:
            # print(D[one], tr)
            ans += ntr
            break

print(ans)

Submission status: Accepted

Solution code:
#素因数分解
# order O(log(N)*N**0.5)?
def fact(A): #fact(int A)
    c0 = A
    r = 2
    lis = []
    count = 1
    while A != 1:
        if A%r == 0:
            A = A//r
            lis.append(r)
            r = 2
        else:
            r += 1
        if r > int(pow(c0,0.5))+1:
            lis.append(A)
            break
    return(lis)

n = int(input())

lis = fact(n)
lis = list(set(lis))
z = min(len(lis),10)
for i in range(z):
    for j in range(2,1000):
        if lis[i]**j < n:
            lis.append(lis[i]**j)
        else:
            break
lis = sorted(lis)
c = 0
i = 0
while n != 1:
    if i > len(lis) -1:
        break
    if n%lis[i] == 0:
        n = n/lis[i]
        c += 1
    i += 1
print(c)

Submission status: Accepted

Solution code:
import sys
import math
import copy
import numpy as np




def MinPrime(N, Prime):
    Max = math.ceil(math.sqrt(N))
    Min = Prime+1
    if(N%2 ==0):
        return 2


    Dev = 2
    if(Min%2==0):
        Min += 1
    for Num in range(Min, Max+1, Dev):
        if(N%Num == 0):
            return Num
    return N

def estimatePow(N, Prime):

    Pow = 0
    N_bef = N
    while(N%Prime==0):
        Pow+= 1
        N //= Prime
    # print(N_bef, N, Pow, Prime)
    return [Pow, N]

def estimateTimes(Pow):
    Times = math.floor(math.sqrt(Pow))
    Sum = (1+Times) * Times /2


    while(True):
        Sum *= (Times+2)/Times
        if(Pow < Sum):
            return Times
        Times += 1
    return Times
def calcOperateionTimes(N):
    Prime = 1
    Times = 0
    #Primes = seachPrimeNum(N)
    while(N > 1):
        # Prime = MinPrime(N, Prime)
        Prime= MinPrime(N, Prime)
        Pow_N = estimatePow(N, Prime)
        N = Pow_N[1]
        Times += estimateTimes(Pow_N[0])
    return Times

if(__name__ == "__main__"):

    N = int( input().strip() )



    Times = calcOperateionTimes(N)
    print(Times)

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:
  factN = factorization(N)
  counter = 0
  for i in range(len(factN)):
    t = factN[i][1]
    e = 0
    while True:
      t -= e
      if t < 0:
        counter += e - 1
        break
      e += 1
  print(counter)

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())
soi=fa(N)
ans=0
for n in range(len(soi)):
    if soi[n][1]<=2:
        ans+=1
    elif soi[n][1]<=5:
        ans+=2
    elif soi[n][1]<=9:
        ans+=3
    elif soi[n][1]<=14:
        ans+=4
    elif soi[n][1]<=20:
        ans+=5
    elif soi[n][1]<=27:
        ans+=6
    elif soi[n][1]<=35:
        ans+=7
    elif soi[n][1]<=44:
        ans+=8
    elif soi[n][1]<=54:
        ans+=9
if N==1:
    ans=0
print(ans)

Submission status: Accepted

Solution code:
import sys
 
if __name__ == '__main__':
    val = int(input().strip())

    arr = []
    i = 2
    while i < int(val ** 0.5 + 1):
        if val % i == 0:
            arr.append(i)
            val //= i
            continue
        i += 1
    if val != 1:
        arr.append(val)
    
    
    count = 0
    cur_val = 0

    for e in arr:
        if cur_val != e:
            cur_val = e
            times = 1
            n = 1
        if times == n * (n + 1) // 2:
            count += 1
            n += 1
        times += 1
    
    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

N = int(input())
primes = factorization(N)
nums = []
for i in primes:
    for j in range(i[1]):
        nums.append(i[0] ** (j + 1))
nums_sorted = sorted(nums)
if 1 in nums_sorted:
    nums_sorted.remove(1)

done = []
count = 0
for i in nums_sorted:
    if N < i:
        break
    if N % i == 0:
        count += 1
        N /= i
print(count)

Submission status: Accepted

Solution code:
n = int(input())
ans = 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
from collections import Counter
c = Counter(prime_factorize(n))
for i in c.values():
    for j in range(1,50):
        if j*(j+1)/2 <= i < (j+1)*(j+2)/2:
            ans += j
            break
print(ans)

Submission status: Accepted

Solution code:
import collections

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

n = int(input())
c = collections.Counter(prime_factorize(n))
ans = 0


for l in c.items():
    x = l[1]
    y = 1
    z = 0
    for i in range(1,x+1):
        z += 1 #同じ数のカウンター
        if z > y+1:
            z = 1
            y += 1
    ans += y

print(ans)

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

prime = collections.Counter(prime_factorize(n))

ans = 0
for cnt in prime.values():
    c = 0
    while cnt - c > 0:
        c += 1
        cnt -= c
    ans += c

print(ans)

Submission status: Accepted

Solution code:
import math
def primeFactors(n):
    d=dict()
    while n % 2 == 0:
        if 2 in d:
            d[2]+=1
        else:
            d[2]=1
        n = n // 2

    for i in range(3, int(math.sqrt(n)) + 1, 2):

        while n % i == 0:
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
            n = n // i

    if n > 2:
        if n in d:
            d[n]+=1
        else:
            d[n]=1

    return d

def getcount(S):
    return int((math.sqrt(1+8*S)-1)/2)


n=int(input())

d = primeFactors(n)

total=0

for x in d:
    total+=getcount(d[x])

print(total)

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)

ans = 0
for i in fact:
    if i[1] > 2:
        tmp = 1
        while True:
            i[1] -= tmp
            tmp += 1
            if i[1] < 0:
                break
            ans += 1
    else:
        ans += 1

if n == 1:
    ans = 0
    
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
if N == 1: print(0)
else:
    lst = factorization(N)
    ans = 0
    for f, i in lst:
        cnt = i
        for j in range(1, i+1):
            if cnt - j > j:
                ans += 1
                cnt -= j
            else:
                ans += 1
                break
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if n==1:
  print(0)
  exit()
def pf(n):
    a = []
    N = n
    for i in range(2, int(pow(N,0.5)//1+2)):
        if n%i==0:
            count=0
            while n%i==0:
                count+=1
                n //= i
            a.append([i,count])
    if n!=1:
        a.append([n,1])
    if a==[]:
        a.append([n,1])
    return a
l=pf(n)
ans=0
ll=len(l)
for i in range(ll):
  x,y=l[i][0],l[i][1]
  ans+=int((-1+pow(1+8*y,0.5))/2)
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter


def pf(x):
  if x == 1:
    return []
  r = []
  while not x & 1:
    r += [2]
    x >>= 1
  i = 3
  m = int(x ** 0.5)
  while i < m + 1:
    while not x % i:
      r += [i]
      x //= i
    i += 2
  if x != 1:
    r += [x]
  return r


def main():
  n = int(input())
  
  pp = pf(n)
 
  cc = Counter(pp)
  
  res = 0
  
  for c, v in cc.items():
    i = 1
    while True:
      if i > v:
        break
      v -= i
      res += 1
      i += 1
      
  print(res)


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

if N == 1:
    print(0)
    exit()
else:
    x =  factorization(N)
    #print(x)


res = 0

for i,j in x:
    cnt = 1
    while  1:
        j -=cnt
        if j < 0: cnt-=1
        if j < 1:
            break
        cnt+=1
    res+=cnt
    cnt = 1

print(res)

Submission status: Accepted

Solution code:
import sys
N = int(input())
if N == 1:
    print(0)
    sys.exit()

C = {}
for i in range(2, max(10, int(N**(0.5))+1)):
    while(N % i == 0):
        N = N//i
        if i not in C:
            C[i] = 1
        else:
            C[i] += 1

if len(C) == 0:
    print(1)
    sys.exit()

ans = 0
for i in C.values():
    s = 1
    while(True):
        i -= s
        if i < 0:
            break
        ans += 1
        s += 1
if N == 1:
    print(ans)
else:
    print(ans+1)

Submission status: Accepted

Solution code:
import collections
S = 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

l = prime_factorize(S)
x = collections.Counter(l)
X = list(x.values())

y = len(X)
ans = 0
for i in range(y):
    if 1 <=X[i] <= 2:
        ans +=1
    elif 3 <= X[i] <=5 :
        ans += 2
    elif 6<= X[i] <=9:
        ans +=3
    elif 10<= X[i] <=14:
        ans +=4
    elif 15<= X[i] <= 20:
        ans +=5
    elif 21 <= X[i] <= 27:
        ans +=6
    elif 28 <= X[i] <=35:
        ans +=7
    elif 36 <= X[i] <= 44:
        ans +=8
print(ans)

Submission status: Accepted

Solution code:
import collections
import math

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

c = collections.Counter(prime_factorize(n))
ans=0
for i in c.keys():
    count=0
    z=c[i]
    for i in range(55):
        z-=i
        if z>=0:
            count=i
        else:
            break
    ans+=count
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

import math
def D():
    n = int(input())
    if n==1:
        print(0)
        return
    f = factorization(n)
    res = 0
    for i,j in f:
        res += math.floor(math.sqrt(2*j + 1/4) - 1/2)
    print(res)
D()

Submission status: Accepted

Solution code:
import collections
def calc_prime(N):
  dic={}
  i=2
  while N != 1:
    d,m=divmod(N,i)
    if m==0:
      N=d
      if i not in dic:dic[i]=1
      else:dic[i]+=1
    else:
      i+=1
  return dic
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())
  #dic=calc_prime(N)
  dic=collections.Counter(prime_factorize(N))
  ans=0
  for k,v in dic.items():
    i=0
    while v > i:
      i+=1
      v-=i
    ans+=i
  print(ans)
if __name__ == '__main__':
  main()

Submission status: Accepted

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

def solv_quadratic_equation(a, b, c):
    """ 2次方程式を解く  """
    D = (b**2 - 4*a*c) ** (1/2)
    x_1 = (-b + D) / (2 * a)
    x_2 = (-b - D) / (2 * a)
    if x_2 > 0:
        return x_2
    else:
        return x_1

n = int(input())
A = Counter(prime_factorize(n))
#print(A)
ans = 0
for (i, j) in A.items():
    c = int(solv_quadratic_equation(1, 1, -2 * j))
    ans += c

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)
else:
    l = factorization(n)
    dic = []
    for i in range(len(l)):
        tmp = l[i][0]
        dic.append(tmp)
        while n >= tmp:
            tmp *= l[i][0]
            if n < tmp:
                break
            dic.append(tmp)
    dic.sort()
    cnt = 0
    while n != 1:
        flag = True
        for i in range(len(dic)):
            if n%dic[i] == 0:
                n //= dic[i]
                cnt += 1
                dic.pop(i)
                flag = False
                break
        if flag:
            break
    print(cnt)

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 p, e in factorization(n):
        i = 1
        while e >= i:
            e -= i
            i += 1
            ans += 1

    print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# モジュールのインポート
import collections
import math

# 標準入力の取得
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


# 求解処理
result = 0
c = collections.Counter(prime_factorize(N))
for p, e in c.items():
    result += int((-1 + math.sqrt(1 + 8*e)) / 2)


# 求解処理
print(result)

Submission status: Accepted

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

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


N = int(input())
soinsu = np.array(factorization(N))
tate = soinsu.shape[0]
kaisawa = []
wa = 0
for i in range(100):
    kaisawa.append(((i+2)*(i+1)//2))

for i in range(tate):
    for j in range(100):
        if soinsu[i, 1] < kaisawa[j]:
            wa += j
            break

if N == 1:
    wa = 0

print(wa)

Submission status: Accepted

Solution code:
N = int(input())
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    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

arr = factorize(N)

count = 0
for p,e in arr:
  i = 1
  while True:
    if e < i:
      break
    e -= i
    i += 1
    count += 1      

print(count)

Submission status: Accepted

Solution code:
n=int(input())

#xの約数を列挙する
def divisor(x):
    ans=set([])
    i=1
    while(i*i<=x):
        if(x%i==0):
            ans.add(i)
            ans.add(x//i)
        i+=1
    ans=sorted(list(ans))
    return ans

div_n=divisor(n)[1:]
#print(div_n)

prime_n=[]
isprime=[True for _ in range(len(div_n))]
for i in range(len(div_n)):
    if(isprime[i]):
        for j in range(i+1,len(div_n)):
            if(div_n[j]%div_n[i]==0):
                isprime[j]=False
        prime_n.append(div_n[i])
    else:
        pass
#print(prime_n)

soinsu={}
for di in prime_n:
    ans_di=0
    ni=n
    while(ni%di==0):
        ni//=di
        ans_di+=1
    soinsu[di]=ans_di
#print(soinsu)

ans=0
for k,v in soinsu.items():
    vi=v
    i=1
    while(vi>=i):
        vi-=i
        i+=1
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
# cook your dish here
import math
n = int(input())
t = n
p = {}

for i in range(2, int(math.sqrt(t)+1)):
    while n%i==0 and n > 1:
        n = n//i 
        if p.get(i, -1) == -1:
            p[i] = 1 
        else:
            p[i] += 1 
    
if n > 1:
    p[n] = 1 

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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
  

c = collections.Counter(prime_factorize(N))

A = c.keys()
count = c.values()

ans = 0

for i in count:
  k = 0
  for j in range(1,i+1):
    k += j
    if k <= i:
      ans += 1
      
print(ans)

Submission status: Accepted

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

def function(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
b = function(n)
c = collections.Counter(function(n))
ans = 0
for number in (c.values()):
  iter = 1
  flag = True
  while flag:
    number -= iter
    ans += 1
    iter += 1
    if number < iter:
      flag = False
print(ans)

Submission status: Accepted

Solution code:
m=int(input())

pf={}

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

sum = 0
for key in pf:
    if pf[key] > 1:
        i = 1
        d = pf[key]
        while True:
            if d - i >= 0:
                d-=i
                sum+=1
                i+=1
            else:
                break
    else:
        sum+=1


print(sum)

Submission status: Accepted

Solution code:
import math

n = int(input())

if n==1:
  print(0)
else:
  fctr = []
  for a in range(2,math.isqrt(n)+1):
    atta = 0
    if n%a==0:
      while n%a==0:
        atta += 1
        n //= a
      fctr.append((a,atta))
  if n!=1:
    fctr.append((n,1))
#  print(fctr)

  kaisu = 0
  for pair in fctr:
    if pair[1]<3:
      kaisu += 1
    elif pair[1]<6:
      kaisu += 2
    elif pair[1]<10:
      kaisu += 3
    elif pair[1]<15:
      kaisu += 4
    elif pair[1]<21:
      kaisu += 5
    elif pair[1]<28:
      kaisu += 6
    elif pair[1]<36:
      kaisu += 7
    elif pair[1]<45:
      kaisu += 8
    elif pair[1]<55:
      kaisu += 9

  print(kaisu)

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())
l  = list(collections.Counter(prime_factorize(n)).values())
count = 0
for i in l:
    x = i
    check = 1
    while True:
        if x >= check:
            x -= check
            count += 1
            check += 1
        else:
            break
print(count)