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:
def prime_factorizarion(n):
	arr = []
	temp = n
	for i in range(2, int(n**0.5)+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 modInv(a,mod):
    return pow(a,mod-2,mod)

def nCr(n,r,mod):
    r=min(r,n-r)
    if r==0:
        return 1
    if r==1:
        return n
    numer=1
    denom=1
    for i in range(r):
        numer=(n-i)*numer%mod
        denom=(i+1)*denom%mod
    return numer*modInv(denom,mod)%mod

mod=10**9+7
N,M=map(int,input().split())
prime_divisors=prime_factorizarion(M)
ans=1
for prime,num in prime_divisors:
    ans=(ans*nCr(num+N-1,num,mod))%mod
print(ans)

Submission status: Wrong Answer

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

def comb(n, k):
  if k > n-k:
    return comb(n, n-k)
  mul, div = 1, 1
  for i in range(k):
    mul = mul * (n-i) % mod
    div = div * (k-i) % mod
  ret = mul * pow(div, mod-2, mod) % mod
  return ret

i = 2
ans = 1
tmp = M
while i * i <= M:
  if tmp % i == 0:
    cnt = 0
    while tmp % i == 0:
      tmp //= i
      cnt += 1
    ans *= comb(cnt+N-1, N-1) % mod
  i += 1
if tmp != 1:
  ans *= comb(1+N-1, N-1) % mod
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def lcm(x, y) : return (x * y) // math.gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

def ncr(n, r, p=MOD):
    a = 1
    b = 1
    for i in range(r):
        a = (a * (n - i) % p)
        b = (b * (r - i) % p)

    return a * pow(b, p - 2, p) % p

N, M = LI()

i = 1
ans = 1
while i * i <= M:
    i += 1

    if M % i == 0:
        cnt = 0
        while M % i == 0:
            cnt += 1
            M //= i
        
        ans = ans * ncr(cnt+(N-1), (N-1)) % MOD



print(ans)

Submission status: Wrong Answer

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


def factorization(n):
    retval = []
    tmp = n
    for i in range(2, int(-(-n**.5//1))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            retval.append((i, cnt))
    if tmp != 1:
        retval.append((tmp, 1))
    if not retval:
        retval.append((n, 1))
    return retval


fact = factorization(m)


def com(n, r):
    X = Y = 1
    if n-r < r:
        r = n-r
    for i in range(1, r+1):
        Y = Y*i % MOD
        X = X*(n-i+1) % MOD
    Y = pow(Y, MOD-2, MOD)
    return X*Y


ans = 1
for f in fact:
    ans *= com(n+f[1]-1, n-1)
print(ans % MOD)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
def factorization(n):
    arr = defaultdict(int)
    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[i] = cnt
    if temp != 1:
        arr[temp] = 1
    if len(arr.keys()) == 0:
        arr[n] = 1
    return arr

def prepare(n, MOD):

    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv

    return factorials, invs

import math
from itertools import combinations
from collections import Counter
MOD = 1000000007

def solve():
    N, M = map(int, input().split())
    temp = factorization(M)
    #print(temp)
    max_num = max(temp.values())
    factorials, invs = prepare(N+max_num-1, MOD)
    #print(factorials, invs)
    ans = 1
    for i, j in temp.items():
        ans *= factorials[N+j-1]
        ans %= MOD
        ans *= invs[N-1]
        ans %= MOD
        ans *= invs[j]
        ans %= MOD
        #print(ans)
    print(ans)


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution 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[i] = cnt
    if temp != 1:
        arr[temp] = 1
    if arr == {}:
        arr[n] = 1
    return arr


def prepare(n, MOD):

    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv

    return factorials, invs

import math
from itertools import combinations
from collections import Counter
MOD = 1000000007

def solve():
    N, M = map(int, input().split())
    temp = factorization(M)
    #print(temp)
    max_num = max(temp.values())
    factorials, invs = prepare(N+max_num-1, MOD)
    #print(factorials, invs)
    ans = 1
    for i, j in temp.items():
        ans *= factorials[N+j-1]
        ans %= MOD
        ans *= invs[N-1]
        ans %= MOD
        ans *= invs[j]
        ans %= MOD
        #print(ans)
    print(ans)


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution 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


import math
from itertools import combinations
from collections import Counter
MOD = 1000000007

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

    temp = factorization(M)
    nums = []
    for i, j in temp:
        for k in range(j):
            nums.append(i)
    #print(nums)

    divisors = set()
    for i in range(1, len(nums)+1):
        for temp in combinations(nums, i):
            y = 1
            for x in temp:
                y = y * x
            divisors.add(y)
    #print(divisors)

    pattern = set()
    for x in divisors:
        m = M // x
        temp_m = factorization(m)
        nums_m = []
        for i, j in temp_m:
            for k in range(j):
                nums_m.append(i)
        nums_m.append(x)
        nums_m.sort()
        pattern.add(tuple(nums_m))
    #print(pattern)

    ans = 0
    fact_N = math.factorial(N)
    for x in pattern:
        ones = [1]*(N-len(x))
        cnt = Counter(ones+list(x))
        #print(cnt)
        perm = fact_N
        for value in cnt.values():
            perm = perm // math.factorial(value)
        ans += perm % MOD
    print(ans)

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution 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


import math
from itertools import combinations
from collections import Counter
N, M = map(int, input().split())

temp = factorization(M)
nums = []
for i, j in temp:
    for k in range(j):
        nums.append(i)
#print(nums)

divisors = set()
for i in range(1, len(nums)+1):
    for temp in combinations(nums, i):
        y = 1
        for x in temp:
            y = y * x
        divisors.add(y)
#print(divisors)

pattern = set()
for x in divisors:
    m = M // x
    temp_m = factorization(m)
    nums_m = []
    for i, j in temp_m:
        for k in range(j):
            nums_m.append(i)
    nums_m.append(x)
    nums_m.sort()
    pattern.add(tuple(nums_m))
#print(pattern)

ans = 0
fact_N = math.factorial(N)
for x in pattern:
    ones = [1]*(N-len(x))
    cnt = Counter(ones+list(x))
    #print(cnt)
    perm = fact_N
    for value in cnt.values():
        perm = perm // math.factorial(value)
    ans += perm
print(ans)

Submission status: Wrong Answer

Solution 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(cnt)

    if temp!=1:
        arr.append(1)

    if arr==[]:
        arr.append(1)

    return arr

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
N = 10**6
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 )

P, Q = map(int,input().split())
L = factorization(Q)
ans = 1
for i in L:
    ans *= cmb(P-1+i,i,mod)

print(ans % mod)

Submission status: Wrong Answer

Solution 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(cnt)

    if temp!=1:
        arr.append(1)

    if arr==[]:
        arr.append(1)

    return arr

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
N = 2 * 10**5
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 )

P, Q = map(int,input().split())
L = factorization(Q)
ans = 1
for i in L:
    ans *= cmb(P-1+i,i,mod)

print(ans % mod)

Submission status: Wrong Answer

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

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
N = 10**6
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 )

P, Q = map(int,input().split())
L = prime_factorize(Q)
ans = 1
for i in L:
    ans *= cmb(P-1+i,i,mod)

print(ans % mod)

Submission status: Wrong Answer

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

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
N = 2 * 10**5
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 )

P, Q = map(int,input().split())
L = prime_factorize(Q)
ans = 1
for i in L:
    ans *= cmb(P-1+i,i,mod)

print(ans % mod)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict as dd
import sys
import math
n, m = map(int, input().split())
dic = dd(int)

#M=1
if m == 1:
    print(1)
    sys.exit()
elif n == 1:
    print(1)
    sys.exit()

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

for i in range(2, math.ceil(m**0.5) + 3):
    while m % i == 0:
        m //= i
        dic[i] += 1
#print(dic)

ans = 1
mod = 10**9 + 7
for count in dic.values():
    ans *= combinations_count(count + n - 1, n-1) % mod

print(ans % mod)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict as dd
import sys
import math
n, m = map(int, input().split())
dic = dd(int)

#M=1
if m == 1:
    print(1)
    sys.exit()

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

for i in range(2, int(m**0.5) + 3):
    while m % i == 0:
        m //= i
        dic[i] += 1
#print(dic)

ans = 1
mod = 10**9 + 7
for count in dic.values():
    ans *= combinations_count(count + n - 1, n-1) % mod

print(ans % mod)

Submission status: Wrong Answer

Solution code:
def modpow(a,n):
  if n<1:
    return 1
  ans=modpow(a,n//2)
  ans=(ans*ans)%mod
  if n%2==1:
    ans*=a
  return ans%mod

def conb(n,i):
  inv,ans=1,1
  for j in range(1,i+1):
    ans=ans*(n-j+1)%mod
    inv=inv*j%mod
  return (ans*modpow(inv,mod-2))%mod


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(cnt)
    if temp!=1:
        arr.append(1)

    if arr==[]:
        arr.append(1)
    return arr



mod=10**9+7
N,M=[int(x) for x in input().rstrip().split()]
fact=factorization(M)
ans=1
for i in fact:
  ans*=conb(i+N-1,N-1)
print(ans%mod)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

mod = 10 ** 9 + 7
N = 200000

#逆元テーブル
inv_t = [0]+[1]
for i in range(2, N):
  inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]

#階乗計算
kai = [1, 1]
rev_kai = [1, inv_t[1]]
for i in range(2, N):
	kai.append(kai[-1] * i % mod)
	rev_kai.append(rev_kai[-1] * inv_t[i] % mod)

# コンビネーション計算
def cmb(n, r):
	return kai[n] * rev_kai[r] * rev_kai[n-r] % mod

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

ans = 1

for _, cnt in factorization(m):
    ans = ans * cmb(cnt + n - 1, n - 1) % mod

print(ans)

Submission status: Wrong Answer

Solution code:
"""
---アルゴリズム概要---
Mを構成する素因数を、a1~aNの各スロットにいくつ置くのか、を考える問題。
まずは試し割りによってMを素因数分解。
重複組合せの公式で各素因数の配置パターンを算出し累乗していく。

試し割りは、O(√M)の計算量で処理できる。
√Mを超える素因数は、多くても一つしか存在しないため、√Mを超える値で試し割りをする必要はない。
もし√Mまでの値で試し割りを終えた段階で、Mを素因数分解しきれていなければ、残った商こそが√Mを超える唯一の素因数である。

簡単に証明
もし√Mを超える素因数が２つ存在しているとしよう。
それらは、(√M + α)と(√M + β)というふうに表すことができる。
この２つの積は明らかにMの値を超えてしまう。つまり前提に矛盾する。
したがって、√Mを超える素因数は多くても一つ
"""
from collections import Counter
import math

N,M = map(int,input().split())
factors = []

while M%2 == 0:
    M//=2
    factors.append(2)
    
f = 3
while f**2 <= M:
    while M%f==0:
        M//=f
        factors.append(f)
    f+=2
if M!=0:
    factors.append(M)

factors = Counter(factors)

ans = 1
for k in factors.values():
    ans *= math.factorial(k+N-1)//(math.factorial(N-1)*math.factorial(k))

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.buffer.readline

def main():
    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
        
    cl = factorization(M)
    
    def combinations(x,y,N):
        fac = [0]*(N+1)
        fac[0],fac[1] = 1,1
        
        for i in range(2,N+1):
            fac[i] = (fac[i-1]*i)%MOD
            
        return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD
        
    ans = 1
    for pr,num in cl:
        ans *= combinations(N-1,num,N+num)
        ans %= MOD
    
    print(ans)
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math

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

fact = factorization(M)

ans = 1

for i in range(len(fact)):
  ans *= ( math.factorial(N-1+fact[i][1]) ) // ( (math.factorial(N-1)) * (math.factorial(fact[i][1])) ) % MOD
  ans = ans%MOD

print(ans)

Submission status: Wrong Answer

Solution 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
  
n,m = map(int,input().split())
chk = factorization(m)

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod) 
  
def comb(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

mod = 10**9+7
ans = 1
for i in chk:
  ans *= comb(i[1]+n-1,i[1],mod)
  ans %= mod
print(ans)

Submission status: Wrong Answer

Solution code:
import math
from collections import Counter

N,M = map(int,input().split())
a = []
def prime_factorize(n):
    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
prime_factorize(M)
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
divisors = Counter(a)
count = 0
for k,v in divisors.items():
    count *= combinations_count(v+N-1,v)

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

Submission status: Wrong Answer

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

if M == 1:
    print(1)

m = M
A = []  #Mの素因数のリスト(今回は必要ない)
B = []  #各素因数で何回割り切れるか
for i in range(2,int(math.sqrt(M))+1):
    if m % i == 0:
        A.append(i)
        c = 0
        while m % i == 0:
            m = m // i
            c += 1
        B.append(c)

if m != 1:
    A.append(m)
    B.append(1)

def p(m,n):
    a = 1
    for i in range(n):
        a = a*(m-i) % mod
    return a

def c(m,n):
    return (p(m,n)*pow(p(n,n),mod-2,mod)) % mod

ans = 1
for i in range(len(B)):
    ans = (ans * c(N-1+B[i],B[i])) % mod

print(ans)

Submission status: Wrong Answer

Solution 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 comb(n, r, p):
    x = 1
    for i in range(1, r + 1):
        x *= (n - i + 1) * pow(i, p - 2, p) % p
    return x % p
p = 10**9+7
n, m = map(int, input().split())
b = [x[1] for x in factorization(m)]
ans = 1
for i in b:
  ans = (ans *  comb(n+i-1, i, p)) % p
print(ans)

Submission status: Wrong Answer

Solution 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 comb(n, r, p):
    x = 1
    for i in range(1, r + 1):
        x *= (n - i + 1) * pow(i, p - 2, p) % p
    return x % p
p = 10**9+7
n, m = map(int, input().split())
b = [x[1] for x in factorization(m)]
ans = 1
for i in b:
  c = comb(n+i-1, i, p)
  ans = (ans * c) % p
print(ans)

Submission status: Wrong Answer

Solution code:
import math
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 comb(n, r, p):
    x = 1
    for i in range(1, r + 1):
        x *= (n - i + 1) * pow(i, p - 2, p) % p
    return x % p
p = 10**9+7
n, m = map(int, input().split())
b = [x[1] for x in factorization(m)]
ans = 1
for i in b:
  c = comb(n+i-1, i, p)
  ans = (ans * c) % p
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

n,m = myinput()
mod = 10**9 + 7

# 素因数分解
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

table = prime_decomposition(m)
# print(table)

# """nを素因数分解"""
# """2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
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
# print(factorization(m))
## [[2, 3], [3, 1]] 
##  24 = 2^3 * 3^1

# Combinations
def comb_mod_faster(n,k,mod):
    if n<k:
        return 0
    if n<0 or k<0:
        return 0
    k = min(n-k,k)
    ans = 1
    inv = [1]*(k+1)
    if k>=1:
        ans *= (n-k+1)%mod
    for i in range(2,k+1):
        inv[i] = mod - inv[mod%i]*(mod//i)%mod
        ans = ans*(n-k+i)*inv[i]%mod
    return ans

# Repeated Combinations
def repeated_combinations(n,k,mod):
    return comb_mod_faster(n+k-1,k,mod)

f = factorization(m)

ans = 1
for i in range(len(f)):
    k = f[i][1]
    ans *= repeated_combinations(n,k,mod)
print(ans%mod)

Submission status: Wrong Answer

Solution code:
import math
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 combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n, m = map(int, input().split())
b = [x[1] for x in factorization(m)]
ans = 1
for i in b:
  c = combinations_count(n+i-1, i)
  ans = ans * c
print(ans%(10**9+7))

Submission status: Wrong Answer

Solution code:
import math
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 combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n, m = map(int, input().split())
b = [x[1] for x in factorization(m)]
ans = 1
for i in b:
  c = combinations_count(n+i-1, i)
  ans = ans * c
print(ans)

Submission status: Wrong Answer

Solution code:
def factrize(x):
    f = {}
    tmp = x
    i = 2
    while i**2 <= tmp:
        cnt = 0
        while tmp % i == 0:
            cnt += 1
            tmp = tmp//i
        if cnt > 0:
            f[i] = cnt
        i += 1
    if tmp != 1 or f == {}:
        f[tmp] = 1
    return f


def comb(n, r, p):
    x = 1
    for i in range(1, r + 1):
        x *= (n - i + 1) * pow(i, p - 2, p) % p
    return x % p


p = 10**9+7
n, m = map(int, input().split())
A = list(factrize(m).values())
ans = 1
for a in A:
    ans = (ans*comb(a+n-1, a, p)) % p
print(ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
mod=10**9+7
N=10**5+1+34
p=[1]*N #assume all are primes from start 
for i in range(2,N):
    if p[i]==1:
        for j in range(2*i,N,i):
            p[j]=0
primes=[]
for i in range(2,N):
    if p[i]==1:
        primes.append(i)

#print(primes)
fact=[1]*N
for i in range(2,N):
    fact[i]=(i*fact[i-1])%mod
ifact=[0]*N
ifact[N-1]=pow(fact[N-1],mod-2,mod)
for i in range(N-2,0,-1):
    ifact[i]=((i+1)*ifact[i+1])%mod
ans=1
for x in primes:
    if x>m:
        break
    cnt=0
    #print(m,end=' before\n')
    while m%x==0:
        m//=x
        cnt+=1
    if cnt==0:
        continue
    #print(x,cnt)
    #print(m,end=' after\n')
    
    val=(fact[n-1+cnt]*(ifact[cnt]*ifact[n-1])%mod)%mod
    ans=(ans*val)%mod
if m>1:
    ans=(ans*n)%mod
print(ans)

Submission status: Wrong Answer

Solution code:
from scipy.misc import comb #<-Atcoderではこちらを使うべし

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


ans = 1
n, m = map(int, input().split())
lst = factorization(m)
for e in lst:
    ans *= comb((n + e[1] - 1), n - 1, exact=True)
print(ans % 1000000007)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
mod=10**9+7
arr=[]
temp=M
for i in range(2,int(M**(1/2))+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([M,1])
def comb(n,k):
  ans=n
  for i in range(1,k):
    ans=ans*((n-i)%mod)*pow(i+1,mod-2,mod)
    ans=ans%mod
  return ans
ans=1
for i in range(len(arr)):
  ans*=comb(arr[i][1]+N-1,arr[i][1])
  ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
mod=10**9+7
arr=[]
temp=M
for i in range(2,int(M**(1/2))+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([M,1])
def comb(n,k):
  ans=n
  for i in range(1,k):
    ans=ans*((n-i)%mod)*pow(i+1,mod-2,mod)
    ans=ans%mod
  return ans
ans=1
for i in range(len(arr)):
  ans*=int(comb(arr[i][1]+N-1,arr[i][1]))*pow(i+1,mod-2,mod)
  ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
import math
N,M=map(int,input().split())
mod=10**9+7
arr=[]
temp=M
for i in range(2,int(M**(1/2))+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([M,1])
def comb(n,k):
  ans=n
  for i in range(1,k):
    ans=ans*((n-i)%mod)*pow(i+1,mod-2,mod)
    ans=ans%mod
  return ans
ans=1
for i in range(len(arr)):
  ans*=int(comb(arr[i][1]+N-1,arr[i][1]))%mod
print(ans%mod)