qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
mod = 10**9+7
ans = 1
num = [0]*N
for i in range(1,N+1):
    for j in range(2,i+1):
        while i % j == 0:
            i //= j
            num[j-1] += 1
for i in range(N):
    if num[i] == 0:
        continue
    else:
        ans *= (num[i]+1) % mod
print(ans)

Fixed code:
N = int(input())
mod = 10**9+7
ans = 1
num = [0]*N
for i in range(1,N+1):
    for j in range(2,i+1):
        while i % j == 0:
            i //= j
            num[j-1] += 1
for i in range(N):
    if num[i] == 0:
        continue
    else:
        ans = ans * (num[i]+1) % mod
print(ans)
Buggy code:
import math
mod = int(1e9+7)

N = int(input())
n = math.factorial(N)

count_of_prime_factors = {}
while True:
    if n > 1:
        count = 0
        while n % 2 == 0:
            n //= 2
            count += 1
        if count != 0:
            count_of_prime_factors.update({2: count})
        if n == 1: 
            break 

        for i in range(3, N+1, 2):
            count = 0
            while n % i == 0:
                n //= i 
                count += 1
            if count != 0:
                count_of_prime_factors.update({i: count})
            if n == 1: 
                break
        else:        
            count_of_prime_factors.update({n: 1})
        break 
    else:
        print(1)
        exit()

ans = 1
for prime_factor, count in count_of_prime_factors.items():
    ans *= count + 1

print(ans % mod)
print(count_of_prime_factors)





Fixed code:
import math
mod = int(1e9+7)

N = int(input())
n = math.factorial(N)

count_of_prime_factors = {}
while True:
    if n > 1:
        count = 0
        while n % 2 == 0:
            n //= 2
            count += 1
        if count != 0:
            count_of_prime_factors.update({2: count})
        if n == 1: 
            break 

        for i in range(3, N+1, 2):
            count = 0
            while n % i == 0:
                n //= i 
                count += 1
            if count != 0:
                count_of_prime_factors.update({i: count})
            if n == 1: 
                break
        else:        
            count_of_prime_factors.update({n: 1})
        break 
    else:
        print(1)
        exit()

ans = 1
for prime_factor, count in count_of_prime_factors.items():
    ans *= count + 1

print(ans % mod)
Buggy code:
n=int(input())
ans=1
mod=10**7+1
m=1
for i in range(n):
    m*=(i+1)
for j in range(2,n+1):
    b=1
    while m%j==0:
        m=m//j
        b+=1
    ans*=b
ans=ans%mod
print(ans)

Fixed code:
n=int(input())
ans=1
mod=10**9+7
m=1
for i in range(n):
    m*=(i+1)
for j in range(2,n+1):
    b=1
    while m%j==0:
        m=m//j
        b+=1
    ans*=b
ans=ans%mod
print(ans)
Buggy code:
n=int(input())
if n==1:
    print(1)
    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
so=[]
ka=[]
for i in range(2,n+1):
    a=factorization(i)
    for j in a:
        if not j[0] in so:
            so.append(j[0])
            ka.append(j[1])
        else:
            ka[so.index(j[0])]+=j[1]
ans=1
for i in ka:
    ans*=(ka+1)
print(ans)

Fixed code:
n=int(input())
if n==1:
    print(1)
    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
so=[]
ka=[]
for i in range(2,n+1):
    a=factorization(i)
    for j in a:
        if not j[0] in so:
            so.append(j[0])
            ka.append(j[1])
        else:
            ka[so.index(j[0])]+=j[1]
ans=1
for i in ka:
    ans*=(i+1)%1000000007
print(ans%1000000007)
Buggy code:
import math
import collections
import sys
sys.setrecursionlimit(500000)

def f(n,x,i):
    if i == x:
        return a
    while n % i == 0:
        a.append(i)
        n //= i

    return f(n,x,i+1)
a = []
n = int(input())
c = collections.Counter(f(math.factorial(n),n,2))
d = [i[1]+1 for i in c.items()]
ans = 1
for i in range(len(d)):
    ans = (ans * d[i]) % 1000000007
print(ans)

Fixed code:
import math
import collections
import sys
sys.setrecursionlimit(500000)

def f(n,i):
    while i * i <= n:
        if n % i == 0:
            a.append(i)
            n //= i
        else:i += 1
    if n != 1:
        a.append(n)
    return a

a = []
n = math.factorial(int(input()))
c = collections.Counter(f(n,2))
d = [i[1]+1 for i in c.items()]
ans = 1
for i in range(len(d)):
    ans = (ans * d[i]) % 1000000007
print(ans)
Buggy code:
import math
n = int(input())

def div(m):
  d = {}
  temp = math.ceil(math.sqrt(m))+1
  for i in range(2, temp):
    while m%i== 0:
      m /= i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
  if d == {}:
    d[m] = 1
  return d

from collections import Counter

d = {}
for i in range(2, n+1):
  d = dict(Counter(d)+Counter(div(i)))
#print(d)
ans = 1
for i in d.values():
  ans *= (i+1)
print(ans%(10**9+7))



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

def div(m):
  d = {}
  temp = int(math.sqrt(m))+1
  for i in range(2, temp):
    while m%i== 0:
      m //= i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
  if d == {}:
    d[m] = 1
  else:
    if m in d:
      d[m] += 1
    elif m != 1:
      d[m] =1
  return d

from collections import Counter

d = {}
for i in range(2, n+1):
  d = dict(Counter(d)+Counter(div(i)))
#print(d)
ans = 1
for i in d.values():
  ans *= (i+1)
  ans %= 10**9+7
print(ans)
Buggy code:
n = int(input())

mod = 10**9+7

sosu = [1] * 100

for j in range(2,n+1):
    tmp = j
    while tmp > 1:
        for i in range(2,n+1):
            if tmp % i == 0:
                sosu[i] += 1
                tmp = tmp // i
        
#print(sosu)
sosu.sort(reverse=True)

ans = 1

for i in range(len(sosu)):
    if sosu[i] > 0:
        ans = ans*sosu[i] % mod
        
print(ans)

Fixed code:
n = int(input())

mod = 10**9+7

sosu = [1] * 1001

for j in range(2,n+1):
    tmp = j
    i = 2
    while tmp > 1:
        if tmp % i == 0:
            sosu[i] += 1
            tmp = tmp // i
        else:
            i += 1
        
#print(sosu)
sosu.sort(reverse=True)

ans = 1

for i in range(len(sosu)):
    if sosu[i] > 1:
        ans = ans*sosu[i] % mod
        
print(ans)
Buggy code:
N = int(input())
MOD = 10 ** 9 + 7
x = 1
for i in range(2, N + 1):
  x *= i

count = 1
for i in range(2, N + 1):
  if x % i != 0:
    continue
  count = 1
  while x % i == 0:
    x //= i
    count += 1
  ans *= count
print(ans % MOD)

Fixed code:
N = int(input())
MOD = 10 ** 9 + 7
x = 1
for i in range(2, N + 1):
  x *= i

count = 1
ans = 1
for i in range(2, N + 1):
  if x % i != 0:
    continue
  count = 1
  while x % i == 0:
    x //= i
    count += 1
  ans *= count
print(ans % MOD)
Buggy code:
from collections import defaultdict
N = int(input())
MOD = 10 ** 9 + 7

def prime_factor(n):
    d = defaultdict(int)
    for i in range(2, n + 1):
        if i * i > n:
            break
            
        while n % i == 0:
            d[i] += 1
            n //= i
            
    if n != 1:
        d[n] = 1
            
    return d

d = defaultdict(int)
for i in range(1, N + 1):
    for j, v in prime_factor(i).items():
        d[j] += v

ans = 1
for v in d.values():
    ans *= v + 1
print(ans)




Fixed code:
from collections import defaultdict
N = int(input())
MOD = 10 ** 9 + 7

def prime_factor(n):
    d = defaultdict(int)
    for i in range(2, n + 1):
        if i * i > n:
            break
            
        while n % i == 0:
            d[i] += 1
            n //= i
            
    if n != 1:
        d[n] = 1
            
    return d

d = defaultdict(int)
for i in range(1, N + 1):
    for j, v in prime_factor(i).items():
        d[j] += v

ans = 1
for v in d.values():
    ans = ans * (v + 1) % MOD
print(ans)
Buggy code:
import math
from collections import defaultdict

N = int(input())

d = defaultdict(int)

def division(n,d):
    flag = True
    tmp = n // 2 + 1
    for num in range(2, tmp):
        while n % num == 0:
            flg = False
            n //= num
            d[num] += 1

    if flg:
        d[n] += 1

    return

ans = 1
for i in d.values():
    ans *= (i+1)

print(ans%(10**9+7))



Fixed code:
import math
from collections import defaultdict

N = int(input())

d = defaultdict(int)

def division(n,d):
    flag = True
    tmp = n // 2 + 1
    for num in range(2, tmp):
        while n % num == 0:
            flag = False
            n //= num
            d[num] += 1

    if flag:
        d[n] += 1

    return

for n in range(2,N+1):
    division(n,d)

ans = 1
for i in d.values():
    ans *= (i+1)

print(ans%(10**9+7))
Buggy code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

# Factoring by trial split
def getPrimeList(n):
  l=[]
  t=int(math.sqrt(n))+1
  
  for a in range(2,t):
    while n%a==0:
      n//=a
      l.append(a)
  
  if n!=1:
    l.append(n)
  
  return l

def main():
  l=[0]*1001

  n=I()

  for i in range(2,n+1):
    x=getPrimeList(i)
    for j in x:
      l[j]+=1

  sm=1
  for i in l:
    sm*=i+1

  return sm

print(main())


Fixed code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

# Factoring by trial split
def getPrimeList(n):
  l=[]
  t=int(math.sqrt(n))+1
  
  for a in range(2,t):
    while n%a==0:
      n//=a
      l.append(a)
  
  if n!=1:
    l.append(n)
  
  return l

def main():
  l=[0]*1001

  n=I()

  for i in range(2,n+1):
    x=getPrimeList(i)
    for j in x:
      l[j]+=1

  sm=1
  for i in l:
    sm*=i+1

  return sm%mod

print(main())
Buggy code:
n=int(input())
x=1
for i in range(1,n+1):
    x*=i

res=1

for i in range(2,n+1):
    cnt=1
    while x%i==0:
        x=x/i
        cnt+=1
    res*=cnt
    
print(res%(10**9+7))

Fixed code:
n=int(input())
x=1
for i in range(1,n+1):
    x*=i

res=1

for i in range(2,n+1):
    cnt=1
    while x%i==0:
        x=x//i
        cnt+=1
    res*=cnt
    
print(res%(10**9+7))
Buggy code:
N = int(input())
prime = [0]*(N+1)
ans = 1
for i in range(2,N+1):
    d = 1
    while i > 1:
        d+=1
        while i % d == 0:
            i = i//d
            prime[d]+= 1
for j in range(N):
    ans = ans *(prime[j]+1)%(10**9+7)
print(ans)


Fixed code:
N = int(input())
prime = [0]*(N+1)
ans = 1
for i in range(2,N+1):
    d = 1
    while i > 1:
        d+=1
        while i % d == 0:
            i = i//d
            prime[d]+= 1
for j in range(N+1):
    ans = ans *(prime[j]+1)%(10**9+7)
print(ans)
Buggy code:
N = int(input())
prime = [2]
Res = 1

for i in range(3, N+1, 2):
    flag = True
    for j in prime:
        if i % j == 0:
            flag = False
            break
    if flag:
        prime.append(i)

div = [0]*len(prime)

for i in range(2, N+1):
    for j in range(len(prime)):
        while i % prime[j] == 0:
            div[j] += 1
            i = i//prime[j]

for i in div:
    Res *= i+1

print(Res)

Fixed code:
N = int(input())
prime = [2]
Res = 1

for i in range(3, N+1, 2):
    flag = True
    for j in prime:
        if i % j == 0:
            flag = False
            break
    if flag:
        prime.append(i)

div = [0]*len(prime)

for i in range(2, N+1):
    for j in range(len(prime)):
        while i % prime[j] == 0:
            div[j] += 1
            i = i//prime[j]

for i in div:
    Res *= i+1
    Res %= 10**9+7

print(Res)
Buggy code:
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

if __name__ == "__main__":
    N = int(input())
    num = math.factorial(N)
    pf = prime_factors(num)
    c = Counter(pf)
    
    res = 1

    for i in c.values():
        res *= i + 1
    
    print(res % (10**9+7))

Fixed code:
import math
from collections import Counter

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

if __name__ == "__main__":
    N = int(input())
    num = math.factorial(N)
    pf = prime_factors(num)
    c = Counter(pf)
    
    res = 1

    for i in c.values():
        res *= i + 1
    
    print(res % (10**9+7))
Buggy code:
n = int(input())

def f(n):
    pf = {}
    for i in range(2, n + 1):
        for j in range(2, i + 1):
            while i % j == 0:
                    pf[j] = pf.get(j, 0) + 1
                    i //= j
    return pf

ans = 1
for v in f(n).values():
    ans *= (v + 1)
print(ans)

Fixed code:
n = int(input())

def f(n):
    pf = {}
    for i in range(2, n + 1):
        for j in range(2, i + 1):
            while i % j == 0:
                    pf[j] = pf.get(j, 0) + 1
                    i //= j
    return pf

ans = 1
for v in f(n).values():
    ans *= (v + 1)
print(ans % (10 ** 9 + 7))
Buggy code:
n = int(input())

def nprf(n):
    pf = {}
    for i in range(2, n + 1):
        for j in range(2, i + 1):
            while i % j == 0:
                if not j in pf:
                    pf[j] = 0
                pf[j] += 1
                i //= j
    return pf
    
cnt = 1
for v in nprf(n).values():
    cnt *= (v + 1)
    
print(cnt % mod)

Fixed code:
n = int(input())
mod = 10 ** 9 + 7

def nprf(n):
    pf = {}
    for i in range(2, n + 1):
        for j in range(2, i + 1):
            while i % j == 0:
                if not j in pf:
                    pf[j] = 0
                pf[j] += 1
                i //= j
    return pf
    
cnt = 1
for v in nprf(n).values():
    cnt *= (v + 1)
    
print(cnt % mod)
Buggy code:
N = int(input())
mod = 10**9+7
arr = [1 for i in range(N+1)]
for i in range(2,N+1):
    if arr[i] > 0:
        j = 2*i
        while(j<N+1):
            arr[j] = 0
            j += i
prime = []
for i in range(2,N):
    if arr[i] != 0:
        prime.append(i)
count = 1
for n in prime:
    tmp = n
    i = 0
    while(tmp < N+1):
        i += N//tmp
        tmp *= n
    count *= (i+1)
print(count%mod)

Fixed code:
N = int(input())
mod = 10**9+7
arr = [1 for i in range(N+1)]
for i in range(2,N+1):
    if arr[i] > 0:
        j = 2*i
        while(j<N+1):
            arr[j] = 0
            j += i
prime = []
for i in range(2,N+1):
    if arr[i] != 0:
        prime.append(i)
count = 1
for n in prime:
    tmp = n
    i = 0
    while(tmp < N+1):
        i += N//tmp
        tmp *= n
    count *= (i+1)
print(count%mod)
Buggy code:
n=int(input())
k=[2]
mod=10**9+7
for i in range(2,n+1):
    for j in range(len(k)):
        if i%k[j]==0:
            break
    else:
        k.append(i)
h=[1 for i in range(len(k))]
print(k)
for i in range(2,n+1):
    c=0
    while i!=1:
        if i%k[c]==0:
            i=i/k[c]
            h[c]+=1
        else:
            c+=1
p=1
print(h)
for i in range(len(k)):
    p=(p*h[i])%mod
print(p)

Fixed code:
n=int(input())
k=[2]
mod=10**9+7
for i in range(2,n+1):
    for j in range(len(k)):
        if i%k[j]==0:
            break
    else:
        k.append(i)
h=[1 for i in range(len(k))]
for i in range(2,n+1):
    c=0
    while i!=1:
        if i%k[c]==0:
            i=i/k[c]
            h[c]+=1
        else:
            c+=1
p=1
for i in range(len(k)):
    p=(p*h[i])%mod
print(p)
Buggy code:
import math

N = int(input())
N = math.factorial(N) 

i = 2 　
num = 1
ans = 1

while N != 1: 
    if N % i == 0:
        N //= i
        num += 1
    else:
        ans *= num
        num = 1
        i += 1
ans *= num
ans %= (10 ** 9) + 7

print(ans)

Fixed code:
from math import factorial

N = int(input())
N = factorial(N)

i = 2
num = 1
ans = 1
while N != 1:
    if N % i == 0:
        N //= i
        num += 1
    else:
        i += 1
        ans *= num
        num = 1
print(ans * num % (10**9 + 7))
Buggy code:

n=int(input())
l=[0]*n

for i in range(1,n+1):
    b=2
    while b <= i:
        while i%b==0:
            i = i//b
            l[b-1]+=1
        b+=1
x=1
for i in l:
    if i != 0:
        x*=(i+1)%(10**9+7)
print(x)

Fixed code:

n=int(input())
l=[0]*n

for i in range(1,n+1):
    b=2
    while b <= i:
        while i%b==0:
            i = i//b
            l[b-1]+=1
        b+=1
x=1
for i in l:
    if i != 0:
        x=x*(i+1)%(10**9+7)
print(x)
Buggy code:
#!/usr/bin/env python3


def prime(t):
    i=2
    while i**2<=t:
        if t%i==0: return 0
        i+=1
    return 1

mod=10**9+7

p=[]
for i in range(2,1008):
    if prime(i):
        p.append(i)

d={i:0 for i in p}
n=int(input())

tmp=1
for i in range(1,n+1):
    tmp*=i
    for j in p:
        while tmp%j==0:
            d[j]+=1
            tmp//=j
        if tmp<j: break
 
for i in d:
    ans*=d[i]+1
    ans%=mod
print(ans)


Fixed code:
#!/usr/bin/env python3


def prime(t):
    i=2
    while i**2<=t:
        if t%i==0: return 0
        i+=1
    return 1

mod=10**9+7

p=[]
for i in range(2,1008):
    if prime(i):
        p.append(i)

d={i:0 for i in p}
n=int(input())

ans=tmp=1
for i in range(1,n+1):
    tmp*=i
    for j in p:
        while tmp%j==0:
            d[j]+=1
            tmp//=j
        if tmp<j: break

for i in d:
    ans*=d[i]+1
    ans%=mod
print(ans)
Buggy code:
n=int(input())
a=[0]*(n+1)
ans=1
for i in range(2,n+1):
    x=i
    p=2
    while x>1:
        while x%p==0:
            a[p]+=1
            x//=p
        p+=1
for i in a:
    ans*=(i+1)%(10**9+7)
print(ans)


Fixed code:
n=int(input())
a=[0]*(n+1)
ans=1
for i in range(2,n+1):
    x=i
    p=2
    while x>1:
        while x%p==0:
            a[p]+=1
            x//=p
        p+=1
for i in a:
    ans=(ans*(i+1))%(10**9+7)
print(ans)
Buggy code:
n = int(input())
cnt = [0]*(n+1)
for i in range(2,n+1):#2~n
    while i !=1:
        for j in range(2,n+1):#2~n
            if i % j == 0:
                i //= j 
                cnt[j] += 1

c = 1
for i in range(2,n+1):
    c *=(cnt[i]+1)
    c %=(10**9+7)

print(c)

Fixed code:
n = int(input())
cnt = [0]*(n+1)
for i in range(2,n+1):#2~n
    s = i
    while s != 1:
        for j in range(2,n+1):#2~n
            if s % j == 0:
                s //= j 
                cnt[j] += 1
                break

c = 1
for i in range(2,n+1):
    c *=(cnt[i]+1)
    c %=(10**9+7)

print(c)
Buggy code:
n = int(input())
s = [2]
q = 1

for i in range(n):
	if i<3:
		continue
	t = []
	for j in range(len(s)):
		t.append((i)%s[j])
	if 0 in t:
		q = 3
	else:
		s.append(i)

x = 1

for i in range(len(s)):
	m = 0
	for j in range(10):
		m += n//(s[i]**(j+1))
	x *= m+1
print(x%(10**9+7))

Fixed code:
n = int(input())
s = [2]
q = 1

for i in range(n+1):
	if i<3:
		continue
	t = []
	for j in range(len(s)):
		t.append((i)%s[j])
	if 0 in t:
		q = 3
	else:
		s.append(i)

x = 1

for i in range(len(s)):
	m = 0
	for j in range(10):
		m += n//(s[i]**(j+1))
	x *= m+1
print(x%(10**9+7))
Buggy code:
N=int(input());t=[0]*N
for i in range(2,N+1):
    s=1
    while i>1:
        s+=1
        while i%s==0:
            i=i//s
            t[s-2]+=1
for j in range(N):
    q=q*(t[j]+1)%(10**9+7)
print(q)

Fixed code:
N=int(input())
q=1
t=[0]*N
for i in range(2,N+1):
    s=1
    while i>1:
        s+=1
        while i%s==0:
            i=i//s
            t[s-2]+=1
for j in range(N):
    q=q*(t[j]+1)%(10**9+7)
print(q)
Buggy code:
def generate(n):
    ans = []
    for i in range(2,n+1):
        flag = True
        for j in range(2,i):
            if(i%j == 0):
                flag = False
        if flag:
            ans.append(i)
    return ans

def factorial(n):
    ans = 1
    for i in range(1,n+1):
        ans *= i
    return ans

ans = 1
N = int(input())
l = generate(N)
N = factorial(N)
for p in l:
    q = 1
    while(N%p == 0):
        q += 1
        N = N // p
    ans *= q
print(ans)


Fixed code:
def generate(n):
    ans = []
    for i in range(2,n+1):
        flag = True
        for j in range(2,i):
            if(i%j == 0):
                flag = False
        if flag:
            ans.append(i)
    return ans

def factorial(n):
    ans = 1
    for i in range(1,n+1):
        ans *= i
    return ans

ans = 1
N = int(input())
l = generate(N)
N = factorial(N)
for p in l:
    q = 1
    while(N%p == 0):
        q += 1
        N = N // p
    ans *= q
    ans %= 1000000007
print(ans)
Buggy code:
from functools import reduce
from copy import deepcopy

n = int(input())

def dadd(t, s): 
    for k,v in s.items():
        t[k] = t.get(k, 0) + v 
    return t

def pfd(c, i): 
    for j in range(2, i // 2 + 1): 
        if i % j == 0:
            d = i // j
            return dadd(deepcopy(c[j]), c.get(d, dict()))
    return { i: 1 } 

p,c = {},{}
for i in range(2, n + 1): 
    q = pfd(c, i)
    c[i] = q 
    dadd(p, q)

tot = reduce(lambda a,(k,v): a * (v + 1), p.items(), 1)
print(tot % (10 ** 9 + 7)) 

Fixed code:
from functools import reduce
from copy import deepcopy

n = int(input())

def dadd(t, s): 
    for k,v in s.items():
        t[k] = t.get(k, 0) + v 
    return t

def pfd(c, i): 
    for j in range(2, i // 2 + 1): 
        if i % j == 0:
            d = i // j
            return dadd(deepcopy(c[j]), c.get(d, dict()))
    return { i: 1 } 

p,c = {},{}
for i in range(2, n + 1): 
    q = pfd(c, i)
    c[i] = q 
    dadd(p, q)

tot = reduce(lambda a,v: a * (v + 1), p.values(), 1)
print(tot % (10 ** 9 + 7))
Buggy code:
n = int(input())
m = 10**9+7
primes = [2,3,5,7,11,13,17,19,23,29,31]
D = [0]*1001


for i in range(2, n+1):
    v = i
    for p in range(2, 1000):
        while(v % p == 0):
            D[p] += 1
            v //= p
        if v == 1:
            break
    if(v == i):
        D[i] += 1

print(D)
score = 1
for d in D:
    score = score * (d + 1)
print(score % m)


Fixed code:
n = int(input())
m = 10**9+7
primes = [2,3,5,7,11,13,17,19,23,29,31]
D = [0]*1001


for i in range(2, n+1):
    v = i
    for p in range(2, 1000):
        while(v % p == 0):
            D[p] += 1
            v //= p
        if v == 1:
            break
    if(v == i):
        D[i] += 1

score = 1
for d in D:
    score = score * (d + 1)
print(score % m)