qyliang/CodeNanoFix huggingface dataset:
Buggy code:
def factoring(n):
    if n == 0:
        return {0: 1}
    if n == 1:
        return {1: 1}
    nOrigin = n
    n = n**0.5
    numlist = [0 for i in range(int(n) + 1)]
    numlist[0] = -1
    numlist[1] = -1

    t = 2
    while t < (n**0.5):
        if numlist[t] == 0:
            numlist[t] = t
            k = 2
            while t * k <= n:
                numlist[t * k] = -1
                k += 1
        t += 1
    while t <= n:
        if numlist[t] == 0:
            numlist[t] = t
        t += 1

    result = {}
    for i in numlist:
        if i == -1:
            continue
        j = 0
        while nOrigin % i == 0:
            j += 1
            nOrigin = nOrigin / i
        if j == 0:
            continue
        else:
            result[i] = j

    if int(nOrigin) != 1:
        result[int(nOrigin)] = 1
    return result

def help(e):
    i=0
    while i*(i+1)//2<=e:
        i+=1
    return i-1


N=int(input())
d=factoring(N)

retval=0
for key,value in d.items():
    retval+=help(value)


print(retval)


Fixed code:
import sys
def factoring(n):
    if n == 0:
        return {0: 1}
    if n == 1:
        return {1: 1}
    nOrigin = n
    n = n**0.5
    numlist = [0 for i in range(int(n) + 1)]
    numlist[0] = -1
    numlist[1] = -1

    t = 2
    while t < (n**0.5):
        if numlist[t] == 0:
            numlist[t] = t
            k = 2
            while t * k <= n:
                numlist[t * k] = -1
                k += 1
        t += 1
    while t <= n:
        if numlist[t] == 0:
            numlist[t] = t
        t += 1

    result = {}
    for i in numlist:
        if i == -1:
            continue
        j = 0
        while nOrigin % i == 0:
            j += 1
            nOrigin = nOrigin / i
        if j == 0:
            continue
        else:
            result[i] = j

    if int(nOrigin) != 1:
        result[int(nOrigin)] = 1
    return result

def help(e):
    i=0
    while i*(i+1)//2<=e:
        i+=1
    return i-1


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

retval=0
for key,value in d.items():
    retval+=help(value)


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

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

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

    return arr

f = factorization(N)
#print(f)
ans = 0
amari_cnt = 0
for a,b in f:
  wk = b
  tempc = 1
  while wk  - tempc >= 0:
    wk -= tempc
    ans += 1
    tempc *= 2

print(ans)
    

Fixed code:
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
if N == 1:
  print(0)
  exit(0)
f = factorization(N)
#print(f)
ans = 0
amari_cnt = 0
for a,b in f:
  wk = b
  tempc = 1
  while wk  - tempc >= 0:
    wk -= tempc
    ans += 1
    tempc += 1

print(ans)
Buggy 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())
S = []
fac = factorization(N)
for i in range(len(fac)):
  S.append(fac[i][1])
ans = 0
for i in range(len(S)):
  for j in range(1,S[i] + 1):
    if S[i] - j <= 0:
      break
    ans += 1
print(ans)

Fixed 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())
S = []
if N == 1:
  print(0)
  exit(0)
fac = factorization(N)
for i in range(len(fac)):
  S.append(fac[i][1])
ans = 0
for i in range(len(S)):
  for j in range(1,S[i] + 1):
    if S[i] - j < 0:
      break
    ans += 1
    S[i] -= j
print(ans)
Buggy code:
n=int(input())
cnt=0
for i in range(2,int(n**0.5)+2):
    if n%i==0:
        expo=0
    while n%i==0:
        n//=i
        expo+=1
        j=1
    while expo-j>=0:
        cnt+=1
        expo-=j
        j+=1
if n>1:
	cnt+=1
print(cnt)


Fixed code:
n=int(input())
cnt=0
for i in range(2,int(n**0.5)+2):
    if n%i==0:
        expo=0
        while n%i==0:
            n//=i
            expo+=1
        j=1
        while expo-j>=0:
            cnt+=1
            expo-=j
            j+=1
if n>1:
    cnt+=1
print(cnt)
Buggy code:
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

fact_N = factorization(N)
#fact_N = np.array(fact_N)
#num_sosuu = fact_N[:,1]

num_sosuu = []
for row in fact_N:
    num_sosuu.append(row[1])

#num_sosuu_max = num_sosuu.max()
num_sosuu_max = max(num_sosuu)

ans = 0
for i in range(len(num_sosuu)):
    num_i = num_sosuu[i]
#    for j in range(np.uint64(np.sqrt(2*num_sosuu_max))):
    for j in range(int((2*num_sosuu_max)**0.5)):
        if num_i >= j+1:
            ans += 1
            num_i -= j+1
        else:
            break

print(str(int(ans)))

Fixed code:
N = int(input())

def factorization(n):
    arr = []
    temp = n
#    for i in range(2, int(-(-n**0.5//1))+1):
    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
#                temp = (temp+0.5)//i
            arr.append([i, cnt])

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

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

    return arr

fact_N = factorization(N)
#fact_N = np.array(fact_N)
#num_sosuu = fact_N[:,1]

num_sosuu = []
for row in fact_N:
    num_sosuu.append(row[1])

#num_sosuu_max = num_sosuu.max()
#num_sosuu_max = max(num_sosuu)

ans = 0
for i in range(len(num_sosuu)):
    num_i = num_sosuu[i]
#    for j in range(np.uint64(np.sqrt(2*num_sosuu_max))):
#    for j in range(int((2*num_sosuu_max)**0.5)):
    j = 0
    judge = True
    while judge:
        if num_i >= j+1:
            ans += 1
            num_i -= j+1
            j+=1
        else:
#            break
            judge = False

if N == 1:
    ans = 0
    
print(str(ans))
Buggy code:
n = int(input())
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
f = list(set(prime_factors(n)))
print(f)
ans = 0
for i in f:
    e = 1
    while n % i**e == 0:
        n = n//(i**e)
        ans += 1
        e+=1

print(ans)  

Fixed code:
n = int(input())
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

f = list(set(prime_factors(n)))
ans = 0
for i in f:
    e = 1
    while n % i**e == 0:
        n = n//(i**e)
        ans += 1
        e+=1

print(ans)
Buggy code:
from collections import defaultdict
N = int(input())
d = defaultdict(int)
tmp = N
for i in range(2, int(math.sqrt(N))+1):
    while tmp % i == 0:
        d[i] += 1
        tmp /= i

if tmp > 1:
    d[tmp] += 1
ans = 0
for key, value in d.items():
    i = value
    j = 1
    while value >= j:
       ans += 1
       value -= j
       j += 1
print(ans)

Fixed code:
import math
from collections import defaultdict
N = int(input())
d = defaultdict(int)
tmp = N
for i in range(2, int(math.sqrt(N))+1):
    while tmp % i == 0:
        d[i] += 1
        tmp /= i

if tmp > 1:
    d[tmp] += 1
ans = 0
for key, value in d.items():
    i = value
    j = 1
    while value >= j:
       ans += 1
       value -= j
       j += 1
print(ans)
Buggy code:
n=int(input())
p=1
while p<1e6:
 c=t=0;p+=1
 while n%p<1:n/=p;x=c==t;t+=x;c+=1-t*x
print(t+1-(n<2))

Fixed code:
n=int(input())
a=p=1
while p<1e6:
 c=t=0;p+=1
 while n%p<1:n/=p;x=c==t;t+=x;c+=1-t*x;a+=x
print(a-(n<2))
Buggy code:

import sys

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)
    sys.exit()

A=factorization(N)

numlist=range(2,50)
sinsa=1
ans=0
for i in range(len(A)):
    beki=A[i][1]
    sosu=A[i][0]
    for j in range(1,beki+1):
        N=N/(sosu**j)
        ans+=1
        sinsa=sinsa+numlist[i]
        if sinsa>beki:
            sinsa=1
            break
print(ans)

Fixed code:

import sys

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)
    sys.exit()

A=factorization(N)

numlist=range(2,50)
sinsa=1
ans=0
for i in range(len(A)):
    beki=A[i][1]
    sosu=A[i][0]
    sinsa=1
    for j in range(1,beki+1):
        N=N/(sosu**j)
        ans+=1
        sinsa=sinsa+j+1
        if sinsa>beki:
            sinsa=1
            break
print(ans)
Buggy code:
import sys
n=int(input())
if n==1:
    print(0)
    sys.exit()
def f(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
tmp=f(n)
ans=0
for i in tmp:
    dd=i[1]
    tt=1
    while dd>0:
        if dd-tt>=0:
            dd-=tt
            tt+=1
            ans+=1
print(ans)

Fixed code:
import sys
n=int(input())
if n==1:
    print(0)
    sys.exit()
def f(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
tmp=f(n)
ans=0
for i in tmp:
    dd=i[1]
    tt=1
    while dd>0:
        if dd-tt>=0:
            dd-=tt
            tt+=1
            ans+=1
        else:
            break
print(ans)
Buggy 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
ans = 0
N = int(input())
f = factorization(N)
for pair in f:
  p = pair[0]
  e = pair[1]
  i = 1
  while(e-i>=0):
    e = e - i
    i = i  + 1
    ans = ans + 1
print(ans)

Fixed 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
ans = 0
N = int(input())
f = factorization(N)
for pair in f:
  p = pair[0]
  e = pair[1]
  i = 1
  while(e-i>=0):
    e = e - i
    i = i  + 1
    ans = ans + 1
if N == 1:
  ans = 0
print(ans)
Buggy 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 f(n):
  for i in range(50,-1,-1):
    if n>=(i*(i+1)//2):
      return i
      break
n=int(input())
cnt=0
alist=factorization(n)
for i in range(len(alist)):
  cnt+=f(alist[i][1])
print(cnt)

Fixed 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 f(n):
  for i in range(50,-1,-1):
    if n>=(i*(i+1)//2):
      return i
      break
n=int(input())
cnt=0
alist=factorization(n)
for i in range(len(alist)):
  cnt+=f(alist[i][1])
if n==1:
  cnt=0
print(cnt)
Buggy code:
import math
N = int(input())

def primary(x):
  D = {}
  for num in range(2, int(math.sqrt(x))+1):
    while x % num == 0:
      if num in D:
        D[num] += 1
      else:
        D.setdefault(num, 1)
      x = x // num
  if not D:
    return 0
  else:
    return D

primaryN = primary(N)
a = 0
if primary(N) == 0:
  print(a)
else:
  for i in primaryN:
    j = 1
    while primaryN[i] > 0:
      primaryN[i] = primaryN[i] - j
      if primaryN[i] >= 0:
        a = a + 1
      j = j + 1
  print(a)


Fixed code:
import math
N = int(input())

def primary(x):
  D = {}
  for num in range(2, int(math.sqrt(x))+2):
    while x % num == 0:
      if num in D:
        D[num] += 1
      else:
        D.setdefault(num, 1)
      x = x // num
  if x > 1:
    D.setdefault(x, 1)
  if not D:
    return 0
  else:
    return D

primaryN = primary(N)
#print(primary(N))
a = 0
if N == 1:
  print(0)
elif primary(N) == 0:
  print(1)
else:
  for i in primaryN:
    j = 1
    while primaryN[i] > 0:
      primaryN[i] = primaryN[i] - j
      if primaryN[i] >= 0:
        a = a + 1
      j = j + 1
  print(a)
Buggy code:
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])
    return arr

l=factorization(n)

ans=0
cnt=1
if n==1:
  print(0)
else:
  for i,e in l:
    cnt=1
    if e==1:
      ans+=1
      continue
    while(cnt<=e):
      e-=cnt
      ans+=1
      cnt+=1
print(ans)

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

l=factorization(n)

ans=0
cnt=1
if n==1:
  print(0)
else:
  for i,e in l:
    cnt=1
    while(cnt<=e):
      e-=cnt
      ans+=1
      cnt+=1
  print(ans)
Buggy 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
    
a=factorization(int(input()))

b=[1,3,6,10,15,21,28,36]

ans=0

for i in a:
    for j in range(len(b)):
        if i[1]<b[j]:
            ans+=j
            break
    
print(ans)

Fixed 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
    
a=factorization(int(input()))

b=[1,3,6,10,15,21,28,36,43]

ans=0
if len(a)==1 and a[0][0]==1:
    print(0)
    exit()

for i in a:
    for j in range(len(b)):
        if i[1]<b[j]:
            ans+=j
            break
print(ans)
Buggy code:
import sys
input = sys.stdin.buffer.readline
import bisect

def main():
    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
    
    c = factorization(N)
    
    can = []
    for i in range(1,50):
        can.append((i*(i+1))//2)

    ans = 0
    for _,cnt in c:
        ind = bisect.bisect_right(can,cnt)
        ans += ind
    
    print(ans)

if __name__ == "__main__":
    main()

Fixed code:
import sys
input = sys.stdin.buffer.readline
import bisect

def main():
    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
    
    c = factorization(N)
    
    can = []
    for i in range(1,50):
        can.append((i*(i+1))//2)

    ans = 0
    for _,cnt in c:
        ind = bisect.bisect_right(can,cnt)
        ans += ind
    
    print(ans)

if __name__ == "__main__":
    main()
Buggy code:
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  print(n, p, e)
  while n >= (p ** e) 
and n % (p ** e) == 0:
    n = n // (p ** e)
    score += 1
    e += 1
  else:
    p = p + 1 if p == 2 else p + 2
else:
  if n != 1:
    score += 1
print(score)

Fixed code:
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  while n % (p ** e) == 0:
    n //= (p ** e)
    score += 1
    e += 1
  else:
    while n % p == 0:
      n //= p
    p += 1
else:
  if n != 1:
    score += 1
print(score)
Buggy code:
N = int(input())
p, score = 2, 0
while p ** 2 <= N:
  e = 1
  while N >= (p ** e) and N % (p ** e) == 0:
    N = N // (p ** e)
    score += 1
    e += 1
  else:
    p = p + 1 if p == 2 else p + 2
else:
  if N != 1 and score == 0:
    score += 1
print(score)

Fixed code:
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  # print(n, p, e)
  while n >= (p ** e) and n % (p ** e) == 0:
    n = n // (p ** e)
    score += 1
    e += 1
  else:
    while n >= p and n % p == 0:
      n = n // p
    p = p + 1 if p == 2 else p + 2
else:
  if n != 1:
    score += 1
print(score)
Buggy code:
import collections
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

p = [1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]

n = int(input())
if n == 0:
    print(0)
else:
    ans = 0
    for j in factorization(n):
        ans += p[j[1]-1]

    print(ans)

Fixed 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

p = [1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]

n = int(input())
if n == 1:
    print(0)
else:
    ans = 0
    for j in factorization(n):
        ans += p[j[1]-1]

    print(ans)
Buggy 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 not arr:
        arr.append([n, 1])

    return arr


N = int(input())
p = factorization(N)
count = 0
while N != 1:
    for x in p:
        for i in range(1, x[1] + 1):
            if N % x[0]**i == 0:
                N /= x[0]**i
                count += 1
            else:
                break
print(count)


Fixed 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 not arr:
        arr.append([n, 1])

    return arr


N = int(input())
p = factorization(N)
count = 0
for x in p:
    if N == 1:
        break
    for j in range(1, x[1] + 1):
        if N % (x[0] ** j) == 0:
            N /= x[0] ** j
            count += 1
        else:
            break
print(count)
Buggy code:
import sys
n=int(input())

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

orgn=n
counter=0
for i in range(2,int((n**0.5) + 1) ):
    if n % i == 0:
        counter += 1
        n //= i
        wari=i**2
        while n % wari == 0:
            counter +=1
            n //= wari
            wari *= i
        
        while n % i ==0:
            n //= i

if n == orgn:
    print(1)

if n > int(n ** 0.5):
        counter+=1
print(counter)

Fixed code:
import sys
n=int(input())

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

orgn=n
counter=0
for i in range(2,int((n**0.5) + 1) ):
    if n % i == 0:
        counter += 1
        n //= i
        wari=i**2
        while n % wari == 0:
            counter +=1
            n //= wari
            wari *= i
        
        while n % i ==0:
            n //= i

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

if n > int(n ** 0.5):
        counter+=1
print(counter)