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: Runtime Error

Solution code:
import sympy

N = int(input())

def answer(a):
    divisor = sympy.divisors(a)
    if len(divisor) == 1:
        return(0)

    divisor = divisor[1:]

    count = 0
    for i in divisor:
        if a % i == 0:
            if a // i == 1:
                count += 1
                break
            else:
                a = a // i
                count += 1

    return(count)

print(answer(N))

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())

divisor = sympy.divisors(N)

if len(divisor) == 1:
    print(0)

divisor = divisor[1:]

count = 0
for i in divisor:
    if N % i == 0:
        if N // i == 1:
            count += 1
            break
        else:
            N = N // i
            count += 1

print(count)

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())

divisor = sympy.divisors(N)

if len(divisor) == 1:
    print(0)

divisor = divisor[1:]

count = 0
for i in divisor:
    if N % i == 0:
        if N // i == 1:
            count += 1
            break
        else:
            N = N // i
            count += 1

print(divisor)
print(count)

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    divisors.sort()
    return divisors
 
 
a = int(input())
count = 0
c = [1]
while True:
    
    b = make_divisors(int(a))
    if a == 1:
        break
    count += 1
    for i in c:
        if i in b:
            b.remove(i)
    c.append(b[0])
    a /= b[0]
print(count)

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    divisors.sort()
    return divisors
 
 
a = int(input())
count = 0
c = [1]
while True:
    
    b = make_divisors(int(a))
    if a == 1:
        break
    count += 1
    for i in c:
        b.remove(i)
    c.append(b[0])
    a /= b[0]
print(count)

Submission status: Runtime Error

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

    divisors.sort()
    return divisors


a = int(input())
count = 0
c = [1]
while True:
    
    b = make_divisors(int(a))
    if a == 1:
        break
    count += 1
    for i in c:
        b.remove(i)
    c.append(b[0])
    a /= b[0]
print(count)

Submission status: Runtime Error

Solution code:
import sympy

a = int(input())
count = 0
c = [1]
while True:
    
    b = sympy.divisors(int(a))
    if a == 1:
        break
    count += 1
    for i in c:
        b.remove(i)
    c.append(b[0])
    a /= b[0]
print(count)

Submission status: Runtime Error

Solution code:
from numpy import sqrt
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())
fac = factorization(n)
s = 0
for i in fac:
    s += (-1+sqrt(1+4*i[1]*2))//2
print(int(s))

Submission status: Runtime Error

Solution code:
rom numpy import sqrt
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())
fac = factorization(n)
s = 0
for i in fac:
    s += (-1+sqrt(1+4*i[1]*2))//2
print(int(s))

Submission status: Runtime Error

Solution code:
def p_facto(n):
    ret = []
    nc = n
    for i in range(2, nc):
        if i*i > nc:
            break
        if n % i == 0:
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            ret.append([i, ex])
    if n != 1:
        ret.append([n, 1])
    return ret


def main(N):
    ans = 0
    for p, e in pf:
        ex = 1
        while true:
            z = p**ex
            if N % z == 0:
                ans += 1
                N //= z
            else:
                break
            ex += 1
    print(ans)


if __name__ == "__main__":
    N = int(input())
    pf = p_facto(N)
    main(N)

Submission status: Runtime Error

Solution code:
n = int(input())
li = []
if n==1:
  print(0)
else:
  for i in range(1000000):
    if n==1:
      break
    if i==0 or i==1 or n%i!=0:
      continue
    j = i
    cnt = 0
    while(n%j==0):
      if flg==0:
        flg = 1
      n /= j
      cnt += 1
    li.append(cnt)
  if flg==0:
    print(1)
  else:
    ans = 0
    for e in li:
      i = 1
      while(e-i>=0):
        e -= i
        i += 1
        ans += 1
    print(ans)

Submission status: Runtime Error

Solution code:
import sympy

n=int(input())

arr2=sympy.factorint(n)

def cnt(nn):
    if nn<3:
        return 1
    elif nn<6:
        return 2
    elif nn<10:
        return 3
    elif nn<15:
        return 4
    elif nn<21:
        return 5
    elif nn<28:
        return 6
    elif nn<36:
        return 7
    elif nn<45:
        return 8
    elif nn<55:
        return 9
    else:
        return 10
icnt=0
for i in arr2.keys():
    icnt=icnt+cnt(arr2[i])

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

Submission status: Runtime Error

Solution code:
N = int(input())

p = 2
counter = 0
while N != 1:
  ind = 0
  n = -1
  while N % p == 0:
    N //= p
    ind += 1
  while (n+1)(n+2)//2 <= ind:
    n += 1
  counter += n
  p += 1

print(counter)

Submission status: Runtime Error

Solution code:
n = int(input())
"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
# n == 1のとき、[1, 1]を返す
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
num = factorization(n)
kazu = []
for num_i in num:
    cnt = 1 #num_i[0]
    hoge = num_i[0]
    for i in range(num_i[1]):
        cnt *= hoge
        kazu.append(cnt)
kazu.sort()
cnt = 0
ans = 1
while ans <= n:
    ans *= kazu[cnt]
    cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
from math import sqrt
from bisect import bisect


def main():
    N = int(input())
    factor = {}
    max_count = 1
    while N > 1:
        for i in range(2, int(sqrt(N))+1):
            if N % i == 0:
                N = N // i
                if i in factor:
                    factor[i] += 1
                    if max_count < factor[i]:
                        max_count = factor[i]
                else:
                    factor[i] = 1
                break
        else:
            if N in factor:
                factor[N] += 1
                if max_count < factor[i]:
                    max_count = factor[i]
            else:
                factor[N] = 1
            N = 1
    sum_up = [n * (n + 1) // 2 for n in range(max_count+1)]
    ans = 0
    for prime, count in factor.items():
        ans += bisect(sum_up, count)-1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
from statistics import median
N = int(input())
A, B = zip(*tuple(tuple(map(int, input().split())) for _ in range(N)))
print(int((median(B) - median(A)) * (1 + (not N & 1))) + 1)

Submission status: Runtime Error

Solution code:
# Import
from collections import deque

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
class PrimeNumber:
    def __init__(self, N):
        self.N = N
        self.compute()

    def compute(self):
        self.isP, self.P = [True] * N+1, []
        for i in range(2,N+1):
            if self.isP[i]:
                self.P.append(i)
                for j in range(2*i,N+1,i):
                    self.isP[j] = False

N = read_int()

pn = PrimeNumber(1000006)
ans = 0
for p in pn.P:
    cnt = 0
    while N % p == 0:
        N /= p
        cnt += 1
    dec = 1
    while cnt >= dec:
        cnt -= dec
        dec += 1
        ans += 1
if N > 1:
    ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
# Import
from collections import deque

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
class PrimeNumber:
    def __init__(self, N):
        self.N = N
        self.compute()

    def compute(self):
        isP, P = [True] * N+1, []
        for i in range(2,N+1):
            if isP[i]:
                P.append(i)
                for j in range(2*i,N+1,i):
                    isP[j] = False
        self.isP, self.P = isP, P

N = read_int()

pn = PrimeNumber(1000006)
ans = 0
for p in pn.P:
    cnt = 0
    while N % p == 0:
        N /= p
        cnt += 1
    dec = 1
    while cnt >= dec:
        cnt -= dec
        dec += 1
        ans += 1
if N > 1:
    ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
from queue import deque
from math import log2

N = int(input())

primenum = []

for i in range(2, int(log2(N))+1):
    for n in primenum:
        if i % n == 0:
            break
    else:
        primenum.append(i)

kouho_num = set()

for n in primenum:
    for i in range(1, 1e12):
        if n**i <= N:
            kouho_num.add(n**i)
        else:
            break

queue = deque([(N, 0, kouho_num)])

divnum, countnum = 0, 0
pnum = set()

res = 0

while queue:
    divnum, countnum, pnum = queue.popleft()
    if divnum == 1:
        res = max(res, countnum)
        continue
    flag = 1
    for num in pnum:
        if divnum % num == 0:
            queue.append((divnum/num, countnum + 1, pnum - set([num])))
            flag = 0
    if divnum > 1 and flag:
        res = max(res, countnum+1)
print(res)

Submission status: Runtime Error

Solution code:
from queue import deque
from math import log2

N = int(input())

primenum = []

for i in range(2, int(log2(N))+1):
    for n in primenum:
        if i % n == 0:
            break
    else:
        primenum.append(i)

kouho_num = set()

for n in primenum:
    for i in range(1, 1e12+1):
        if n**i <= N:
            kouho_num.add(n**i)
        else:
            break

queue = deque([(N, 0, kouho_num)])

divnum, countnum = 0, 0
pnum = set()

res = 0

while queue:
    divnum, countnum, pnum = queue.popleft()
    if divnum == 1:
        res = max(res, countnum)
        continue
    flag = 1
    for num in pnum:
        if divnum % num == 0:
            queue.append((divnum/num, countnum + 1, pnum - set([num])))
            flag = 0
    if divnum > 1 and flag:
        res = max(res, countnum+1)
print(res)

Submission status: Runtime Error

Solution code:
import math
from collections import Counter
A= int(input())
resArray = []
tmpA = A
i = 1
while i <= math.sqrt(A):
    #print (i)
    i += 1
    if tmpA == 1:
        break

    if i >2 and i %2 == 0:
        continue


    while tmpA % i == 0:
        tmpA = tmpA / i
        resArray.append(i)

res = 0
if tmpA == A:
    print(1)
    exit()
else tmpA > 1:
    res += 1


cArray = Counter(resArray)

for i in cArray.values():
    if i > 0:
        
        tmp = 1
        while tmp*(tmp+1)//2 <= i:
            tmp += 1
        res += tmp -1
print(res)

Submission status: Runtime Error

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

f = factorization(n)
ans = 0
for i in f[1]:
    ans += int((-1+ math.sqrt(1+8*i))/2)
print(ans)

Submission status: Runtime Error

Solution code:
sieve = [True] * (10**6+1)
prime = []
for i in range(2, 10**6):
  if sieve[i]:
    prime.append(i)
    if i < 10**3:
      for j in range(i**2, 10**6, i):
        sieve[j] = False
n = int(input())
if n == 1:
  print(0)
else:
  e = []
  for p in prime:
    if n % p == 0:
      idx = 0
      while n % p == 0:
        n = n // p
        idx += 1
      e.append(idx)
    if n == 1:
        break
  if len(e) > 0:
    total = 0
    for idx in e:
      cnt = 1
      while idx => cnt*(cnt+1)//2:
        cnt += 1
      cnt -= 1
      total += cnt 
    if n == 1:
      print(total)
    else:
      print(total + 1)
  else:
    print(1)

Submission status: Runtime Error

Solution code:
sieve = [True] * 10**6
prime = []
for i in range(2, 10**6):
  if sieve[i]:
    prime.append(i)
    if i < 10**3:
      for j in range(i**2, 10**6, i):
        sieve[j] = False
n = int(input())
if n == 1:
  print(0)
else:
  e = []
  for p in prime:
    if n % p == 0:
      idx = 0
      while n % p == 0:
        n = n // p
        idx += 1
      e.append(idx)
    if n == 1:
        break
  if len(e) > 0:
    total = 0
    for idx in e:
      cnt = 1
      while idx => cnt*(cnt+1)//2:
        cnt += 1
      cnt -= 1
      total += cnt 
    if n == 1:
      print(total)
    else:
      print(total + 1)
  else:
    print(1)

Submission status: Runtime Error

Solution code:
sieve = [True] * 10**6
prime = []
for i in range(2, 10**6):
  if sieve[i]:
    prime.append(i)
    if i < 10**3:
      for j in range(i**2, 10**6, i):
        sieve[j] = False
n = int(input())
if n == 1:
  print(0)
else:
  e = []
  for p in prime:
    if n % p == 0:
      idx = 0
      while n % p == 0:
        n = n // p
        idx += 1
      e.append(idx)
      if n == 1:
        break
  if len(e) > 0:
    total = 0
    for idx in e:
      cnt = 1
      while idx => cnt*(cnt+1)//2:
        cnt += 1
      cnt -= 1
      total += cnt 
    if n == 1:
      print(total)
    else:
      print(total + 1)
  else:
    print(1)

Submission status: Runtime Error

Solution code:
sieve = [True] * 10**6
prime = []
for i in range(2, 10**6):
  if sieve[i]:
    prime.append(i)
    if i < 10**3:
      for j in range(i**2, 10**6, i):
        sieve[j] = False
n = int(input())
if n == 1:
  print(0)
else:
  e = []
  for p in prime:
    if n % p == 0:
      idx = 0
      while n % p == 0:
        n = n // p
        idx += 1
      e.append(idx)
      if n == 1:
        break
  if len(e) > 0:
    total = 0
    for idx in e:
      cnt = 1
      while idx => cnt*(cnt+1)//2:
        cnt += 1
      total += cnt - 1
    if n == 1:
      print(total)
    else:
      print(total + 1)
  else:
    print(1)

Submission status: Runtime Error

Solution code:
sieve = [True] * 10**12
prime = []
for i in range(2, 10**6):
  if sieve[i]:
    prime.append(i)
    for j in range(i**2, 10**12, i):
      sieve[j] = False
n = int(input())
if n == 1:
  print(0)
else:
  e = []
  for p in prime:
    if n % p == 0:
      idx = 0
      while n % p == 0:
        n = n // p
        idx += 1
      e.append(idx)
      if n == 1:
        break
  if len(e) > 0:
    total = 0
    for idx in e:
      cnt = 1
      while idx => cnt*(cnt+1)//2:
        cnt += 1
      total += cnt - 1
    if n == 1:
      print(total)
    else:
      print(total + 1)
  else:
    print(1)

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())

    fp = {}
    i = 1
    tmp = n
    while i * i <= n:
        i += 1
        while tmp % i == 0:
            tmp = int(tmp / i)
            if i in fp.keys():
                fp[i] += 1
            else:
                fp[i] = 1
    if len(fp.keys()) == 0:
        fp[n] = 1
    print(fp)
    import pdb
    pdb.set_trace()

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


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
N = n
ans = 0
d = 0
i = 2
while n>1 and i*i<=N:
  c = 0
  if n % i == 0:
    d == 1
    while n % i == 0:
      n = int(n / i)
      c += 1

    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1

  i += 1
      
    
if n > 1:
  ans = 1
print(ans)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
#include <numeric> 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define int long long int
#define mod 1000000007
#define INT_BITS 16
#define inf 1000000099
#define pi 3.141592
#define watch(x) cout<<(#x)<<"="<<(x)<<"\n" 
#define pb push_back


 set<int> primeFactors(int n) 
{ 
    set<int>us;
    // Print the number of 2s that divide n 
    while (n%2 == 0) 
    { 
        us.insert(2);
        n = n/2; 
    } 
  
    // n must be odd at this point.  So we can skip  
    // one element (Note i = i +2) 
    for (int i = 3; i <= sqrt(n); i = i+2) 
    { 
        // While i divides n, print i and divide n 
        while (n%i == 0) 
        { 
            us.insert(i);
            n = n/i; 
        } 
    } 
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2 
    if (n > 2) 
        us.insert(n); 

    return us;
}


int32_t main()
{
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
  #endif
      int n;
      cin>>n;
       set<int>us=primeFactors(n);
       int count=0;
      for(auto x:us)
      {
        int val=pow(x,1);
        int i=1;
        while(val <= n)
        {
            i++;
            if(n%val==0)
            {
                n/=val;
                count++;
            }
            val=pow(x,i);
        }
        //cout<<x<<" ";
      }
      cout<<count<<endl;
      
}

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    f = set(prime_factorize(n))
    s = set()
    for p in f:
        e = 1
        z = p ** e
        while z <= n:
            if n % z == 0:
                if z not in s:
                    n //= z
                    s.add(z)
            e += 1
            z = p ** e
    print(len(s))
        
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import math

def prime(x):
    if x==1:
        prime=False
    else:
        prime=True
        for i in range(2,int(math.sqrt(x)+1)):
            if x%i==0:
                prime=False
                break
    return prime

def count_prime(N):
    prime_self=False
    
    if prime(N):
        prime_self=True
        p=[]
    else:    
        p=[0 for n in range(int(math.sqrt(N)+1))]
        end=False
        while N>1 and end==False:
            rtN=int(math.sqrt(N)+1)
            for i in range(2,rtN):
                if N%i==0 and prime(i):
                    p[i]+=1
                    N=N//i
                    break
            if prime(N):
                p[N]+=1
                end=True
    return p,prime_self

def main():
    N=int(input())
    p=count_prime(N)[0]
    cnt=0
    for n in range(len(p)):
        num=1
        while p[n]>=1:
            p[n]-=num
            if p[n]>=0:
                cnt+=1
            num+=1
    if count_prime(N)[1]:
        cnt+=1
    print(cnt)
        
if __name__=="__main__":
    main()

Submission status: Runtime Error

Solution code:
import math


def prime_factorization(n):
    result = []

    N = n
    x = 2
    while x <= math.sqrt(N):
        if n % x == 0:
            result.append(x)
            n = n / x

        x += 1

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

    if result.count(result[-1]) > 1:
      result.pop(-1)
        
    return result


N = int(input())

result = prime_factorization(N)

print(len(result))

Submission status: Runtime Error

Solution code:
import math


def prime_factorization(n):
    result = []

    N = n
    x = 2
    while x <= math.sqrt(N):
        if n % x == 0:
            result.append(x)
            n = n / x

        x += 1

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

    if result[-1] == result[-2]:
      result.pop(-1)
        
    return result


N = int(input())

result = prime_factorization(N)

print(len(result))

Submission status: Runtime Error

Solution code:

def f(exponent):
	#reurns how many times a prime raised to exponent can be used
	step = 1
	cumul = 0
	count = 0
	while( cumul <= exponent):
		cumul += step
		count +=1
		step +=1
	return count - (1 if cumul > exponent else 0)

def answer(n):
	if n == 1: return 0
	res = 0
	on = n
	for d in range(2, int(on ** 0.5) + 1)
		if n % d == 0:
			e = 0
			while(n%d == 0): e +=1
			res+= f(e)
		
	return res if n == 1 else 1

print answer(int(raw_input()))

Submission status: Runtime Error

Solution code:

def f(exponent):
	#reurns how many times a prime raised to exponent can be used
	step = 1
	cumul = 0
	count = 0
	while( cumul <= exponent):
		cumul += step
		count +=1
		step +=1
	return count - (1 if cumul > exponent else 0)

def answer(n):
	if n == 1: return 0
	res = 0
	on = n
	for d in range(2, int(on ** 0.5) + 1)
		if n % d == 0:
			e = 0
			while(n%d == 0): e +=1
			res+= f(e)
		d +=1
	return res if n == 1 else 1

Submission status: Runtime Error

Solution code:

def f(exponent):
	#reurns how many times a prime raised to exponent can be used
	step = 1
	cumul = 0
	count = 0
	while( cumul <= exponent):
		cumul += step
		count +=1
		step +=1
	return count - (1 if cumul > exponent else 0)

def answer(n):
	if n == 1: return 0
	res = 0
	on = n
	for d in range(2, int(n ** 0.5) + 1)
		if n % d == 0:
			e = 0
			while(n%d == 0): e +=1
			res+= f(e)
		
	return res if n == 1 else 1

print answer(int(raw_input()))

Submission status: Runtime Error

Solution code:
import math
N = int(input())
p = N
t = 0
for num in range(2,int(math.sqrt(N))+1):
    d = 1
    while N % num**d ==0:
        N //= num**d
        t += 1
        d += 1
if(t==0 and P != 1):
    t = 1
print(t)

Submission status: Runtime Error

Solution code:
from itertools import accumulate


def main():
    n = int(input())
    prime_counter = [0] * n
    acc = tuple(accumulate(range(1, 42)))  # 10^12 < 2^39

    f = 2
    while f * f <= n:
        if n % f == 0:
            n //= f
            prime_counter[f] += 1
        else:
            f += 2
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter:
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
from collections import defaultdict
from itertools import accumulate


def main():
    n = int(input())
    prime_counter = [0] * int(n ** 0.5 + 2)
    acc = tuple(accumulate(range(1, 42)))  # 10^12 < 2^39

    f = 2
    while f * f <= n:
        if n % f == 0:
            n //= f
            prime_counter[f] += 1
        else:
            f += 2
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter:
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
from collections import defaultdict
import math

def soi(num_ref):
    arr = []
    num = num_ref
    for i in range(2, int(math.sqrt(num))+1):
        if num%i == 0:
            cnt = 0
            while num%i == 0:
                cnt += 1
                num //= i
            arr.append([i, cnt])
    if num != 1:
        arr.append({num, 1})
    if arr == []:
        arr.append([num_ref, 1])
    return arr

N = int(input())
if N == 1:
    print(0)
    exit()
arr = soi(N)
cnt = 0
for i in arr:
    minus = 1
    tmp = i[1]
    while(tmp - minus >= 0):
        tmp -= minus
        minus += 1
        cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1000000)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
n = I()
n_z = n # n/z
prime_e = [] # 素数**自然数のリスト
p = 2 # 最初の素数
e = 1

def fermat_test(q):
    if q == 2: return True
    elif q < 2 or q & 1 == 0: return False   # q & 1 == 0 偶数の場合のFalseを返す意。 


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


while p * p <= n: # 素数pの2乗がnより大きいと1回も割れない。
    if n_z % p == 0:
        z = p ** e
        while n_z % z == 0:
            if z not in prime_e:
                n_z = int(n_z / z)
                prime_e.append(z)
            e += 1
            z = p ** e
    p += 1
    e = 1
    while fermat_test(p) == False:
        p += 1
print(len(prime_e)

Submission status: Runtime Error

Solution code:
import math
import decimal


def main():

    N = int(input())
    ans = 0
    A = int(math.ceil(N**0.5)+1)
    explist = []
    flag = False
    if N >= 3:
        for L in range(2, A):
            if N < L:
                break
            d = L
            cnt = 0
            while(True):
                if N % d == 0:
                    N /= d
                    cnt += 1
                    flag = True
                else:
                    break
            explist.append([d, cnt])
        for i in explist:
            c = i[1]
            for j in range(1, A):
                if c >= j:
                    ans += 1
                    c -= j
                    print(c[0])
                else:
                    break
        if flag:
            print(ans)
            return
        else:
            print(1)
            return
    elif N == 2:
        print(1)
        return
    else:
        print(0)
        return


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import numpy as np
import math

def fuctrization(n):
    arr = []
    tmp = n
    for i in range(2,math.ceil(n**(1/2))+1):
        if tmp%i==0:
            j = 0
            while tmp%i==0:
                j += 1
                tmp //= i
            arr.append([i,j])
    if tmp != 1:
        arr.append([tmp,1])
    if arr:
        pass
    else:
        arr.append([n,1])
            
    return arr
            
        
        
n = int(input())
if n == 1:
    print(0)
else:
    arr = fuctrization(n)
    nn = 0
    for i in range(len(arr)):
        k = arr[i][1]
        nnn = 1
        while k-nnn>0:
            k -= nnn
            nnn += 1
            if k-nnn == 0:
                pass
            elif nnn != 1:
                nnn -= 1
        nn += nnn
print(nn)

Submission status: Runtime Error

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

"""
z = p^e where p is a prime number and e = positive int
z divides N
"""

n = int(input())
count = 0

for z in range(2, (n**0.5)+1):
    if n % z == 0:
        n //= z
        count += 1

if n > 2:
    print(count+1)
else:
    print(count)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1000000)
def input():
    return sys.stdin.readline()[:-1]
n = int(input()) # 素数のリスト
n_z = n # n/z
prime_e = []
p = 2 # 最初の素数
e = 1

def fermat_test(q):
    q = abs(q)
    if q == 2: return True
    elif q < 2 or q & 1 == 0:    # q & 1 == 0 偶数の場合の意。 
    # x(int) & y(int)と表記すると2進数表記にしたときに、各桁のどこかが一致する場合は1、どこも一致しない場合は0を返す。
    # 例えば10→2進数:1010と1→2進数:1を比較するとドコモ一致しないので、0が帰ってくる。
    # 2進数表記の偶数は一番下の桁が0のため、2進数表記の1は一致しないため、0が返ってくる。
        return False

while p * p <= n: # 素数pの2乗がnより大きいと1回も割れない。
    # print("current n_z: {}".format(n_z))
    if n_z % p == 0:
        z = p ** e
        while n_z % z == 0:
            n_z = n_z / z
            prime_e.append(z)
            e += 1
            z = p ** e           
    p += 1
    e = 1
    while fermat_test(p) == False:
        # print("{} is Not Prime".format(p))
        p += 1
print(len(prime_e)#, prime_e)

Submission status: Runtime Error

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

"""
z = p^e where p is a prime number and e = positive int
z divides N
"""

def get_primes(up_to=1000):
    primes = []

    A = [True] * (up_to + 2)

    for i in range(2, int(up_to**0.5)+1):
        if A[i]:
            j = i*2
            while j < up_to:
                A[j] = False
                j += i
    
    i = 2

    while i < up_to:
        if A[i]:
            primes.append(i)
        i += 1

    return primes

from math import sqrt

n = int(input())
used = set()
primes = get_primes(int(sqrt(n))+2)
ze = []
for z in primes:
    i = 1
    zval = z**i
    while zval <= n:
        if not(zval in used):
            ze.append(zval)
            used.add(zval)
        i += 1
        zval = z**i

ze.sort()

count = 0

for z in ze:
    if z > n:
        break

    if n % z == 0:
        count += 1
        n //= z

def is_prime(n):
    if n < 2:
        return False
    elif n == 2 or  n == 3:
        return True

    for i in range(2, int(sqrt(n))+2):
        if n % i == 0:
            return False
    return True

#print(primes)
if not ze:
    print(0)
if n > ze[-1]:
    print(count +1)
else:
    print(count)