qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = int(input())

def divGame(N=n):
  if N == 1:
    return 0
  if N == 2:
    return 1
  
  factors = []
  
  count = 0
  while N % 2 == 0:
    N /= 2
    count += 1
  if count != 0:
    factors.append(count)

  for i in range(3, int(N**0.5 + 1), 2):
    count = 0
    while N % i == 0:
      N /= i
      count += 1
    if count != 0:
      factors.append(count)
  if N != 1:
    factors.append(1)

  factors.sort()

  answer = 0
  accum = 1
  count = 1
  for i in range(len(factors)):
    while factors[i] > accum:
      count += 1
      accum += count
    answer += count

  return answer

print(divGame())

Fixed code:
n = int(input())

def divGame(N=n):
  if N == 1:
    return 0
  if N == 2:
    return 1
  
  factors = []

  for i in range(2, int(N**0.5 + 1)):
    count = 0
    while N % i == 0:
      N /= i
      count += 1
    if count != 0:
      factors.append(count)
  if N != 1:
    factors.append(1)

  factors.sort()

  answer = 0
  accum = 1
  count = 1
  for i in range(len(factors)):
    while factors[i] >= accum:
      count += 1
      accum += count
    answer += count - 1

  return answer

print(divGame())
Buggy code:
n = int(input())
li = []
if n==1:
  print(0)
else:
  for i in range(1000000):
    if n==1:
      break
    if i==0 or i==1 or n%i!=0:
      continue
    j = i
    cnt = 0
    while(n%j==0):
      if flg==0:
        flg = 1
      n /= j
      cnt += 1
    li.append(cnt)
  if flg==0:
    print(1)
  else:
    ans = 0
    for e in li:
      i = 1
      while(e-i>=0):
        e -= i
        i += 1
        ans += 1
    print(ans)

Fixed code:
n = int(input())
li = []
flg = 0
for i in range(1000000):
  if n==1:
    break
  if i==0 or i==1 or n%i!=0:
    continue
  j = i
  cnt = 0
  while(n%j==0):
    if flg==0:
      flg = 1
    n /= j
    cnt += 1
  li.append(cnt)
if flg==0 and n!=1:
  print(1)
elif flg==0 and n==1:
  print(0)
elif n==1:
  ans = 0
  for e in li:
    i = 1
    while(e-i>=0):
      e -= i
      i += 1
      ans += 1
  print(ans)
else:
  ans = 1
  for e in li:
    i = 1
    while(e-i>=0):
      e -= i
      i += 1
      ans += 1
  print(ans)
Buggy code:
N = int(input())

import heapq 





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,i, cnt])

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

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

    return arr

# for N in range(1,100000):
# N = 288
# print(N)

heap = factorization(N) 
print(heap)
# print(heap)
heapq.heapify(heap)
ans = 0

while(heap):
    # print(heap)
    if N == 1:
        break
    sub,prime,cnt = heapq.heappop(heap)
    if N < sub:
        break
    if N % sub == 0:
        N = N // sub
        ans += 1
        if cnt > 0:
            cnt -= 1
            sub *= prime
            heapq.heappush(heap, [sub,prime,cnt])

    print(ans)




Fixed code:
N = int(input())

import heapq 





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,i, cnt])

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

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

    return arr

# for N in range(1,100000):
# N = 288
# print(N)

heap = factorization(N) 
# print(heap)
# print(heap)
heapq.heapify(heap)
ans = 0

while(heap):
    # print(heap)
    if N == 1:
        break
    sub,prime,cnt = heapq.heappop(heap)
    if N < sub:
        break
    if N % sub == 0:
        N = N // sub
        ans += 1
        if cnt > 0:
            cnt -= 1
            sub *= prime
            heapq.heappush(heap, [sub,prime,cnt])

print(ans)
Buggy code:
import collections
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
c =  collections.Counter(prime_factorize(n))
a = c.values()
# print(c.items())
count =0
for i in a:
    k=1
    for j in range(n):
        if (i==1):
            count+=1
            break
        i-=k
        k +=j+1
        # print(i,j)
        count +=1
        if (i<=j):
            break
    
print(count)

Fixed code:
import collections
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
c =  collections.Counter(prime_factorize(n))
a = c.values()
# print(a)
count =0
for i in a:
    k=1
    for j in range(n):
        if (i==1):
            count+=1
            break
        i-=k
        k +=1
        # print(i,k-1)
        count +=1
        if (i<=k-1):
            break
    
print(count)
Buggy code:
import sys
from collections import deque
import collections
import numpy as np

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

def hantei(n):
    i = 0
    while (i+1)*i/2<n:
        i+=1
    return i

c = collections.Counter(prime_factorize(n))
ans = 0
#print(c)

for i in c.values():
    #print("val=",i)
    ans += hantei(i)
print(ans)


Fixed code:
import sys
from collections import deque
import collections
import numpy as np

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

def hantei(n):
    i = 0
    if n == 1 or n==2:
        return 1
    while (i+1)*i/2<=n:
        i+=1
    return i-1

c = collections.Counter(prime_factorize(n))
ans = 0
#print(c)

for i in c.values():
    #print("val=",i)
    ans += hantei(i)
print(ans)
Buggy code:
import math
import collections


def main():
    N = int(input())
    limit = math.sqrt(N)
    vals = []
    i = 2
    while True:
        if i > limit:
            break
        if N % i ==0:
            vals.append(i)
            N //= i
        else:
            i += 1
    if len(vals) == 0:
        print(1)
        exit()
    c = collections.Counter(vals)
    ans = 0
    for v, freq in c.items():
        i = 0
        while True:
            i += 1
            freq -= i
            if freq < 0:
                break
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Fixed code:
import math
import collections


def main():
    N = int(input())
    if N == 1:
        print(0)
        exit()
    limit = math.sqrt(N)
    vals = []
    i = 2
    while True:
        if i > limit:
            break
        if N % i == 0:
            vals.append(i)
            N //= i
        else:
            i += 1
    if N != 1:
        vals.append(N)
    c = collections.Counter(vals)
    ans = 0
    for v, freq in c.items():
        i = 0
        while True:
            i += 1
            freq -= i
            if freq < 0:
                break
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
Buggy code:
N = int(input())

def prime_factorization(N):
  n = int(N**0.5)
  numList = [i if i != 1 else 2 for i in range(1, n, 2) ]
  primeList = [2]
  ansDict = {}
  idx = 0
  for data in numList:
    for x in primeList:
      if (data%x != 0 or x == 2):
        count = 0
        while N%data == 0:
          count += 1
          N //= data
        if count > 0:
          ansDict[data] = count
        if N == 1:
          return ansDict
        if x != 2:
          primeList.append(data)
        break           
  return ansDict
    
ansDict = prime_factorization(N)
ansCount = 0
if ansDict == {}:
  print(0)
else: 
  for k,v in ansDict.items():
    tmpCount = 1
    while tmpCount <= v:
      ansCount += 1
      v -= tmpCount
      tmpCount += 1    
  print(ansCount)

Fixed code:
N = int(input())
 
def prime_factorization(N):
  n = int(N**0.5)+1
  numList = [i if i != 1 else 2 for i in range(1, n, 2) ]
  primeList = [2]
  ansDict = {}
  idx = 0
  for data in numList:
    for x in primeList:
      if (data%x != 0 or x == 2):
        count = 0
        while N%data == 0:
          count += 1
          N //= data
        if count > 0:
          ansDict[data] = count
        if N == 1:
          return ansDict
        if x != 2:
          primeList.append(data)
        break
  if N != 1:
    ansDict[N] = 1
  
  return ansDict 

if N <= 1:
  print(0)
  exit()
  
ansDict = prime_factorization(N)
ansCount = 0
for p,v in ansDict.items():
  e = 1
  while e <= v:
    ansCount += 1
    v -= e 
    e += 1  

print(ansCount)
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())
fs = factorization(N)

if N == 1:
  print(0)

ans = 0
for f in fs:
  for e in range(1, f[1] + 1):
    z = f[0] ** e
    if N % z == 0:
      N //= z
      ans += 1

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())
fs = factorization(N)

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

ans = 0
for f in fs:
  for e in range(1, f[1] + 1):
    z = f[0] ** e
    if N % z == 0:
      N //= z
      ans += 1

print(ans)
Buggy code:
import math

n = int(input())
i = 2
count = 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

a = factorization(n) 
a_l = len(a)
#print(a)
ans = 0

for i in range(a_l):
  w = a[i][1]
  w_n = 1
  c_n = 0
  while True:
    if w < w_n:
      break
    else:
      w = w-w_n
      w_n = w_n + 1
      c_n = c_n + 1
  ans = ans + c_n
print(ans)

Fixed code:
import math

n = int(input())
i = 2
count = 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

a = factorization(n) 
a_l = len(a)
#print(a)
ans = 0

for i in range(a_l):
  w = a[i][1]
  w_n = 1
  c_n = 0
  while True:
    if w < w_n:
      break
    else:
      w = w-w_n
      w_n = w_n + 1
      c_n = c_n + 1
  ans = ans + c_n
if n == 1:
  print(0)
else:
  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

fact = factorization(997764507000)

count = 0

for tup in fact:
    countTup = 0
    while True:
        countTup += 1
        if tup[1] < countTup:
            break
        tup[1] -= countTup
    count += countTup - 1
    
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 arr==[]:
        arr.append([n, 1])

    return arr

a = int(input())

fact = factorization(a)

count = 0

for tup in fact:
    countTup = 0
    while True:
        countTup += 1
        if tup[1] < countTup:
            break
        tup[1] -= countTup
    count += countTup - 1

if a == 1:
    print(0)
else:
    print(count)
Buggy code:
n=int(input())
lst=[]
i=2
while i**2<=n:
    if n%i==0:
        n//=i
        lst.append(i)
        continue
    i+=1
lst.append(n)
from collections import Counter
dic=dict(Counter(lst))
s=0
for i in dic:
    n=dic[i]
    k=0
    while n>=0:
        s+=1
        k+=1
        n-=k
    s-=1
print(s)

Fixed code:
n=int(input())
if n==1:
    print(0)
else:
    lst=[]
    i=2
    while i**2<=n:
        if n%i==0:
            n//=i
            lst.append(i)
            continue
        i+=1
    lst.append(n)
    from collections import Counter
    dic=dict(Counter(lst))
    s=0
    for i in dic:
        n=dic[i]
        k=0
        while n>=0:
            s+=1
            k+=1
            n-=k
        s-=1
    print(s)
Buggy code:
import math
n = int(input())
prime_list = []

for i in range(2, int(math.sqrt(n)) + 1):
    if n % i == 0:
        prime_list.append(i)
        n /= i
        index = 2
        counter = 0
        while 1:
            if n % i == 0:
                n /= i
                counter += 1
                if(counter == index):
                    prime_list.append(i ** index)
                    index += 1
                    counter = 0
            else:
                break
print(len(prime_list))


Fixed code:
import math
n = int(input())
prime_list = []

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

for i in range(2, int(math.sqrt(n)) + 1):
    if n % i == 0:
        prime_list.append(i)
        n /= i
        index = 2
        counter = 0
        while 1:
            if n % i == 0:
                counter += 1
                n /= i
                if(counter == index):
                    prime_list.append(i ** index)
                    index += 1
                    counter = 0
            else:
                break
if n > 1:
    prime_list.append(n)

print(len(prime_list))
Buggy code:
m=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(m)
ans=0
for i in range(len(l)):
    a=1
    while(l[i][1]>=a):
        ans+=1
        l[i][1]-=a
        a+=1

print(ans)

Fixed code:
m=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(m)
ans=0
for i in range(len(l)):
    a=1
    while(l[i][1]>=a):
        ans+=1
        l[i][1]-=a
        a+=1
if m==1:
    print("0")
else:
    print(ans)
Buggy code:
import math
n=int(input())
def factorization(num):
    factor = []
    flag = True
    is_Prime= True
    while num > 1 and flag:
        flag = False
        for i in range(int(math.sqrt(num))+2):
            k = i + 2
            if num % k == 0:
                factor.append(k)
                num = int(num / k)
                is_Prime = False
                flag = True
                break
    if is_Prime:
        factor.append(num)
    return factor
a = factorization(n)
from collections import Counter
co = Counter(a)
result = 0
for k, num in co.items():
    c = 0
    for i in range(1, num+1):
        c += i
        result += 1
        if c > num:
            result -= 1
            break
print(result)


Fixed code:
import math
n=int(input())
def factorization(num):
    factor = []
    flag = True
    is_Prime= True
    if num == 1:
        is_Prime = False
    while num > 1 and flag:
        flag = False
        for i in range(int(math.sqrt(num))+2):
            k = i + 2
            if num % k == 0:
                factor.append(k)
                num = int(num / k)
                is_Prime = False
                flag = True
                break
    if is_Prime or num > 1:
        factor.append(num)
    return factor
a = factorization(n)
from collections import Counter
co = Counter(a)
result = 0
for k, num in co.items():
    c = 0
    for i in range(1, num+1):
        c += i
        result += 1
        if c > num:
            result -= 1
            break
print(result)
Buggy code:
N = int(input())
a = [int(0.5*i*(i+1)) for i in range(10)]
import math
res = 0
top = int(math.sqrt(N))
for i in range(2,top):
    count = 0
    while N%i == 0:
        N = N//i
        count += 1
    for j in range(10):
        if count < a[j]:
            res += (j-1)
            break
print(res)

Fixed code:
N = int(input())
a = [int(0.5*i*(i+1)) for i in range(10)]
import math
res = 0
top = int(math.sqrt(N))
for i in range(2,top+1):
    count = 0
    while N%i == 0:
        N = N//i
        count += 1
    for j in range(10):
        if count < a[j]:
            res += (j-1)
            break
if N != 1:
    print(res+1)
else:
    print(res)
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(cnt)
    if temp!=1:
        arr.append(1)
    if arr==[]:
        arr.append(1)
    return arr

def calc(n):
    val = 1
    count = 0
    for i in range(2,100000):
        count += 1
        val = val + i
        if val > n:
            return count

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

print(arr)

ans = 0 
for val in arr:
    ans += calc(val)
 
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(cnt)
    if temp!=1:
        arr.append(1)
    if arr==[]:
        arr.append(1)
    return arr

def calc(n):
    val = 1
    count = 0
    for i in range(2,100000):
        count += 1
        val = val + i
        if val > n:
            return count

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

arr = factorization(N)

ans = 0 
for val in arr:
    ans += calc(val)
 
print(ans)
Buggy code:
from collections import Counter


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


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

if __name__ == "__main__":
  main()


Fixed code:
from collections import Counter


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


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


if __name__ == "__main__":
  main()
Buggy code:
def fa(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

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

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

    return arr




n=int(input())
if n==1:
  print(0)
  exit()
A=fa(n)
ans=0
for i in range(len(A)):
  x=int(2*A[i][1]**(0.5))
  if (x-2)*(x-1)<=2*A[i][1]<x*(x-1):
    a=x-2
  if (x-1)*x<=2*A[i][1]<x*(x+1):
    a=x-1
  if (x+1)*x<=2*A[i][1]<(x+2)*(x+1):
    a=x
  if (x+1)*(x+2)<=2*A[i][1]<(x+2)*(x+3):
    a=x+1
  if (x+3)*(x+2)<=2*A[i][1]<(x+4)*(x+3):
    a=x+2
  ans=ans+a
print(a)

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

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

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

    return arr




n=int(input())
if n==1:
  print(0)
  exit()
A=fa(n)
ans=0
for i in range(len(A)):
  x=int((2*A[i][1])**(0.5))
  if (x-2)*(x-1)<=2*A[i][1]<x*(x-1):
    a=x-2
  if (x-1)*x<=2*A[i][1]<x*(x+1):
    a=x-1
  if (x+1)*x<=2*A[i][1]<(x+2)*(x+1):
    a=x
  if (x+1)*(x+2)<=2*A[i][1]<(x+2)*(x+3):
    a=x+1
  if (x+3)*(x+2)<=2*A[i][1]<(x+4)*(x+3):
    a=x+2
  ans=ans+a
print(ans)
Buggy code:
Number=int(input())
#Number=997764507000

times=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])
    
    if n==1:
        return []
    else:
        return arr


Factors=factorization(Number)
print(Factors)

for i in Factors:
    Power=i[1]
    BiggerThan=0
    MinusPower=1
    
    while Power>BiggerThan:
        times+=1
        Power-=MinusPower
        MinusPower+=1
        BiggerThan+=1

print(times)

Fixed code:
Number=int(input())

times=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])
    
    if n==1:
        return []
    else:
        return arr


Factors=factorization(Number)
#print(Factors)

for i in Factors:
    Power=i[1]
    BiggerThan=0
    MinusPower=1
    
    while Power>BiggerThan:
        times+=1
        Power-=MinusPower
        MinusPower+=1
        BiggerThan+=1

print(times)
Buggy code:
import math
N_ = N = int(input())
div = {}
for i in range(2, int(math.sqrt(N))+1):
    while N % i == 0:
        N /= i
        if i in div:
            div[i] += 1
        else:
            div[i] = 1
    if N == 1:
        break
if len(div) == 0:
    div[N_] = 1
ans = 0
for v in div.values():
    i = 1
    while v >= i:
        v -= i
        i += 1
        ans += 1
print(ans)


Fixed code:
import math
N = int(input())
if N == 1:
    print(0)
    exit()
div = {}
for i in range(2, int(math.sqrt(N))+1):
    while N % i == 0:
        N = N // i
        if i in div:
            div[i] += 1
        else:
            div[i] = 1
    if N == 1:
        break
if N != 1:
    div[N] = 1
ans = 0
for v in div.values():
    i = 1
    while v >= i:
        v -= i
        i += 1
        ans += 1
print(ans)
Buggy code:
n = int(input())

ans = 0
for i in range(2,int(n**0.5)+1):
    count = 1
    loop = 1
    while n % i == 0:
        n = int(n/i)
        count -= 1
        if count == 0:
            ans += 1
            loop += 1
            count = loop
            print(str(n) + "," + str(i) + "," + str(ans)+","+str(i**loop))
if n > 1:
    ans = 1
print(ans)

Fixed code:
n = int(input())

ans = 0
for i in range(2,int(n**0.5)+1):
    count = 1
    loop = 1
    while n % i == 0:
        n = int(n/i)
        count -= 1
        if count == 0:
            ans += 1
            loop += 1
            count = loop

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