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:
N=int(input())
if N==1:
    print(0)
else:
    sup=int(N**0.5)
    ans=0
    for i in range(2,sup+1):
        if N < i:
            break
        if N%i==0:
            ans+=1
            N=N//i
    if ans==0:
        print(1)
    else:
        print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())

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

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

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

    return arr

S = factorization(N)
ans=0
start=1
for i in S:
  U=0
  for j in range(1,i[1]+1):
    U+=j
    ans+=1
    if U>i[1]:
      ans-=1
      break
print(ans)

Submission status: Wrong Answer

Solution code:
import math


def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


def primes(n):
    ps = {}
    for i in range(2, int(math.sqrt(n)) + 1):
        if n == 1:
            break
        cnt = 0
        while n % i == 0:
            n = n // i
            cnt += 1
        if cnt > 0:
            ps[i] = cnt

    return ps


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

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

    ps = primes(n)

    # ans = sum([int(decimal.Decimal((-1 + (1 + 8 * v) ** 0.5) / 2)) for v in ps.values()])
    ans = 0
    for v in ps.values():
        i = 1
        while v - i >= 0:
            ans += 1
            v -= i
            i += 1
        

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans = 0

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)

if a == []:
    print(0)
else:
    c = collections.Counter(a)
    for i in c.values():
        if i != 2:
            m = math.floor(math.sqrt(2*i))
            while 2*i>m*(m+1):
                m += 1
            ans += m
        else:
            ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
print(int(math.log(n)/math.log(2)))

Submission status: Wrong Answer

Solution code:
import sys
from copy import deepcopy
from collections import deque
from math import floor

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

    def is_prime(n):
        for i in range(2, n + 1):
            if i * i > n:
                break
            if n % i == 0:
                return False
        return n != 1
    if is_prime(n):
        print(1)
        sys.exit()

    nn = floor(n**0.5)
    nn = max(6, nn)
    p = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(nn + 1)]
    p[0] = p[1] = False
    p[2] = p[3] = p[5] = True
    for i1 in range(7, floor(nn ** 0.5) + 1, 2):
        if p[i1]:
            for i2 in range(i1 ** 2, nn + 1, i1):
                p[i2] = False
        else:
            continue
    pl = [i for i, b in enumerate(p) if b == True]

    nums = deepcopy(pl)
    for pe in pl:
        cnt = 2
        while True:
            tnum = pow(pe, cnt)
            if tnum > n:
                break
            elif tnum != 0:
                if n % tnum == 0:
                    nums.append(tnum)
            cnt += 1
    nums.sort()
    numsd = deque(nums)

    r = 0
    while n != 1:
        if not numsd:
            break
        nextn = numsd.popleft()
        if n % nextn == 0:
            n = n / nextn
            r += 1
    print(r)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
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()
    divisors=divisors[1:]
    number=N
    answer=0
    for a in divisors:
        if number % a==0:
            number/=a
            number=int(number)
            answer+=1
    return answer
if N==1:
    print(0)
else:
    print(make_divisors(N))

Submission status: Wrong Answer

Solution code:
from sys import stdin
import sys

import array
import textwrap


# Eratosthenesの篩により、整数end未満の素数を列挙する
# 参考：高橋直大『最強最速アルゴリズマー養成講座』pp.410-412
def sieve_of_eratosthenes(end, typecode="L"):
    assert end > 1
    # 整数iが素数であるかをis_prime[i]が示す
    # 最初はすべてTrueで初期化しておく
    # 最終的にprimesではなくこれを返してもよい
    is_prime = array.array("B", (True for i in range(end)))
    # 0, 1はいずれも素数ではない
    is_prime[0] = False
    is_prime[1] = False
    # 素数を格納する配列
    primes = []
    # 篩う
    for i in range(2, end):
        if is_prime[i]:  # iが素数であるとき
            primes.append(i)  # 素数の配列に加える
            for j in range(2 * i, end, i):  # iを超えるiの倍数について
                is_prime[j] = False  # 素数ではないため除外する
    return primes


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


n = int(input())
if is_prime(n) is True:
    print('1')
    sys.exit()
temp = []
i = 2
primes = sieve_of_eratosthenes(1000000)
for i in range(2, 40):
    for k in range(2, 10):
        primes.append(i**k)
primes.sort()
# print(primes)

for i in range(len(primes)):
    if n == 1:
        print(len(temp))
        break
    if n % primes[i] == 0 and primes[i] not in temp:
        temp.append(primes[i])
        n = n//primes[i]
        i = 0
        # print(temp, n)
    if n in temp:
        print(len(temp))
        break
    # print(primes[i])

Submission status: Wrong Answer

Solution code:
import math


def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


def primes(n):
    ps = {}
    for i in range(2, int(math.sqrt(n)) + 1):
        if n == 1:
            break
        cnt = 0
        while n % i == 0:
            n = n // i
            cnt += 1
        if cnt > 0:
            ps[i] = cnt

    return ps


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

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

    ps = primes(n)

    # ans = sum([int(decimal.Decimal((-1 + (1 + 8 * v) ** 0.5) / 2)) for v in ps.values()])
    ans = 0
    for v in ps.values():
        i = 1
        while v - i >= 0:
            ans += 1
            v -= i
            i += 1
        print(i, v)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def prime_factorization(n):
  d = 2
  cnt = 0
  seen = []
  while d*d <= n:
    if n%d == 0:
      t = 1
      while d**t <= n:
        flg = True
        tmpn = n
        for _ in range(t):
          if tmpn%d==0:
            tmpn //= d
          else:
            flg = False
            break
        if flg:
          seen.append(d**t)
          cnt += 1
          n = tmpn
          t += 1
        else:
          break
    d += 1

  if n != 1 and n not in seen:
    cnt += 1

  return cnt

n = int(input())
print(prime_factorization(n))

Submission status: Wrong Answer

Solution code:
import math
from collections import defaultdict

def pat_cnt(m):
    wk = m
    ans = 0
    for i in range(1,m+1):
        wk -= i
        if wk < 0:
            break
        ans += 1

    return ans

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

flg = False
#ftr = []
tgt = defaultdict(int)

tmp = int(math.sqrt(n))+1
for num in range(2,tmp):
    while n % num == 0:
        n //= num
        tgt[num] += 1
        flg = True

#素数ナラ 1
if flg == False:
    print(1)
    exit()

#カズサガス
#print(tgt)
tcnt = 0
for k,v in tgt.items():
    tcnt += pat_cnt(v)

print(tcnt)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
from math import sqrt


def solve(*args: str) -> str:
    n = int(args[0])

    ret = 0
    i = 2
    sqrt_n = -int(-sqrt(n))
    P = [True for _ in range(1+sqrt_n)]
    P[0] = False
    P[1] = False

    for i in range(2, len(P)):
        if P[i]:
            for j in range(i+i, len(P), i):
                P[j] = False

    Q = []
    for p, is_prime in enumerate(P):
        if is_prime and n % p == 0:
            t = p
            while t <= n:
                Q.append(t)
                t *= p
    if not Q and 1 < n:
        Q.append(n)

    Q.sort()
    for q in Q:
        if n % q == 0:
            n //= q
            ret += 1

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Wrong Answer

Solution code:
mod=1000000007
p_l=[]
def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1

def prime_list(tt):
    pl=[]
    for i in range(2,tt+1):
        if prime_t(i):
            pl.append(i)
    return pl

pc={}
ps=set([])
#pl=prime_list(10**12)
pl=prime_list(100012)

n=int(input())
if n==1:
    print(0)
    exit()
ans=0
chk=1
for i in pl:
#    print(i)
    if n<i:
        break
    if n%i==0:
        chk=1
        x=i
        while 1:
            if n%x==0:
                ans+=1
                n//=x
                x*=i
            else:
                break

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import math

n = int(input())
div = []

# n の約数を全部並べる
for i in range(1, int(math.sqrt(n))+1):
    if n%i == 0:
        div.append(i)
        div.append(n//i)

div = list(sorted(set(div)))
#print('div =', div)
ans = 0 

for i in range(1, len(div)):
    if int(n) == 1:
        break
    if n%div[i] == 0:
        n /= div[i]
        ans += 1

print(ans)

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:

n = int(raw_input())
 
def f(c):

	cumul = 0
	step = 1
	cc = 0
	while(cumul < c):
		cc +=1
		cumul += step
		step += 1
	if cumul > c: cc -=1
	return cc

d = 2
count = 0
on = n


while(n != 1 and d *d <= on):
	if n%d==0:
		c = 0
		while(n%d == 0): 
			c += 1
			n /= d
		count += f(c)
	d+=1
if n != 1:
	print 1
else:
	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())
N = factorization(N)
count = 0
for i in range(0,len(N)):
    print(i)
    t = 0
    for j in range(1,N[i][1]+1):
        t += j
        if N[i][1] == t:
            count += j
            break
        elif N[i][1] < t:
            count += j-1
            break
        else:
            pass
print(count)

Submission status: Wrong Answer

Solution code:
import math

def using_sqrt(limit,elm):
    n = 0
    if limit < 2:
        return 0

    elm.append(2)

    for k in range(3, limit+1,2):
        factor = 0

        # 2以外の偶数は素数ではないので無視する
        if k % 2 == 0 and k != 2:
            continue

        # 繰り返しの上限を対象の平方根にする
        for divisor in range(2, math.floor(math.sqrt(k))+1):
            if k % divisor == 0:
                factor += 1

        if factor == 0:
            elm.append(k)
            n += 1

    return n


N = int(input())
A = []

using_sqrt(N,A)

A_len=len(A)

for i in range(A_len):
    chk = A[i]
    while True:
        chk *= A[i]
        if chk <= N:
            A.append(chk)
        else:
            break

A.sort()

A_len=len(A)
cnt = 0
chk_N = N
for i in range(A_len):
    if chk_N % A[i] == 0:
        chk_N = int(chk_N / A[i])
        print(chk_N)
        cnt += 1

    if chk_N == 1:
        break

print(cnt)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
L = N
if L == 1:
    print(0)
else:
    num = 0
    for i in range(2, int(math.sqrt(L))+1):
        if N % i == 0:
            N = N / i
            num = num + 1

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

Submission status: Wrong Answer

Solution code:
import math
def main():

    N = int(input())
    primes = []
    def isprime(n):
        if n == 1: return False
        for i in range(2, int(math.sqrt(n))+1):
            if n % i == 0:
                return False
        return True

    primes = set()
    for i in range(1, int(math.sqrt(N))+1):
        if N % i == 0 and isprime(i):
            primes.add(i)
            if isprime(N//i):
                primes.add(N//i)
    if isprime(N):
        primes.add(N)
    # print(primes)

    ans = 0
    for p in primes:
        q = p
        while N % q == 0:
            ans += 1
            N //= q
            q *= p
        if N == 1:
            break
    return ans


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

Submission status: Wrong Answer

Solution code:
N=int(input())
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()
    divisors=divisors[1:]
    number=N
    answer=0
    for a in divisors:
        if number % a==0:
            number/=a
            number=int(number)
            answer+=1
    return answer
print(make_divisors(N))

Submission status: Wrong Answer

Solution code:
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())
sosu = prime_factorize(N)
history = set()
count = 0
cursor = N
while len(sosu) > 0:
    num = sosu.pop(0)
    while len(sosu) > 0 and (num == sosu[0]):
        num *= sosu.pop(0)
        if num not in history:
            history.add(num)
            break
    cursor /= num
    count += 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

def countstep(a):
    i = 0
    while a>=i+1:
        i += 1
        a -= i
    return i

n = int(input())
a = factorization(n)

count = 0
for i in range(len(a)):
    count += countstep(a[i][1])
print(count)

Submission status: Wrong Answer

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

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

def main():
    n = int(input())
    a = make_divisors(n)[1:]
    i = 0
    for x in a:
        if n % x == 0:
            n //= x
            i += 1

    print(i)





main()

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
p=2
c=0
curr=0
while n%p==0:
    curr+=1
    n//=p
j=0
for i in range (1,curr):
    j+=i
    if j<=curr:
        c+=1
    else:
        break
for i in range (3,int(math.sqrt(n))+1,2):
    p=i
    curr=0
    while n%p==0:
        curr+=1
        n//=p
    j=0
    for i in range (1,curr):
        j+=i
        if j<=curr:
            c+=1
        else:
            break
if n>2:
    c+=1
print(c)

Submission status: Wrong Answer

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


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
b = factorization(a)
for i in range(len(b)):
    count=0
    c = b[i][1]

    for j in range(1,40):
        if c - j >= 0:
            c -= j
            count += 1
        else:
            ans += count
            break
if ans ==1:
    print(0)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
org_n = n

array = [True] * (math.ceil(math.sqrt(n))+10)
                  
for i in range(2,len(array)):
  if not array[i]:
    continue
    
  for j in range(i*2,len(array), i):
    array[j] = False
    
sosu = []

for i in range(2,len(array)):
  if array[i]:
    sosu.append(i)
    
count = 0
for i in range(len(sosu)):
  j = 1
  while (n % (sosu[i]**j) == 0):
    n //= (sosu[i]**j)
    count += 1
    j += 1

if org_n == 1:
  count = 0
  
elif org_n == n:
  count += 1

    
print(count)

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

    N = int(input())

    if N == 1:
        print(0)
        return

    def get_prime(n):
        import math
        p = []
        if n % 2 == 0:
            p.append(2)

        sq = math.ceil(math.sqrt(n))
        i = 3
        while i <= sq:
            if n % i == 0:
                p.append(i)
                if i*i != n:
                    p.append(n//i)
            i += 2
        p.append(n)
        return p
    
    p = get_prime(N)

    def prime_factorization(n, p):
        from collections import Counter
        d = Counter()
        for i in p:
            while n % i == 0:
                d[i] += 1
                n //= i
        return d

    d = prime_factorization(N, p)

    ans = 0
    his = {}
    for i in d:
        tmp = 1
        for j in range(d[i]):
            tmp *= i
            if N % tmp == 0 and not tmp in his:
                ans += 1
                N //= tmp
                his[tmp] = 1
            else:
                break

    print(ans)

main()

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
n = N
ans = 0
for i in range(2, int(np.sqrt(10**12))):
  if N < i:
    break
  if N % i == 0:
    N = N // i
    ans += 1

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

Submission status: Wrong Answer

Solution code:
import math
def D():
    N = int(input())
    if N == 1:
        print(0)
        return
    temp = N
    count = 0
    while temp % 2 == 0: 
       temp //= 2
       count += 1
    track = 1
    # print(count)
    while count-track >= 0:
        count -= track
        track += 1
    # print(temp, track-1)
    ans = max(0, track-1)
    for i in range(3,int(math.sqrt(N))+1,2): 
        count = 0
        while temp % i== 0: 
            temp //= i
            count += 1
        track = 1
        while count-track >= 0:
            count -= track
            track += 1
        ans += max(0, track - 1)
    print(max(1, ans))

D()

Submission status: Wrong Answer

Solution code:
import math
import numpy as np

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

def gen_list_n_removed(l, n):
    return [i for i in l if i != n]

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum



N = int(input())

num_list = set()

hoge = seachPrimeNum(500000)

for i in range(1, 30):
    for j in hoge:
        res = j ** i
        if res > 10 ** 12:
            break
        num_list.add(j ** i)

num_list = sorted(num_list)

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

count = 0
while True:
    for i in num_list:
        if N % i == 0:
            N = N / i
            count += 1
            num_list = gen_list_n_removed(num_list, i)
            break
        if i == num_list[-1]:
            print(count)
            exit(0)

Submission status: Wrong Answer

Solution code:
# Contest No.: ABC169
# Problem No.: D
# Solver:      JEMINI
# Date:        20200531

import sys
import heapq

def main():
    temp = [True] * (10 ** 6 + 10)
    temp[0] = False
    temp[1] = False
    for i in range(2, 10 ** 6 + 10):
        if temp[i]:
            cnt = 2 * i
            while cnt < 10 ** 6 + 10:
                temp[cnt] = False
                cnt += i
    prime = []
    for i in range(10 ** 6 + 10):
        if temp[i]:
            prime.append(i)

    n = int(input())
    ans = 0
    tempN = n
    for i in prime:
        if i > n:
            break
        if tempN % i:
            continue
        div = 0
        while True:
            cnt = 1
            while tempN % (i ** (2 * cnt)) == 0:
                cnt += 1
            if tempN % (i ** cnt):
                break
            div += cnt
            tempN = tempN // (i ** cnt)
        #print(div)
        if div > 2:
            div = int((div * 2) ** 0.5)
        else:
            div = 1
        #print(i, div, tempN)
        ans += div
    if tempN > 1:
        ans += 1
    print(ans)
    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
def main():

    N = int(input())
    primes = []
    def isprime(n):
        if n == 1: return False
        for i in range(2, int(math.sqrt(n))+1):
            if n % i == 0:
                return False
        return True

    primes = set()
    for i in range(1, int(math.sqrt(N))+1):
        if N % i == 0 and isprime(i):
            primes.add(i)
            if isprime(N//i):
                primes.add(i)
    if isprime(N):
        primes.add(N)
    # print(primes)

    ans = 0
    for p in primes:
        q = p
        while N % q == 0:
            ans += 1
            N //= q
            q *= p
        if N == 1:
            break
    return ans


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

Submission status: Wrong Answer

Solution code:
n= int(input())

def div(x):
	for p in primes:
		if p>x**0.5:
			break
		if x%p== 0:
			return False
	return True

primes= [2]
for num in range(3, int(n**0.5)):
	if div(num):
		primes.append(num)

###

prime_factors= {}

while n != 1:
	for p in primes:
		if n%p==0:
			if p in prime_factors:
				prime_factors[p]+=1
				n/=p
				break
			else:
				prime_factors[p]=1
				n/= p
				break
		elif div(n):
			prime_factors[n]=1
			n=1
			break
tot= 0
for p in prime_factors:
	if prime_factors[p]>=36:
		tot+= 8
	elif prime_factors[p]>=28:
		tot+=7
	elif prime_factors[p]>=21:
		tot+=6
	elif prime_factors[p]>=15:
		tot+=5
	elif prime_factors[p]>=10:
		tot+=4
	elif prime_factors[p]>=6:
		tot+=3
	elif prime_factors[p]>=3:
		tot+=2
	else:
		tot+=1


print(tot)

Submission status: Wrong Answer

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


count = 0
lists = factorization(n)
flag = True
i = 0
while flag:
    i = i + 1
    flag = False
    for pair in lists:
        if pair[1] >= i:
            pair[1] -= i
            count += 1
            flag = True
        else:
            continue

sum = 1
for l in lists:
    if l[1] == 0:
        continue
    sum = sum * l[0] ** l[1]

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

divs = make_divisors(sum)
for div in divs:
    a = factorization(div)
    if len(a) > 1:
        if sum % div == 0:
            count += 1
            sum = sum/div

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
res = N
count = 0


def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()


for i in range(2, N):
    res /= i
    if not is_integer(res):
        break
    count += 1

print(count)