Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03317 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
g=1
while k+(k-1)*(g-1)< n:
  g+=1
print(g)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
c=0
mn=min(l)
while len(l)>=1:
  if mn==min(l):
    m=l.index(min(l))
    if m==0:
      l=l[m+1:]
    elif m+l[k-1::-1].index(min(l))==len(l):
      c+=m//(k-1)
      if m%(k-1)!=0:
        c+=1
      l=l[m+1:]
    else:
      c+=1
      l=l[k:]
  else:
    c+=len(l)//(k-1)
    if len(l)%(k-1)!=0:
      c+=1
    l=[]
print(c)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
c=0
mn=min(l)
while len(l)>=1:
  if mn==min(l):
    m=l.index(min(l))
    if m==0: # count == 0
      l=l[m+1:]
    elif m+l[k-1::-1].index(min(l))==len(l):
      c+=m//(k-1)
      if m%(k-1)!=0:
        c+=1
      l=l[m+1:]
    else: # count >= 2
      #print(l[k-1::-1])
      c+=1
      l=l[k:]
  else:
    c+=len(l)//(k-1)
    if len(l)%(k-1)!=0:
      c+=1
    l=[]
print(c)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
c=0
mn=min(l)
while len(l)>=1:
  if mn==min(l):
    m=l.index(min(l))
    if m==0:
      l=l[m+1:]
    elif m+l[k-1::-1].index(min(l))==len(l):
      c+=m//(k-1)
      if m%(k-1)!=0:
        c+=1
      l=l[m+1:]
    else:
      c+=1
      l=l[k:]
  else:
    c+=len(l)//(k-1)
    if len(l)%(k-1)!=0:
      c+=1
    l=[]
Problem p02785 (python)

Fixed submission:
n,k = map(int, input().split())
h = list(map(int, input().split()))

hh = sorted(h)

for i in range(k):
  if(len(hh) == 0):
    break
  hh.pop()
  
print(sum(hh))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))

sorted(h)

for i in range(k):
  h.pop()
  
print(sum(h))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))

ans = sum(h)

for i in range(k):
  ans -= max(h)
  h.pop(h.index(max(h)))

print(ans)
Problem p02699 (python)

Fixed submission:
animals = list(map(int, raw_input().split()))
S = animals[0]
W = animals[1]
if(W >= S): print('unsafe')
else: print('safe')

Buggy submission (verdict: Runtime Error):
animals = list(map(int, raw_input().split()))
S = animals[0]
W = animals[1]
if(W >= S): print('unsafe')
else: print('safe')
Problem p02711 (python)

Fixed submission:
n=input()
for c in n:
 if c=='7': #与えられた数に7が1つでも含まれていればYesを返す
   print('Yes')
   break
else: #1つも含まれていなければNoを返す
 print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())

[int(N) for c in str(N)]

if 7 in N:
    print('Yes')
else:
    print("No")
Problem p02701 (python)

Fixed submission:
n = int(input())

l= []
for i in range(n):
    a  = input()
    l.append(a)
s = set(l)
print(len(s))

Buggy submission (verdict: Runtime Error):
n = int(input())
l= []
s = {}

for i in range(n):
  a = input()
  l.append(a)
 
s = set(l)
print(len(s)
Problem p02699 (python)

Fixed submission:
s, w = [int(s) for s in input().split(" ")]
if w >= s:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
s, w = [int(s) for s in intput().split(" ")]
if w >= s:
  print("unsafe")
else:
  print("safe")
Problem p02699 (python)

Fixed submission:
S, W = map(int, input().split())

if S <= W:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
if S <= W:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
if S<W:
  print("unsafe")
else:
  print("safe")
Problem p02711 (python)

Fixed submission:
s = input()
if '7' in s:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):

s = raw_input()
if '7' in s:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):

arg = int(raw_input())

s = str(arg)
if '7' in s:
    print('Yes')
else:
    print('No')
Problem p02712 (python)

Fixed submission:
seq = int(input())

total = int(0)
for i in range(1, seq+1, 1):
    if ((i % 3) != 0) and ((i % 5) != 0):
        total = total + i
print(total)

Buggy submission (verdict: Runtime Error):
seq = raw_input()

total = int(0)
for i in range(1, int(seq)+1, 1):
    if ((i % 3) != 0) and ((i % 5) != 0):
        total = total + i
print(total)

Buggy submission (verdict: Runtime Error):
seq = raw_input()

total = int(0)
for i in range(1, int(seq)+1, 1):
    if ((i % 3) != 0) & ((i % 5) != 0):
        total = total + i
print(total)

Buggy submission (verdict: Runtime Error):
seq = int(raw_input())

sum = 0
for i in range(1, seq+1, 1):
    if ((i % 3) != 0) & ((i % 5) != 0):
        sum = sum + i
print(sum)
Problem p02707 (python)

Fixed submission:
N = int(input())
A = sorted(list(map(int, input().split())))

#for n in range(N):
#    print(A.count(n+1))

M = {}
for a in A:
    M[a] = M.get(a,0) + 1

for n in range(N):
    print(M.get(n+1,0))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split())).sort()

for n in range(N):
    print(A.count(n+1))
Problem p03073 (python)

Fixed submission:
S = list(input())

count = 0
for i,s in enumerate(S):
    if i!=0:
        if S[i-1] == s:
            count += 1
            if s == "0":
                S[i] = "1"
            else:
                S[i] = "0"
print(count)

Buggy submission (verdict: Runtime Error):
S = list(input())

count = 0
for i,s in enumerate(S):
    if i!=0:
        if S[i-1] == s:
            count += 1
            if s == "0":
                S[i] = "1"
            else:
                S[i] = "0"
            print(S)
print(count)
Problem p02863 (python)

Fixed submission:
import sys
input=sys.stdin.readline   #input高速化 １文字の時の改行文字に注意+

d={i:0 for i in range(3001)}
db={i:0 for i in range(3001)}

n,t=map(int,input().split())

x=[tuple(map(int,input().split()))for i in n*[0]]
x.sort()
dp=[]
dp2=[]
for time,value in x:
    for k,v in d.copy().items():
        if k+time<t:
            if d[k+time]<v+value:
                d[k+time]=v+value
        else:
            break
    l=[0]
    for i in range(1,t+1):
        if d[i]>l[-1]:
            l.append(d[i])
        else:
            l.append(l[-1])

    dp.append(l)    
        
for time,value in x[::-1]:
    for k,v in db.copy().items():
        if k+time<t:
            if db[k+time]<v+value:
                db[k+time]=v+value
        else:
            break

    l=[0]
    for i in range(1,t+1):
        if db[i]>l[-1]:
            l.append(db[i])
        else:
            l.append(l[-1])
        
    dp2.append(l)
dp=[[0]*t,[0]*t]+dp
dp2=([[0]*t,[0]*t]+dp2)[::-1]

ans=0

for i in range(len(dp)):
    for j in range(t):
        if i==0 or i==len(dp)-1:
            tmp=dp[i][j]+dp2[i][t-j-1]
            if ans<tmp:
                ans=tmp
        else:
            tmp=dp[i][j]+dp2[i][t-j-1]+x[i-1][1]
            if tmp>ans:
                ans=tmp
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import*

d=defaultdict(list)
n,t=map(int,input().split())

x=[list(map(int,input().split()))+[i]for i in range(n)]

d[0]=[0,[]]
for time,value,idx in x:
    for k,v in d.copy().items():
        if k+time<=t:
            if len(d[k+time])==2:
                if v[0]+value>d[k+time][0]:
                    d[k+time]=[v[0]+value,v[1]+[idx]]
            else:
                d[k+time]=[v[0]+value,v[1]+[idx]]



y,z=d[max(d.keys())]

for i in z[::-1]:
    del x[i]
    
print(y+max(i[1] for i in x))
Problem p02879 (python)

Fixed submission:
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    a,b=map(int,input().split())
    if a<10 and b< 10:
        print(a*b)
    else:
        print(-1)
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline  #危険！基本オフにしろ！

def main():
    n,k=map(int,input().split())
    a=sorted(map(int,input().split()))
    b=sorted(map(int,input().split()),reverse=1)
    #print(a,b)
    ok=max(a)*max(b)
    ng=-1
    
    
            
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if sum(a[i]-mid//b[i]for i in range(n) if a[i]*b[i]>mid)<=k:
            ok=mid
        else:
            ng=mid
    print(ok)

if __name__ == '__main__':
    main()
Problem p02916 (python)

Fixed submission:
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    n=int(input())
    *a,=map(int,input().split())
    *b,=map(int,input().split())
    *c,=map(int,input().split())
    t=sum(b)
    for i in range(len(a)-1):
        if a[i]+1==a[i+1]:
            t+=c[a[i]-1]
    print(t)

            
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    n=int(input())
    *a,=map(int,input().split())
    *b,=map(int,input().split())
    *c,=map(int,input().split())
    t=sum(b)
    for i in range(len(a)-1):
        if a[i]+1==a[i+1]:
            t+=c[i+1]
    print(t)

            
if __name__ == '__main__':
    main()
Problem p02948 (python)

Fixed submission:
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    a,b=map(int,input().split())
    d=defaultdict(list)
    for i in range(a):
        c,e=map(int,input().split())
        d[c].append(-e)
    for k,v in d.items():
        v=sorted(v)
    ans=[]
    anss=0
    for i in range(1,b+1):
        if i in d.keys():
            for j in d[i]:
                heappush(ans,j)
        if ans:
            anss+=heappop(ans)
    print(-anss)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
 
#define sorted(vector) sort(vector.begin(),vector.end())
#define vmin(vector) *min_element(vector.begin(),vector.end())
#define vmax(vector) *max_element(vector.begin(),vector.end())
#define vsum(vector) accumulate(vector.begin(),vector.end(),0)
#define append(a) push_back(a)
#define int(a) stoi(a)
#define str(a) to_string(a)
#define bisect_left(vector,a) lower_bound(vector.begin(),vector.end(),a)
#define bisect_right(vector,a) upper_bound(vector.begin(),vector.end(),a)

using namespace std;
long floatinf=-10000000;



int main(void){
    map<long,vector<long>> defaultdict;
    long n,m,p;
    long tmp1,tmp2,tmp3;
    cin>>n,m,p;
    
    for(int i=0  ;i<m  ;i++){
        cin>>tmp1>>tmp2>>tmp3;
        defaultdict[tmp1]={tmp2,tmp3};
    }
    vector<long> BELLMANFORD(long point, long d, long p);{
        vector<long long> cost=vector<long long>(n+1,-floatinf);
    }
    for(int i=0  ;i<n-1  ;i++){
        for(int j=0  ;j<n-1  ;j++){
            
        }
    }
Problem p03075 (python)

Fixed submission:
from itertools import*
a,b,c,d,e,k=map(int,open(0).read().split())
x=[a,b,c,d,e]
for i in combinations(x,2):
    p,q=list(i)
    if abs(p-q)>k:
        print(":(")
        exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ab=sorted(s+t for t in B for s in A)[-1:-K-1:-1]
abc=sorted(i+x for i in ab for x in C)[-1:-K-1:-1]
print(*abc,sep="\n")X, Y, Z, K = map(int, input().split())

Buggy submission (verdict: Runtime Error):
x,y,z,k=map(int,input().split())
a=tuple(map(int,input().split()))
b=tuple(map(int,input().split()))
c=tuple(map(int,input().split()))
 
def f(p,q):
    return sorted([i+j for j in q for i in p])[::-1][:k]
 
if x+y<y+z:
    for i in sorted(f(c,f(a,b)))[::-1][:k]:
        print(i)
elif x+z<y+z:
    for i in sorted(f(b,f(a,c)))[::-1][:k]:
        print(i)
else:
    for i in sorted(f(a,f(b,c)))[::-1][:k]:
        print(i)

Buggy submission (verdict: Runtime Error):
from itertools import*
x,y,z,k=map(int,input().split())
a=map(int,input().split())
b=map(int,input().split())
c=map(int,input().split())
#print(a,b,c)
for e in sorted(sum(i)for i in product(a,b,c))[::-1][:k]:
    print(e)
Problem p03104 (python)

Fixed submission:
a,b=map(int,input().split())
def f(x):
    if x%4==0:
        return x
    elif x%4==1:
        return 1
    elif x%4==3:
        return 0
    else:
        return x+1
print(f(a-1)^f(b))

Buggy submission (verdict: Runtime Error):
from itertools import*
a,b=map(int,input().split())
L=[]
for i in range(100):
    if a<=2**i<=b:
        L.append(2**i)
l=[]
for s in L:
    if (b-s)%2==0:
        l.append(1)
for s in range(a,l[0]+1):
Problem p03108 (python)

Fixed submission:
class UNION_FIND(object):
    def __init__(self,n):
        #親の番号を格納する。親だった場合は-(その集合のサイズ)
        #作るときはParentの値を全て-1にする
	    #こうすると全てバラバラになる
        self.parent=[-1 for i in range(n)]
        
    def root(self,x):
        #Aがどのグループに属しているか調べる
        if self.parent[x]<0:
            return x
        else:
            self.parent[x]=self.root(self.parent[x])
            return self.parent[x]

    def size(self,x):
        #自分のいるグループの頂点数を調べる
        return -self.parent[self.root(x)]   #親をとってきたい
        
    def union(self,x,y):
        #AとBをくっ付ける
        #AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        #print(self.parent)
        x=self.root(x)
        y=self.root(y)
        #print(x,y)
        if x==y:   #すでにくっついてるからくっ付けない
            return False
            
        #大きい方(A)に小さいほう(B)をくっ付けたい
		#大小が逆だったらひっくり返しちゃう。
        if self.size(x)<self.size(y):
            x,y=y,x
        self.parent[x]+=self.parent[y]  #Aのサイズを更新する
        self.parent[y]=x   #Bの親をAに変更する
        return True



n,m=map(int,input().split())
uni=UNION_FIND(n)
ans=n*(n-1)//2

Input=[]
anslist=[ans]
for s in m*[0]:
    a,b=map(int,input().split())
    Input.append([a-1,b-1])

for i in range(m-1,0,-1):
    x=Input[i][0]
    y=Input[i][1]
    #print(x,y)
    if uni.root(x) != uni.root(y):
        ans-=uni.size(x)*uni.size(y)
        uni.union(x,y)
    anslist.append(ans)

for t in anslist[::-1]:
    print(t)

Buggy submission (verdict: Runtime Error):
from collections import *
n,m=map(int,input().split())
l=[]
for s in m*[0]:
    a,b=map(int,input().split())
    l.append([a,b])
def f(l):
    d=defaultdict(list)
    for t in l:
        d[t[0]].append(t[1])
        d[t[1]].append(t[0])
    return d

def DFS_dict(point,TFlist,d):
    if all(TFlist):
        return 1
    ans=0
    for i in d[point]:
        if TFlist[i-1]:
            continue
        TFlist[i-1]=True
        ans+=DFS_dict(i,TFlist,d)
        TFlist[i-1]=False
    return ans
TFlist=[True]+[False]*(n-1)
for q in range(m):
    if DFS_dict(1,TFlist,f(l))>0:
        print(0)
    else:
        print(m+2-sum(len(e) for e in f(l).values())//2)
    l.pop(0)
Problem p03127 (python)

Fixed submission:
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
for s in range(len(a)-1):
  if s==0:x=a[s]
  x=gcd(x,a[s+1])
print(x)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=0
if m>n*2:
  m-=n*2
  ans=n+m//4
elif m==n*2:
  ans=n
else:
  ans=m//2
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(sorted(map(int,input().split()),reverse=True))
L=[]
for s in range(len(a)-1):
  x=a[s]
  b=a[s+1:]
  L.extend([x%s for s in b if x%s!=0])
if L!=[]:
  print(min([r%d for r in a for d in L if r%d!=0]))
else:
  print(0)
Problem p03135 (python)

Fixed submission:
A,B=map(int,input().split(" "))
print('{:.10f}'.format(A/B))

Buggy submission (verdict: Runtime Error):
print(int(input())/int(input()))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=sorted([A[s]-A[s+1] for s in range(M-1)])
print(abs(sum(L[N-1:])))
Problem p03137 (python)

Fixed submission:
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=[A[s]-A[s+1] for s in range(M-1)]
if M>N:
    print(abs(sum(sorted(L)[N-1:])))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split(" "))
#Nはポーンの数 Mは入力の数
A=list(map(int,input().split(" ")).sort())
print(A)
Problem p03250 (python)

Fixed submission:
a=list(sorted(input().split()))[::-1];a.insert(2,"+");print(eval("".join(a)))

Buggy submission (verdict: Runtime Error):
import collections as c
s=input()
t=input()
d=c.defaultdict(list)
d2=c.defaultdict(list)
for k,v in enumerate(s):
    d[v].append(k)
for k,v in enumerate(t):
    d2[v].append(k)
if list(d.values())==list(d2.values()):
    print("Yes")
else:
    print("No")
Problem p03252 (python)

Fixed submission:
import collections as c
s=input()
t=input()
d=c.defaultdict(list)
d2=c.defaultdict(list)
for k,v in enumerate(s):
    d[v].append(k)
for k,v in enumerate(t):
    d2[v].append(k)
a=set(tuple(i) for i in d.values())
b=set(tuple(i) for i in d2.values())
if a==b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from itertools import*;i=lambda:sorted([len(list(v))for k,v in groupby(input()]);print('YNeos'[i()!=i()::2])

Buggy submission (verdict: Runtime Error):
import collections as c
s=input()
t=input()
d=c.defaultdict(list)
d2=c.defaultdict(list)
for k,v in enumerate(s):
    d[v].append(k)
for k,v in enumerate(t):
    d2[v].append(k)
if set(tuple(d.values()))==set(tuple(d2.values())):
    print("Yes")
else:
    print("No")
Problem p03253 (python)

Fixed submission:
a,b=map(int,input().split())


from collections import Counter
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b += 1
    if n > 1:
        fct.append(n)
    return fct
if len(factorize(b))==0:
    print(1)
    exit()

mod=10**9+7
print(reduce(mul,map(lambda x:cmb(a-1+x,a-1),Counter(factorize(b)).values()))%mod)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a==1:
    print(1)
    exit()
from collections import Counter
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
mod=10**9+7
print(reduce(mul,map(lambda x:cmb(a-1+x,a-1),Counter(factorize(b)).values()))%mod)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a==1 and b==1:
    print(1)
    exit()
from collections import Counter
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
mod=10**9+7
print(reduce(mul,map(lambda x:cmb(a-1+x,a-1),Counter(factorize(b)).values()))%mod)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
from collections import Counter
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
mod=10**9+7
print(reduce(mul,map(lambda x:cmb(a-1+x,a-1),Counter(factorize(b)).values()))%mod)