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



Sample input:
2 6


Sample output:
4

Submission status: Wrong Answer

Solution code:
import math
import time

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

MOD = 10 ** 9 + 7

# (a^b)%MODを返す関数
# 例えばb = 62のとき
# 62 -> 31 -> 30 -> 15 -> 14 -> 7 -> 6 -> 3 -> 2 -> 1 -> 0
def modpow(a, b):
    if b == 0:
        return(1)

    # b:evenのとき
    if b % 2 == 0:
        # a^(b/2)をhalfとしてその二乗を計算
        half_b = b // 2
        half = modpow(a, half_b)
        return((half ** 2) % MOD)
    # b:oddのとき
    else:
        # bを偶数にするために1減らす
        return((a * modpow(a, b-1)) % MOD)

# (aCb)%MODを返す関数
# 例えば10C3のとき
# 10C3 = 10*9*8/3*2*1 = mul/div
def modcomb(a, b):
    # aCb = aC(a-b)なので
    # bが大きかったらa-bに書き換えた方が早い
    if b > a - b:
        return(modcomb(a, a-b))

    # aCb = mul/div
    mul = 1
    div = 1
    for i in range(b):
        mul *= a - i
        div *= b - i
        mul %= MOD
        div %= MOD

    # (mul/div)%MODを求めたい
    # divの逆元を用いる
    # p:primeのときmodpとして(ここではMOD:primeなので使える)
    # a^(-1) ≡　a^(p-2)
    # この式は、ある数をaで割った時のあまりが
    # ある数にa^(p-2)をかけた時のあまりに等しいという意味
    res = (mul * modpow(div, MOD - 2)) % MOD
    return(res)

ans = 1

for i in range(2, math.floor(math.sqrt(M))+1):
    # 次のifがTrueになるiは必然的に素数になる
    if M % i == 0:
        cnt = 0
        while M % i == 0:
            cnt += 1
            M //= i
        ans *= modcomb(cnt + (N - 1), cnt)
        ans %= MOD
# 最後に残った場合、その素数を処理する
if M != 1:
    ans *= modcomb(1 + (N - 1), cnt)
    ans %= MOD

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
def factorization(n) -> list:
	if n==1:
		return [1]
	ret = []
	i = 2
	while i*i<=n:
		while n%i==0:
			n //= i
			ret.append(i)
		i += 1
	if n!=1:
		ret.append(n)
	return ret

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

factors = Counter(factorization(m))
mx = n+max(factors.values())

fac = [1]*(mx+1)
inv = [1]*(mx+1)
for i in range(1,mx+1):
	fac[i] = fac[i-1] * i % mod
inv[-1] = pow(fac[-1], mod - 2, mod)
for i in range(mx-1, -1, -1):
	inv[i] = inv[i+1] * (i+1) % mod
def cmb(n,r):
	assert n >= r >= 0
	return fac[n] * inv[n-r] * inv[r] % mod
	
ans=1
for v in factors.values():
	ans*=cmb(n+v-1,v)
	ans%=mod

print(ans)

Submission status: Wrong Answer

Solution code:
import collections
import math

MOD = 10**9 + 7


def eratosthenes(n):
    sieve = [True for _ in range(n + 1)]
    sieve[0] = False
    sieve[1] = False

    def _update(p):
        if sieve[p]:
            for i in range(p * 2, n + 1, p):
                sieve[i] = False

    if n > 1:
        _update(2)
    p = 3
    while p * p <= n:
        _update(p)
        p += 2
    return sieve


n, m = map(int, input().split())
mm = math.ceil(math.sqrt(m))
sieve = eratosthenes(mm)
primes = [i for i in range(mm) if sieve[i]]
counter = collections.Counter()
for p in primes:
    while m % p == 0:
        counter[p] += 1
        m //= p
    if m == 1:
        break
else:
    counter[m] += 1
res = 1
for p, e in counter.items():
    res *= math.factorial(e + n - 1) // (math.factorial(e) *
                                         math.factorial(n - 1))
    res %= MOD
print(res)

Submission status: Wrong Answer

Solution code:
import math

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

def trial_division(n):
  #素因数を格納するリスト
  factor = []
  #2から√n以下の数字で割っていく
  tmp = int(math.sqrt(n)) + 1
  for num in range(2,tmp):
    cnt = 0
    while n % num == 0:
      n //= num
      cnt += 1 
    if cnt != 0:
      factor.append(cnt)
  #リストが空ならそれは素数
  if not factor:
    return factor
  else:
    if n != 1:
      factor.append(1)
    return factor

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

ans = 1
cnts = trial_division(M)
for cnt in cnts:
  ans = ans * (cmb(cnt+N-1, cnt))%MOD

print(cnts)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10000000)

N, M = map(int, input().split())
MAX = 10**5
MOD = 10**9+7
prime = [2]
nums = []
n = M
cnt = 0
while n%2 == 0:
  cnt += 1
  n = n//2
if cnt != 0:
  nums.append(cnt)
for i in range(3, MAX):
  if i**2 > M:
    break
  is_prime = True
  for p in prime:
    if i%p == 0:
      is_prime = False
      break
  if is_prime:
    prime.append(i)
    n = M
    cnt = 0
    while n%i == 0:
      cnt += 1
      n = n//i
    if cnt != 0:
      nums.append(cnt)

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
ans = 1
for cnt in nums:
  ans = ans * (cmb(cnt+N-1, cnt))%MOD
print(ans)

Submission status: Wrong Answer

Solution code:
import math
 
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

n, m = map(int, input().split())
#print(div(m))
from math import factorial
d = div(m)
#print(d)
ans = 1
for i in d.values():
  ans *= int(factorial(i+n-1)) // int(factorial(n-1)) // int(factorial(i))
  ans %= 10**9+7
print(ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
MOD=10**9+7
def factorization(n):
    arr = []
    temp = n
    if n==1:
        return arr
    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
arr=factorization(m)
print(arr)
l=len(arr)
N=30
comb=[1]*31
inv_t = [0]+[1]
for i in range(2,N+1):
  inv_t += [inv_t[MOD % i] * (MOD - int(MOD / i)) % MOD]
for i in range(1,31):
    comb[i]=comb[i-1]*(n-1+i)*inv_t[i]
    comb[i]%=MOD
count=1
for fact,num in arr:
    #print(fact,num,comb[num])
    count*=comb[num]
    count%=MOD
print(count)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
MOD=10**9+7
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
arr=factorization(m)
l=len(arr)
N=30
comb=[1]*31
inv_t = [0]+[1]
for i in range(2,N+1):
  inv_t += [inv_t[MOD % i] * (MOD - int(MOD / i)) % MOD]
for i in range(1,31):
    comb[i]=comb[i-1]*(n-1+i)*inv_t[i]
    comb[i]%=MOD
count=1
for fact,num in arr:
    #print(fact,num,comb[num])
    count*=comb[num]
    count%=MOD
print(count)

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce
import math
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
import itertools
N,M = [int(x) for x in input().split()]
e = [0]*(int(math.sqrt(M)) + 10000)
for j in range(2,int(math.sqrt(M)) + 10000):
  while M%j==0:
    e[j] += 1
    M = M//j
ans = 1
for i in e:
  ans *=cmb(i+N-1,i)
  ans %=10**9+7
print(ans)

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce
import math
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
import itertools
N,M = [int(x) for x in input().split()]
e = [0]*(int(math.sqrt(M)) + 100)
for j in range(2,int(math.sqrt(M)) + 100):
  while M%j==0:
    e[j] += 1
    M = M//j
ans = 1
for i in e:
  ans *=cmb(i+N-1,i)
  ans %=10**9+7
print(ans)

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce
import math
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
import itertools
N,M = [int(x) for x in input().split()]
e = [0]*(int(math.sqrt(M)) + 2)
for j in range(2,int(math.sqrt(M)) + 2):
  while M%j==0:
    e[j] += 1
    M = M//j
ans = 1
for i in e:
  ans *=cmb(i+N-1,i)
  ans %=10**9+7
print(ans)

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce
import math
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
import itertools
N,M = [int(x) for x in input().split()]
e = [0]*(int(math.sqrt(M)) + 1)
for j in range(2,int(math.sqrt(M)) + 1):
  while M%j==0:
    e[j] += 1
    M = M//j
ans = 1
for i in e:
  ans *=cmb(i+N-1,i)
  ans %=10**9+7
print(ans)

Submission status: Wrong Answer

Solution code:
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
import itertools
N,M = [int(x) for x in input().split()]
e = [0]*((int(M**0.5)+2))
for j in range(2,int(M**0.5)+2):
  while M%j==0:
    e[j] += 1
    M = M//j
ans = 1
for i in e:
  ans *=cmb(i+N-1,i)
  ans %=10**9+7
print(ans)

Submission status: Wrong Answer

Solution code:
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
import itertools
N,M = [int(x) for x in input().split()]
e = [0]*(int(M**0.5)+1)
for j in range(2,int(M**0.5)+1):
  while M%j==0:
    e[j] += 1
    M = M//j
ans = 1
for i in e:
  ans *=cmb(i+N-1,i)
  ans %=10**9+7
print(ans)

Submission status: Wrong Answer

Solution code:
#17:33
n,m = map(int,input().split())
mod = 10 ** 9 + 7
i = 2
tmp = 0
fact = []
while i ** 2 <= m:
  if m % i == 0:
    m //= i
    tmp += 1
  else:
    if tmp > 0:
      fact.append(tmp)
    i += 1
    tmp = 0
if m == i:
  tmp += 1
  fact.append(tmp)
else:
  if tmp > 0:
    fact.append(tmp)
  fact.append(1)
#print(fact)
ans = 1
def inv(y):
  z = 1
  while y != 1:
    z *= mod // y + 1
    z %= mod
    y = y - mod % y
  return z
#print(inv(5))
for x in fact:
  for j in range(x):
    ans *= n+j
    ans %= mod
    ans *= inv(j+1)
    ans %= mod
print(ans)

Submission status: Wrong Answer

Solution code:
#17:33
n,m = map(int,input().split())
mod = 10 ** 9 + 7
i = 2
tmp = 0
fact = []
while i ** 2 <= m:
  if m % i == 0:
    m //= i
    tmp += 1
  else:
    if tmp > 0:
      fact.append(tmp)
    i += 1
    tmp = 0
if m == i:
  tmp += 1
  fact.append(tmp)
else:
  fact.append(tmp)
  fact.append(1)
#print(fact)
ans = 1
def inv(y):
  z = 1
  while y != 1:
    z *= mod // y + 1
    z %= mod
    y = y - mod % y
  return z
#print(inv(5))
for x in fact:
  for j in range(x):
    ans *= n+j
    ans %= mod
    ans *= inv(j+1)
    ans %= mod
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import collections

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


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

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

c = collections.Counter(prime_factorize(M))
#print(c)
ans = 1
for i,j in c.items():
    ans_ = cmb(N+j-1,j) % 1000000007
    ans *= ans_
print(ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
mod = 10 ** 9 + 7

def combo(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    else:
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod



N = n + 100
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

#print(combo(2,1))

#print(m)
fac = {}
mm = m
#print(mm)
count = 0
while mm % 2 == 0:
    count += 1
    mm //= 2
if count > 0:
    fac[2] = count
f = 3
count = 0
while f ** 2 <= mm:
    while mm % f == 0:
        count += 1
        mm //= f
        #print(f,count)
    if count > 0:
        fac[f] = count
    f += 2
    #print(fac)
if mm != 1:
    if mm in fac:
        fac[mm] += 1
    else:
        fac[mm] = 1
#print(fac)

count = 1

for i in fac:
    if fac[i] >= 1:
        count = (count * combo(fac[i]+n-1,fac[i],mod)) % mod
    #print(count)
    
print(count)

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    N,M = map(int, input().split())
    mod = 10**9 + 7
    MAX = 2*10**5
    kaijo = [1]*MAX
    for i in range(2,MAX):
        kaijo[i] = (kaijo[i-1] * i)%mod
    
    if M == 1:
        print(1)
        sys.exit()
    
    def p_prime(n): 
        prime = [2]
        for i in range(3,n+1):
            flag = 0
            for j in prime:
                if i%j == 0:
                    flag = 1
                    break
                if i**0.5 < j:
                    break
            if flag == 0:
                prime.append(i)
        return prime
    prime = p_prime(10**5)
    
    a = {}
    for p in prime:
        count = 0
        tmpM = M
        while tmpM%p ==0:
            count += 1
            tmpM //= p
        if count > 0:
            a[p] = count
    ans = 1
    for p in a:
        i = a[p]
        ans = (ans * kaijo[i+N-1])%mod
        ans = (ans * pow(kaijo[i],mod-2,mod))%mod
        ans = (ans * pow(kaijo[N-1],mod-2,mod))%mod
    print(ans)
    
    
main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    N,M = map(int, input().split())
    mod = 10**9 + 7
    MAX = 10**5 + 10**2
    kaijo = [1]*MAX
    for i in range(2,MAX):
        kaijo[i] = (kaijo[i-1] * i)%mod
    
    if M == 1:
        print(1)
        sys.exit()
    
    def p_prime(n): 
        prime = [2]
        for i in range(3,n+1):
            flag = 0
            for j in prime:
                if i%j == 0:
                    flag = 1
                    break
                if i**0.5 < j:
                    break
            if flag == 0:
                prime.append(i)
        return prime
    prime = p_prime(4*10**4)
    
    a = {}
    for p in prime:
        count = 0
        while M%p ==0:
            count += 1
            M //= p
        if count > 0:
            a[p] = count
    ans = 1
    for p in a:
        i = a[p]
        ans = (ans * kaijo[i+N-1])%mod
        ans = (ans * pow(kaijo[i],mod-2,mod))%mod
        ans = (ans * pow(kaijo[N-1],mod-2,mod))%mod
    print(ans)
    
    
main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    N,M = map(int, input().split())
    mod = 10**9 + 7
    MAX = 2*10**5
    kaijo = [1]*MAX
    for i in range(2,MAX):
        kaijo[i] = (kaijo[i-1] * i)%mod
    
    if M == 1:
        print(1)
        sys.exit()
    
    def p_prime(n): 
        prime = [2]
        for i in range(3,n+1):
            flag = 0
            for j in prime:
                if i%j == 0:
                    flag = 1
                    break
                if i**0.5 < j:
                    break
            if flag == 0:
                prime.append(i)
        return prime
    prime = p_prime(10**5)
    
    a = {}
    for p in prime:
        count = 0
        while M%p ==0:
            count += 1
            M //= p
        if count > 0:
            a[p] = count
    ans = 1
    for p in a:
        i = a[p]
        ans = (ans * kaijo[i+N-1])%mod
        ans = (ans * pow(kaijo[i],mod-2,mod))%mod
        ans = (ans * pow(kaijo[N-1],mod-2,mod))%mod
        ans %= mod
    print(ans)
    
    
main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    N,M = map(int, input().split())
    mod = 10**9 + 7
    MAX = 2*10**5
    kaijo = [1]*MAX
    for i in range(2,MAX):
        kaijo[i] = (kaijo[i-1] * i)%mod
    
    if M == 1:
        print(1)
        sys.exit()
    
    def p_prime(n): 
        prime = [2]
        for i in range(3,n+1):
            flag = 0
            for j in prime:
                if i%j == 0:
                    flag = 1
                    break
                if i**0.5 < j:
                    break
            if flag == 0:
                prime.append(i)
        return prime
    prime = p_prime(10**5)
    
    a = {}
    for p in prime:
        count = 0
        while M%p ==0:
            count += 1
            M //= p
        if count > 0:
            a[p] = count
    ans = 1
    for p in a:
        i = a[p]
        ans *= (kaijo[i+N-1] * pow(kaijo[i],mod-2,mod) * pow(kaijo[N-1],mod-2,mod))%mod
        ans %= mod
    print(ans)
    
    
main()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
mod = 10**9+7

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

mf = factorize(m)
from collections import Counter

c = Counter(mf)
ans = 1
from scipy.misc import comb
for i in list(c.values()):
  ans*= comb((i+(n-1)),i)

print(int(round(ans))%mod)

Submission status: Wrong Answer

Solution code:
import sys
import math
def input():
    return sys.stdin.readline()[:-1]

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def trial_division(n):
    factor = []
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    if n!=1:
        factor.append(n)
    return factor

n,m=map(int,input().split())
mod=10**9+7
if m==1:
    print(1)
    quit()
li=trial_division(m)
tmp=li[0]
countli=[]
count=1
for i in range(1,len(li)):
    if tmp!=li[i]:
        countli.append(count)
        count=1
    else:
        count+=1
    tmp=li[i]
countli.append(count)
ans=1
for i in range(len(countli)):
    r=countli[i]
    s=n+r-1
    r=min(r,n-1)
    p=1
    for j in range(r):
        p*=n-j
        p//=j+1
    ans*=p
    ans%=mod
    
print(ans%mod)

Submission status: Wrong Answer

Solution code:
import math

def main():
    N,M = map(int,input().split())
    div_list = []
    ans = 1
    for i in range(2,int(-(-M**(1/2)//1)+1)):
        if M%i == 0:
            count = 0
            while M%i == 0:
                count += 1
                M //= i
            div_list.append(count)
        if M == 1:
            break
    for i in div_list:
        a = math.factorial(i+N-1)
        b = math.factorial(i)
        c = math.factorial(N-1)
        ans *= (a//(b*c))%(10**9+7)
    print(ans%(10**9+7))
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math

N, M = map(int, input().split())
yakusu = dict()
sqrt_M = int(math.sqrt(M))
for i in range(2, sqrt_M + 1):
    count = 0
    while M % i == 0:
        count += 1
        M //= i
    if count > 0:
        yakusu[i] = count
if M > 1:
    yakusu[M] = 1


def nCr(n, r):
    if r > n - r:
        return nCr(n, n - r)
    ans = 1
    for i in range(n, n-r, -1):
        ans *= i
    for i in range(1, r+1):
        ans //= i
    return ans


ans = 1
MOD = 10 ** 9 + 7
for n in yakusu.values():
    print(n)
    ans *= nCr(n + N - 1, N - 1)
    ans %= MOD

print(ans)

Submission status: Wrong Answer

Solution code:
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

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

def fact(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

l = fact(m)
ans = 1

if len(l) == 1:
    print(1)
    exit()

for i in range(len(l)):
    b = l[i][1]
    ans *= cmb(b+n-1, b)
    ans %= MOD

print(ans)

Submission status: Wrong Answer

Solution code:
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

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

def fact(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

l = fact(m)
ans = 1

if len(l) == 1:
    print(1)
    exit()

for i in range(len(l)):
    b = l[i][1]
    print(cmb(100000, 1))
    ans *= cmb(b+n-1, b)
    ans %= MOD

print(ans)

Submission status: Wrong Answer

Solution code:
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

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

def fact(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

l = fact(m)
ans = 1

for i in range(len(l)):
    b = l[i][1]
    ans *= cmb(b+n-1, b)
    ans %= MOD

print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt
from collections import Counter

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

mod = 10**9+7

def factor(n) :
    factors = Counter()
    p = 2
    while p*p <= n :
        while n%p == 0 :
            factors.update([p])
            n //= p
        p += 1
    return factors

def comb(n, r) :
    if n - r < r: r = n - r
    if r < 0: return 0
    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

vv = factor(m).values()
ans = 1
for v in vv :
    a = 0
    for i in range(min(n, v)) :
        a += comb(n, i+1)*comb(v-1, i)
    ans *= a
    ans %= mod
print(ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
mod=10**9+7
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
l=factorization(m)
ans=1
for p,b in l:
    com1=1
    com2=1
    for i in range(b):
        com1*=(b+n-1-i)
        com2*=(1+i)
    ans*=(com1//com2)%mod
print(ans%mod)

Submission status: Wrong Answer

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

C = [1] # (N+K-1, N-1) K=0,1,2,...,30
for k in range(1,31):
    C.append(C[-1]*(k+N-1)//k)

F = {}
f = 2
while f*f<=M and M>1:
    if M%f==0:
        if f in F: F[f] += 1
        else: F[f] = 1
        M//=f
    else:
        f+=1

if M in F: F[M]+=1
else: F[M]=1

d = 1
for f, k in F.items():
    d *= C[k]

print(d%1000000007)

Submission status: Wrong Answer

Solution code:
import sys
from math import factorial
input = sys.stdin.readline

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

_prime = [i for i in range(3, int(M ** 0.5) + 10) if i % 2 != 0]
prime = [2]
t = 2

while True:
    _prime = [v for v in _prime if v % t != 0]
    if len(_prime) == 0:
        break
    prime.append(_prime[0])
    t = _prime[0]
    
m = {}
for i in range(len(prime)):
    p = prime[i]
    
    while M % p == 0:
        M = M // p
        if m.get(p) == None:
            m[p] = 0
        m[p] += 1
 
ans = 1
mod = 10 ** 9 + 7
aaa = {}
for v in m.values():
    a = N + v - 1
    b = N - 1
    c = a - b
    
    if aaa.get(a) == None:
        aaa[a] = factorial(a)
    a = aaa[a]
    
    if aaa.get(b) == None:
        aaa[b] = pow(factorial(b), mod - 2, mod)
    b = aaa[b]
    
    if aaa.get(c) == None:
        aaa[c] = pow(factorial(c), mod - 2, mod)
    c = aaa[c]

    ans *= (a % mod * b % mod * c % mod) % mod
    
print(ans % mod)

Submission status: Wrong Answer

Solution code:
import sys
from math import factorial
input = sys.stdin.readline

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

_prime = [i for i in range(3, int(M ** 0.5) + 10) if i % 2 != 0]
prime = [2]
t = 2

while True:
    _prime = [v for v in _prime if v % t != 0]
    if len(_prime) == 0:
        break
    prime.append(_prime[0])
    t = _prime[0]
    
m = {}
for i in range(len(prime)):
    p = prime[i]
    
    while M % p == 0:
        M = M // p
        if m.get(p) == None:
            m[p] = 0
        m[p] += 1
 
ans = 1
mod = 10 ** 9 + 7
for v in m.values():
    a = N + v - 1
    b = N - 1
    c = a - b

    b = pow(factorial(b), mod - 2, mod)
    c = pow(factorial(c), mod - 2, mod)

    ans *= (factorial(a) * b % mod * c % mod) % mod
    
print(ans % mod)

Submission status: Wrong Answer

Solution code:
import sys
from math import factorial
input = sys.stdin.readline

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

prime = [i for i in range(2, int(M ** 0.5) + 10)]
prime2 = []
c = 0
for i in range(len(prime)):
    if i >= len(prime):
        break
    a = prime[i]
    prime = [v for v in prime if v % a != 0]
    prime2.append(a)

m = {}
for i in range(len(prime2)):
    p = prime2[i]
    
    while M % p == 0:
        M = M // p
        if m.get(p) == None:
            m[p] = 0
        m[p] += 1

ans = 1
mod = 10 ** 9 + 7
for v in m.values():
    a = N + v - 1
    b = N - 1
    c = a - b
    
    b = pow(factorial(b), mod - 2, mod)
    c = pow(factorial(c), mod - 2, mod)
    
    ans *= (factorial(a) * b % mod * c % mod)
    
print(ans % mod)

Submission status: Wrong Answer

Solution code:
import sys
from math import factorial
input = sys.stdin.readline

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

prime = [i for i in range(2, int(M ** 0.5) + 10)]
c = 0
while True:
    t = prime[c]
    prime = [v for v in prime if v % t != 0 or v == t]
    if c >= len(prime) - 1:
        break
    c += 1
    
m = {}
for i in range(len(prime)):
    p = prime[i]
    
    while M % p == 0:
        M = M // p
        if m.get(p) == None:
            m[p] = 0
        m[p] += 1
        
ans = 1
mod = 10 ** 9 + 7
for v in m.values():
    a = N + v - 1
    b = N - 1
    c = a - b
    
    b = pow(factorial(b), mod - 2, mod)
    c = pow(factorial(c), mod - 2, mod)
    
    ans *= (factorial(a) * b % mod * c % mod)
    
print(ans % mod)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from functools import reduce
from operator import mul

MOD = 10 ** 9 + 7

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

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

factors = defaultdict(int)
i = 2
while M > 1 and i * i <= N:
    while M % i == 0:
        M //= i
        factors[i] += 1
    i += 1 if i == 2 else 2
if M > 1:
    factors[M] += 1

ans = 1
for n in factors.values():
    ans *= nCr(N + n - 1, n)
    ans %= MOD
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#ABC110 D

import math
from collections import Counter
N,M = map(int,input().split())
mod = 10**9 + 7

def factorize(n):
    if n < 4:
        return {n:1}
    b = 2
    fct = {}
    while b**2 <= n:
        if n % b == 0:
            fct[b] = 0
            while n % b == 0:
                n //= b
                fct[b] += 1
        b += 1
    if n > 1:
        fct[n] = 1
    return fct

def fast(x,n):
    if n == 0:
        return 1
    elif n % 2 == 0:
        return fast(x**2 % mod,n//2) % mod
    elif n % 2:
        return x*fast(x**2 % mod,n//2) % mod

cnt = list(factorize(M).values())
ans = 1
for i in cnt:
    ans *= math.factorial(i+N-1)
    ans %= mod
    ans *= fast(math.factorial(i),mod-2)
    ans %= mod
    ans *= fast(math.factorial(N-1),mod-2)
    ans %= mod
print(ans)

Submission status: Wrong Answer

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

#試し割法
def primeFact(n):
    #2から√n以下の数字で割っていく
    R = int(n**(0.5)) + 2
    #素因数を格納するリスト
    factor = [0] * R
    for num in range(2, R):
        while n % num == 0:
            n //= num
            factor[num] += 1
    return factor

primes = primeFact(M)
maxCount = max(primes)
if maxCount == 0 :  # Mが素数の場合
    print(N)
else :
    primeCount = list(filter(lambda x : x > 0, primeFact(M)))  # 素因数の個数

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

    ans = 1
    for prime in primeCount :
        ans *= comb(prime + N - 1, prime) % MOD

    print(ans % MOD)

Submission status: Wrong Answer

Solution code:
import sys
n,m=map(int,input().split())
MOD = 10**9+7
ans=1
def inv_mod(a, p=MOD):
    def inv_mod_sub(a, p):
        if a == 1:
            return 1, 0
        else:
            d, r = p//a, p%a
            x, y = inv_mod_sub(r, a)
            return y-d*x, x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n, k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD
pf={}
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
if m==1:
  print(1)
  sys.exit()
Max=max(list(pf.values()))
f_mod=[1]*(Max+n+1)
f_mod_inverse=[1]*(Max+n+1)
for i in range(1,Max+n+1):
  f_mod[i]=(f_mod[i-1]*i)%MOD
  f_mod_inverse[i]=(f_mod_inverse[i-1]*inv_mod(i)) % MOD  
for i in pf.values():
  ans*=comb_mod(i+n-1,n-1)
print(ans%MOD)