qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import collections
s = input()
t = input()

S = sorted(list(collections.Counter(s)))
T = sorted(list(collections.Counter(t)))

if S == T:
    print('Yes')
else:
    print('No')

Fixed code:
import collections
s = input()
t = input()

S = sorted(list(collections.Counter(s).values()))
T = sorted(list(collections.Counter(t).values()))

if S == T:
    print('Yes')
else:
    print('No')
Buggy code:
import sys
import collections

s = list(map(str,input()))
t = list(map(str,input()))
cnts = collections.Counter(s)
cntt = collections.Counter(t)
cs = sorted(cnts.values())
ct = sorted(cntt.values())

print(cnts)
print(cntt)

if len(s) != len(t):
    print("No")
    sys.exit()

for i,j in zip(cnts.values(),cntt.values()):
    if i != j:
        print("No")
        sys.exit()

print("Yes")

Fixed code:
import sys
import collections

s = list(map(str,input()))
t = list(map(str,input()))
cnts = collections.Counter(s)
cntt = collections.Counter(t)
cs = sorted(cnts.values())
ct = sorted(cntt.values())

if len(s) != len(t):
    print("No")
    sys.exit()

for i,j in zip(cs,ct):
    if i != j:
        print("No")
        sys.exit()

print("Yes")
Buggy code:
from collections import*
f=lambda:sorted(Counter(input()).values())
print("YNEOS"[f()!=f()::2])

Fixed code:
from collections import*
f=lambda:sorted(Counter(input()).values())
print("YNeos"[f()!=f()::2])
Buggy code:
s = input()
t = input()

go = []
back = []
g = []
b = []
def has_duplicates(seq):
    return len(seq) != len(set(seq))


for i in range(len(s)):
  go.append(s[i]+t[i])
  back.append(t[i]+s[i])

go_l = set(go)
back_l = set(back)
go = list(go_l)
back = list(back_l)

print(go)
print(back)

for i in range(len(go)):
  g.append(go[i][0])
  b.append(back[i][0])
  
print(g)
print(b)
  
ansg = has_duplicates(g)
ansb = has_duplicates(b)

if ansg == True or ansb == True:
  print("No")
else:
  print("Yes")

Fixed code:
s = input()
t = input()

go = []
back = []
g = []
b = []
def has_duplicates(seq):
    return len(seq) != len(set(seq))


for i in range(len(s)):
  go.append(s[i]+t[i])
  back.append(t[i]+s[i])

go_l = set(go)
back_l = set(back)
go = list(go_l)
back = list(back_l)

#print(go)
#print(back)

for i in range(len(go)):
  g.append(go[i][0])
  b.append(back[i][0])
  
#print(g)
#print(b)
  
ansg = has_duplicates(g)
ansb = has_duplicates(b)

if ansg == True or ansb == True:
  print("No")
else:
  print("Yes")
Buggy code:
S = input()
T = input()

d = dict([])
ans = 'Yes'
for i,s in enumerate(S):
    t = T[i]
    try:
        if d[s] != t:
            print('S',d[s], t)
            ans = 'No'
            break
    except:
        d[s] = t

d = dict([])
ans = 'Yes'
for i,t in enumerate(T):
    s = S[i]
    try:
        if d[t] != s:
            print('T',d[t], s)
            ans = 'No'
            break
    except:
        d[t] = s
        
print(ans)

Fixed code:
S = input()
T = input()

ans = 'Yes'

d = dict([])
for i,s in enumerate(S):
    t = T[i]
    try:
        if d[s] != t:
            ans = 'No'
            break
    except:
        d[s] = t

d = dict([])
for i,t in enumerate(T):
    if ans == 'No':
        break
    s = S[i]
    try:
        if d[t] != s:
            ans = 'No'
            break
    except:
        d[t] = s
        
print(ans)
Buggy code:
s1 = input()
s2 = input()
dict_s1 = {}
dict_s2 = {}
for i in range(len(s1)):
    if s1[i] not in dict_s1:
        dict_s1[s1[i]] = s2[i]
    else:
        if dict_s1[s1[i]] != s2[i]:
            print('No')
            #quit()
    if s2[i] not in dict_s2:
        dict_s2[s2[i]] = s1[i]
    else:
        if dict_s2[s2[i]] != s1[i]:
            print('No')
            #quit()
print('Yes')

Fixed code:
s1 = input()
s2 = input()
dict_s1 = {}
dict_s2 = {}
for i in range(len(s1)):
    if s1[i] not in dict_s1:
        dict_s1[s1[i]] = s2[i]
    else:
        if dict_s1[s1[i]] != s2[i]:
            print('No')
            quit()
    if s2[i] not in dict_s2:
        dict_s2[s2[i]] = s1[i]
    else:
        if dict_s2[s2[i]] != s1[i]:
            print('No')
            quit()
print('Yes')
Buggy code:
from collections import defaultdict
s=list(input())
t=list(input())
change_st=defaultdict(int)
change_ts=defaultdict(int)
for i in range(len(s)):
    if change_st[s[i]]==0:
        change_st[s[i]]=t[i]
    else:
        if change_st[s[i]]!=t[i]:
            print("No")
            break
    if change_ts[t[i]]==0:
        change_ts[t[i]]==0
    else:
        if change_ts[t[i]]!=s[i]:
            pritn("No")
            break
else:
    print("Yes")

Fixed code:
from collections import defaultdict
s=list(input())
t=list(input())
change_st=defaultdict(int)
change_ts=defaultdict(int)
for i in range(len(s)):
    if change_st[s[i]]==0:
        change_st[s[i]]=t[i]
    else:
        if change_st[s[i]]!=t[i]:
            print("No")
            break
    if change_ts[t[i]]==0:
        change_ts[t[i]]=s[i]
    else:
        if change_ts[t[i]]!=s[i]:
            print("No")
            break
else:
    print("Yes")
Buggy code:
# C - String Transformation
import collections
S = str(input())
T = str(input())

S1 = sorted(collections.Counter(S).values())
T1 = sorted(collections.Counter(T).values())
print(S1,T1)

if S1 == T1:
    print('Yes')
else:
    print('No')

Fixed code:
# C - String Transformation
import collections
S = str(input())
T = str(input())

S1 = sorted(collections.Counter(S).values())
T1 = sorted(collections.Counter(T).values())

if S1 == T1:
    print('Yes')
else:
    print('No')
Buggy code:
import string
import sys
S = input()
T = input()
sLst = [0] * 26
tLst = [0] * 26

for i in range(26):
    sLst[i] = S.count(string.ascii_lowercase[i])
    tLst[i] = T.count(string.ascii_lowercase[i])
sLst.sort(reverse=True)
tLst.sort(reverse=True)

for i in range(26):
    if sLst[i] != tLst[i]:
        print('No')
        sys.exit()

print('YES')

Fixed code:
import string
import sys
S = input()
T = input()
sLst = [0] * 26
tLst = [0] * 26

for i in range(26):
    sLst[i] = S.count(string.ascii_lowercase[i])
    tLst[i] = T.count(string.ascii_lowercase[i])
sLst.sort(reverse=True)
tLst.sort(reverse=True)

for i in range(26):
    if sLst[i] != tLst[i]:
        print('No')
        sys.exit()

print('Yes')
Buggy code:
a=input()
b=input()

while (1):
    if a=='':
        break
    a=a.replace(a[0],'')
    b=b.replace(b[0],'')
    print(a,b)
    

    if len(a)!=len(b):
        print('No')
        exit()

print('Yes')


Fixed code:
a=input()
b=input()

while (1):
    if a=='':
        break
    a=a.replace(a[0],'')
    b=b.replace(b[0],'')    

    if len(a)!=len(b):
        print('No')
        exit()

print('Yes')
Buggy code:
import collections
a = list(input())
b = list(input())
A = collections.Counter(a)
B = collections.Counter(b)
Asort = sorted(A.values())
Bsort = sorted(B.values())
if list(Asort.values()) == list(Bsort.values()):
  print("Yes")
else:
  print("No")

Fixed code:
import collections
a = list(input())
b = list(input())
A = collections.Counter(a)
B = collections.Counter(b)
Alist = list(A.values())
Blist = list(B.values())
Asort = sorted(Alist)
Bsort = sorted(Blist)
if Asort == Bsort:
  print("Yes")
else:
  print("No")
Buggy code:
S = input()
T = input()

N = len(S)
Slist = {}
Tlist = {}
for i in range(N):
    if S[i] in Slist:
        Slist[S[i]] += 1
    else:
        Slist[S[i]] = 1
    if T[i] in Tlist:
        Tlist[T[i]] += 1
    else:
        Tlist[T[i]] = 1

M = len(Slist)
L = len(Tlist)
if M == L:
    skey = []
    tkey = []
    svalue = []
    tvalue = []
    for k, v in Slist.items():
        skey.append(k)
        svalue.append(v)
    skey.sort()
    svalue.sort()
    print(skey)
    print(svalue)
    for k, v in Tlist.items():
        tkey.append(k)
        tvalue.append(v)
    tkey.sort()
    tvalue.sort()
    print(tkey)
    print(tvalue)
    if svalue == tvalue:
        print('Yes')
    else:
        print('No')
        
else:
    print('No')

Fixed code:
S = input()
T = input()

N = len(S)
Slist = {}
Tlist = {}
for i in range(N):
    if S[i] in Slist:
        Slist[S[i]] += 1
    else:
        Slist[S[i]] = 1
    if T[i] in Tlist:
        Tlist[T[i]] += 1
    else:
        Tlist[T[i]] = 1

M = len(Slist)
L = len(Tlist)
if M == L:
    skey = []
    tkey = []
    svalue = []
    tvalue = []
    for k, v in Slist.items():
        skey.append(k)
        svalue.append(v)
    skey.sort()
    svalue.sort()
    
    for k, v in Tlist.items():
        tkey.append(k)
        tvalue.append(v)
    tkey.sort()
    tvalue.sort()
    
    if svalue == tvalue:
        print('Yes')
    else:
        print('No')
        
else:
    print('No')
Buggy code:
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()),list(T.values())
print(["No", "Yes"][s.sort() == t.sort()])

Fixed code:
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()),list(T.values())
print(["No", "Yes"][Counter(s) == Counter(t)])
Buggy code:
S=input()
T=input()

Rs = {}

for s,t in zip(S,T):
    
    if s in Rs.keys() and Rs[s] != t:
        print("No")
        exit()
    if not s in Rs.keys():
        Rs[s] = t

res = [""] * len(S)
for i,s in enumerate(S):
    res[i] = Rs[s]

print("Yes" if "".join(res)==T else "No")

Fixed code:
S=input()
T=input()

Rs = {}
Rt = {}

for s,t in zip(S,T):
    
    if s in Rs.keys() and Rs[s] != t:
        print("No")
        exit()
    if t in Rt.keys() and Rt[t] != s:
        print("No")
        exit()

    if not s in Rs.keys():
        Rs[s] = t
    if not t in Rt.keys():
        Rt[t] = s

ress = [""] * len(S)
for i,s in enumerate(S):
    ress[i] = Rs[s]

print("Yes" if "".join(ress)==T else "No")
Buggy code:
S=input()
T=input()

c1=[[] for i in abc]
c2=[[] for i in abc]
for i in range(0,len(S)):
    c1[ord(S[i])-ord("a")].append(i)

for i in range(0,len(T)):
    c2[ord(T[i])-ord("a")].append(i)

ans="Yes"
for i in c1:
    if(i not in c2):
        ans="No"
        break
    
print(ans)

Fixed code:
abc=list("abcdefghijklmnopqrstuvwxyz")
S=input()
T=input()

c1=[[] for i in abc]
c2=[[] for i in abc]
for i in range(0,len(S)):
    c1[ord(S[i])-ord("a")].append(i)

for i in range(0,len(T)):
    c2[ord(T[i])-ord("a")].append(i)

ans="Yes"
for i in c1:
    if(i not in c2):
        ans="No"
        break
    
print(ans)
Buggy code:
import sys
s=input()
t=input()
n=len(s)-1
d=dict()
for i in range(n):
  if t[i] in d.keys():
  	if d[t[i]] != s[i]:
      print("No")
      sys.exit()
  else:
    d[t[i]] = s[i]
else:
  print("Yes")

Fixed code:
import sys
s=input()
t=input()
n=len(s)
d=dict()
d2=dict()
for i in range(n):
    if t[i] in d.keys():
        if d[t[i]] != s[i]:
            print("No")
            sys.exit()
    else:
        d[t[i]] = s[i]
    
    if s[i] in d2.keys():
        if d2[s[i]] != t[i]:
            print("No")
            sys.exit()
    else:
        d2[s[i]] = t[i]
else:
    print("Yes")
Buggy code:
s = list(str(input()))
t = list(str(input()))



def judge(S,T):
    start = [-1 for i in range(26) ] 
    goal = [-1 for i in range(26)]
    for i in range(len(S)):
        a = ord(S[i]) - ord('a')
        b = ord(T[i]) - ord('a')
        if start[a] != -1 or goal[b] != -1:
            if start[a]!= b or goal[b] !=a:
                print("No")
                break
        else:
            start[a] = b
            goal[b] =a
        if i==len(S)-1:
            print("Yes")
            
            
 judge(s,t)           

Fixed code:
s = list(str(input()))
t = list(str(input()))

def judge(S,T):
    start = [-1 for i in range(26) ] 
    goal = [-1 for i in range(26)]
    for i in range(len(S)):
        a = ord(S[i]) - ord('a')
        b = ord(T[i]) - ord('a')
        if start[a] != -1 or goal[b] != -1:
            if start[a]!= b or goal[b] !=a:
                print("No")
                break
        else:
            start[a] = b
            goal[b] =a
        if i==len(S)-1:
            print("Yes")
            
judge(s,t)
Buggy code:

S = input()
T = input()

S_dic={}
T_dic={}

for i in range(len(S)):

    if S[i] in S_dic:
        S_dic[S[i]].append(i)
    else:
        S_dic[S[i]] = [i]

for i in range(len(T)):

    if T[i] in T_dic:
        T_dic[T[i]].append(i)
    else:
        T_dic[T[i]] = [i]


print (S_dic)
print (T_dic)

T_dicR = {}

for i in T_dic:
    T_dicR[ str(T_dic[i]) ] = 1

ans = True

for i in S_dic:

    if str(S_dic[i]) not in T_dicR:
        ans = False
        break

print (T_dicR)

if ans:
    print ("Yes")

else:
    print ("No")

Fixed code:

S = input()
T = input()

S_dic={}
T_dic={}

for i in range(len(S)):

    if S[i] in S_dic:
        S_dic[S[i]].append(i)
    else:
        S_dic[S[i]] = [i]

for i in range(len(T)):

    if T[i] in T_dic:
        T_dic[T[i]].append(i)
    else:
        T_dic[T[i]] = [i]


#print (S_dic)
#print (T_dic)

T_dicR = {}

for i in T_dic:
    T_dicR[ str(T_dic[i]) ] = 1

ans = True

for i in S_dic:

    if str(S_dic[i]) not in T_dicR:
        ans = False
        break

#print (T_dicR)

if ans:
    print ("Yes")

else:
    print ("No")
Buggy code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

S = readline().rstrip().decode()
T = readline().rstrip().decode()

cnt = [[0] * 26 for i in range(26)]

for i in range(len(S)):
    cnt[ord(S[i]) - ord('a')][ord(T[i]) - ord('a')] += 1

for j in range(26):
    n = 0
    for i in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)
exit(1)

Fixed code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

S = readline().rstrip().decode()
T = readline().rstrip().decode()

cnt = [[0] * 26 for i in range(26)]

for i in range(len(S)):
    cnt[ord(S[i]) - ord('a')][ord(T[i]) - ord('a')] += 1

for j in range(26):
    n = 0
    for i in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)

for i in range(26):
    n = 0
    for j in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)

print("Yes")
Buggy code:
s = input()
t = input()

end = []
flag = 1
for i in range(len(s)):
  if s[i] not in end:
    end.append(s[i])
    for j in range(len(t)):
      if s[i] == s[j]:
        if t[i] != t[j]:
          flag = 0

if flag == 0:
  print('No')
else:
  print('Yes')

Fixed code:
s = input()
t = input()

end = []
flag = 1
for i in range(len(s)):
  if s[i] not in end:
    end.append(s[i])
    for j in range(len(t)):
      if s[i] == s[j]:
        if t[i] != t[j]:
          flag = 0
      else:
        if t[i] == t[j]:
          flag = 0

if flag == 0:
  print('No')
else:
  print('Yes')
Buggy code:
S=input().strip()
T=input().strip()
fl=True
dic={}
for i in range(len(S)):
    if S[i] in dic:
        if dic[S[i]] != T[i]:
            fl=False
            break
    else:
        dic[S[i]]=T[i]
        dic[T[i]]=S[i]
if fl:
    print('Yes')
else:
    print('No')

Fixed code:
S=input().strip()
T=input().strip()
fl=True
dicu={}
dicl={}
for i in range(len(S)):
    if S[i] in dicu:
        if dicu[S[i]] != T[i]:
            fl=False
            break
    else:
        dicu[S[i]]=T[i]
    if T[i] in dicl:
        if dicl[T[i]] != S[i]:
            fl=False
            break
    else:
        dicl[T[i]]=S[i]
if fl:
    print('Yes')
else:
    print('No')
Buggy code:
dic = {}
s=input()
t=input()
ans = "Yes"
for i in range(len(s)):
  try:
    if dic[s[i]]!=t[i]:
      ans = "No"
  except:
    dic[s[i]] = t[i]
print(ans)

Fixed code:
dic = {}
dic1 = {}
s=input()
t=input()
ans = "Yes"
for i in range(len(s)):
  try:
    if dic[s[i]]!=t[i]:
      ans = "No"
  except:
    dic[s[i]] = t[i]
  try:
    if dic1[t[i]]!=s[i]:
      ans = "No"
  except:
    dic1[t[i]] = s[i]
print(ans)
Buggy code:
import sys
from collections import defaultdict

S = input()
T = input()
L = len(S)

dcts = defaultdict(int)
for i in range(L):
    s = S[i]
    t = T[i]
    if dcts[s] == 0:
        dcts[s] = t
    else:
        if dcts[s] != t:
            print('No')
            sys.exit()
            
    if dcts[t] == 0:
        dcts[t] = s
    else:
        if dcts[t] != s:
            print('No')
            sys.exit()
print('Yes')

Fixed code:
import sys
from collections import defaultdict

S = input()
T = input()
L = len(S)

dcts = defaultdict(int)
dctt = defaultdict(int)
for i in range(L):
    s = S[i]
    t = T[i]
    if dcts[s] == 0:
        dcts[s] = t
    else:
        if dcts[s] != t:
            print('No')
            sys.exit()
    if dctt[t] == 0:
        dctt[t] = s
    else:
        if dctt[t] != s:
            print('No')
            sys.exit()
print('Yes')
Buggy code:
from collections import defaultdict
N,M = map(int,input().split())
d = defaultdict(int)
for i in range(2, floor(sqrt(M))+1):
    while M % i == 0:
        d[i] += 1
        M //= i
if M != 1:
    d[M] += 1
def comb(n,k):
    if k == 0:
        return 1
    return comb(n-1,k-1) * n // k
ans = 1
for e in d.values():
    ans *= comb(N+e-1, e)
print(ans % (10**9+7))

Fixed code:
from math import floor, sqrt
from collections import defaultdict
N,M = map(int,input().split())
d = defaultdict(int)
for i in range(2, floor(sqrt(M))+1):
    while M % i == 0:
        d[i] += 1
        M //= i
if M != 1:
    d[M] += 1
def comb(n,k):
    if k == 0:
        return 1
    return comb(n-1,k-1) * n // k
ans = 1
for e in d.values():
    ans *= comb(N+e-1, e)
print(ans % (10**9+7))
Buggy code:
# ABC110 D factorization
N,M=map(int,input().split())
p=10**9+7
L=10**5*3
f,inv,finv=[0]*(L+1),[0]*(L+1),[0]*(L+1)

def factorization(N):
    res=[]
    for i in range(2,int(N**(1/2))+2):
        if not N%i:
            r=0
            while not N%i:
                N//=i
                r+=1
            res.append((i,r))
    if not res:
        res.append((N,1))
    return res

def nCr_init(L,p):
    for i in range(L+1):
        if i<=1:
            f[i],finv[i],inv[i]=1,1,1
        else:
            f[i]=(f[i-1]*i)%p
            inv[i]=(p-inv[p%i]*(p//i))%p
            finv[i]=(finv[i-1]*inv[i])%p

def nCr(n,r,p):
    if 0<=r<=n and 0<=n:
        return (f[n]*finv[n-r]*finv[r])%p
    else:
        return 0

nCr_init(L,p)
p_list=factorization(M)
print(p_list)
res=1
for a,r in p_list:
    res=(res*nCr(r+N-1,N-1,p))%p
print(res)

Fixed code:
# ABC110 D factorization
N,M=map(int,input().split())
p=10**9+7
L=10**5*3
f,inv,finv=[0]*(L+1),[0]*(L+1),[0]*(L+1)

def factorization(N):
    res=[]
    for i in range(2,int(N**(1/2))+2):
        if not N%i:
            r=0
            while not N%i:
                N//=i
                r+=1
            res.append((i,r))
    if N>1:
        res.append((N,1))
    return res

def nCr_init(L,p):
    for i in range(L+1):
        if i<=1:
            f[i],finv[i],inv[i]=1,1,1
        else:
            f[i]=(f[i-1]*i)%p
            inv[i]=(p-inv[p%i]*(p//i))%p
            finv[i]=(finv[i-1]*inv[i])%p

def nCr(n,r,p):
    if 0<=r<=n and 0<=n:
        return (f[n]*finv[n-r]*finv[r])%p
    else:
        return 0

nCr_init(L,p)
p_list=factorization(M)
res=1
for a,r in p_list:
    res=(res*nCr(r+N-1,r,p))%p
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([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr
 
def cmb(n,r,mod):
  a=1
  b=1
  r = min(r,n-r)
  for i in range(r):
    a = a*(n-i)%mod
    b = b*(i+1)%mod
  return a*pow(b,mod-2,mod)%mod

N,M = map(int,input().split())
MOD = 10**9+7
f = factorization(M)
ans = 1

for i,j in f:
  ans *= cmb(j+N-1,j,MOD)

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
 
def cmb(n,r,mod):
  a=1
  b=1
  r = min(r,n-r)
  for i in range(r):
    a = a*(n-i)%mod
    b = b*(i+1)%mod
  return a*pow(b,mod-2,mod)%mod

N,M = map(int,input().split())
MOD = 10**9+7
f = factorization(M)
ans = 1

for i,j in f:
  ans *= cmb(j+N-1,j,MOD)
  ans %= MOD
if M == 1:
  ans = 1
print(ans)
Buggy code:
p = 10**9+7
def pow(x,m):
    if m==0:
        return 1
    if m==1:
        return x
    if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p
A = [1 for _ in range(N+100)]
for i in range(2,N+100):
    A[i] = (A[i-1]*i)%p
B = [1 for _ in range(N+100)]
B[N+100-1] = pow(A[N+100-1],p-2)
for i in range(N+100-2,1,-1):
    B[i] = (B[i+1]*(i+1))%p
P = [1 for _ in range(10**5)]
P[0]=0
P[1]=0
for i in range(2,int((10**5)**0.5)+1):
    for j in range(i*i,10**5,i):
        P[j] = 0
Q = []
for i in range(2,10**5):
    if P[i]==1:
        Q.append(i)
N,M = map(int,input().split())
C = {q:0 for q in Q}
for q in Q:
    if M%q==0:
        while M%q==0:
            M = M//q
            C[q] += 1
prod = 1
for q in Q:
    k = C[q]
    a = A[k+N-1]
    a = (a*B[N-1])%p
    a = (a*B[k])%p
    prod = (prod*a)%p
print(prod)

Fixed code:
p = 10**9+7
def pow(x,m):
    if m==0:
        return 1
    if m==1:
        return x
    if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p
N,M = map(int,input().split())
A = [1 for _ in range(N+100)]
for i in range(2,N+100):
    A[i] = (A[i-1]*i)%p
B = [1 for _ in range(N+100)]
B[N+100-1] = pow(A[N+100-1],p-2)
for i in range(N+100-2,1,-1):
    B[i] = (B[i+1]*(i+1))%p
P = [1 for _ in range(10**5)]
P[0]=0
P[1]=0
for i in range(2,int((10**5)**0.5)+1):
    for j in range(i*i,10**5,i):
        P[j] = 0
Q = []
for i in range(2,10**5):
    if P[i]==1:
        Q.append(i)

C = {q:0 for q in Q}
for q in Q:
    if M%q==0:
        while M%q==0:
            M = M//q
            C[q] += 1
if M>1:
    C[M] = 1
    Q.append(M)
prod = 1
for q in Q:
    k = C[q]
    a = A[k+N-1]
    a = (a*B[N-1])%p
    a = (a*B[k])%p
    prod = (prod*a)%p
print(prod)
Buggy code:
import collections
import math

N, M = map(int, input().split())


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


def comb(n: int, r: int) -> int:
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if M == 1:
    print(1)
else:
    primes = collections.Counter(prime_factorize(M))
    res = 1
    for freq in primes.values():
        res *= comb(N + freq - 1, freq)
    print(res)


Fixed code:
import collections
import math

N, M = map(int, input().split())


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


def comb(n: int, r: int) -> int:
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if M == 1:
    print(1)
else:
    primes = collections.Counter(prime_factorize(M))
    res = 1
    for freq in primes.values():
        res *= comb(N + freq - 1, freq)
        res %= (10 ** 9 + 7)
    print(res)