Problem:
 Score : 400 points    Problem Statement You are given positive integers N and M .  How many sequences a of length N consisting of positive integers satisfy a_1 \times a_2 \times ... \times a_N = M ? Find the count modulo 10^9+7 .  Here, two sequences a' and a'' are considered different when there exists some i such that a_i' \neq a_i'' .      Constraints  All values in input are integers.  1 \leq N \leq 10^5  1 \leq M \leq 10^9         Input Input is given from Standard Input in the following format:  N  M       Output Print the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7 .        Sample Input 1 2 6      Sample Output 1 4  Four sequences satisfy the condition: \{a_1, a_2\} = \{1, 6\}, \{2, 3\}, \{3, 2\} and \{6, 1\} .       Sample Input 2 3 12      Sample Output 2 18       Sample Input 3 100000 1000000000      Sample Output 3 957870001

Solution (Python):
from math import factorial
N, M = map(int,input().split())


def factorize(n):
    i = 2
    table = [0]
    cnt= [0]
    while i * i <= n:
        while n % i == 0:
            n /= i
            if table[-1] != i:
                table.append(i)
                cnt.append(0)
            cnt[-1] += 1
        i += 1
    if n > 1:
        table.append(n)
        cnt.append(1)
    return table,cnt


fs,ns = factorize(M)
ans = 1
for n in ns[1:]:
    a = 1
    for i in range(N,n+N):
        a *= i
    ans *= a//factorial(n)
print(ans%(10**9+7))

Solution (Python):
from math import factorial

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

if M==1:
  print(1)
  exit()
MOD=(10**9)+7
def trial_division(n):
    
    factor = []
    
    tmp = int(n**0.5) + 2
    for num in range(2,tmp):
        count=0
        while n % num == 0:
            n //= num
            count+=1
        if count>0:
          factor.append(count)
    
    if not factor:
        return [1]
    elif n!=1:
        factor.append(1)
        return factor
    else:
        return factor


factor=trial_division(M)

ans=1
for a in factor:
  for i in range(a):
    ans*=N+i
  ans //= factorial(a)
  ans%=MOD

print(ans)

Solution (Python):
from itertools import accumulate
from math import*
from collections import deque
from collections import defaultdict
from itertools import permutations
from heapq import*
from collections import Counter
from itertools import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
from functools import reduce


n,m = map(int,input().split())
pdic= {}
p = 2
while m >1:
    c = 0
    while m%p==0:
        c+=1
        m //= p
    if c>0:
        pdic[p] = c
    p+=1

d = factorial(n-1)
ans = 1
for p in pdic.keys():
    num = pdic[p]
    ans *= factorial(num+n-1)//(factorial(num)*d)
print(ans%(10**9+7))

Solution (Python):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance





mod = 10**9 + 7


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def calc_orderd_dp(divided, max_count):
    if max_count <= 1:
        return 1
    if divided == 1:
        return max_count
    if divided <= 0:
        return 1

    ret = 0
    for i in range(min(divided, max_count)):
        i += 1
        comb = combination(max_count, i)
        dp = calc_orderd_dp(divided - i, i)
        ret = modadd(ret, comb * dp)

    return ret


def main():
    n, m = intin()

    factors = get_factors(m)

    factors_count = {}
    for factor in factors:
        if factor <= 1:
            continue
        factors_count.setdefault(factor, 0)
        factors_count[factor] += 1

    ans = 1

    for factor, count in factors_count.items():
        ans = modmlt(ans, calc_orderd_dp(count, n))

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N,M=map(int,input().split())

if N==1:
    print(1)
    exit()
else:
        
    
    L=[0 for i in range((10**5)+1)]
    for i in range(2,10**5):
        while M%i==0:
            L[i]+=1
            M//=i
        if M==1:
            break
    if M>1:
        L.append(1)
    
    mod=(10**9+7)
    
    def cmb(n, r, mod):
        if ( r<0 or r>n ):
            return 0
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod
    
    mod = 10**9+7 
    N1 = (10**5)*2
    g1 = [1, 1] 
    g2 = [1, 1] 
    inverse = [0, 1] 
    
    for i in range( 2, N1 + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
    ans=1
    for i in range(len(L)):
        if L[i]!=0:
            ans*=cmb(L[i]+N-1,min(L[i],N),mod)
            ans%=mod
            
    print(ans)

Solution (Python):
import collections
n, m = map(int, input().split())

factor = []
tmp = int(m ** (1/2)) + 1
for i in range(2, tmp):
    while m % i == 0:
        m //= i
        factor.append(i)
if m > 1:
    factor.append(m)
num = list(collections.Counter(factor).most_common())

def comb(n, r):
    tmp = 1
    for i in range(r):
        tmp *= n - i
    for i in range(r):
        tmp //= r - i
    return tmp

ans = 1
for x in num:
    ans *= (comb(x[1] + n - 1, x[1]) % 1000000007)
    ans %= 1000000007
print(ans)

Solution (Python):
n,m=map(int, input().split())
def is_prime(N):
    is_prime=[True]*(N+1)
    is_prime[0:2]=False,False
    for i in range(int(N**0.5)+1):
        if is_prime[i]==False:
            continue
        for j in range(i*2,N+1,i):
            is_prime[j]=False
    return is_prime
def primes(N):
    prime=is_prime(N)
    return [i for i in range(N+1) if prime[i]]
def prime_factorization(n):
    ps=primes(int(n**0.5))
    r=[]
    for i,p in enumerate(ps):
        num=0
        while(True):
            x,y=divmod(n,p)
            if y!=0:
                break
            n=x
            num+=1
        if num>0:
            r.append((p,num))
    if n>1:
        r.append((n,1))
    return r
mod=10**9+7
def add(a,b):
    return (a+b)%mod
def sub(a,b):
    return (a-b)%mod
def mul(a,b):
    return ((a%mod)*(b%mod))%mod
def pow(x,y):
    if y==0:
        return 1
    elif y==1:
        return x%mod
    elif y%2==0:
        return pow(x,y//2)**2 % mod
    else:
        return pow(x,y//2)**2 * x % mod
def div(a,b):
    return mul(a,pow(b,mod-2))
def fac(n):
    a=1
    for i in range(2,n+1):
        a=mul(a,i)
    return a

f=prime_factorization(m)
ans=1
for p in f:
    ans=mul(ans,fac(p[1]+n-1))
    ans=div(ans,fac(p[1]))
    ans=div(ans,fac(n-1))
print(ans)

Solution (Python):
N,M = map(int,input().split())
MOD = 10 ** 9 + 7
import sys
frac_list = [0 for i in range(100)]

def comb_cal(n,r):
    tmp = 1
    for i in range(r):
        tmp *= (n - i)
    for i in range(r):
        tmp //= r - i
    return tmp

frac = []
while True:
    for i in range(2,int(M**(1/2))+1):
        if M % i == 0:
            frac.append(i)
            M //= i
            break
    else:
        break
if M > 1:
    frac.append(M)
def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c = counter(frac)
ans = 1
for x in c:
    ans *= (comb_cal(x[1]+N-1,x[1]) % MOD)
    ans %= MOD
print(ans)

Solution (Python):
import math

def getPrimeFactorsDict(num):
  pn = 2 
  pfdict = {} 
  while pn * pn <= num: 
    while num % pn == 0: 
      num = num / pn
      pfdict[pn] = pfdict.get(pn, 0) + 1
    pn += 1 
  if num > 1:
    pfdict[int(num)] = pfdict.get(int(num), 0) + 1
    
  return pfdict


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

d = getPrimeFactorsDict(M)

ans = 1
for key in d.keys():

  if d[key] == 1:
    ans *= N
  else:
    ans *= math.factorial(N+d[key]-1) // (math.factorial(N-1) *  math.factorial(d[key]))

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

Solution (Python):
def soin(num):
    re = []
    div = 2
    while 1:
        lim = int(num ** 0.5) + 1
        while num % div:
            div += 1
            if div > lim:
                re += [1]
                return re
        sisu = 0
        while num % div == 0:
            num //= div
            sisu += 1
        re += [sisu]
        if num == 1:
            return re


def com(a, b):
    if a == b:
        return 1
    t = (a, b)
    if (a, b) in com_memo:
        return com_memo[t]
    re = com(a - 1, b) * a // (a - b)
    com_memo[t] = re
    return re


def f(n, m):
    if m == 1:
        print(1)
        return
    sisus = soin(m)
    ans = 1
    for s in sisus:
        ans = ans * com(s + n - 1, n - 1) % md
    print(ans)


md = 10 ** 9 + 7
n, m = map(int, input().split())
com_memo = {}
f(n, m)

Solution (Python):
def soin(num):
    re = []
    div = 2
    while 1:
        lim = int(num ** 0.5) + 1
        while num % div:
            div += 1
            if div > lim:
                re += [1]
                return re
        sisu = 0
        while num % div == 0:
            num //= div
            sisu += 1
        re += [sisu]
        if num == 1:
            return re


def com(a, b):
    if a == b:
        return 1
    t = (a, b)
    if (a, b) in com_memo:
        return com_memo[t]
    re = com(a - 1, b) * a // (a - b)
    com_memo[t] = re
    return re


def f(n, m):
    sisus = soin(m)
    ans = 1
    for s in sisus:
        ans = ans * com(s + n - 1, n - 1) % md
    print(ans)


md = 10 ** 9 + 7
n, m = map(int, input().split())
if m==1:
    print(1)
    exit()
com_memo = {}
f(n, m)

Solution (Python):
N,M = map(int,input().split())

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

def modpow(a,n,mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res

def modinv(a,mod):
    return modpow(a,mod - 2,mod)

def cnk(a,b):
    MOD = 10**9+7
    ret = 1
    for i in range(b):
        ret *= (a-i)
        ret %= MOD
        ret = ret * modinv(i+1,MOD) % MOD
    return ret

lis = factorize(M)
ans = 1
for l in lis:
    ans *= cnk(l[1]+N-1,N-1)
    ans %= 10**9+7

print(ans)

Solution (Python):

import collections
from operator import mul
from functools import reduce
N, M = map(int, input().split())

def cmb(n, r):
    r = min(r, n-r)
    if r==0: return 1
    over = reduce(mul, range(n, n-r, -1))
    under = reduce(mul, range(1, r+1))
    return over // under

ps = []
tmp = M
for m in range(2, M+1):
    while tmp % m == 0:
        tmp /= m
        ps.append(m)
    if int(tmp) == 1:
        break
    if m*m > M:
        if N > 1:
            ps.append(M)
        break

ps = collections.Counter(ps)

ans = 1
mod = 10**9+7
for c in ps.values():
    ans *= cmb(c+N-1, c) % mod
    if ans > mod:
        ans %= mod

print(ans)

Solution (Python):
N, M = [int(i) for i in input().split()]

def prime_decomposition(n):
  table = []
  i = 2
  while i * i <= n:
    count = 0
    while n % i == 0:
      n //= i
      count += 1
    if count != 0:
        table.append((i, count))
    i += 1
  if n > 1:
    table.append((n, 1))
  return table

def cmb(n,r):
    from operator import mul
    from functools import reduce
    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

mod = 10 ** 9 + 7
A = prime_decomposition(M)
result = 1
for _, a in A:
    result = result * cmb(a + N - 1, a) % mod

print(result)

Solution (Python):
N, M = [int(i) for i in input().split()]

def prime_decomposition(n):
  table = []
  i = 2
  while i * i <= n:
    count = 0
    while n % i == 0:
      n //= i
      count += 1
    if count != 0:
        table.append((i, count))
    i += 1
  if n > 1:
    table.append((n, 1))
  return table

def cmb(n, r):
    N, R = n, r
    for i in range(1, r):
        N *= n - i
        R *= r - i
    return N // R

mod = 10 ** 9 + 7
A = prime_decomposition(M)
result = 1
for _, a in A:
    result = result * cmb(a + N - 1, a) % mod

print(result)

Solution (Python):
N, M = [int(i) for i in input().split()]

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

def cmb(n, r):
    N, R = n, r
    for i in range(1, r):
        N *= n - i
        R *= r - i
    return N // R

from collections import Counter
A = Counter(prime_decomposition(M))

mod = 10 ** 9 + 7
result = 1
for a in A.values():
    result = result * cmb(a + N - 1, a) % mod

print(result)

Solution (Python):
from functools import reduce
n,m=map(int,input().split())
dic=dict()
p=2
while m>=p*p:
    if m%p==0:
        dic[p]=0
        while m%p==0:
            dic[p]+=1
            m//=p
    p+=1
if m!=1:
    if m not in dic.keys():
        dic[m]=0
    dic[m]+=1
def comb(a,b):
    p=1
    for i in range(a,a-b,-1):
        p*=i
    for i in range(2,b+1):
        p//=i
    return p
l=[comb(i+n-1,i) if 1 not in dic.keys() else 1 for i in dic.values() ]
ans=1
for i in l:
    ans=ans*i%1000000007
print(ans)

Solution (Python):
import math
from collections import Counter

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

factor=[]
for f in range(2, math.ceil(math.sqrt(M))):
	while M % f == 0:
		factor.append(f)
		M //= f
if M > 1:
	factor.append(M)

def F(n):
	if n == 1:
		return n
	return n * F(n-1)

def G(n, k):
	if k == 1:
		return n
	return n * G(n-1, k-1)

def H(n, k):
	return G(n+k-1, k) // F(k)

ans = 1
for c in Counter(factor).values():
	ans *= H(N, c)
	ans %= MOD

print(ans)

Solution (Python):
MOD = 10**9 + 7

def power_mod(a,n):
    if n == 0:
        return 1
    x = (power_mod(a,n//2)**2)%MOD
    return x if n%2 == 0 else (a*x)%MOD

def inverse(a):
    return power_mod(a,MOD-2)

def comb(n,k):
    
    num = 1
    den = 1
    for i in range(1,k+1):
        num *= (n+1-i)
        den *= i
        num %= MOD
        den %= MOD
    return (num * inverse(den))%MOD

def solve(N,M,min_p=2):
    if M == 1:
        return 1
    for p in range(min_p, M+1):
        if p*p > M:
            
            return N
        if M%p != 0:
            continue
        e = 0
        while M%p == 0:
            M //= p
            e += 1
        return (solve(N, M, p) * comb(N-1+e,e))%MOD
      
N,M = map(int, input().split())
ans = solve(N,M)

print(ans)

Solution (Python):
from operator import mul
from functools import reduce

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

def Pdeco(m):
    ret=[]
    for i in range(2,int((M)**(0.5))+100):
        if m<=i:
            if m!=1: ret.append(int(m))
            break
        elif i>int((M)**(0.5)+50):
            ret.append(m)
            break

        while m%i==0:
            m=m//i
            ret.append(i)
    return ret


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

L=Pdeco(M)
nums=set(L)

for n in nums:
    p=L.count(n)
    ans=(ans*cmb(N+p-1,N-1))%P

print(ans)

Solution (Python):
n,m=map(int,input().split())
l={}
p=2

while m>=p*p:
    if m%p==0:
        if not p in l.keys():
            l[p]=0
        l[p]+=1
        m//=p
    else:
        p+=1
if not m in l.keys():
    l[m]=0
l[m] += 1

ans=1
for p,q in l.items():
    if p==1:
        continue
    for i in range(q):
        ans*=n+i
    for i in range(q):
        ans//=i+1

print(ans%1000000007)

Solution (Python):
from operator import mul
from functools import reduce

MOD = 10 ** 9 + 7

def get_soinnsuu(num):
    soinnsuu = []
    for i in range(2, int(num ** 0.5) + 2):
        now_time = 0
        if num < i:
            break
        while num % i == 0:
            now_time += 1
            num = num // i
        if now_time > 0:
            soinnsuu.append(now_time)
    if num > 1:
        soinnsuu.append(1)
    return soinnsuu


def comb(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 start_process(N, M):
    soinnsuu = get_soinnsuu(M)
    ans = 1
    for ele in soinnsuu:
        ans *= int(comb(ele + N - 1, ele))
    
    print(ans % MOD)


def main():
    N, M = map(int, input().split())
    start_process(N, M)



if __name__ == '__main__':
    main()

Solution (Python):

import sys

MOD = 1000000007  

def get_factors(n):
    fact = 2
    tmp = n
    ret = []
    while fact * fact <= n:
        count = 0
        while tmp % fact == 0:
            tmp //= fact
            count += 1
        if count > 0:
            ret.append(count)
            
        fact += 1
    if tmp > 1:
        ret.append(1)
    return ret

def comb(n, k):
    if k > n:
        return 0
    ret = 1
    k = min(k, n - k)
    for i in range(k):
        ret *= n - i
        ret //= i + 1
    return ret

def solve(N: int, M: int):
    facts = get_factors(M)
    
    ret = 1
    for c in facts:
        ret *= comb(c + N - 1, N - 1)
    print(ret % MOD)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    M = int(next(tokens))  
    solve(N, M)

if __name__ == '__main__':
    main()

Solution (Python):
from functools import reduce
from operator import mul

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

  
def cmb(n, r):
    """
    組み合わせの数 nCr
    :param n:
    :param r:
    :return:
    """
    r = min(n - r, r)
    if r == 0:
        return 1
    return reduce(mul, range(n, n - r, -1)) // reduce(mul, range(r, 0, -1))
  
  
N,M = map(int, input().split())
m_factorized = factorize(M)
mod = 10 ** 9 + 7

ans = 1

    
for i in m_factorized:
  k = i[1] 
  ans *= cmb(N-1+k,k)
  ans %= mod
print(ans)

Solution (Python):
import math
from collections import Counter

from scipy.misc import comb


def get_factors(n):
    """
    素因数分解
    :param int n:
    :type: list of int
    """
    if n <= 1:
        return []

    ret = []
    while n > 2 and n % 2 == 0:
        ret.append(2)
        n //= 2
    i = 3
    while i <= math.sqrt(n):
        if n % i == 0:
            ret.append(i)
            n //= i
        else:
            i += 2
    ret.append(n)
    return ret


n, m = map(int, input().split())
MOD = 10 ** 9 + 7

factors = get_factors(m)
counts = Counter(factors)





ans = 1
for k, v in counts.items():
    ans *= comb(v + (n - 1), v, exact=True)
    ans %= MOD
print(ans)

Solution (Python):
import math
from collections import Counter
from functools import reduce
from operator import mul


def get_factors(n):
    """
    素因数分解
    :param int n:
    :type: list of int
    """
    if n <= 1:
        return []

    ret = []
    while n > 2 and n % 2 == 0:
        ret.append(2)
        n //= 2
    i = 3
    while i <= math.sqrt(n):
        if n % i == 0:
            ret.append(i)
            n //= i
        else:
            i += 2
    ret.append(n)
    return ret


def comb(n, r):
    """
    組み合わせの数 nCr
    :param n:
    :param r:
    :return:
    """
    r = min(n - r, r)
    if r == 0:
        return 1
    return reduce(mul, range(n, n - r, -1)) // reduce(mul, range(r, 0, -1))


n, m = map(int, input().split())
MOD = 10 ** 9 + 7













factors = get_factors(m)
counts = Counter(factors)





ans = 1
for k, v in counts.items():
    ans *= comb(v + (n - 1), v)
    ans %= MOD
print(ans)

Solution (Python):
from math import factorial as fact
from operator import mul
from functools import reduce
import sys
input = sys.stdin.readline


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


N, M = map(int, input().split())
num = []
p_flag = [True]*(int(M**0.5)+2)

for i in range(2, int(M**0.5)+2):
    if p_flag:
        for j in range(2*i, int(M**0.5)+2, i):
            p_flag[j] = False

        cnt = 0
        while M % i == 0:
            cnt += 1
            M //= i
        if cnt > 0:
            num.append(cnt)
        if M == 1:
            break
else:
    num.append(1)

ans = 1
for i in num:
    ans = (ans * cmb(N-1+i, i)) % (10**9+7)
print(ans)

Solution (Python):

import sys
import math
MOD = 1000000007  


def factorization(n: int):
    if n == 1:
        return []
    factors = None
    for i in range(2, math.ceil(math.sqrt(n))+1):
        if n % i == 0:
            factors = [i] + factorization(n // i)
            break
    if factors == None:
        return [n]
    else:
        return factors


def comb(i: int, j: int):
    if j > i-j:
        return comb(i, i-j)
    mul = 1
    for k in range(i-j+1, i+1):
        mul *= k
    for k in range(2, j+1):
        mul //= k
    
    return mul


def solve(N: int, M: int):
    factor = factorization(M)
    factorDict = {}
    for f in factor:
        if f not in factorDict:
            factorDict[f] = 0
        factorDict[f] += 1
    mul = 1
    for k in factorDict:
        mul = (mul*comb(factorDict[k]+N-1, factorDict[k])) % MOD
    print(mul)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    M = int(next(tokens))  
    solve(N, M)


if __name__ == '__main__':
    main()

Solution (Python):
from math import factorial, sqrt
N,M=map(int,input().split())
prms={}
tmp=M
for i in range(2, int(sqrt(M))+2):
    while not tmp%i:
        if not i in prms:
            prms[i]=1
        else:
            prms[i]+=1
        tmp //= i
if tmp != 1:
    prms[tmp] = 1



res=1
def cmb(a,b):
    res=1
    if a - b < b:
        b = a-b
    for i in range(b):
        res *= (a-i)
        res //= (i+1)
    return res

for p, cnt in prms.items():
    res *= cmb(cnt+N-1, cnt)
    res %= 1000000007

print(res % 1000000007)

Solution (Python):
import math
def soinsu(N):
    sqr = int(math.sqrt(N))
    lis = []
    for i in range(2,sqr+2):
        while N % i == 0:
            lis.append(i)
            N = N // i
    if not N == 1:
        lis.append(N)
    return lis
mod = 1000000007
def modpow(a,b,MOD=mod):
    res = 1
    while b > 0:
        if (b & 1) == 1:
            res = (res*a) % MOD
        a = (a*a) % MOD
        b = b >> 1
    return res
fact = []
def ncrinit(MOD=mod):
    fact.append(1)
    for i in range(1,110005):
        fact.append((fact[i-1]*i)%MOD)

def calcnCr(n,r,MOD=mod):
    up = fact[n]
    down = modpow((fact[n-r]*fact[r])%mod,mod-2,mod)
    return (up*down)%mod

def compres(lis):
    li = []
    se = set(lis)
    for i in se:
        li.append(lis.count(i))
    return li
res = 1
N,M = list(map(int,input().split()))
ncrinit()
co = compres(soinsu(M))
for i in co:
    res = (res* (calcnCr(i+N-1,i)))%mod
print(res)

Solution (Python):
import math
N, M = map(int, input().split())

MOD = 10 ** 9 + 7

d = []

for i in range(2, int(math.sqrt(M))+2):
    if M % i == 0:
        d.append(0)
    while M % i == 0:
        d[-1] += 1
        M //= i
if M != 1:
    d.append(1)

def comb(n, k):
    a = 1
    for i in range(k):
        a *= (n-i)
    for i in range(k):
        a //= (i+1)
    return a

answer = 1
for i in d:
    answer *= comb(i+N-1, i)
    answer %= MOD

print(answer)

Solution (Python):
import math

N,M=map(int,input().split())
dic={}
for i in range(2,int(M**0.5)+1):
    if M%i==0:
        dic.setdefault(i,1)
        M//=i
        while M%i==0:
            dic[i]+=1
            M//=i
    if M==1: break

if M!=1: dic[M]=1


ans=1
for k in dic.keys():
    x=dic[k]
    tmp=1
    for i in range (N,x+N):
        tmp*=i
    ans*=tmp//math.factorial(x)
    ans%=1000000007
print(ans%1000000007)

Solution (Python):
from operator import mul
from functools import reduce


n,m = map(int,input().split())
MOD = 10**9+7


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


def nCr(n,r):
    r = min(r,n-r)
    if r == 0:
        return 1
    over = reduce(mul, range(n,n-r,-1))
    under = reduce(mul,range(1,r+1))
    return over // under

f = factorize(m)
ans=1
for p,num in f:
    ans *= nCr(num+n-1,num)
    ans %= MOD
    
print(ans)

Solution (Python):
def main():
    def nCr(n,r):
        a=1
        x=n
        while(x!=n-r):
          a*=x
          x-=1
        b=1
        x=r
        while(x!=0):
          b*=x
          x-=1
        return a//b

    INF=10**9+7
    N,m=map(int,input().split())


    sum=1
    yd = {}
    i = 2
    while m != 1:
      while m % i == 0:
        if i in yd:
          yd[i] += 1
        else:
          yd[i] = 1
        m //= i
      i += 1
    for b in yd.values():
        if b<N-1:
            sum*=nCr(N-1+b,b)
        else:
            sum*=nCr(N-1+b,N-1)
        sum%=INF  
    print(sum)
if __name__ == '__main__':
    main()

Solution (Python):
def nCr(n,r):
    a=1
    x=n
    while(x!=n-r):
      a*=x
      x-=1
    b=1
    x=r
    while(x!=0):
      b*=x
      x-=1
    return a//b

INF=10**9+7
N,m=map(int,input().split())


sum=1
yd = {}
i = 2
while m != 1:
  while m % i == 0:
    if i in yd:
      yd[i] += 1
    else:
      yd[i] = 1
    m //= i
  i += 1
for b in yd.values():
    if b<N-1:
        sum*=nCr(N-1+b,b)
    else:
        sum*=nCr(N-1+b,N-1)
    sum%=INF  
print(sum)

Solution (Python):
from math import factorial
from math import sqrt
def nCr(n,r):
    a=1
    x=n
    while(x!=n-r):
      a*=x
      x-=1
    b=1
    x=r
    while(x!=0):
      b*=x
      x-=1
    return a//b

INF=10**9+7
N,m=map(int,input().split())


sum=1
yd = {}
i = 2
while m != 1:
  while m % i == 0:
    if i in yd:
      yd[i] += 1
    else:
      yd[i] = 1
    m //= i
  i += 1
for b in yd.values():
    sum*=nCr(N-1+b,b)
    sum%=INF
print(sum)

Solution (Python):
from math import factorial
from math import sqrt
def nCr(n,r):
    return factorial(n)//(factorial(r)*factorial(n-r))
"""
def factorize(p):
    b=[]

    for i in range(2,int(sqrt(p)+2)):
        a=0
        while((p%i)==0):
            a+=1
            p=p//i
          
        if a!=0:
            b.append(a)
        if p==1:
          break
    return b
"""

INF=10**9+7
N,m=map(int,input().split())


sum=1

yd = {}
i = 2
while m != 1:
  while m % i == 0:
    if i in yd:
      yd[i] += 1
    else:
      yd[i] = 1
    m //= i
  i += 1
for b in yd.values():
    sum*=nCr(N-1+b,N-1)
    sum%=INF
print(sum)

Solution (Python):
inpl = lambda: list(map(int,input().split()))
MOD = 10**9 + 7
N, M = inpl()
 
def factorize(n):
  factorize_list = []
  i = 2
  while i*i <= n:
    k = 0
    while n % i == 0:
      n //= i
      k += 1
    if k > 0:
      factorize_list.append(k)
    i += 1
  if n > 1:
    factorize_list.append(1)
  return(factorize_list)

def H(n,k):
  h = 1
  L = n + k - 1
  k = min(n-1,k)
  for j in range(k):
    h *= L-j
  for j in range(k):
    h //= j+1
  return h

ans = 1
for k in factorize(M):
  ans *= H(N,k) % MOD
  ans %= MOD

print(ans)

Solution (Python):
inpl = lambda: list(map(int,input().split()))
MOD = 10**9 + 7
N, M = inpl()
 
def factorize(n):
  prime_list = []
  factorize_list = []
  i = 2
  while i*i <= n:
    for p in prime_list:
      if i % p == 0:
        break
    else:
      prime_list.append(i)
      k = 0
      while n % i == 0:
        n //= i
        k += 1
      factorize_list.append(k)
    i += 1
  if n > 1:
    factorize_list.append(1)
  return(factorize_list)

def H(n,k):
  h = 1
  L = n + k - 1
  k = min(n-1,k)
  for j in range(k):
    h *= L-j
  for j in range(k):
    h //= j+1
  return h

ans = 1
for k in factorize(M):
  ans *= H(N,k) % MOD
  ans %= MOD

print(ans)

Solution (Python):
N, M = map(int, input().split())

def factorization(N):
    prime = primelist(int(N**(1/2))+2)
    factor = [0 for i in range(int(N**(1/2)+2))]
    isprime = False
    for i in prime:
        while N % i == 0:
            N = N // i
            factor[i] += 1
    if sum(factor) == 0:
        isprime = True
    if N != 1:
        factor.append(1)
    return factor, isprime


def primelist(N):
    prime = [2]
    for i in range(3, N+1):
        flag = 1
        for j in prime:
            if i % j == 0:
                flag = 0
                break
        if flag == 1:
            prime.append(i)
    return prime

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result
factor = factorization(M)[0]
ans = 1


for i in factor:
    ans *= cmb(N+i-1, i)
    ans %= 1000000007

print(ans)