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

Solution (Python):

aaa = [0,1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8]

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

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

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

    return arr
N = int(input())
l = factorization(N) 

ans = 0

for arr in l:
  if arr[0] != 1:
    a = arr[1]
    b = aaa[a]
    ans += b
  
print(ans)

Solution (Python):
N = int(input())

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

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

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

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

    return arr

dic = {}
for v in factorization(N):
    dic[v[0]] = v[1]



lst = []
for i in dic:
    for j in range(1, dic[i]+1):
        lst.append(i**j)
lst.sort()


cnt = 0
for i in lst:
    if  N % i == 0 and N // i > 0:
        N = N / i
        cnt += 1
print(cnt)

Solution (Python):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
ans = 0
N = int(input())
f = factorization(N)
for pair in f:
  p = pair[0]
  e = pair[1]
  i = 1
  while(e-i>=0):
    e = e - i
    i = i  + 1
    ans = ans + 1
if N == 1:
  ans = 0
print(ans)

Solution (Python):
import sys
import collections

def main():

    input = sys.stdin.readline

    N = int(input())

    c = collections.Counter(prime_factorize(N))

    ans = 0

    for value in c.values():
        j = 1
        for i in range(2,1000000):
            j += i

            if value < j:
                ans += (i - 1)
                break


    print(ans)

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__":
    main()

Solution (Python):
N = int(input())
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
  
l = prime_factorize(N)
ans = 0
for k,v in Counter(l).items():
  i = 1
  while v>=i:
    v-=i
    ans += 1
    i += 1
    
print(ans)

Solution (Python):
N = int(input())

a = []
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
        a.append([i, cnt])

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

ans = 0
for i in range(len(a)):
    e = 1
    while 1:
        if N % a[i][0]**e == 0:
            N /= a[i][0]**e
            a[i][1] -= e
            e+=1
            ans += 1
        else:
            break
        if a[i][1] < e:
            break

print(ans)

Solution (Python):
from collections import Counter
from itertools import accumulate
B=[i for i in range(101)]
B=list(accumulate(B))

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

d=Counter(prime_factorize(N))
k=d.keys()
ans=0
for i in k:
  a=1
  while d[i]>=B[a]:
    ans+=1
    a+=1
print(ans)

Solution (Python):
from bisect import bisect_left

def prime_factorize(n):
    res = []
    for i in range(2, int(n**(1/2))+1):
        if n % i != 0: continue
        num = 0
        while n % i == 0:
            num += 1
            n /= i
        res.append((i, num))
    if n != 1:
        res.append((n, 1))
    
    return res

n = int(input())

prime = prime_factorize(n)

c = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55]

ans = 0
for k, v in prime:
    i = bisect_left(c, v)
    if c[i] == v: i += 1
    ans += i

print(ans)

Solution (Python):
import math
from collections import deque
from collections import defaultdict

import time


def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq


n = readInt()

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 ahaha(x):
	n = (-1+int((1+8*x)**0.5))//2
	return n

f = factorization(n)

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

ans=0

for i in f:
	ans+=ahaha(i[1])

print(ans)

Solution (Python):

from collections import Counter

prime_factor = []
N = int(input())
for i in range(2,int(N**0.5)+1):
    while N % i == 0:
        prime_factor.append(i)
        N /= i
if N > 1:
    prime_factor.append(N)

c = Counter(prime_factor)

cnt = 0
for k, v in c.items():
    diff = 1
    while v > 0:
        v -= diff
        if v >= 0:
            cnt += 1
        diff += 1

print(cnt)

Solution (Python):


n = int(input())

def factorization(n):
    arr = []
    if n == 1:
        return 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_list = factorization(n)
ans = 0

for i in range(len(f_list)):
    _tmp = f_list[i][1]
    j = 1
    while _tmp >= 0:
        _tmp -= j
        j += 1
    ans += j-2

print(ans)

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

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

print(ans)

Solution (Python):
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
            count = 0
            while temp%i==0:
                cnt+=1
                temp //= i
                if cnt == count+1:
                    count += 1
                    cnt = 0
            arr.append([i, count])

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

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

    return arr

arr = factorization(N)
if N == 1:
    print(0)
    sys.exit()
else:
    print(sum([arr[i][1] for i in range(len(arr))]))

Solution (Python):
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)
    quit()
f = factorization(n)
ans = 0
c = len(f)
for i in range(c):
    s = 0
    g = f[i][1]
    if g == 2:
        ans += 1
    else:
        for j in range(g):
            s += j + 1
            f[i][1] -= j+1
            if s > g:
                break
            ans += 1
print(ans)

Solution (Python):
n = int(input())
r = 0
i = 2
while i * i <= n:
  j = k = 1
  while n % i == 0:
    n //= i
    j -= 1
    if j == 0:
      r += 1
      j = k = k + 1   
  i += 1
print(r + (n > 1))

Solution (Python):

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():
    import numpy as np
    import sys
    n = int(input())
    arr = factorization(n)
    ans = 0
    for fact,num in arr:
        if fact == 1:
            print(0)
            exit(0)
        ans += int((np.sqrt(1+8*num) - 1)/2)  
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
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
c = collections.Counter(prime_factorize(n))
v = list(c.values())
ans = 0
for i in v:
    j = 1
    p = 0
    count = 0
    while True:
        p += j
        j += 1
        if i<p:
            break
        count += 1
    ans += count
print(ans)

Solution (Python):
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)
ans=0
for i in range(len(a)):
  tmp=0
  for j in range(1,50):
    tmp+=j
    if a[i][1] >= tmp:
      ans += 1
if n==1:
  print(0)
else:
  print(ans)

Solution (Python):
N = int(input())

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 2
    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]


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

ans = 0
divisors = make_divisors(N)

if len(divisors) == 0 and N != 1:
    print(1)
    exit()

for i in divisors:
    primes = set(prime_factor(i))
    if len(primes) == 1 and N % i == 0:
        ans += 1
        N /= i
        N = int(N)

print(ans)

Solution (Python):
m = int(input())

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

l = []

for i in range(1, 40):
    p = i * (i+1) / 2
    l.append(p)

def check(n):
    num = 0
    i = 0
    while n >= l[i]:
        num += 1
        i += 1
    return num


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

primers = factorization(m)

ans = 0

for i in primers:
    ans += check(i[1])

print(ans)

Solution (Python):
n = int(input())
if n == 1:
  print(0)
else:
  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

  arr = factorization(n)
  ans = 0
  for i in range(len(arr)):
    cnt = arr[i][1]
    j = 1
    while cnt >= 0:
      cnt -= j
      j += 1
    ans += (j - 2)
  print(ans)

Solution (Python):
import copy
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


soinsuu = factorization(n)

ans = 0
kouho = []
for aa in soinsuu:
    for i in range(aa[1]):
        kouho.append(aa[0]**(i+1))

dame = [1]
while True:
    flag = False
    kouho.sort()
    for i in range(len(kouho)):
        if kouho[i] in dame:
            continue
        else:
            flag = True
            waruyatu = copy.deepcopy(kouho[i])
            dame.append(waruyatu)
            for j in range(len(kouho)):
                if kouho[j]%waruyatu == 0:
                    kouho[j] = kouho[j]//waruyatu
            ans += 1
            break
    if not flag:
        break

print(ans)

Solution (Python):
N=int(input())
def factorize(n):
    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

bunkai=factorize(N)
blist=list(set(bunkai))

ans=0
for i in blist:
    tmp=bunkai.count(i)
    for p in range(1,50):
        if tmp>=p:
            ans+=1
            tmp-=p
        else:
            break
print(ans)

Solution (Python):
N = int(input())

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

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

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

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

    return arr

arr = factorization(N)

count = 0
for i in arr:
    for j in range(1,10**5):
        if j*(j+1)/2 <= i[1] < (j+1)*(j+2)/2:
            count += j
            break

print(count)

Solution (Python):
def factorization(n):
    """
    nを素因数分解
    2以上の整数n => [[素因数, 指数], ...]の2次元リスト
    """
    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_li = factorization(N)
ans = 0
for t in fact_li:
    if t[0] == 1:
        continue
    tmp = t[1]
    for i in range(1, tmp + 1):
        if tmp >= i:
            ans += 1
            tmp -= i
        else:
            break

print(ans)

Solution (Python):
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())

ans = 0
c = factorization(N)  

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

Solution (Python):
import sys
input = sys.stdin.readline
def prime_factorize(n):
    res = []
    for i in range(2, int(n**0.5)+1):
        if n % i != 0:continue
        ex = 0
        while n % i == 0:
            ex += 1
            n = n//i
        res.append((i, ex))
    if n != 1:res.append((n, 1))
    return res
def main():
    N = int(input())
    p = prime_factorize(N)
    ans = 0
    for v, ex in p:
        current = 1
        while ex > 0:
            ex -= current
            if ex >= 0:
                ans += 1
                current += 1
            else:
                break
    print(ans)
if __name__ == "__main__":
    main()

Solution (Python):
import sys
sys.setrecursionlimit(100000)


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


elements = set()


def decomposition(used_set, last_used, rest):
    global elements

    if rest == 0:
        if len(used_set) > len(elements):
            elements = used_set
    i = last_used + 1
    while rest - i >= 0:
        if i in used_set:
            continue
        decomposition(used_set | {i}, i, rest - i)
        i += 1


N = int(input())
if N == 1:
    print(0)
    exit()
factors = factorization(N)
ans = 0
for p, e in factors:
    if e == 2:
        ans += 1
    else:
        elements = set()
        decomposition({1}, 1, e - 1)
        ans += len(elements)
print(ans)

Solution (Python):
from decimal import Decimal as de
n=int(input())
def factorization(n):
    factor=[]
    p=[]
    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
            factor.append(i)
            p.append(cnt)
    if temp!=1:
        factor.append(temp)
        p.append(1)
    if len(factor)==0:
        factor.append(n)
        p.append(1)
    return factor,p

ans=0
for i in [k for j,k in zip(factorization(n)[0],factorization(n)[1]) if j!=1]:
  ans+=((de(1)+de(8)*de(i))**de('0.5')-de(1))//de(2)
print(int(ans))

Solution (Python):
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(input())
if N==1:
    print(0)
    sys.exit()
A=factorization(N)

ans=0
for i in range(len(A)):
    p=0
    res=A[i][1]
    while res-p>0:
        p+=1
        res-=p
    
    ans+=p
print(ans)

Solution (Python):
import sys
n=int(input())
if n==1:
  print(0)
  sys.exit()


import collections
def prime_fact(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_fact(n))
d=list(c.items())
num=0
for i in range(len(d)):
  z=int(d[i][1])
  j=1
  while z>=0:
    z=z-j
    j+=1
    if z<0:
      break
    else:
      num+=1
print(num)

Solution (Python):
import sys
from bisect import bisect_left, bisect_right
N=int(sys.stdin.readline().strip())

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)

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

ans=0
for x,y in F:
    if x==1: continue
    ans+=bisect_right(L,y)
print ans

Solution (Python):
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())
l = factorization(n)
ans = 0
for c in l:
    if c[0]==1:
        break
    lim = c[1]
    num = 1
    while lim >= num:
        lim -= num
        num += 1
    ans += num-1

print(ans)

Solution (Python):
import sys
def factoring(n):
    if n == 0:
        return {0: 1}
    if n == 1:
        return {1: 1}
    nOrigin = n
    n = n**0.5
    numlist = [0 for i in range(int(n) + 1)]
    numlist[0] = -1
    numlist[1] = -1

    t = 2
    while t < (n**0.5):
        if numlist[t] == 0:
            numlist[t] = t
            k = 2
            while t * k <= n:
                numlist[t * k] = -1
                k += 1
        t += 1
    while t <= n:
        if numlist[t] == 0:
            numlist[t] = t
        t += 1

    result = {}
    for i in numlist:
        if i == -1:
            continue
        j = 0
        while nOrigin % i == 0:
            j += 1
            nOrigin = nOrigin / i
        if j == 0:
            continue
        else:
            result[i] = j

    if int(nOrigin) != 1:
        result[int(nOrigin)] = 1
    return result

def help(e):
    i=0
    while i*(i+1)//2<=e:
        i+=1
    return i-1


N=int(input())
if N==1:
    print(0)
    sys.exit(0)
d=factoring(N)

retval=0
for key,value in d.items():
    retval+=help(value)


print(retval)

Solution (Python):
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 ruisekiwa(n):
	if n<3:
		return 1
	elif n<6:
		return 2
	elif n<10:
		return 3
	elif n<15:
		return 4
	elif n<21:
		return 5
	elif n<28:
		return 6
	elif n<36:
		return 7
	else:
		return 8


a=factorization(N)
ans=0


for insu in a:
	
	
	ans+=ruisekiwa(insu[1])

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

Solution (Python):
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

a=int(input())
cc=collections.Counter(prime_factorize(a))
cc=cc.values()
ans=0
for k in cc:
    j=1
    while k>=0:
        k=k-j
        ans+=1
        j+=1
    ans=ans-1
print(ans)

Solution (Python):
from collections import Counter

n = int(input())

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

ans = 0
for p, x in Counter(ps).items():
    i = 1
    j = 1
    if x != 1:
        while i <= x:
            j += 1
            i += j
        ans += j-1
    else:
        ans += 1

print(ans)

Solution (Python):
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()
l = factorization(n)

ans = 0
for i in range(len(l)):
	num = l[i][1]
	tmp = 1
	count = 0
	while True:
		if num < 0:
			ans += count - 1
			break
		num -= tmp
		tmp += 1
		count += 1
print(ans)

Solution (Python):
import collections
import math
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))
d = list(c.values())
number = 0
for i in range(len(d)):
    number += math.floor((-1 + math.sqrt(1 + 8*d[i]))/2)
print(number)

Solution (Python):
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 how_many_times(p):
    i = 0
    while True:
        if i * (i + 1) // 2 > p:
            break
        i += 1

    return i - 1


n = int(input())
factors = Counter(prime_factorize(n))

ans = 0
for f, p in factors.items():
    ans += how_many_times(p)

print(ans)

Solution (Python):
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 p_num in c.values():
    i = 0
    tmp = 0
    while True:
        i += 1
        tmp += i
        if p_num < tmp:
            break
    ans += i - 1
print (ans)

Solution (Python):
from sys import stdin
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


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  
    
    N_fac = factorization(N)
    cnt = 0
    if N == 1:
        pass
    else:
        for fac,power in N_fac:
            for i in range(power+10):
                if i*(i+1)/2 > power:
                    i -= 1
                    cnt += i
                    break
    
    print(cnt)


if __name__ == "__main__":
    main()

Solution (Python):
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())
prime_factors = factorization(N)
if prime_factors[0][0] == 1:
    print(0)
else:
    ans = 0
    for pf in prime_factors:
        n = pf[1]
        i = 0
        while n >= i:
            n -= i
            i += 1
        ans += i-1
    print(ans)

Solution (Python):
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


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())
    divs = sorted(divisor(n))
    ans = 0
    for div in divs[1:]:
        if n % div == 0 and len(factorization(div)) == 1:
            n /= div
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

def prime(n):
    a = 2
    res = []
    while (a * a <= n):
        if (n % a != 0):
            a += 1
            continue
        ex = 0

        while (n % a == 0):
            ex += 1
            n //= a

        res.append([a, ex])

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

n = int(input())
p = prime(n)

ans = 0
for i in p:
    count = 0
    for j in range(i[1]):
        ans += 1
        count += 1
        i[1] -= count
        if count >= i[1]:
            break

print(ans)