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
n,m =map(int,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(int(n))
  return table
 
a =prime_decomposition(m)

def combination(n,r):
    r = min(r,n-r)
    result = 1
    for i in range(n-r+1,n+1):
        result *= i
    for i in range(1,r+1):
        result //= i
    return result


ans=1
count = 1
for i in range(1,len(a)):
  if a[i-1]== a[i]:
    count +=1
  else:
    ans *= combination(count+n-1,count)
    ans %=1000000007
    count = 1
    
ans *= combination(count+n-1,count)
ans %=1000000007
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n,m =map(int,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(int(n))
  return table

a =prime_decomposition(m)

ans=1
count = 1
for i in range(1,len(a)):
  if a[i-1]== a[i]:
    count +=1
  else:
    ans *= int(math.factorial(count+n-1)/(math.factorial(count)*math.factorial(n-1)))
    ans %=1000000007
    count = 1
    
ans *= int(math.factorial(count+n-1)/(math.factorial(count)*math.factorial(n-1)))
ans %=1000000007
print(ans)

Submission status: Wrong Answer

Solution code:
import math
def factoring(n):
    factoried = []
    sup = math.floor(pow(n,1/2))
    for i in range(2,sup + 1):
        count = 0
        while n % i == 0:
            count += 1
            n = n // i
        if count > 0:
            factoried.append([i,count])
    return factoried

# 組み合わせ　n_C_r
import math
def comb(n,r):
    r = min(r,n-r)
    result = 1
    for i in range(n-r+1,n+1):
        result *= i
    for i in range(1,r+1):
        result //= i
    return result

N,M = map(int,input().split())
if M == 1:
    print(1)
    exit()
ans = 1
for a,b in factoring(M):
    ans *= comb(b+N-1,b)
    ans %= 10**9 + 7
print(ans)

Submission status: Wrong Answer

Solution code:
import math
def factoring(n,dict_count = {}):
    sup = math.floor(pow(n,1/2))
    n_new = n
    for i in range(2,sup + 1):
        if n % i == 0:
            n_new = n // i
            if i in dict_count:
                dict_count[i] += 1
            else:
                dict_count[i] = 1
            break
    if n == n_new:
        if n_new in dict_count:
            dict_count[n_new] += 1
        else:
            dict_count[n_new] = 1
        return sorted(list(dict_count.items()))
    return factoring(n_new,dict_count)

# 組み合わせ　n_C_r
import math
def comb(n,r):
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))

N,M = map(int,input().split())
ans = 1
for a,b in factoring(M):
    ans *= comb(b+N-1,N-1)
    ans %= 10**9 + 7
print(ans)

Submission status: Wrong Answer

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

def prf(n):
    pf = {}
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            pf[i] = pf.get(i, 0) + 1
            n //= i
    if n > 1:
        pf[n] = 1
    return pf

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

ans = 1
for v in prf(m).values():
    ans *= comb(n-1+v, v) % mod
    
print(ans)

Submission status: Wrong Answer

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

f = []
p = 2
while p * p <= m:
    if m % p != 0:
        p += 1
        continue
    c = 0
    while m % p == 0:
        c += 1
        m //= p
    f.append(c)
    p += 1
if m != 1:
    f.append(1)


def comb(a, b):
    ret = 1
    r = min(b, a-b)
    for i in range(a-r+1, a+1):
        ret *= i
    for j in range(1, r+1):
        ret /= j
    return (int)(ret)


res = 1
for ele in f:
    ret = comb(ele+n-1, n-1)
    res *= ret

print(res % mod)

Submission status: Wrong Answer

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

f = []
p = 2
while p * p <= m:
    if m % p != 0:
        p += 1
        continue
    c = 0
    while m % p == 0:
        c += 1
        m //= p
    f.append(c)
    p += 1
if m != 1:
    f.append(1)


def comb(a, b):
    ret = 1
    r = min(b, a-b)
    for i in range(a-r+1, a+1):
        ret *= i
    for j in range(1, r+1):
        ret /= j
    return ret


res = 1
for ele in f:
    ret = comb(ele+n-1, n-1)
    res *= ret

print(res % mod)

#print(comb(5, 2))

Submission status: Wrong Answer

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

l_prime = [0]*(n+1)
N = n
ran = range(3, N+1)

while n % 2 == 0:
    l_prime[2] += 1
    n /= 2

for i in ran:
    while n != 1:
        if n % i == 0:
            n /= i
            l_prime[i] += 1
        else:
            i += 2


def fact(n):
    tmp = 1
    while n != 0:
        tmp *= n
        n -= 1

    return tmp


def comb(a, b):
    if a < b:
        print("err")

    return (int)(fact(a)/(fact(a-b)*fact(b)))


res = 1
for i in range(1, N+1):
    ele = l_prime[i]
    if ele != 0:
        ret = comb(ele+m-1, ele)
        print(ret)
        res *= ret

print(res)

Submission status: Wrong Answer

Solution code:
from math import factorial

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

pdic={}

p=2
while p**2<M:
    c=0
    while M%p==0:
        c+=1
        M//=p
    if c>0:
        pdic[p]=c
    p+=1
if M>1:
    pdic[M]=1

ans=1
tmp=factorial(N-1)

for p in pdic.keys():
    e=pdic[p]
    ans*=factorial(N+e-1)//(factorial(e)*tmp)

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

Submission status: Wrong Answer

Solution code:
def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor


from math import factorial


def comb(n, r, R):
    return factorial(n) // (factorial(n-r) * R)

n, m = map(int, input().split())
r = 1
R = factorial(r)
prime_fac = prime_factorize(m)
for v in prime_fac.values():
    r *= comb(v+n-1, v, R)
mod = 1000000000 + 7
print(r % mod)

Submission status: Wrong Answer

Solution code:
def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor


from math import factorial


def comb(n, r):
    return factorial(n) // (factorial(n-r) * factorial(r))


n, m = map(int, input().split())
r = 1
prime_fac = prime_factorize(m)
print(prime_fac)
for v in prime_fac.values():
    r *= comb(v+n-1, v)
mod = 1000000000 + 7
print(r % mod)

Submission status: Wrong Answer

Solution code:
import math

n,m=map(int,input().split())
a=math.floor(math.sqrt(m))+1
l=[0]*(a+1)
for i in range(2,a+1):
    while m%i==0:
        l[i]+=1
        m//=i
b=list(filter(lambda x:x!=0,l))
show=False
if len(b)==0:
    show=True
ans=1
#print(b)
for i in b:
    com=1
    for j in range(i):
        com*=n+i-1-j
    for j in range(i):
        com//=j+1
    ans*=com
    ans%=(10**9+7)
if show:
    print(n)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import math

n,m=map(int,input().split())
a=math.floor(math.sqrt(m))+1
l=[0]*(a+1)
for i in range(2,a+1):
    while m%i==0:
        l[i]+=1
        m//=i
b=list(filter(lambda x:x!=0,l))
show=False
if len(b)==0:
    show=True
ans=1
#print(b)
for i in b:
    com=1
    for j in range(i):
        com*=n+i-1-j
    for j in range(i):
        com//=j+1
    ans*=com
if show:
    print(n)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import math

n,m=map(int,input().split())
a=math.floor(math.sqrt(m))+1
l=[0]*(a+1)
for i in range(2,a+1):
    while m%i==0:
        l[i]+=1
        m//=i
b=list(filter(lambda x:x!=0,l))
show=False
if len(b)==0:
    show=True
ans=1
print(b)
for i in b:
    com=1
    for j in range(i):
        com*=n+i-1-j
    for j in range(i):
        com//=j+1
    ans*=com
if show:
    print(n)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import math

def com(n,k):
    return math.factorial(n)//(math.factorial(n-k)*math.factorial(k))


n,m=map(int,input().split())
a=math.floor(math.sqrt(m))+1
l=[0]*(a+1)
for i in range(2,a+1):
    while m%i==0:
        l[i]+=1
        m//=i
b=list(filter(lambda x:x!=0,l))
show=False
if len(b)==0:
    show=True
ans=1
for i in b:
    ans*=com(i+n-1,n-1)
    ans%=(10**9+7)
if show:
    print(n)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import math
import collections

N, M = [int(_) for _ in input().split()]

mod = 10 ** 9 + 7
MAX_N = 10 ** 5 + 100

#階乗
def calc_factorial(max_i):
    factorial = [1] * max_i
    for i in range(1, max_i):
        factorial[i] = i * factorial[i - 1] % mod
    return factorial

#素因数分解
def calc_factorization(n):
    factorization = {}
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            factorization[i] = 1
            n = n // i
            while n % i == 0:
                factorization[i] += 1
                n = n // i
    if n > 1:
        factorization[n] = 1
    return factorization

#組み合わせ
def combinations_count(factorial, n, r):
    return factorial[n] // (factorial[n - r] * factorial[r])

C = calc_factorization(M)
#階乗を計算しておく
factorial = calc_factorial(MAX_N)

res = 1
for c in C.items():
    #print(c[0], c[1])
    res *= combinations_count(factorial, (c[1] + N - 1), c[1])

print(res % mod)

Submission status: Wrong Answer

Solution code:
import math
import collections

N, M = input().strip().split(' ')
N, M = [int(N), int(M)]

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

#素因数分解
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

C = collections.Counter(prime_factors(M))

res = 1
for c in C.items():
    #print(c[0], c[1])
    res *= combinations_count((c[1] + N - 1), c[1])

print(res)

Submission status: Wrong Answer

Solution code:
import math

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

A=[0 for i in range(10**5)]

for i in range(2,10**5):
    while M%i==0:
        M=M//i
        A[i]+=1
ANS=1       

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) *math.factorial(r))
for j in range(10**5):
    if A[j]==0:
        pass
    else:
        ANS*=combinations_count(N-1+A[j],N-1)
        ANS%=(10**9+7)
    
print(ANS)

Submission status: Wrong Answer

Solution code:
import collections

def factor(m):
  q = m
  r = []
  i = 2
  while i * i <= m:
    if q % i:
      i += 1
    else:
      r.append(i)
      q //= i
  return r

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

r = factor(m)
v = collections.Counter(r)
c = 1
for value in v.values():
  temp = 1
  for i in range(value):
    temp *= value + n - 1 - i
  for i in range(value):
    temp //= i + 1
  temp %= p
  c = c * temp % p
print(c)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

"""
参考：http://drken1215.hatenablog.com/entry/2018/09/23/224100
　　　http://tutuz.hateblo.jp/entry/2018/09/24/121248
・素因数分解と重複組み合わせ
・毎回階乗やると死ぬから階乗と逆元のテーブル作る(忘れてた)
"""

from collections import defaultdict
from math import sqrt

MOD = 10 ** 9 + 7

def fact_prime(num):
    d = defaultdict(int)
    # 終点はルート切り捨て+1
    end = int(sqrt(num)) + 1
    for i in range(2, end+1):
        cnt = 0
        # 素因数分解：小さい方から割れるだけ割って素数をカウント
        while num % i == 0:
            num //= i
            d[i] += 1
        # 最後までそのまま来たやつはnumが素数(ただし1^1は1^0なので数に入れない)
        if i == end and len(d) == 0 and num != 1:
            d[num] += 1
    return d

# とりあえずv+N-1が収まればいいはず
MAX = 10 ** 5 * 2
# 予め組み合わせ計算に必要な階乗と逆元のテーブルを作っておく
factorial = [1] * (MAX)
factorial[0] = factorial[1] = 1
for i in range(2, MAX):
    factorial[i] = factorial[i-1] * i % MOD

inverse = [1] * (MAX)
# powに第三引数入れると冪乗のmod付計算を高速にやってくれる
inverse[MAX-1] = pow(factorial[MAX-1], MOD-2, MOD)
for i in range(MAX-2, 0, -1):
    # 最後から戻っていくこのループならH+W回powするより処理が速い
    inverse[i] = inverse[i+1] * (i+1) % MOD

# 組み合わせの数
def nCr(n, r):
    # 10C7 = 10C3
    r = min(r, n-r)
    # 分子の計算
    numerator = factorial[n]
    # 分母の計算
    denominator = inverse[r] * inverse[n-r] % MOD
    return numerator * denominator % MOD

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

ans = 1
for k, v in fact_prime(M).items():
    # 重複組み合わせ
    # v個のkとN-1個の仕切りから、v個を並べる(v+N-1個のマスからv個を選び出す組み合わせ)
    ans = (ans * nCr(v+N-1, v)) % MOD
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

"""
参考：http://drken1215.hatenablog.com/entry/2018/09/23/224100
　　　http://tutuz.hateblo.jp/entry/2018/09/24/121248
・素因数分解と重複組み合わせ
"""

from collections import defaultdict
from math import sqrt, factorial

MOD = 10 ** 9 + 7

def fact_prime(num):
    d = defaultdict(int)
    # 終点はルート切り捨て+1
    end = int(sqrt(num)) + 1
    for i in range(2, end+1):
        cnt = 0
        # 素因数分解：小さい方から割れるだけ割って素数をカウント
        while num % i == 0:
            num //= i
            d[i] += 1
        # 最後までそのまま来たやつはnumが素数(ただし1^1は1^0なので数に入れない)
        if i == end and len(d) == 0 and num != 1:
            d[num] += 1
    return d

# 組み合わせの数(MOD付)
def nCr(n, r):
    # 10C7 = 10C3
    r = min(r, n-r)
    # 分子の計算
    numerator = factorial(n) % MOD
    # 分母の計算
    denominator = pow(factorial(r) * factorial(n-r), MOD-2, MOD) % MOD
    return numerator * denominator % MOD

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

ans = 1
for k, v in fact_prime(M).items():
    # 重複組み合わせ
    # v個のkとN-1個の仕切りから、v個を並べる(v+N-1個のマスからv個を選び出す組み合わせ)
    ans = (ans * nCr(v+N-1, v)) % MOD
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

"""
参考：http://drken1215.hatenablog.com/entry/2018/09/23/224100
　　　http://tutuz.hateblo.jp/entry/2018/09/24/121248
・素因数分解と重複組み合わせ
"""

from collections import defaultdict
from math import sqrt, factorial

MOD = 10 ** 9 + 7

def fact_prime(num):
    d = defaultdict(int)
    # 終点はルート切り捨て+1
    end = int(sqrt(num)) + 1
    for i in range(2, end+1):
        cnt = 0
        # 素因数分解：小さい方から割れるだけ割って素数をカウント
        while num % i == 0:
            num //= i
            d[i] += 1
        # 最後までそのまま来たやつはnumが素数(ただし1^1は1^0なので数に入れない)
        if i == end and len(d) == 0 and num != 1:
            d[num] += 1
    return d

# 組み合わせの数(MOD付)
def nCr(n, r):
    # 10C7 = 10C3
    r = min(r, n-r)
    # 分子の計算
    numerator = factorial(n) % MOD
    # 分母の計算
    denominator = pow(factorial(r), MOD-2, MOD) * pow(factorial(n-r), MOD-2, MOD) % MOD
    return numerator * denominator % MOD

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

ans = 1
for k, v in fact_prime(M).items():
    # 重複組み合わせ
    # v個のkとN-1個の仕切りから、v個を並べる(v+N-1個のマスからv個を選び出す組み合わせ)
    ans = (ans * nCr(v+N-1, v)) % MOD
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

"""
参考：http://drken1215.hatenablog.com/entry/2018/09/23/224100
　　　http://tutuz.hateblo.jp/entry/2018/09/24/121248
・素因数分解と重複組み合わせ
"""

from collections import defaultdict
from math import sqrt, factorial

MOD = 10 ** 9 + 7

def fact_prime(num):
    d = defaultdict(int)
    # 終点はルート切り捨て+1
    end = int(sqrt(num)) + 1
    for i in range(2, end+1):
        cnt = 0
        # 素因数分解：小さい方から割れるだけ割って素数をカウント
        while num % i == 0:
            num //= i
            d[i] += 1
        # 最後までそのまま来たやつはnumが素数
        if i == end and len(d) == 0:
            d[num] += 1
    return d

# 組み合わせの数(MOD付)
def nCr(n, r):
    # 10C7 = 10C3
    r = min(r, n-r)
    # 分子の計算
    numerator = factorial(n) % MOD
    # 分母の計算
    denominator = pow(factorial(r), MOD-2, MOD) * pow(factorial(n-r), MOD-2, MOD) % MOD
    return numerator * denominator % MOD

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

ans = 1
for k, v in fact_prime(M).items():
    # 重複組み合わせ
    # v個のkとN-1個の仕切りから、v個を並べる(v+N-1個のマスからv個を選び出す組み合わせ)
    ans = (ans * nCr(v+N-1, v)) % MOD
print(ans)

Submission status: Wrong Answer

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

A=[0 for i in range(10**5)]

for i in range(2,10**5):
    while M%i==0:
        M=M/i
        A[i]+=1
        
#print(A[:5])

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

ans=1
for j in range(10**5):
    if A[j]==0:
        pass
    else:
        ans*=combinations_count(N-1+A[j],N-1)
        ans%=(10**9+7)
print(ans)

Submission status: Wrong Answer

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

N, M = (int(i) for i in input().split())

def soin(N):
	res = []
	i = 2
	while i < round(N**(1/2)) + 3:
		if N%i == 0:
			res.append(i)
			N = N//i
			i = 2
		else:
			i += 1
	if N != 1:
		res.append(N)
	return res

def power(a, b):
	if b == 0:
		return 0
	elif b == 1:
		return a % 1000000007
	elif b % 2 == 0:
		return (power(a, b//2) ** 2) % 1000000007
	else:
		return (power(a, b//2) ** 2 * a) % 1000000007

def divide(a, b):
	return (a * power(b, 1000000005)) % 1000000007

def combination(a, b):
	res = 1
	for i in range(b):
		res *= a - i
		res = res % 1000000007
	for i in range(b):
		res = divide(res, i+1)
	return res
	
L = soin(M)
cc = 1
res = 1
for i in range(len(L) -1):
	if L[i] == L[i+1]:
		cc += 1
	else:
		res *= combination(N + cc -1, cc)
		res = res % 1000000007
		cc = 1
res *= combination(N+cc -1, cc)
res = res % 1000000007
print(res)

Submission status: Wrong Answer

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

N, M = (int(i) for i in input().split())

def soin(N):
	res = []
	i = 2
	while i < round(N**(1/2)) + 3:
		if N%i == 0:
			res.append(i)
			N = N//i
			i = 2
		else:
			i += 1
	if N != 1:
		res.append(N)
	return res

def power(a, b):
	if b == 0:
		return 0
	elif b == 1:
		return a % 1000000007
	elif b % 2 == 0:
		return (power(a, b//2) ** 2) % 1000000007
	else:
		return (power(a, b//2) ** 2 * a) % 1000000007

def divide(a, b):
	return (a * power(b, 1000000005)) % 1000000007

def combination(a, b):
	res = 1
	for i in range(b):
		res *= a - i
		res = res % 1000000007
	for i in range(b):
		res = divide(res, i+1)
	return res
	
L = soin(M)
cc = 1
res = 1
for i in range(len(L) -1):
	if L[i] == L[i+1]:
		cc += 1
	else:
		res *= combination(N + cc -1, cc)
		res = res % 1000000007
		cc = 1
res *= combination(N+cc -1, cc)
res = res % 1000000007
print(res)
print(soin(6))

Submission status: Wrong Answer

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

N, M = (int(i) for i in input().split())

def soin(N):
	res = []
	i = 2
	while i < round(N**(1/2)) + 3:
		if N%i == 0:
			res.append(i)
			N = N//i
			i = 2
		else:
			i += 1
	res.append(N)
	return res

def power(a, b):
	if b == 0:
		return 0
	elif b == 1:
		return a % 1000000007
	elif b % 2 == 0:
		return (power(a, b//2) ** 2) % 1000000007
	else:
		return (power(a, b//2) ** 2 * a) % 1000000007

def divide(a, b):
	return (a * power(b, 1000000005)) % 1000000007

def combination(a, b):
	res = 1
	for i in range(b):
		res *= a - i
		res = res % 1000000007
	for i in range(b):
		res = divide(res, i+1)
	return res
	
L = soin(M)
cc = 1
res = 1
for i in range(len(L) -1):
	if L[i] == L[i+1]:
		cc += 1
	else:
		res *= combination(N + cc -1, cc)
		res = res % 1000000007
		cc = 1
res *= combination(N+cc -1, cc)
res = res % 1000000007
print(res)

Submission status: Wrong Answer

Solution code:
# coding: utf8

import math

const = 10 ** 9 + 7

def read_int_n():
    return list(map(int, input().split()))

def comb(n, m):
    return math.factorial(n) // (math.factorial(m) * math.factorial(n - m)) 

def power(x, y):
    """
        ２分累乗法
    """
    if      y == 0      :   return 1
    elif    y == 1      :   return x % const
    elif    y % 2 == 0  :   return power(x, y/2) ** 2 % const
    else                :   return power(x, math.floor(y/2)) ** 2 * x % const

if __name__ == "__main__":
    n, m = read_int_n()
    # mを素因数分解する
    cnts = {}
    for i in range(2, math.ceil(math.sqrt(m)) + 1):
        while m % i == 0:
            if i not in cnts:
                cnts[i] = 1
            else:
                cnts[i] += 1
            m //= i
    ans = 1
    for key, value in cnts.items():
        num = 1
        for i in range(value):
            num *= (n + value - 1 - i)
        num //= math.factorial(value)
        # ans *= comb(value + n - 1, value) % const
        ans *= num % const
        ans = ans % const
    print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf8

import math

const = 10 ** 9 + 7

def read_int_n():
    return list(map(int, input().split()))

def comb(n, m):
    return math.factorial(n) // (math.factorial(m) * math.factorial(n - m)) 

def power(x, y):
    """
        ２分累乗法
    """
    if      y == 0      :   return 1
    elif    y == 1      :   return x % const
    elif    y % 2 == 0  :   return power(x, y/2) ** 2 % const
    else                :   return power(x, math.floor(y/2)) ** 2 * x % const

if __name__ == "__main__":
    n, m = read_int_n()
    # mを素因数分解する
    cnts = {}
    for i in range(2, math.ceil(math.sqrt(m)) + 1):
        while m % i == 0:
            if i not in cnts:
                cnts[i] = 1
            else:
                cnts[i] += 1
            m //= i
    ans = 1
    for key, value in cnts.items():
        ans *= comb(value + n - 1, value) % const
    print(ans % const)

Submission status: Wrong Answer

Solution code:
# coding: utf8

import math

const = 10 ** 9 + 7
factorize = []

def read_int_n():
    return list(map(int, input().split()))

def get_factorize(n):
    if factorize[n] == 0:
        factorize[n] = (get_factorize(n-1) % const * n % const) % const
    return factorize[n]

def comb(n, m):
    return ((math.factorial(n) % const) * (power((math.factorial(m) * math.factorial(n-m)), const-2) % const)) % const

def power(x, y):
    """
        ２分累乗法
    """
    if      y == 0      :   return 1
    elif    y == 1      :   return x % const
    elif    y % 2 == 0  :   return power(x, y/2) ** 2 % const
    else                :   return power(x, math.floor(y/2)) ** 2 * x % const

if __name__ == "__main__":
    n, m = read_int_n()
    factorize = [0] * (n + math.ceil(math.sqrt(m)) + 1)
    factorize[0] = 1
    factorize[1] = 1
    # mを素因数分解する
    cnts = {}
    for i in range(2, math.ceil(math.sqrt(m)) + 1):
        while m % i == 0:
            if i not in cnts:
                cnts[i] = 1
            else:
                cnts[i] += 1
            m /= i
    ans = 1
    for key, value in cnts.items():
        ans *= comb(value + n - 1, value) % const
    print(ans % const)

Submission status: Wrong Answer

Solution code:
from math import *

def Prime_Factorization(M):
    factor_count_list = []

    while True:
        root_M = int(sqrt(M))

        for i in range(2, root_M + 1):
            e = 0
            while M % i == 0:
                e += 1
                M = M // i
            if e > 0:
                factor_count_list.append(e)
                break
            if (M == 1):
                break
        else:
            break
    if M > root_M:
        factor_count_list.append(1)

    print(factor_count_list)
    return factor_count_list

def comb(num_object, num_bar):
    return factorial(num_object) // (factorial(num_object - num_bar) * factorial(num_bar))

def all_comb(N, factor_count_list):
    ans = 1
    for factor in factor_count_list:
        ans = (ans * comb(factor + N - 1, factor)) % (10 ** 9 + 7)
    return ans

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

    print(all_comb(N, factor_count_list))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from math import *

def Prime_Factorization(M):
    factor_count_list = []
    root_M = int(sqrt(M))

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

    if M > root_M:
        factor_count_list.append(1)

    return factor_count_list

def comb(num_object, num_bar):
    return factorial(num_object) // (factorial(num_object - num_bar) * factorial(num_bar))

def all_comb(N, factor_count_list):
    ans = 1
    for factor in factor_count_list:
        ans = (ans * comb(factor + N - 1, factor)) % (10 ** 9 + 7)
    return ans

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

    if factor_count_list:
        print(all_comb(N, factor_count_list))
    else:
        print(N)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from math import *
from collections import *

def Prime_Factorization(M):
    factor_list = []
    root_M = int(sqrt(M))

    for i in range(2, root_M + 1):
        while M % i == 0:
            factor_list.append(i)
            M = M // i
        if (M == 1):
            break
            
    if M > root_M:
        factor_list.append(M)

    return factor_list

def comb(num_object, num_bar):
    return factorial(num_object) // (factorial(num_object - num_bar) * factorial(num_bar))

def all_comb(N, factor_count_list):
    ans = 1
    for factor in factor_count_list:
        ans = (ans * comb(factor_count_list[factor] + N - 1, factor_count_list[factor])) % (10 ** 9 + 7)
    return ans

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

    if factor_list:
        factor_count_list = Counter(factor_list)
        print(all_comb(N, factor_count_list))
    else:
        print(N)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from math import *
from collections import *

def Prime_Factorization(M):
    factor_list = []

    for i in range(2, int(sqrt(M)) + 1):
        while M % i == 0:
            factor_list.append(i)
            M = M // i
        if (M == 1):
            break

    return factor_list

def comb(num_object, num_bar):
    return factorial(num_object) // (factorial(num_object - num_bar) * factorial(num_bar))

def all_comb(N, factor_count_list):
    ans = 1
    for factor in factor_count_list:
        ans = (ans * comb(factor_count_list[factor] + N - 1, factor_count_list[factor])) % (10 ** 9 + 7)
    return ans

def main():
    N, M = map(int, input().split())
    factor_list = Prime_Factorization(M)
    
    if factor_list:
        factor_count_list = Counter(factor_list)
        print(all_comb(N, factor_count_list))
    else:
        print(N)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from math import *
from collections import *

def Prime_Factorization(M):
    factor_list = []

    for i in range(2, int(sqrt(M)) + 1):
        while M % i == 0:
            factor_list.append(i)
            M = M // i
        if (M == 1):
            break

    return factor_list

def comb(num_object, num_bar):
    return factorial(num_object) // (factorial(num_object - num_bar) * factorial(num_bar))

def all_comb(N, factor_count_list):
    ans = 1
    for factor in factor_count_list:
        ans = (ans * comb(factor_count_list[factor] + N - 1, factor_count_list[factor])) % (10 ** 9 + 7)
    return ans

def main():
    N, M = map(int, input().split())
    factor_list = Prime_Factorization(M)
    factor_count_list = Counter(factor_list)
    print(all_comb(N, factor_count_list))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math


def is_prime(num):
    if (num < 2):
        return False
    elif(num == 2):
        return True
    elif (num % 2 == 0):
        return False
    sqrt_num = int(math.sqrt(num))
    for i in range(3, sqrt_num+1):
        if i % 2 == 0:
            continue
        if (num % i == 0):
            return False
    return True


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


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

m = {}
num = 1
sqrt_num = math.ceil(math.sqrt(M))
while(True):
    num += 1
    if num > sqrt_num:
        if is_prime(M):
            m[M] = 1
        break
    if not(is_prime(num)):
        continue

    if M % num == 0:
        m[num] = 0
        _num = M
        while(True):
            if _num % num == 0:
                m[num] += 1
                _num /= num
            else:
                if is_prime(_num):
                    m[int(_num)] = 1
                break

ans = 1
mod = 10**9+7
for v in m.values():
    ans *= combination(v+N-1, v)
    ans %= mod
print(ans)

Submission status: Wrong Answer

Solution code:
import math


def is_prime(num):
    if (num < 2):
        return False
    elif(num == 2):
        return True
    elif (num % 2 == 0):
        return False
    sqrt_num = int(math.sqrt(num))
    for i in range(3, sqrt_num+1):
        if i % 2 == 0:
            continue
        if (num % i == 0):
            return False
    return True


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


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

m = {}
num = 1
sqrt_num = math.ceil(math.sqrt(M))
while(True):
    num += 1
    if num > sqrt_num:
        if is_prime(M):
            m[M] = 1
        break
    if not(is_prime(num)):
        continue

    if M % num == 0:
        m[num] = 0
        _num = M
        while(True):
            if _num % num == 0:
                m[num] += 1
                _num /= num
            else:
                break

ans = 1
mod = 10**9+7
for v in m.values():
    ans *= combination(v+N-1, v)
    ans %= mod
print(ans)