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 math

N=int(input())

is_prime = [True] * (N+1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(N**0.5) + 1):
    if not is_prime[i]:
        continue
    for j in range(i * 2, N+1, i):
        is_prime[j] = False
A=[i for i in range(N + 1) if is_prime[i]]


a=[]
for i in A:
    if N%i==0:
        a.append(i)

ans=0
for i in a:
    e=int(math.log(N,i))
    x=0
    for j in range(1,100):
        x+=j
        if e>=x:
            ans+=1

print(ans)

Submission status: Runtime Error

Solution code:
import math

N=int(input())
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n+1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def factorization(n,A):
    a=[]
    for i in A:
        if n%i==0:
            a.append(i)
    return a

A=primes(N)
a=factorization(N,A)

ans=0
for i in a:
    e=int(math.log(N,i))
    x=0
    for j in range(1,100):
        x+=j
        if e>=x:
            ans+=1

print(ans)

Submission status: Runtime Error

Solution code:
import math

N=int(input())
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n+1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def factorization(n,A):
    a=[]
    for i in A:
        if n%i==0:
            a.append(i)
    return a

A=primes(N)
print(1)
a=factorization(N,A)
print(2)

ans=0
for i in a:
    e=int(math.log(N,i))
    x=0
    for j in range(1,100):
        x+=j
        if e>=x:
            ans+=1

print(ans)

Submission status: Runtime Error

Solution code:
import collections
import bisect
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))
sums = []
s=1
ans = 0
if c.values():
  while s <= max(c.values()):
    sums.append(s)
    s += s+1
  for v in c.values():
    idx = bisect.bisect_left(sums,v)
    
    if idx <= len(c.values()):
      if sums[idx] == v:
        ans += idx+1
      else:
        ans += idx
    else:
      ans += max(sums)
print(ans)

Submission status: Runtime Error

Solution code:
import sympy
n = int(input())
p = sympy.divisors(n)
x = 0
i = 1
ans = 0
def countf(x):
    for j in range(1,x+2):
        if (1+j)*j//2 > x:
            return j - 1
while n != 1:
    if n % p[i] == 0:
        x += 1
        n = n // p[i]
    else:
        if x != 0:
            ans += countf(x)
            x = 0
        i += 1
ans += countf(x)
print(ans)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, n) for (long long i = 0; i < (long long)(n); i++)
using Graph = vector<vector<int>>;
using ll = long long;

//----------素因数分解----------
vector<ll> prime_factorization(ll n){
  vector<ll> factors(n+1,0);
  rep3(i,n+1){
    if(i<=1) continue;
    while(n%i==0){
      n/=i;
      factors[i]++;
    }
  }
  return factors;
}

int main() {
  ll n;
  cin>>n;
  auto factors=prime_factorization(n);
  sort(factors.begin(),factors.end());
  reverse(factors.begin(),factors.end());
  int cnt=0;
  rep3(i,n+1){
    if(factors[i]==0) break;
    while(factors[i]-j>=0){
      factors[i]-=j;
      cnt++;
      j++;
    }
  }
  cout<<cnt<<endl;
}

Submission status: Runtime Error

Solution code:
n = int(input())

fact={}
i = 2
while n != 1:
    if n % i == 0:
        n = n/i
        if i in fact:
            fact[i] += 1
        else:
            fact[i] = 1
    else:
        i += 1
    if i > (n**(1/2)+1):
        fact[n] =1
        break

#print(fact)
if fact == {}:
    print(0)
else:
    ans = 0
    for v in fact.values():
        #print(v)
        for i in range(1,v+1):
            if v - i >= 0:
                ans +=1
                v = v-i
                
print(ans)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, n) for (long long i = 0; i < (long long)(n); i++)
using Graph = vector<vector<int>>;
using ll = long long;


int main() {
    ll n;
    cin>>n;
    vector<ll> ns(n,0);
    rep(i,n+1){
        if(i==0){
            continue;
        }
        if(i==1){
            continue;
        }
        bool d=true;
        rep(j,sqrt(i)){
            if(j==0) continue;
            if(j==1) continue;
            if(i%j==0){
                d=false;
            }
        }
        if(d==false) continue;
        ll m=n;
        if(n%i==0){
            while(m%i==0){
                m/=i;
                ns[i]++;
            }
        }
    }
    ll cnt=0;
    rep(i,n+1){
        if(ns[i]==0) continue;
        int j=1;
        while(ns[i]-j>=0){
            ns[i]-=j;
            cnt++;
            j++;
        }
    }
    cout<<cnt<<endl;
}

Submission status: Runtime Error

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

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


#12だったら[[2,2],[3,1]]みたいな、[素因数、次数]みたいに格納したい

import sys
import math
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#######ここから天ぷら########
from math import sqrt
def eratosu(n):
  if not isinstance(n,int):
    raise TypeError("nがint型になってねえぞ")
  if n<2:
    raise ValueError('nが2よりちっちぇえぞ')
  prime = []
  limit = sqrt(n)
  data = [i+1 for i in range(1, n)]  #2,3,4,...,n
  while True:
    p = data[0]
    if limit <= p:
        return prime + data
    prime.append(p)
    data = [e  for e in data if e % p != 0]
def bunkai(n):
    if n==2:
        return [[2,1]]
    if n==3:
        return [[3,1]]
    ans=[]
    temp=n
    #そんな早くしなくてよかったり、何回もするわけじゃないなら、
    #for i in range(2,int(sqrt(n))+1): とかで
    primelist=eratosu( int(sqrt(n)) )
    for i in primelist:
        if temp % i ==0:
            ji=0
            while temp%i==0:
                ji+=1
                temp//=i
            ans.append([i,ji])
    if ans==[]:return([n,1])  #素数のとき
    if temp!=1:
        ans.append([temp,1])  #4*5882353とか
    return ans

a=bunkai(n)
ans=0
import bisect as bi
p=[1,3,6,10,15,21,28,36,45,55]
for l in a:
  q=l[1]
  ans+=bi.bisect_right(p,q)
print(ans)

Submission status: Runtime Error

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

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


#12だったら[[2,2],[3,1]]みたいな、[素因数、次数]みたいに格納したい

import sys
import math
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#######ここから天ぷら########
from math import sqrt
def eratosu(n):
  if not isinstance(n,int):
    raise TypeError("nがint型になってねえぞ")
  if n<2:
    raise ValueError('nが2よりちっちぇえぞ')
  prime = []
  limit = sqrt(n)
  data = [i+1 for i in range(1, n)]  #2,3,4,...,n
  while True:
    p = data[0]
    if limit <= p:
        return prime + data
    prime.append(p)
    data = [e  for e in data if e % p != 0]
def bunkai(n):
    ans=[]
    temp=n
    #そんな早くしなくてよかったり、何回もするわけじゃないなら、
    #for i in range(2,int(sqrt(n))+1): とかで
    primelist=eratosu( int(sqrt(n)) )
    for i in primelist:
        if temp % i ==0:
            ji=0
            while temp%i==0:
                ji+=1
                temp//=i
            ans.append([i,ji])
    if ans==[]:return([n,1])  #素数のとき
    if temp!=1:
        ans.append([temp,1])  #4*5882353とか
    return ans

a=bunkai(n)
ans=0
import bisect as bi
p=[1,3,6,10,15,21,28,36,45,55]
for l in a:
  q=l[1]
  ans+=bi.bisect_right(p,q)
print(ans)

Submission status: Runtime Error

Solution code:
is_Prime = [True] * (10**6 + 1)
is_Prime[0] = False
is_Prime[1] = False
for i in range(2, int(10**3)+1):
    for j in range(2*i, 10**6+1, i):
        if j % i == 0:
            is_Prime[j] = False
P = [i for i in range(n+1) if is_Prime[i]]

N = int(input())
count = 0
for p in P:
    count_p = 0
    while N % p == 0:
        count_p += 1
        N /= p
    count += int((-1+(1+8*count_p)**(1/2))/2)
    if p == P[-1] and N != 1:
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
import sympy
N = int(input())
p_list = list(sympy.primerange(2,1000000))
print(p_list)
cnt = 0
for i in range(10000):
    j = 1
    while N % (p_list[i] ** j) == 0:
        cnt += 1
        N = N / (p_list[i] ** j)
        j += 1
    a = sympy.isprime(N)
    if a == True:
        cnt += 1
        break
print(cnt)

Submission status: Runtime Error

Solution code:
n = int(input())

lst = [1] * (n + 1)
if n == 1:
  print(0)
else:
  count = 0
  num = n
  for i in range(2, n + 1):
    if lst[i] == 0:
      continue
    for j in range(i, n + 1, i):
      lst[j] = 0
      if num % j == 0:
        num /= j
        count += 1
      if num % j == num:
        break
    if num == 1:
      break
  print(count)

Submission status: Runtime Error

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

temp = factorization(N)
temp = sorted(temp, key= lambda x: x[0])

output_set = []
output = [ output_set + [t[0]]*t[1] for t in temp ]


count = 0
for i in output:
    temp = len(i)
    sums = 0
    for t in range(1,temp+1):
        sums += t
        if temp >= sums:
            count += 1

print(count)

Submission status: Runtime Error

Solution code:
a

Submission status: Runtime Error

Solution code:
N = int(input())

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

ans = []
end = int(N ** (1/2))
for i in range(2, end + 1):
    while N % i == 0:
        ans.append(i)
        N = N // i

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

count = 0
trans = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55]

res = 0
for i in range(len(ans) - 1):
    if ans[i] != ans[i+1]:
        for j in range(len(trans)):
            if count > trans[j]:
                continue
            else:
                res += (j + 1)
                break
        count = 1
    else:
        count += 1

if ans[-1] == ans[-2]:
    if ans[-1] == ans[0]:
        count += 1
    for j in range(len(trans)):
        if count > trans[j]:
            continue
        elif count == trans[j]:
            res += (j + 1)
            break
        else:
            res += (j)
            break
else:
    res += 1

print(res)

Submission status: Runtime Error

Solution code:
import math

#引数nが素数かどうかを判定
def is_prime(n):
    for i in range(2, int(math.sqrt(n))+1):
        if n%i == 0:
            return False
    return True

def getPrimeExp(n):
    array = [True]*(n+1)
    result = []
    for i in range(2, n+1):
        if array[i]:
            array[i] = False
            result.append(i)
            for j in range(2, n+1):
                ij = i**j
                if ij <= n and array[ij]:
                    result.append(ij)
                    array[ij] = False
                elif ij > n:
                    break
            for j in range(i*2, n+1, i):
                array[j] = False

            # for j in range(2, n):
            #     ij = i**j
            #     if ij <= n:
            #         result.append(ij)
            #         array[ij] = False
    return sorted(result)

N = int(input())
if is_prime(N):
    print(1)
else:
    cnt = 0
    primeExp = getPrimeExp(N) 
    n = N
    # print(primeExp)
    for z in primeExp:
        if n%z == 0:
            n = int(n/z)
            cnt += 1
    print(cnt)

Submission status: Runtime Error

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 a == 1:
  print(0)
  exit()
a = factorization(N)
cnt = 0
for i in a:
  temp = i[1]-1
  d = 2
  while temp>=d:
    temp -= d
    d += 1
  cnt+=d-1
print(cnt)

Submission status: Runtime Error

Solution code:
from collections import deque
def main():
    N,M,*AB=map(int,open(0).read().split())
    g=[[] for _ in range(N+1)]
    for a,b in zip(*[iter(AB)]*2):
        g[a].append(b)
        g[b].append(a)
    q=deque([1])
    s=[0]*(N+1)
    s[1]=1
    while q:
        u=q.popleft()
        for v in g[u]:
            if not s[v]:
                s[v] = u
                q.append(v)
    print("Yes")
    print("\n".join(map(str, s[2:])))
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6 + 5;

bool ar[N];
vector<int> prime;

void sieve() {
    fill_n(ar, N, 1);
    ar[0] = ar[1] = 0;
    for (int i = 4; i < N; i+=2) ar[i] = 0;
    for (int i = 3; i*i < N; i+=2) {
        if (not ar[i]) continue;
        for (int j = i*i; j < N; j+=i) ar[j] = 0;
    }
    prime.push_back(2);
    for (int i = 3; i < N; i+=2) {
        if (ar[i]) prime.push_back(i);
    }
}

int main() {
    sieve();

    ll n;
    scanf("%lld", &n);

    auto tmp = n;
    int indx = 0;
    map<ll,int> factor;
    while(tmp != 1) {
        if ((ll) prime[indx]*prime[indx] > tmp) break;
        while(tmp%prime[indx] == 0) {
            tmp = tmp/prime[indx];
            factor[prime[indx]]++;
        }
        indx++;
    }
    if (tmp != 1) factor[tmp] = 1;
    int cnt = 0;
    for (auto p : factor) {
        for (int i = 1; ; ++i) {
            if ((i*(i+1))/2 > p.second) {
                cnt += i-1;
                break;
            }
        }
    }
    printf("%d\n", cnt);
    
}

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#define int long long
#define ss second
#define ff first
using namespace std;

signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;

    vector<pair<int,int>> primes;
    set<int> nums;

    for(int i=2; i*i <= n; i++){
        if(n%i == 0){
            int qtd = 0;
            while(n%i == 0) n/=i, qtd++;
            primes.push_back({i,qtd});
        }
    }
    
    if(n > 1) primes.push_back({n,1});

    for(pair<int,int> &x: primes){
        int prime = x.first, factor = x.second, cnt = 1;
        while(factor >= cnt){
            nums.insert(prime);
            factor -= cnt;
            cnt++;
            prime = pow(x.first,cnt);
        }
    }

    cout<<nums.size()<<endl;
    // for(int x: nums) cout<<x<<" ";
    // cout<<endl;
}

Submission status: Runtime Error

Solution code:
from itertools import groupby
n =int(input())

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n%i == 0:
      n //= i
      table.append(i)
      i += 1
  if n > 1:
    table.append(n)
  return table

from itertools import groupby
ans = 0
p = prime_decomposition(n)
for k,g in p:
  gn = len(list(g))
  for i in range(1,1000000000000):
    gn -= i
    if gn >= 0:
      ans += 1
    else:
      break
print(ans)

Submission status: Runtime Error

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





n=int(input(""))

if(n!=1):
    

    s=0

    t=0
    lista=prime(n)
    aa=len(lista)
    c=lista[0]
    for i in lista:
        if (c==i):
            t+=1
        else:
            k=1
            while(t>=k):
                t-=k
                s+=1
                k+=1
            t=1
            c=i

    if(t!=1):
        k=1
        while(t>=k):
            t-=k
            s+=1
            k+=1
        


            
        
        
    
    
if(n==1):
    s==0

print(s)

Submission status: Runtime Error

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








n=int(input(""))

s=0

t=0
lista=prime(n)
aa=len(lista)
c=lista[0]
for i in lista:
    if (c==i):
        t+=1
    else:
        k=1
        while(t>=k):
            t-=k
            s+=1
            k+=1
        t=1
        c=i

if(t!=1):
    k=1
    while(t>=k):
        t-=k
        s+=1
        k+=1
    


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

    print(s)

Submission status: Runtime Error

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








n=int(input(""))
if(n==1):
    print(0)
s=0

t=0
lista=prime(n)
aa=len(lista)
c=lista[0]
for i in lista:
    if (c==i):
        t+=1
    else:
        k=1
        while(t>=k):
            t-=k
            s+=1
            k+=1
        t=1
        c=i

if(t!=1):
    k=1
    while(t>=k):
        t-=k
        s+=1
        k+=1
    


        
    
    
    
    
    

print(s)

Submission status: Runtime Error

Solution code:
import math
a=int(input())
b=[]
ans=0
for i in range(1,int(math.sqrt(a)),1):
  if a%i==0:
    b=b+[i]+[int(a/i)]
b.remove(1)
for i in b:
  cnt=0
  if a%i==0:
    while a%i==0:
      cnt+=1
      a=a/i
    ans+=(math.sqrt(2*cnt+0.25)-0.5)//1
print(int(ans))

Submission status: Runtime Error

Solution code:
import numpy as np
import math
from decimal import *
#from numba import njit

def getVar():
    return map(int, input().split())
def getArray():
    return list(map(int, input().split()))
def getNumpy():
    return np.array(list(map(int, input().split())), dtype='int64')

def factorization(n):
    d = {}
    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
            d.append({i, cnt})

    if temp!=1:
        d.append({temp, 1})

    if d==[]:
        d.append({n, 1})

    return d

def main():
    N = int(input())
    d = factorization(N)
    count = 0

    for v in d.values():
        i = 1
        while(v >= i):
            v -= i
            i += 1
            count += 1
        
    print(count)


main()

Submission status: Runtime Error

Solution code:
import numpy as np
import math
from decimal import *
import sympy
#from numba import njit

def getVar():
    return map(int, input().split())
def getArray():
    return list(map(int, input().split()))
def getNumpy():
    return np.array(list(map(int, input().split())), dtype='int64')

def main():
    N = int(input())
    d = sympy.factorint(N)
    count = 0

    for v in d.values():
        i = 1
        while(v >= i):
            v -= i
            i += 1
            count += 1
        
    print(count)


main()

Submission status: Runtime Error

Solution code:
from collections import Counter

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

Submission status: Runtime Error

Solution code:
import numpy as np

def is_prime(n):
    nmax = np.sqrt(n)
    nmax = nmax.astype(np.int64) + 1
    for i in range(2, nmax):
        if(n%i)==0:
            return False
    return True

def pf(n):
    sn = np.sqrt(n).astype(np.int64) + 1
    ps = []
    for i in range(1, sn):
        if (n%i)==0:
            ps.append(i)
            ps.append(int(n/i))
    del ps[0]
    return ps        

n = int(input())
ps = []
num = pf(n)
for i in num:
    if is_prime(i):
        ps.append(i)
        
zs = []        
for p in ps:
    z = p
    while(z<=n):
        zs.append(z)
        z *= p
zs.sort()
cnt = 0
for z in zs:
    if(n>1):
        if(n%z==0):
            n /= z
            cnt += 1
print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T1, class T2> using P = pair<T1, T2>;
using I = int;
using D = double;
using B = bool;
using C = char;
using S = string;
using LL = long long;
using LD = long double;
using ULL = unsigned long long;
using PII = P<I, I>;
using VPII = V<PII>;
using PLL = P<LL, LL>;
using VPLL = V<PLL>;
using VI = V<I>;
using VVI = VV<I>;
using VLL = V<LL>;
using VVLL = VV<LL>;
using VC = V<C>;
using VVC = VV<C>;
using VS = V<S>;
using VVS = VV<S>;
using VB = V<B>;
using VVB = VV<B>;
#define REP(type, i, n) for (type i = 0; i < (type)(n); ++i)
#define REP2(type, i, m, n) for (type i = (m); i < (type)(n); ++i)
#define REPR(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define REPR2(type, i, m, n) for (type i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a, type) sort(ALL(a), G<type>())
#define REVERSE(a) reverse(ALL(a))
#define SIZE(a, type) ((type)(a).size())
#define bit_search(bit, n) REP(LL, bit, 1LL<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REPx(&x, a) cin >> x;
#define INPUTP(a) REPx(&x, a) cin >> x.first >> x.second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n, PER) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(roop, n) a[idx][roop] = v[roop]; idx++;} while(next_permutation(ALL(v))); PER = a;} while(0); // int fact(), VVI PERを宣言しておく、n=10が限界(500 ms)
#define ENDL cout << endl;

const int INF = 2e9;
const LL MOD = 1e9 + 7;

template<class T> using PRIORITY_QUEUE = priority_queue< T, V<T>, greater<T> >;
template<class T> inline bool chmin(T &a, T b){if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b) {a = b; return true;} return false;}
template<class T> inline void debug1(V<T> A){REP(int, i, SIZE(A, int)){if (A[i] == INF) cout << "I ";else cout << A[i] << " ";}ENDL}
template<class T> inline void debug2(VV<T> A){REP(int, i, SIZE(A, int)){REP(int, j, SIZE(A[i], int)){if (A[i][j] == INF) cout << "I "; else cout << A[i][j] << " ";}ENDL}}

template<class T>
void prime_factorize(T n, VPLL &res)
{
  // 素因数分解する。計算量はO(√N)。
  for (T s = 2; n >= s * s; s += 2)
  {
    T e = 0;
    if (n % s == 0)
    {
      while(n % s == 0)
      {
        n /= s;
        e++;
      }
      res.emplace_back(s, e);
    }
    if (s == 2) s--;
  }
  if (n != 1) res.emplace_back(n, 1);
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  LL n;
  cin >> n;
  VPLL res;
  prime_factorize(n, res);
  LL ans = 0;
  REPx(x, res)
  {
    LL a = x.first, b = x.second;
    LL ct = 1;
    while(b)
    {
      if (b >= ct)
      {
        ans++;
        b -= ct++;
      }
      else break;
    }
  }
  cout << ans << endl;

  return 0;
}

Submission status: Runtime Error

Solution code:
n=int(input())
ans=0
for s in range(2,10*12)
 while n>0:
  if  n%s==0:
    n=n/s
    s=s*s
    ans+=1
  else:
    s=s+2

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<ll> prime={2};
bool seive[(int)2e6];
ll power(ll a, ll b){
    ll s=1;
    while(b--){
        s*=a;
    }
    return s;
}
void prim(){
    for(int i=3; i<1e3; i+=2){
        if(seive[i]==0){
            prime.emplace_back(i);
            for(int j=i*i; j<1e3; j+=i)seive[i]=1;
        }
    }
    for(int i=1001; i<1e6; i+=2)if(seive[i]==0)prime.emplace_back(i);
}
int main()
{
    prim();
    ll n,cnt=0;
    cin>>n;
    int i=0,k=1;
    while(n){
        ll tosee=power(prime[i], k);
        if(tosee>n)break;
        while(n%tosee==0){
            n/=tosee;
            cnt++;
            tosee = power(prime[i],++k);
        }
        i++; k=1;
    }
    cout<<cnt<<'\n';
}

Submission status: Runtime Error

Solution code:
import numpy as np
n=int(input())
count=[1]*(n+1)
x=[]#素因数格納
for i in range(2,n+1):
  if n%i==0 and count[i]==1:
    x.append(i)
    for j in range(2*i,n+1,i):
      count[j]=0
y=[]#指数
for i in x:
  c=1
  while n%(i**(c+1))==0:
    c+=1
  y.append(c)

def judge(y):
  i=1
  while np.arange(i+2).sum()<=y:
    i+=1
  return i
ans=0
for i in range(len(y)):
  ans+=judge(y[i])
print(ans)

Submission status: Runtime Error

Solution code:
import math

def factors(n):
    l = int(math.sqrt(n)) + 1
    ret = {}
    nf2 = 0
    while n % 2 == 0:
        nf2 += 1
        n //= 2
    if nf2 != 0:
        ret[2] = nf2
    nf3 = 0
    while n % 3 == 0:
        nf3 += 1
        n //= 3
    if nf3 != 0:
        ret[3] = nf3
    # n = append_factors(n, ret, 2)
    # n = append_factors(n, ret, 3)
    i = 6
    while i*i <= n + 1:
        p1, p2 = i - 1, i + 1
        nf01 = 0
        while n % p1 == 0:
            nfp1 += 1
            n //= p1
        if nfp1 != 0:
            ret[p1] = nfp1
        nfp2 = 0
        while n % p2 == 0:
            nfp2 += 1
            n //= p2
        if nfp2 != 0:
            ret[p2] = nfp2
        # n = append_factors(n, ret, i - 1)
        # n = append_factors(n, ret, i + 1)
        i += 6
    if n != 1:
        ret[n] = 1

    return ret

def minimum_sum(x):
    # find the minimum integer n where n(n+1)/2 <= x
    # n^2 < n(n+1) <= 2x < (n+1)(n+2) < (n+2)^2

    n = int(math.sqrt(x))
    while (n + 1)*(n + 2) <= 2*x:
        n += 1

    return n

def main():
    N = int(input())
    fs = factors(N)
    # print(fs)
    ans = 0
    for f in fs:
        ans += minimum_sum(fs[f])
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import math

def append_factors(n, f, p):
    num_factors = 0
    while n % p == 0:
        num_factors += 1
        n //= p
    if num_factors != 0:
        f[p] = num_factors
    return n

def factors(n):
    l = int(math.sqrt(n)) + 1
    ret = {}
    n = append_factors(n, ret, 2)
    n = append_factors(n, ret, 3)
    i = 6
    while i*i <= n + 1:
        p1, p2 = i - 1, i + 1
        n = append_factors(n, ret, i - 1)
        n = append_factors(n, ret, i + 1)
        i += 6
    if n != 1:
        append_factor(ret, n)

    return ret

def minimum_sum(x):
    # find the minimum integer n where n(n+1)/2 <= x
    # n^2 < n(n+1) <= 2x < (n+1)(n+2) < (n+2)^2

    n = int(math.sqrt(x))
    while (n + 1)*(n + 2) <= 2*x:
        n += 1

    return n

def main():
    N = int(input())
    fs = factors(N)
    # print(fs)
    ans = 0
    for f in fs:
        ans += minimum_sum(fs[f])
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def append_factor(f, p):
    if p not in f:
        f[p] = 0
    f[p] += 1

def factors(n):
    l = int(math.sqrt(n)) + 1
    ret = {}
    while n % 2 == 0:
        append_factor(ret, 2)
        n //= 2
    while n % 3 == 0:
        append_factor(ret, 3)
        n //= 3
    i = 6
    while i*i <= n:
        while n % (i - 1) == 0:
            append_factor(ret, i - 1)
            n //= (i - 1)
        while n % (i + 1) == 0:
            append_factor(ret, i + 1)
            n //= (i + 1)
        i += 6
    if n != 1:
        append_factor(ret, n)

    return ret

def minimum_sum(x):
    # find the minimum integer n where n(n+1)/2 <= x
    # n^2 < n(n+1) <= 2x < (n+1)(n+2) < (n+2)^2

    n = int(math.sqrt(x))
    while (n + 1)*(n + 2) <= 2*x:
        n += 1

    return n

def main():
    N = int(input())
    fs = factors(N)
    # print(fs)
    ans = 0
    for f in fs:
        ans += minimum_sum(fs[f])
    print(ans)

if __name__ == '__main__':
    main()