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: Wrong Answer

Solution code:
from sys import stdin
from math import sqrt
input = stdin.readline

N = int(input())

s = set([])

ans = 0

seen = [0] * 10 ** 7

for i in range(2, int(sqrt(N)) + 1):
    tmp = i

    while tmp < N + 1:
        s.add(tmp)
        tmp *= i

lis = list(s)
lis.sort()

# print(lis)

for l in lis:
    if N % l == 0:
        ans += 1
        N //= l

for i in range(2, int(sqrt(N)) + 1):
    if N % i == 0:
        print(ans)
        exit()

if N != 1 and N not in lis:
    ans += 1

print(ans)

Submission status: Wrong Answer

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


def get_knu(a):
    if a == 1:
        return 1
    before = 1
    n = 2
    while True:
        knum = (n * (n + 1)) // 2
        if a == knum:
            return n
        elif knum > a > before:
            return a - 1
        else:
            n += 1
            before = knum


D = int(input())
p = get_prime_fact(D)

if len(p) != len(set(p)):
    res = 0
    for n in set(p):
        count = p.count(n)
        if count == 1:
            res += 1
        else:
            res += get_knu(count)

    print(res)
else:
    print(len(p))

Submission status: Wrong Answer

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

#main
n = int(input())
B=[0,1]
for i in range(1,11):
    for j in range(i):
        B.append(i)

A=factorization(n)

ans=0
for i in A:
    ans+=B[i[1]]

if n==1:
    ans=0

print(ans)

Submission status: Wrong Answer

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())
ans = -1
for i in factorization(n):
    ans = ans + i[1]
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
num=1
count=0
num2=int(math.sqrt(n))
while num<=num2:
    num+=1
    if n%num==0:
        count+=1
        n=n//num
if count==0:
    count=1
print(count)

Submission status: Wrong Answer

Solution code:
from functools import reduce
from decimal import *
from operator import mul

def main():
    n = int(input())
    p = prime_factorize(n)
    ans = []
    i = 1
    for v in p:
        i *= v
        if i not in ans:
            ans.append(i)
            i = 1
    sa = list(sorted(ans))

    count = 0
    for v in sa:
        n = int(n/v)
        count += 1
        if n == 1:
            break
    print(count)

def input_list():
    return list(map(int, input().split()))

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

Submission status: Wrong Answer

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


def primes(n):
    ps = {}
    for i in range(2, int(n ** 0.5) + 20):
        if n == 1:
            break
        if n % i == 0:
            cnt = 0
            while n % i == 0:
                n = n // i
                cnt += 1

            ps[i] = cnt

    return ps


def main():
    n = int(input())
    if n == 1:
        print(0)
        exit()

    if is_prime(n):
        print(1)
        exit()

    ps = primes(n)

    ans = sum([int((-1 + (1 + 8 * v) ** 0.5) / 2) for v in ps.values()])
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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())
l_a = factorization(N) 
cnt = 0
for i in l_a:
  cnt += int(((1 + 8 * i[1]) ** .5 - 1) / 2 )
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
factors = []
f = 2
while n%f == 0:
    n //= f
    factors.append(f)
    f *= f

for f in range(3, int(n**0.5)+ 1, 2):
    while n%f == 0:
        factors.append(f)
        n //= f
        f *= f

if n != 1 and not n in factors:
    factors.append(n)

print(len(factors))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# vim: set fileencoding=utf-8

# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation


"""Module docstring
"""

import functools
import heapq
import itertools
import logging
import math
import os
import random
import string
import sys
from argparse import ArgumentParser
from collections import defaultdict, deque
from copy import deepcopy
from io import BytesIO, IOBase
from itertools import compress
from typing import Dict, List, Optional, Set, Tuple


def count(prime_divisors: Dict[int, int]) -> int:
    result = 0
    for e in prime_divisors.values():
        result += int((math.sqrt(1 + 8 * e) - 1) / 2)
    return result


def primes(n):
    """ Returns  a list of primes < n for n > 2 """
    sieve = bytearray([True]) * (n // 2)
    for i in range(3, int(n ** 0.5) + 1, 2):
        LOG.debug((i))
        if sieve[i // 2]:
            sieve[i * i // 2 :: i] = bytearray((n - i * i - 1) // (2 * i) + 1)
    return [2, *compress(range(3, n, 2), sieve[1:])]


def solve(nb: int) -> int:
    if nb == 1:
        return 0
    prime_divisors = defaultdict(int)
    while not nb % 2:
        prime_divisors[2] += 1
        nb //= 2
    cur = nb
    for i in range(3, math.ceil(math.sqrt(nb + 1)) + 2, 2):
        if cur == 1:
            break
        while not cur % i:
            prime_divisors[i] += 1
            cur //= i
    # LOG.debug((prime_divisors))
    if not prime_divisors:
        return 1
    return count(prime_divisors)


def do_job(stdin, stdout):
    "Do the work"
    LOG.debug("Start working")
    N = int(stdin.readline().strip())
    # values = []
    # for _ in range(N):
    #     values.append(stdin.readline().split())
    result = solve(N)
    print(result, file=stdout)


def print_output(testcase: int, result, stdout) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case #{}: {}".format(testcase + 1, result), file=stdout)
    # 6 digits float precision {:.6f} (6 is the default value)
    # print("Case #{}: {:f}".format(testcase + 1, result), file=stdout)


BUFSIZE = 8192


class FastIO(IOBase):
    # pylint: disable=super-init-not-called, expression-not-assigned
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    # pylint: disable=super-init-not-called
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def configure_log() -> None:
    "Configure the log output"
    log_formatter = logging.Formatter("L%(lineno)d - " "%(message)s")
    handler = logging.StreamHandler(IOWrapper(sys.stderr))
    handler.setFormatter(log_formatter)
    LOG.addHandler(handler)


LOG = None
# for interactive call: do not add multiple times the handler
if not LOG:
    LOG = logging.getLogger("template")
    configure_log()


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    parser = ArgumentParser()
    parser.add_argument(
        "-v",
        "--verbose",
        dest="verbose",
        action="store_true",
        default=False,
        help="run as verbose mode",
    )
    args = parser.parse_args(argv)
    if args.verbose:
        LOG.setLevel(logging.DEBUG)
    stdin = IOWrapper(sys.stdin)
    stdout = IOWrapper(sys.stdout)
    do_job(stdin, stdout)
    stdout.flush()
    for h in LOG.handlers:
        h.flush()
    return 0


if __name__ == "__main__":
    sys.exit(main())

Submission status: Wrong Answer

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

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

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

    return arr

n=int(input())
if n==1:
    print(0)
    exit()
ans=0
t=factorization(n)
for i in range(len(t)):
    if t[i][1]%2==0:
        ans+=t[i][1]//2
    else:
        ans+=(t[i][1]+1)//2

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
count=0
L=[]
if n==1:
    print(0)
    exit()
for i in range(2,-int(-(n**0.5))):
    if n%i==0:
        n //= i
        L.append(i)
        count += 1
if n not in L:
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
import math
def eratos(n):
    isprime = [True for i in range(n+1)]
    isprime[0] = False
    isprime[1] = False
    for i in range(2, int(math.sqrt(n))+13):
        if isprime[i]:
            j = i + i
        while j <= n:
            isprime[j] = False
            j = j + i
    return isprime
N = int(input())
ans = 0
is_prime = eratos(10**6)
for i in range(2, 10**6+1):
    if not is_prime[i]:
        continue
    x = i
    while N % x == 0:
        ans += 1
        N //= x
        x += i
        # print(N)
if ans == 0 and N != 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

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())
ans = 0
for i in factorization(n):
    ans = ans + i[1]
print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

P = factorization(N)

flag = 0

for i in range(len(P)):
  for j in range(40):
    P[i][1] = P[i][1] - (j + 1)
    if P[i][1] >= 0:
      flag += 1
    else:
      break
      
print(flag)

Submission status: Wrong Answer

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())
count = 0
primelist = factorization(n)
#print(primelist)
for i in range(len(primelist)):
  for j in range(40):
    if j*(j+1)/2 > primelist[i][1]:
      count += (j-1)
      break
print(count)

Submission status: Wrong Answer

Solution code:
import math
#試し割法
def trial_division(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 = trial_division(int(input()))

key = []
val = []

dupli = set()
for i in range(len(N)):
    if (not N[i] in dupli):
        key.append(N[i])
        dupli.add(N[i])

for i in range(len(key)):
    val.append(N.count(key[i]))

sum = 0
for i in range(len(key)):
    count = 1
    length = val[i]
    if (length < 3):
        sum += 1
    else:
        while(length > 0):
            sum += 1
            length -= count
            count += 1

print(sum)

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=0
i=1
k=1
while N % (2**i) == 0:
  ans+=1
  N=N//2
  i+=1
f=3
while f <= N:
  if N % (f**k) == 0:
    ans+=1
    k+=1
  else:
    f += 2
    k=1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)


n=int(input().rstrip())
a=[]
tmp=n
for i in range(2,int(n**0.5)+1):
    if tmp%i==0:
        while tmp%i==0:
            a.append(i)
            tmp//=i
#print(a)
s=set()
t=1
for i in a:
    if i not in s:
        s.add(i)
    else:
        t*=i
        if t not in s:
            s.add(t)
            t=1
    #print(t,s)
if t not in s and t!=1:
    s.add(i)
print(max(len(s),1))

Submission status: Wrong Answer

Solution code:

N = int(input())

import math


n = math.sqrt(N) + 1

cm = []
idx = 2
while True:
    if N % idx == 0:
        N //= idx
        cm.append(idx)
    else:
        idx += 1
     
    if N == 1:
        break
        
    if idx > n+1:
        print(1)
        exit()

#print(cm)

su = [0] * 1000
s = 0
for i in range(1, 40+1):
    s += i
    #print(s)
    su[s] = i
    
#print(su)

f = 0
for i in range(1000):
    if su[i] == 0:
        su[i] = f
    else:
        f = su[i]

#print(su)

count = 0
for i in list(set(cm)):
    #print(cm.count(i))
    count += su[cm.count(i)]

    
print(count)

Submission status: Wrong Answer

Solution code:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()
N=int(input())
#N=10**18
if N==1:
    print(0)
    exit()

#N=10**12
sosuulst=[]
def sosuu(x,S):
    while S<int(x**.5+1):
        for s in sosuulst:
            if S%s==0:
                break
        else:
            sosuulst.append(S)
        S+=1
    for s in sosuulst:
        if x%s==0:
            while x%s==0:
                x//=s
            if x==1:
                return(1,S)
            else:
                return(0,S)
    return(1,S)




c=0
lst=[]
lst2=[]
for i in range(2,int(N**.5+1)):
    if N%i==0:
        lst.append(i)
        lst2.append(N//i)
lst2.reverse()
lst+=lst2
lst.append(N)
#print(lst)
S=2
for i in lst:

    if N%i==0:

        flag=sosuu(i,S)
        if flag:

            #print(N,i)
            N//=i
            c+=1
print(c)

Submission status: Wrong Answer

Solution code:
import math
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
ans=0
l=factorization(n)
for i,j in l:
  cnt=0
  for k in range(2,int(math.sqrt(i))+1):
    if i%k==0:
      cnt=1
      break
  if cnt==0:
    if j<=2:
      ans+=1
    else:
      c=1
      t=1
      while j>0:
        ans+=1
        j-=c
        c+=t
        t+=1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = []
while n != 0:
	rem = n % 10
	li.append(rem)
	n //= 10
count = 0
for i in reversed(li):
	if i == 1:
		count += 1
	else:
		break
print(count)

Submission status: Wrong Answer

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())
primes = get_primes(int(sqrt(n))+2)
count = 0

#print(primes)
for z in primes:
    if z > n:
        break
    
    #ori_z = z
    exp = 1
    while n % z**exp == 0:
        count += 1
        n //= z**exp
        exp += 1

print(count)

Submission status: Wrong Answer

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

n = int(input())

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

Submission status: Wrong Answer

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

print(len(prime_factorize(int(input()))))

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
count = 0
flg = True

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

for i in range(2, int(math.sqrt(n)) + 1):
    if n % i == 0:
        count += 1
        n = n // i
        flg = False

if flg == True:
    print(1)
    exit()

print(count)

Submission status: Wrong Answer

Solution code:
import math
M = int(input())
N = M
sq = math.floor(math.sqrt(N+0.01))
sum = 0
count = 0
while(N%2 == 0):
    count += 1
    N /= 2
sum += (math.sqrt(8*count+1.0000001)-1)//2
count = 0
while(N%3 == 0):
    count += 1
    N /= 3
sum += (math.sqrt(8*count+1.0000001)-1)//2
for i in range(5, sq+7, 6):
    if(N%i != 0 and N%(i+2) != 0):
        continue
    count = 0
    while(N%i == 0):
        count += 1
        N /= i
    sum += (math.sqrt(8*count+1.0000001)-1)//2
    count = 0
    while(N%(i+2) == 0):
        count += 1
        N /= (i+2)
    sum += (math.sqrt(8*count+1.0000001)-1)//2
    if(N == 1):
        print(int(sum))
        exit()
if(N == M):
    print("1")
    exit()
print(int(sum))

Submission status: Wrong Answer

Solution code:
from sys import stdin
from math import sqrt
input = stdin.readline

N = int(input())

s = set([])

ans = 0

seen = [0] * 10 ** 7

for i in range(2, int(sqrt(N)) + 1):
    tmp = i

    while tmp < int(sqrt(N)) + 1:
        s.add(tmp)
        tmp *= i

lis = list(s)
lis.sort()

# print(lis)

for l in lis:
    if N % l == 0:
        ans += 1
        N //= l

for i in range(2, int(sqrt(N)) + 1):
    if N % i == 0:
        print(ans)
        exit()

if N != 1 and N not in lis:
    ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:

def main():
    import sys
    import math
    def input():
        return sys.stdin.readline()[:-1]

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

    temp = N
    cnt=0
    for i in range(2, int(-(-N**0.5//1))+1):
        if temp%i==0:
            cnt+=1
            temp //= i
        if temp <= i:
            break
    if cnt == 0:
        cnt=1
    print(cnt)



    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter


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


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


if __name__ == "__main__":
  main()

Submission status: Wrong Answer

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

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

    for e in arr:
        if cur_val != e:
            cur_val = e
            times = 1
            n = 1
        if times == n * (n + 1) // 2:
            count += 1
            n += 1
        times += 1
    
    print(count)

Submission status: Wrong Answer

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


r = 0
if n != 1:
    f = factorization(n) 
    for a, b in f:
        r += int((b/2) + 0.5)

print(r)

Submission status: Wrong Answer

Solution code:
import sys
from math import sqrt, floor


def _i(): return int(sys.stdin.readline().strip())


def main():
    n = _i()
    sqn = int(sqrt(n))
    p = [True] * (sqn+1)
    d = {}
    f = True
    for i in range(2, sqn+1):
        if not p[i]:
            continue
        if f and n % i == 0:
            f = False

        if n % i == 0:
            d[i] = 1
        for j in range(i+i, sqn+1, i):
            p[j] = False
    if f and n != 1:
        d[n] = 1
    for k in d.keys():
        c = 0
        t = k
        while n % t == 0:
            c += 1
            t *= k
        d[k] = floor((-1+sqrt(1+8*c))/2)

    return sum(d.values())


if __name__ == "__main__":
    print(main())

Submission status: Wrong Answer

Solution code:
N=int(input())
nn=N
import math
sq=int(math.sqrt(N))+1

i=2
ans=0
count1=0
count2=1
while sq>=i:
    if nn%i==0:
        nn//=i
        count1+=1
        if count1//count2>0:
            ans+=1
            count2+=1
            count1=0
    else:
        i+=1
        count1=0
        count2=1

if ans==0 and N>=2:
    ans+=1

print(ans)

Submission status: Wrong Answer

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

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

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

    return arr

n = int(input())
arr = factorization(n)
cnt = 0
for j in arr:
    i = j[0]
    if i == 1 or i == 2:
        cnt = cnt + 1
    elif i == 3 or i == 4 or i == 5:
        cnt = cnt + 2
    elif i == 6 or i == 7 or i == 8 or i == 9:
        cnt = cnt + 3
    else:
        cnt = cnt + 4
        
print(cnt)

Submission status: Wrong Answer

Solution code:
import math
def sosu(n):
    sosu=1
    if n==1:
        sosu=0
    sq=int(math.sqrt(n))
    for x in range(2,sq+2):
        if n%x==0 and x<n:
            sosu=0
            break
    return sosu  #素数なら1、そうでなければ0
n=int(input())
so=[]
count=0
sq=int(math.sqrt(n))+2
if n==1:
    count=0
elif sosu(n)==1:
        count=1
else:
    for x in range(2,sq):
        if x>n:
            break
        hantei=sosu(x)
        shisu=1
        if hantei==1:
            while n%(x**shisu)==0:
                count+=1
                shisu+=1
                n=n/x
print(count)

Submission status: Wrong Answer

Solution code:
import math
n= int(input())
if n == 1:
    print(0)
else:
    a = [0]*(int(math.sqrt(n)) + 2)
    a[1] = 1
    ans = 0
    for i in range(2, int(math.sqrt(n)) + 2):
        if a[i] == 0:
            for j in range(i+i, int(math.sqrt(n)) + 2, i):
                a[j] = 1
    for i in range(2, len(a)):
        if a[i] == 0:
            k = 1
            s = i
            while n % s == 0:
                ans += 1
                n //= s
                s *= i
    if ans == 0:
        print(1)
    else:
        print(ans)
    # print(len('997764507000'))

Submission status: Wrong Answer

Solution code:
from math import floor,sqrt
N=int(input())

p = [1]*floor(sqrt(10**6))
p[0]=p[1]=0
prime=[]
for i in range(2,len(p)):
    if p[i]==0:
        continue
    prime.append(i)
    for j in range(i*2,len(p),i):
        p[j]=0

ans=0
for x in prime:
    cnt=0
    while N%x==0:
        cnt+=1
        N//=x
    ans+=floor((-1+sqrt(1+8*cnt))/2)
print(ans+int(N!=1))

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math

a=int(stdin.readline())
PP=0
K=0

if a==1:
    print(0)
    K=1
L=list()

for b in range(2,int(math.floor(math.sqrt(a)))):
    count=0
    if a%b==0:
        while a%b==0:
            count+=1
            a=a/b
    if count>0:
       L.append(count)

if len(L)==0 and K==0:
    print(1)
    PP=1
sum=0
print(L)
for k in range(0,len(L)):
    p=L[k]
    sum+=int(math.floor((-1+math.sqrt(1+8*p))/2))

if PP==0 and K==0:
   print(sum)

Submission status: Wrong Answer

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

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

D()

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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


def sum_n(n):
    return int(n*(1+n)/2)


N = int(input())

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

fac = factorization(N)


count = 0

for i in range(len(fac)):
    j = 1
    while (sum_n(j) < fac[i][1]):
        j += 1
    count += j

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())

import collections

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

c = collections.Counter(prime_factorize(N))

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

ans = 0

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