TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
# coding: utf-8
# Your code here!
import bisect

line=[i*(i+1)//2 for i in range(10**7+1)]

N=int(input())

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

do=[0 for i in range(10**6+1)]

for i in range(2,int(N**0.5)+1):
    while N%i==0:
        N/=i
        do[i]+=1

ans=0
judge=True

for _,item in enumerate(do):
    index=(bisect.bisect_right(line,item))-1
    ans+=index
    if index!=0:
        judge=False

print(ans+1 if judge else ans)




# coding: utf-8
# Your code here!
import bisect

line=[i*(i+1)//2 for i in range(10**6+1)]

N=int(input())


do=[0 for i in range(10**6+1)]

for i in range(2,int(N**0.5)+1):
    while N%i==0:
        N/=i
        do[i]+=1

ans=0 if N==1 else 1

for _,item in enumerate(do):
    index=(bisect.bisect_right(line,item))-1
    ans+=index

print(ans)




Verdicts: Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):

def resolve():
  N = int(input())
  prime_factors = factorization(N)
  tri_dict = {
    1 :  1,
    2 :  1,
    3 :  2 ,
    4 :  2 ,
    5 :  2 ,
    6 :  3 ,
    7 :  3 ,
    8 :  3 ,
    9 :  3 ,
    10 :  4 ,
    11 :  4 ,
    12 :  4 ,
    13 :  4 ,
    14 :  4 ,
    15 :  5 ,
    16 :  5 ,
    17 :  5 ,
    18 :  5 ,
    19 :  5 ,
    20 :  5 ,
    21 :  6 ,
    22 :  6 ,
    23 :  6 ,
    24 :  6 ,
    25 :  6 ,
    26 :  6 ,
    27 :  6 ,
    28 :  7 ,
    29 :  7 ,
    30 :  7 ,
    31 :  7 ,
    32 :  7 ,
    33 :  7 ,
    34 :  7 ,
    35 :  7 ,
    36 :  8 ,
    37 :  8 ,
    38 :  8 ,
    39 :  8 ,
    40 :  8
  }
  result = 0

  for prime_factor in prime_factors:
    if prime_factor[0] > 1:
      result += tri_dict[prime_factor[1]]

  print(result)
 
if __name__ == "__main__":
    resolve()

# 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

def resolve():
  N = int(input())
  prime_factors = factorization(N)
  result = 0

  for prime_factor in prime_factors:
    if prime_factor[0] == 1:
      continue

    for count in range(2, 42):
      if prime_factor[1] < (count + 1)*count//2:
        result += count - 1
        break
  print(result)

if __name__ == "__main__":
  resolve()


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys
def input(): return sys.stdin.readline().rstrip()
class UnionFind():
    def __init__(self, n):
        self.n=n
        self.parents=[-1]*n 
    def find(self,x):
        
        if self.parents[x]<0:return x
        else:
            self.parents[x]=self.find(self.parents[x])
            return self.parents[x]
    def unite(self,x,y):
        
        x,y=self.find(x),self.find(y)
        if x==y:return
        if self.parents[x]>self.parents[y]:
            x,y=y,x
        self.parents[x]+=self.parents[y]
        self.parents[y]=x 
def main():
    n, m = map(int,input().split())
    uf = UnionFind(n)
    for i in range(m):
        a, b = map(int,input().split())
        a -= 1
        b -= 1
        uf.unite(a, b)
    uf_lis = uf.parents
    ans = 0
    for p in uf_lis:
        if p < 0:
            ans = max(ans, -p)
    print(ans)


if __name__=='__main__':
    main()

import sys
def input(): return sys.stdin.readline().rstrip()
class Sieve2: 
    def __init__(self,n):
        self.primes=[]
        self.f=[0]*(int(n**0.5)+1) 
        self.f[0]=self.f[1]=-1
        for i in range(2,int(n**0.5)+1): 
            if self.f[i]: continue
            self.primes.append(i)
            self.f[i]=i
            for j in range(i*i,int(n**0.5)+1,i):
                if not self.f[j]:
                    self.f[j]=i  

    def prime_fact(self,x): 
        fact_dict=dict()
        for p in self.primes:
            if p*p>x:break
            while x%p==0:
                x//=p
                fact_dict[p]=fact_dict.get(p,0)+1
        if x>1:fact_dict[x]=fact_dict.get(x,0)+1
        return fact_dict

def main():
    n = int(input())
    Sieve = Sieve2(n)
    prime_dict = Sieve.prime_fact(n)
    ans = 0
    for fact in prime_dict.values():
        f = fact
        x = 1
        while f > 0:
            if f >= x:
                ans += 1
            f -= x
            x += 1
    print(ans)


if __name__=='__main__':
    main()

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, 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]

N = int(input())
eratos = get_sieve_of_eratosthenes(10**5)
used = []
count = 0

while(1):
    divisors = make_divisors(N)
    for z in divisors:
        prime_z = list(set(prime_factor(z)))
        e = len(prime_z)
        if (len(prime_z)==1):
            li = [prime_z[0] for i in range(20)]
            for i in li:
                if i in eratos and i not in used :
                    used.append(i)
                    count += 1
                    N //= i
                    continue
            continue
    break
print(count)


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

N = int(input())
li = prime_factor(N)
tmp = list(set(li))
ans = 0

for i in tmp:
    count = 0
    p = n = 1
    while(li.count(i)>=p):
        count += 1
        n += 1
        p += n
    ans += count

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-
import collections
# factrize
def factorize(target_number):
    factor_list = []
    while target_number % 2 == 0:
        factor_list.append(2)
        n //= 2
    factor = 3
    while factor * factor <= target_number:
        while target_number % factor == 0:
            target_number //= factor
            factor_list.append(factor)
        factor += 2
    if target_number > 1:
        factor_list.append(target_number)
    return factor_list

N = int(input())

fact_list = factorize(N)

fact_counter_dict = collections.Counter(fact_list)
ans = 0
for fact, freq in fact_counter_dict.items():
    freq_copy = freq
    for i in range(1, freq + 1):
        freq_copy -= i
        if freq_copy < 0:
            break
        ans += 1
print(ans)

# -*- coding: utf-8 -*-
import collections
# factrize
def factorize(target_number):
    factor_list = []
    while target_number % 2 == 0:
        factor_list.append(2)
        target_number //= 2
    factor = 3
    while factor * factor <= target_number:
        while target_number % factor == 0:
            target_number //= factor
            factor_list.append(factor)
        factor += 2
    if target_number > 1:
        factor_list.append(target_number)
    return factor_list

N = int(input())

fact_list = factorize(N)

fact_counter_dict = collections.Counter(fact_list)
ans = 0
for fact, freq in fact_counter_dict.items():
    freq_copy = freq
    for i in range(1, freq + 1):
        freq_copy -= i
        if freq_copy < 0:
            break
        ans += 1
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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()

import math
 
N = int(input())
Prime = []
ans = 0
 
def func(n):
    while n % 2 == 0:
        n = n // 2
        Prime.append(2)
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        while n % i == 0:
            n = n //i
            Prime.append(i)
    if n > 2:
        Prime.append(n)
 
func(N)
 
for i in set(Prime):
    c = i
    while N % c == 0:
        N = N // c
        ans += 1
        c = c * i
 
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
import sys
from collections import Counter

N = int(input())
Ns = N
Nso = []
i = 0

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

Nruto = math.sqrt(N)
Nruto = math.floor(Nruto)



for i in range(2,Nruto+1):
    while N%i==0:
        N=N//i
        Nso.append(i)
        Nso.append(N)
    if N==1:
        break
    Nruto = math.sqrt(N)
    Nruto = math.floor(Nruto)






Nso.sort()
Nso = Counter(Nso)

print(Nso)


x = 0
count = 0
xcount = 0
while Ns > 1 and x <= len(Nso):
    for x in Nso.keys():
        for y in range(1, Nso[x]+1, +1):
            if Ns % (x**y) == 0:
                count = count+1
                Ns = Ns/(x**y)
                xcount = xcount+y
                print(x,y)
            else:
                break

print(count)


from collections import Counter
import math
N = int(input())
Nso = []
Nruto = math.sqrt(N)
Nruto = math.floor(Nruto)
for i in range(2, Nruto+1):
    while N % i == 0:
        N = N//i
        Nso.append(i)
    if N == 1:
        break
    Nruto = math.sqrt(N)
    Nruto = math.floor(Nruto)
Nso.append(N)
if 1 in Nso:
    Nso.remove(1)
Nso = Counter(Nso)
ans = 0
for v in Nso.values():
    count = 0
    for i in range(1, v+1):
        if count+i > v:
            break
        else:
            count += i
            ans += 1

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())

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

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

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

    return arr

comb = factorization(n)
lst = []
for i in comb:
    for j in range(i[1]):
        lst.append(i[0]**(j+1))

lst.sort()
ans = 0
for i in lst:
    if n == 1:
        break
    elif n > 1:
        if n%i == 0:
            n = n/i
            print("n is ", n)
            ans += 1
print(ans)


n = int(input())

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

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

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

    return arr

comb = factorization(n)
lst = []
for i in comb:
    for j in range(i[1]):
        lst.append(i[0]**(j+1))

lst.sort()
ans = 0
for i in lst:
    if n == 1:
        break
    elif n > 1:
        if n%i == 0:
            n = n/i
            ans += 1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
n = int(input())
l = int(math.sqrt(n))
ans = 0
  
insu = []
sisu = []
i = 2
while i <= l:
  if n % i == 0:
    if i in insu:
      sisu[insu.index(i)] += 1
    else:
      insu.append(i)
      sisu.append(1)
    n //= i
  else:
    i += 1
if n != 1:
  insu.append(n)
  sisu.append(1)
  
if not insu:
  if n == 1:
    print(0)
  else:
    print(1)
  exit()

for s in sisu:
  cnt = 1
  while cnt * (cnt + 1) / 2 <= s:
    ans += 1
    cnt += 1

print(insu)
print(sisu)
print(ans)

import math
n = int(input())
l = int(math.sqrt(n))
ans = 0
  
insu = []
sisu = []
i = 2
while i <= l:
  if n % i == 0:
    if i in insu:
      sisu[insu.index(i)] += 1
    else:
      insu.append(i)
      sisu.append(1)
    n //= i
  else:
    i += 1
if n != 1:
  insu.append(n)
  sisu.append(1)
  
if not insu:
  if n == 1:
    print(0)
  else:
    print(1)
  exit()

for s in sisu:
  cnt = 1
  while cnt * (cnt + 1) / 2 <= s:
    ans += 1
    cnt += 1
    
# print(insu)
# print(sisu)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import collections
import sys

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

Z = prime_factorize(N)

if not Z:
    print(0)
    sys.exit(0)

P = collections.Counter(Z)

print(P)

x = 0

for i in P.values():
    #print(i)
    y = 0
    z = 0
    for j in range(1, i+1):
        y = y + j
        z += 1
        print(i, y, z)
        if y >= i:
            if y > i:
                z -= 1
            break
    
    x = x + z

print(x)



import collections
import sys

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

Z = prime_factorize(N)

if not Z:
    print(0)
    sys.exit(0)

P = collections.Counter(Z)

#print(P)

x = 0

for i in P.values():
    #print(i)
    y = 0
    z = 0
    for j in range(1, i+1):
        y = y + j
        z += 1
        
        if y >= i:
            if y > i:
                z -= 1
            break
    
    x = x + z

print(x)



Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
ans = 0
d = 2
for d in range(2, int(n**0.5) + 1):
    e = d
    while n%d == 0:
        n //= d
        print(n, d)
        d *= d
        ans += 1
    while n%e == 0:
        n = n//e

if n:
    ans += 1
print(ans)




import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
ans = 0
d = 2
while d**2 <= n:
    dd = d
    while n % d == 0:
        n //= d
        print(n, d, ans)
        d **= 2
        ans += 1
    while n % dd == 0:
        n //= dd
    d = dd + 1
if n != 1:
    ans += 1
print(ans)



import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
ans = 0
d = 2
while d**2 <= n:
    dd = d
    while n % d == 0:
        n //= d
        print(n, d, ans)
        d *= d
        ans += 1
    while n % dd == 0:
        n //= dd
    d = dd + 1
if n != 1:
    ans += 1
print(ans)



import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
ans = 0
d = 2
while d**2 <= n:
    if n % d != 0:
        d += 1
        continue

    dd = d
    while n % d == 0:
        n //= d
        d *= dd
        ans += 1

    while n % dd == 0:
        n //= dd
    d = dd + 1

if n != 1:
    ans += 1
print(ans)



Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
N=int(input())
ans=0
for i in range(2,int(N**(1/2))+1):
  if N%i==0:
    break
  if i==int(N**(1/2)):
    print(1)
    sys.exit()
i=1
k=1
while N % (2**i) == 0:
  ans+=1
  N=N//(2**i)
  i+=1
while N % 2 == 0:
  N=N//2
f=3
while f*f <= N:
  if N % (f**k) == 0:
    ans+=1
    N=N//(f**k)
    k+=1
  else:
    while N % f == 0:
      N=N//f
    f += 2
    k=1
print(ans)

N=int(input())
ans=0
for i in range(2,10**6+1):
  anssub=0
  t=0
  while N%i==0:
    N=N//i
    anssub+=1
  while t*(t+1)//2<=anssub:
    t+=1  
  ans+=t-1
if N!=1:
  ans+=1
print(ans)  

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def main(n):

    prime = []
    if n < 2:
        prime.append((1,0))
    for p in range(2,int(n**0.5)):
        cnt = 0
        if p*p > n:
            break
        while n%p == 0:
            n //= p
            cnt += 1
        prime.append((p,cnt))
    if n > 1:
        prime.append((n,1))
    return prime
                    
n = int(input())    
pf = main(n)

ans = 0
for p, f in pf:
    cnt = 1
    while f >= cnt:
        f -= cnt
        ans += 1
        cnt += 1
    else:
        break

print(ans)




def main(n):

    prime = []
    if n < 2:
        prime.append((1,0))
    for p in range(2,int(n**0.5)):
        cnt = 0
        if p*p > n:
            break
        while n%p == 0:
            n //= p
            cnt += 1
        prime.append((p,cnt))
    if n > 1:
        prime.append((n,1))
    return prime
                    
n = int(input())    
pf = main(n)

ans = 0
for p, f in pf:
    cnt = 1
    while f >= cnt:
        f -= cnt
        ans += 1
        cnt += 1

print(ans)




Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
import math

def factorize(n):
  ret, a = [], n
  for i in range(2, int(n**0.5)+1):
    if a%i>0: continue
    c=0
    while a%i==0:
      a//=i
      c+=1
    else:
      ret.append((i,c))
  if a!=1: ret.append((a,1))
  return ret


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())
N = factorize(n)
#p(N)
A=[]
for k,v in N:
  for i in range(v):
    A.append(k)
#p(A)

B=[]
for i in range(1 << len(A)):
  a = 1
  for j in range(len(A)):
    if (i >> j) & 1 :
      a *= i
  if a>1:
    B.append(a)
B.sort()


ans =0
for b in B:
  if n >=b:
    n /=b
    ans += 1

print(ans)


#-------------------------------------------------------------------
import sys
def _p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
import math

def factorize(n):
  ret, a = [], n
  for i in range(2, int(n**0.5)+1):
    if a%i>0: continue
    c=0
    while a%i==0:
      a//=i
      c+=1
    else:
      ret.append((i,c))
  if a!=1: ret.append((a,1))
  return ret


n = int(input())
N = factorize(n)

ans=0
for p,i in N:
  for j in range(i):
    a = pow(p,j+1)

    if a > n: break

    if n % a == 0:
      n /= a
      ans += 1


print(ans)



Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
from collections import defaultdict

def main():
    N = int(input())
    fac = defaultdict(int)

    for i in range(2, int(math.sqrt(N))+1):
        while N % i == 0:
            is_p = False
            fac[i] += 1
            N = N // i

        if i == int(math.sqrt(N)) and N != 1:
            fac[N] += 1

    ans = 0
    for k, v in fac.items():
        print(k, v)
        e = 1
        for i in range(10000000):       
            if e <= v:
                ans += 1
                v -= e
                e += 1
            else:
                break
    print(ans)

if __name__ == "__main__":
    main()

import math
from collections import defaultdict

def main2():
    N = int(input())
    fac = defaultdict(int)
    lim = int(math.sqrt(N))

    for i in range(2, lim + 1):
        while N % i == 0:
            is_p = False
            fac[i] += 1
            N = N // i

        if i == lim:
            if N != 1:
                fac[N] += 1

    ans = 0
    for k, v in fac.items():
        e = 1
        for i in range(10000000):       
            if e <= v:
                ans += 1
                v -= e
                e += 1
            else:
                break
    print(ans)

if __name__ == "__main__":
    main2()

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
ans = 0
for i in range(2, int(N**0.5 + 1)):
    f = 1
    while True:
        if N % i**f:
            f -= 1
            break
        f += 1
        N //= i**f
    ans += f
print(ans)


import collections
N = int(input())


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


ans = 0
for v in prime_factorize(N).values():
    for i in range(1, 100):
        if (i + 1) * (i + 2) // 2 > v:
            break
    ans += i
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from sys import stdin
import math
def I(): return int(stdin.readline().rstrip())

n = I()
m = n
l = []
for i in range(2,int(math.sqrt(n))+1):
    if n==1 or n<i:
        break
    if n%i==0:
        c = 0
        while n%i==0:
            n//=i
            c += 1
        for j in range(1,c+1):
            l.append(i**j)
    i += 1
if n!=1:
    l.append(n)

l.sort()
print(l)
ans = 0
for i in l:
    if m==1 or m<i:
        break
    else:
        if not m%i:
            m/=i
            ans += 1

print(ans)

from sys import stdin
import math
def I(): return int(stdin.readline().rstrip())

n = I()
m = n
l = []
for i in range(2,int(math.sqrt(n))+1):
    if n==1 or n<i:
        break
    if n%i==0:
        c = 0
        while n%i==0:
            n//=i
            c += 1
        for j in range(1,c+1):
            l.append(i**j)
    i += 1
if n!=1:
    l.append(n)

l.sort()
ans = 0
for i in l:
    if m==1 or m<i:
        break
    else:
        if not m%i:
            m/=i
            ans += 1

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from collections import Counter
N = int(input())
factors = []
i = 2
while N > 1:
  if N < i * i:
    factors.append(N)
    break
  while N % i == 0:
    factors.append(i)
  i += 1

ans = 0
for count in Counter(factors).values():
  i = 1
  while count >= i:
    count -= i
    i += 1
    ans += 1
print(ans)


from collections import Counter
N = int(input())
factors = []
i = 2
while N > 1:
  if N < i * i:
    factors.append(N)
    break
  while N % i == 0:
    factors.append(i)
    N //= i
  i += 1

ans = 0
for count in Counter(factors).values():
  i = 1
  while count >= i:
    count -= i
    i += 1
    ans += 1
print(ans)


Verdicts: Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
from math import floor, sqrt


def func(x):
    return floor((sqrt(1 + 8 * x) - 1) / 2)


N = int(input())
limit = floor(sqrt(N))

primes = [2]

count = 0
flag = True
p = 2
while 1:
    print(p,N)
    isprime = True
    if N == 1:
        break
    if p > sqrt(N):
        count += 1
        break
    if p > 3:
        for i in primes:
            if i >= sqrt(p):
                break
            if p % i == 0:
                isprime = False
                break
        if not isprime:
            p += 2
            continue
        primes.append(p)
    a = 0
    while N % p == 0:
        print("while",p, a)
        a += 1
        N = N // p
    count += func(a)
    p += 2
print(count)





from math import floor, sqrt


def func(x):
    return floor((sqrt(1 + 8 * x) - 1) / 2)


N = int(input())
limit = floor(sqrt(N))

primes = [2]

count = 0
flag = True
p = 2
while 1:
    #print(p,N)
    isprime = True
    if N == 1:
        break
    if p > sqrt(N):
        count += 1
        break
    
    a = 0
    while N % p == 0:
        #print("while",p, a)
        a += 1
        N = N // p
    count += func(a)
    if p == 2:
        p = 3
    else:
        p += 2
print(count)





Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N=int(input())
Nk=N
rootN=int(N**0.5)
p=[1]*(rootN+1)
p[0]=0
p[1]=0
for i in range(2,rootN+1):
    for j in range(i*2,rootN,i):
        p[j]=0
ps=[i for i in range(1,rootN) if p[i]==1]
pq=[]
for i in ps:
    c=0
    for j in range(1,41):
        if (N/(i**j)).is_integer():
            c+=1
            N/=(i**j)
        else:
            break
    if c!=0:
        pq.append(c)

res=0
for j in pq:
    c=0
    for k in range(1,41):
        if j-k >=0:
            c+=1
            j-=k
        else:
            break
    res+=c

if N==Nk:
    res+=1
    
print(res)

if N > rootN:
    res*=2

#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    ps=[]
    for i in range(2,int((N**0.5))+1):
        if N%i==0:
            cnt=0
            for j in range(40):
                if N%i==0:
                    N//=i
                    cnt+=1
            ps.append([i,cnt])
    if N!=1:
        ps.append([N,1])
        
    ans=0
    for p in ps:
        ans+=int(((8*p[1]+1)**0.5-1)/2)
    print(ans)
    
    
if __name__=="__main__":
    main()


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):

def q4():
    N = int(input())
    arr = prime_factorize(N)
    if not arr:
        print(0)
        return

    ans_count = 0
    count = 1

    min_val = min(arr)
    while arr:
        if arr.count(min_val) < count:
            arr = list(filter(lambda a: a != min_val, arr))
            count = 1
            if not arr:
                break
            min_val = min(arr)
            continue
        arr = arr[count:]
        ans_count += 1
        count += 1
    print(ans_count)


q4()



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


def q4():
    N = int(input())
    arr = prime_factorize(N)
    if not arr:
        print(0)
        return

    ans_count = 0
    count = 1

    min_val = min(arr)
    while arr:
        if arr.count(min_val) < count:
            arr = list(filter(lambda a: a != min_val, arr))
            count = 1
            if not arr:
                break
            min_val = min(arr)
            continue
        arr = arr[count:]
        ans_count += 1
        count += 1
    print(ans_count)


q4()


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-


def input_int():
    return int(input())



def int1(x):
    return int(x) - 1



def input_to_int_map():
    return map(int, input().split())



def input_to_int_tuple():
    return tuple(map(int, input().split()))



def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))

import math

def factorization(n):
    
    factor = []
    
    tmp = int(math.sqrt(n)) + 1
    target = n
    for num in range(2, tmp):
        while target % num == 0:
            target //= num
            factor.append(num)

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

    return factor


def main():
    n = input_int()

    a = factorization(n)

    target = set()

    from collections import deque
    tyofuku = []

    for _a in a:
        if _a in target:
            tyofuku.append(_a)
        else:
            target.add(_a)

    mult = 1
    for i in tyofuku:
        mult *= i

    for i in range(1, mult + 1):
        if i not in target and mult % i == 0:
            target.add(i)

    print(len(target))


if __name__ == "__main__":
    main()


# -*- coding: utf-8 -*-


def input_int():
    return int(input())



def int1(x):
    return int(x) - 1



def input_to_int_map():
    return map(int, input().split())



def input_to_int_tuple():
    return tuple(map(int, input().split()))



def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))

import math


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

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

   return arr


def main():
    n = input_int()

    ans = 0
    if n < 1:
        print(ans)
        return
    a = factorization(n)
    for _, i in a:
        j = 1
        while i >= j:
            ans += 1
            i -= j
            j += 1

    print(ans)

if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import itertools
N=int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
x=prime_factorize(N)
l=list(set(prime_factorize(N)))
s=[]
for i in range(len(l)):
    s.append([])
for i in l:
    a=l.index(i)
    b=i
    for j in range(x.count(i)):
        s[a].append(i)
        i*=b
t=list(itertools.chain.from_iterable(s))
ans=0
while len(t)>0:
    p=t.pop(t.index(min(t)))
    sp=s[l.index(p)]
    ssp=sp[len(sp)-1]
    sp.pop(sp.index(ssp))
    if len(sp)>1:
        t.pop(t.index(ssp))
    ans+=1
print(ans)    
        





            
    


    


    
    














    


    














import itertools
N=int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
x=prime_factorize(N)
l=list(set(prime_factorize(N)))
s=[]
for i in range(len(l)):
    s.append([])
for i in l:
    a=l.index(i)
    b=i
    for j in range(x.count(i)):
        s[a].append(i)
        i*=b
t=list(itertools.chain.from_iterable(s))
ans=0
while len(t)>0:
    p=t.pop(t.index(min(t)))
    sp=s[l.index(p)]
    ssp=sp[len(sp)-1]
    sp.pop(sp.index(ssp))
    t.pop(t.index(ssp))
    ans+=1
print(ans)    
        





            
    


    


    
    














    


    














import collections
N=int(input())
if N==1:
    print(0)
    exit()
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)) 
s=list(set(prime_factorize(N)))
ans=0
def a(n):
    return (1/2)*n*(n+1)
def f(n):
    ans=0
    x=1
    while n>=a(x):
        x+=1
        ans+=1
    return ans
for i in s:
    x=c[i]
    ans+=f(x)
print(ans)

        










        

    









    

        




    















    



    





    






        






    
















        


























            
    


    


    
    














    


    














Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())


def solve(n):
    res = 0
    for d in range(2, n):
        if d * d > n:
            break

        degree = 0
        while n % d == 0:
            n /= d
            degree += 1

        i = 1
        while degree >= i:
            degree -= i
            i += 1
            res += 1

    return res if n == 1 else 1


print(solve(n))


n = int(input())


def solve(n):
    res = 0
    for d in range(2, n):
        if d * d > n:
            break

        degree = 0
        while n % d == 0:
            n /= d
            degree += 1

        i = 1
        while degree >= i:
            degree -= i
            i += 1
            res += 1

    if n > 1:
        res += 1
    return res


print(solve(n))


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)
print(fac)

count = 0

for i in range(len(fac)):
    j = 0
    while (True):
        j += 1
        if (sum_n(j) == fac[i][1]):
            break
        elif (sum_n(j) > fac[i][1]):
            j = j - 1
            break

    count += j

print(count)


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 = 0
    while (True):
        j += 1
        if (sum_n(j) == fac[i][1]):
            break
        elif (sum_n(j) > fac[i][1]):
            j = j - 1
            break

    count += j

print(count)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def sieve(x):
    """
    Sieve of Eratosthenes
    :param x: max value
    :return: list of bool
    """

    is_prime = [True] * (x + 1)
    is_prime[0] = is_prime[1] = False

    for i in range(2, x + 1):
        if is_prime[i]:
            for j in range(i * 2, x + 1, i):
                is_prime[j] = False

    return is_prime


def f(x):
    if x < 2:
        return False

    i = 2
    while i * i <= x:
        if x % i == 0:
            return False
        i += 1

    return True


n = int(input())

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

is_prime = sieve(10 ** 7)
primes = [i for i, e in enumerate(is_prime) if e]

ans = 0
used = set()
for e in primes:
    div = e
    while div <= n:
        if n % div == 0:
            ans += 1
            n //= div
            used.add(div)
        div *= e


print(ans)


import numpy as np
from math import sqrt
from collections import defaultdict


def sieve(x):
    primes = []
    is_prime = np.ones(x + 1, bool)
    is_prime[0] = is_prime[1] = False
    for i in range(x + 1):
        if is_prime[i]:
            primes.append(i)
            is_prime[2*i::i] = False

    return primes


def prime_fact(x):
    mx = int(sqrt(x)) + 5
    primes = sieve(mx)
    pf = defaultdict(int)
    for e in primes:
        while x % e == 0:
            x //= e
            pf[e] += 1

    if x != 1:
        pf[x] += 1

    return pf


n = int(input())

pf = prime_fact(n)
ans = 0
for v in pf.values():
    i = 1
    while (i + 1) * (i + 2) // 2 <= v:
        i += 1

    ans += i

print(ans)


Verdicts: Time Limit Exceeded

Accepted