Problem: 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''.

Submission attempts (in order):
N, M = map(int, input().split())

mod = 1000000007

f = [] 

for p in range(2, M): 
    e = 0
    while M%p == 0:
        e += 1
        M /= p
    
    if e>0:
        f.append(e)
    
    if M == 1:
        break

def pw(a, e):
    if e == 1:
        return a
    p = pw(a, e // 2)
    if e%2 == 1:
        return p * p % mod * a % mod
    else:
        return p * p % mod


fact = [1] * 100033
inv = [1] * 100033
for k in range(1, 100033):
    fact[k] = fact[k-1] * k % mod
    inv[k] = pw(fact[k], mod-2))

def combine(n, k):
    return fact[n] * inv[k] % mod * inv[n-k] % mod

ans = 1
for e in f:
    ans *= combine(e+N-1, e) 
    ans %= mod

print(ans)


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

mod = 1000000007

f = [] 

for p in range(2, M): 
    e = 0
    while M%p == 0:
        e += 1
        M /= p
    
    if e>0:
        f.append(e)
    
    if M == 1:
        break

def pw(a, e):
    if e == 1:
        return a
    p = pw(a, e // 2)
    if e%2 == 1:
        return p * p % mod a % mod
    else:
        return p * p % mod


fact = [1] * 100040
inv = [1] * 100040
for k in range(1, 100040):
    fact[k] = fact[k-1] * k % mod
    inv[k] = pw(fact[k], mod-2)

ans = 1
for e in f:
    ans = ans * fact[e+N-1] % mod * inv[e] % mod * inv[N-1] % mod 

print(ans)


mod = 1000000007



def prime(n):
    d = []
    i = 2
    while n != 1:
        s = 0
        while n % i == 0:
            n /= i
            s += 1
        d.append(s)
        i += 1
    return d


def mod_pow(x, n):
    if n == 1:
        return x
    elif n % 2 == 0:
        half_x = mod_pow(x, n // 2)
        return half_x * half_x % mod
    else:
        return x * mod_pow(x, n-1) % mod

fact = [0] * 100099
inv = [0] * 100099
frac[0] = 1
inv[0] = 1
for k in range(1, 100099):
    fact[k] = fact[k-1] * k % mod
    inv[k] = mod_pow(fact[k], mod-2)

def nCr(n, r):
    return fact[n] * inv[r] % mod * inv[n-r] % mod

def solve():
    N, M = map(int, input().split())
    p = prime(M)
    s = 1
    for i in p:
        s *= nCr(i + N - 1, N - 1)
        s %= mod
    print(s)

solve()

from collections import Counter

mod = 1000000007


def factor(n):
    d = Counter()
    i = 2
    while i*i <= n:
        while n%i == 0:
            n //= i
            d[i] += 1
        i += 1
    if n > 1:
        d[n] += 1
    return d



def mod_pow(x, n):
    if n == 0:
        return 1
    elif n % 2 == 0:
        half = int(n / 2)
        half_x = mod_pow(x, half)
        return half_x * half_x % mod
    else:
        return x * mod_pow(x, n - 1) % mod


def nCr(n, r):
    x = 1
    r = min(r, n - r)
    for i in range(r):
        x *= n - i
        x %= mod
        x *= mod_pow(i + 1, mod - 2)
        x %= mod
    return x


def solve():
    N, M = map(int, input().split())
    p = factor(M)
    s = 1
    for i in p.values():
        s *= nCr(i + N - 1, N - 1)
        s %= mod
    print(s)


solve()

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted