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 sys
mod = 1000000007
sys.setrecursionlimit(3000)


#a**p mod pを求める
# def modpow(a,p):
#     if p == 0:
#         return 1
#     if p%2 == 0:
#         halfP = p//2
#         half  = modpow(a,halfP)
#         return half*half %mod
#     else:
#         return a * modpow(a,p-1) % mod

# def calcComb(a,b):
#     if b > a-b:
#         return calcComb(a,b)

#     ansMul,ansDiv = 1,1

#     for i in range(0,b):
#         ansMul *= (a - i)
#         ansDiv *= (i + 1)

#         ansMul %= mod
#         ansDiv %= mod

#     # /ansDiv = ansDiv**(p-2)
#     ans = ansMul * modpow(ansDiv, mod-2)

#     return ans
def calcComb(x, y):
    y = min(y, x - y)
    a = 1
    for i in range(x, x - y, -1):
        a *= i
    b = 1
    for i in range(1, y + 1):
        b *= i
    return a // b

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

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

    if Mnokori % i == 0:
        cnt = 0
        while Mnokori % i == 0:
            cnt += 1
            Mnokori //= i

        ans *= calcComb(N + cnt-1, N-1)
        ans %= mod
    if Mnokori != 1:
        ans *= calcComb(N + 1-1, N-1)
        ans %= mod


print(ans)

Submission status: Wrong Answer

Solution code:
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n,m = map(int,input().split())
mm = int(math.sqrt(m))
s = {}
for i in range(2,mm+2):
    if m%i != 0:
        continue
    while m%i == 0:
        m = m//i
        s[i] = s.get(i, 0) + 1
    if m == 1:
        break
ans = 1
for i in s.values():
    ans = (ans*comb(i+n-1,i))%(10**9+7)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
(n, m)  =map(int, input().split())
sqm = math.sqrt(m)
map = {}
i = 2
y = m
while m != 1 and sqm > i:
    if m % i == 0 :
        m = m / i
        if i in map:
            map[i] += 1
        else:
            map[i] = 1
    else:
        i += 1
sum = 1
for i in map:
    tmpn = n + map[i] - 1
    c = 1
    d = 1
    e = 1
    for j in range(map[i]):
        c = c * (tmpn - j)
        d = d * (map[i] - j)
    e = e * c // d
    
    sum = sum * e % 1000000007
print(sum )

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import unittest
import math

MOD = 10**9+7


def func(n,m):
    fac = [1 for _ in range(n+100)]
    finv = [1 for _ in range(n+100)]
    inv = [1 for _ in range(n+100)]
    for i in range(2,n+100):
        fac[i] = (fac[i-1]*i)%MOD
        inv[i] = (MOD - inv[MOD%i] * (MOD//i))%MOD
        finv[i] = (finv[i-1]*inv[i])%MOD

    def comb(a,b):
        return (fac[a]*((finv[b]*finv[a-b])%MOD))%MOD

    fact = {}
    for x in range(2, math.ceil(math.sqrt(m))+2):
        while m%x==0:
            if x not in fact:
                fact[x] = 0
            fact[x] += 1
            m = m//x
        if m==1:
            break

    ret = 1
    for k in fact.values():
        ret *= comb(k+n-1,k)
        ret %= MOD
    return ret

class Test(unittest.TestCase):
    def test(self):
        self.assertEqual(func(2,6), 4)
        self.assertEqual(func(3,12), 18)
        self.assertEqual(func(100000, 1000000000), 957870001)
        self.assertEqual(func(2,3), 2)

if __name__ == '__main__':
    n,m = map(int, input().split())
    print(func(n,m))
    # unittest.main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import unittest
import math

MOD = 10**9+7


def func(n,m):
    fac = [1 for _ in range(n+100)]
    finv = [1 for _ in range(n+100)]
    inv = [1 for _ in range(n+100)]
    for i in range(2,n+100):
        fac[i] = (fac[i-1]*i)%MOD
        inv[i] = (MOD - inv[MOD%i] * (MOD//i))%MOD
        finv[i] = (finv[i-1]*inv[i])%MOD

    def comb(a,b):
        return (fac[a]*((finv[b]*finv[a-b])%MOD))%MOD

    fact = {}
    for x in range(2, math.ceil(math.sqrt(m))+1):
        while m%x==0:
            if x not in fact:
                fact[x] = 0
            fact[x] += 1
            m = m//x
        if m==1:
            break

    ret = 1
    for k in fact.values():
        ret *= comb(k+n-1,k)
        ret %= MOD
    return ret

class Test(unittest.TestCase):
    def test(self):
        self.assertEqual(func(2,6), 4)
        self.assertEqual(func(3,12), 18)
        self.assertEqual(func(100000, 1000000000), 957870001)

if __name__ == '__main__':
    n,m = map(int, input().split())
    print(func(n,m))
    # unittest.main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import unittest
import math

MOD = 10**9+7

def comb(a,b):
    return (math.factorial(a)//(math.factorial(b)*math.factorial(a-b)))%MOD

def func(n,m):
    fact = {}
    for x in range(2, math.ceil(math.sqrt(m))+1):
        while m%x==0:
            if x not in fact:
                fact[x] = 0
            fact[x] += 1
            m = m//x
        if m==1:
            break

    ret = 1
    for k in fact.values():
        ret *= comb(k+n-1,n-1)
        ret %= MOD
    return ret

class Test(unittest.TestCase):
    def test(self):
        self.assertEqual(func(2,6), 4)
        self.assertEqual(func(3,12), 18)
        self.assertEqual(func(100000, 1000000000), 957870001)

if __name__ == '__main__':
    n,m = map(int, input().split())
    print(func(n,m))
    # unittest.main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import unittest
import math

MOD = 10**9+7

def comb(a,b):
    return (math.factorial(a)//(math.factorial(b)*math.factorial(a-b)))%MOD

def func(n,m):
    fact = {}
    for x in range(2, math.ceil(math.sqrt(m))+1):
        while m%x==0:
            if x not in fact:
                fact[x] = 0
            fact[x] += 1
            m = m//x
        if m==1:
            break

    ret = 1
    for k in fact.values():
        ret *= comb(k+n-1,k)
        ret %= MOD
    return ret

class Test(unittest.TestCase):
    def test(self):
        self.assertEqual(func(2,6), 4)
        self.assertEqual(func(3,12), 18)
        self.assertEqual(func(100000, 1000000000), 957870001)

if __name__ == '__main__':
    n,m = map(int, input().split())
    print(func(n,m))
    # unittest.main()

Submission status: Wrong Answer

Solution code:
import math
import sys
import collections


mod = 1000000007
sys.setrecursionlimit(mod)
fact = {1: 1}


def run(n, m):
    # print('{}を{}個の数列で表現'.format(m, n))
    ans = 1
    primes = []
    for i in range(2, m):
        if i*i > m:
            break
        if m % i == 0:
            cnt = 0
            while m % i == 0:
                cnt += 1
                m //= i
                primes.append(i)
            # ans *= comb(cnt+n-1, n-1)
            # ans %= mod
    counts = collections.Counter(primes)
    # print(counts)
    for (_, v) in counts.items():
        ans *= comb(v+n-1, n-1)
        ans %= mod
    if m != 1:
        ans *= n
    return ans


def comb(n, r):
    mul = math.factorial(n) // math.factorial(n - r)
    div = math.factorial(r)
    # mul = factorial(n) // factorial(n - r)
    # div = factorial(r)
    mul %= mod
    div %= mod
    return (mul * modpow(div, (mod-2))) % mod


'''
def factorial(n):
    if n in fact:
        return fact[n]
    else:
        fact[n] = n*factorial(n-1)
        return fact[n]
'''


def modpow(a, p):
    if p == 0:
        return 1
    if p % 2 == 0:
        halfp = p // 2
        half = modpow(a, halfp)
        return int((half * half) % mod)
    else:
        return int((a * modpow(a, p-1)) % mod)


def main():
    n, m = map(int, input().split())
    print(run(n, m))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
import sys
import collections


mod = 1000000007
sys.setrecursionlimit(mod)
fact = {1: 1}


def run(n, m):
    print('{}を{}個の数列で表現'.format(m, n))
    ans = 1
    primes = []
    for i in range(2, m):
        if m == 1:
            break
        if m % i == 0:
            cnt = 0
            while m % i == 0:
                cnt += 1
                m //= i
                primes.append(i)
            # ans *= comb(cnt+n-1, n-1)
            # ans %= mod
    counts = collections.Counter(primes)
    print(counts)
    for (k, v) in counts.items():
        ans *= comb(v+n-1, n-1)
        ans %= mod
    return ans


def comb(n, r):
    mul = math.factorial(n) // math.factorial(n - r)
    div = math.factorial(r)
    # mul = factorial(n) // factorial(n - r)
    # div = factorial(r)
    mul %= mod
    div %= mod
    return (mul * modpow(div, (mod-2))) % mod


'''
def factorial(n):
    if n in fact:
        return fact[n]
    else:
        fact[n] = n*factorial(n-1)
        return fact[n]
'''


def modpow(a, p):
    if p == 0:
        return 1
    if p % 2 == 0:
        halfp = p // 2
        half = modpow(a, halfp)
        return int((half * half) % mod)
    else:
        return int((a * modpow(a, p-1)) % mod)


def main():
    n, m = map(int, input().split())
    print(run(n, m))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 23 22:00:37 2018
ABC110D
@author: maezawa
"""
import collections

def comb(n, r):
    if n == 0 or r == 0:
        return 1
    return comb(n, r-1)*(n-r+1)//r

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

mod = 10**9+7
np = int(10**4.5 + 10)
is_prime = [True]*(np+1)

is_prime[0] = False
is_prime[1] = False

for i in range(2, np//2):
    if is_prime[i] == True:
        for j in range(2*i,np+1,i):
            is_prime[j] = False

prime_numbers = [i for i in range(np+1) if is_prime[i]]

pds = []
for i in prime_numbers:
    if i > m//2:
        break
    md = m
    while md%i == 0:
        pds.append(i)
        md = md//i
        if md > np:
            pds.append(md)
if pds == []:
    pds.append(m)

#print(pds)
cpds = collections.Counter(pds)
#print(cpds)
ans = 1
for i in cpds.values():
    ans = ans*comb(n+i-1,i)%mod

print(ans)

Submission status: Wrong Answer

Solution code:
import math
import sys


mod = 1000000007
sys.setrecursionlimit(mod)
fact = {1: 1}


def run(n, m):
    print('{}を{}個の数列で表現'.format(m, n))
    ans = 1
    for i in range(2, m):
        if m == 1:
            break
        if m % i == 0:
            cnt = 0
            while m % i == 0:
                cnt += 1
                m //= i
            ans *= comb(cnt+n-1, n-1)
            ans %= mod
            print('{}が{}個'.format(i, cnt))
            print('now ans is', ans)
    return ans


def comb(n, r):
    mul = math.factorial(n) // math.factorial(n - r)
    div = math.factorial(r)
    # mul = factorial(n) // factorial(n - r)
    # div = factorial(r)
    mul %= mod
    div %= mod
    return (mul * modpow(div, (mod-2))) % mod


'''
def factorial(n):
    if n in fact:
        return fact[n]
    else:
        fact[n] = n*factorial(n-1)
        return fact[n]
'''


def modpow(a, p):
    if p == 0:
        return 1
    if p % 2 == 0:
        halfp = p // 2
        half = modpow(a, halfp)
        return int((half * half) % mod)
    else:
        return int((a * modpow(a, p-1)) % mod)


def main():
    n, m = map(int, input().split())
    print(run(n, m))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 23 22:00:37 2018
ABC110D
@author: maezawa
"""
import collections

def comb(n, r):
    if n == 0 or r == 0:
        return 1
    return comb(n, r-1)*(n-r+1)//r

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

mod = 10**9+7
np = int(10**4.5 + 10)
is_prime = [True]*(np+1)

is_prime[0] = False
is_prime[1] = False

for i in range(2, np//2):
    if is_prime[i] == True:
        for j in range(2*i,np+1,i):
            is_prime[j] = False

prime_numbers = [i for i in range(np+1) if is_prime[i]]

pds = []
for i in prime_numbers:
    if i > m:
        break
    md = m
    while md%i == 0:
        pds.append(i)
        md = md//i
        #pds.append(md)
if pds == []:
    pds.append(m)

#print(pds)
cpds = collections.Counter(pds)
#print(cpds)
ans = 1
for i in cpds.values():
    ans = ans*comb(n+i-1,i)%mod

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 23 22:00:37 2018
ABC110D
@author: maezawa
"""
import collections

def comb(n, r):
    if n == 0 or r == 0:
        return 1
    return comb(n, r-1)*(n-r+1)//r

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

mod = 10**9+7
np = int(10**4.5 + 10)
is_prime = [True]*(np+1)

is_prime[0] = False
is_prime[1] = False

for i in range(2, np//2):
    if is_prime[i] == True:
        for j in range(2*i,np+1,i):
            is_prime[j] = False

prime_numbers = [i for i in range(np+1) if is_prime[i]]

pds = []
for i in prime_numbers:
    if i > m:
        break
    if m%i == 0:
        pds.append(i)
        md = m//i
        while md%i == 0:
            #print(md)
            pds.append(i)
            md = md//i
        #pds.append(md)

#print(pds)
cpds = collections.Counter(pds)
#print(cpds)
ans = 1
for i in cpds.values():
    ans = ans*comb(n+i-1,i)%mod

print(ans)

Submission status: Wrong Answer

Solution code:
def comb(a, b):
    if b > a - b:
        return comb(a, a - b)
    # res = 1
    mul = 1
    div = 1
    for i in range(b):
        # res *= (a - i)
        # res /= (i + 1)
        mul *= (a - i)
        div *= (i + 1)
    res = mul / div
    return res


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

MOD = 10 ** 9 + 7

ans = 1
i = 2
left = m + 0
while True:
    if (i * i > m) and (left == 1):
        break
    power = 0
    while left % i == 0:
        left /= i
        power += 1
    if power > 0:
        ans *= comb(n - 1 + power, power)
    i += 1

ans %= MOD

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 23 22:00:37 2018
ABC110D
@author: maezawa
"""
import collections

def comb(n, r):
    if n == 0 or r == 0:
        return 1
    return comb(n, r-1)*(n-r+1)//r

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

mod = 10**9+7
np = int(10**4.5 + 10)
is_prime = [True]*(np+1)

is_prime[0] = False
is_prime[1] = False

for i in range(2, np//2):
    if is_prime[i] == True:
        for j in range(2*i,np+1,i):
            is_prime[j] = False

prime_numbers = [i for i in range(np+1) if is_prime[i]]

pds = []
for i in prime_numbers:
    if i > m:
        break
    if m%i == 0:
        pds.append(i)
        md = m//i
        while md%i == 0:
            #print(md)
            pds.append(i)
            md = md//i
        #pds.append(md)

print(pds)
cpds = collections.Counter(pds)
#print(cpds)
ans = 1
for i in cpds.values():
    ans = ans*comb(n+i-1,i)%mod

print(ans)

Submission status: Wrong Answer

Solution code:
def comb(a, b):
    if b > a - b:
        return comb(a, a - b)
    # res = 1
    mul = 1
    div = 1
    for i in range(b):
        # res *= (a - i)
        # res /= (i + 1)
        mul *= (a - i)
        mul %= MOD

        div *= (i + 1)
        div %= MOD
    res = mul / div
    return res


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

MOD = 10 ** 9 + 7

ans = 1
i = 2
left = m + 0
while True:
    if (i * i > m) and (left == 1):
        break
    power = 0
    while left % i == 0:
        left /= i
        power += 1
    if power > 0:
        ans *= comb(n - 1 + power, power)
    i += 1

ans %= MOD

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 23 22:00:37 2018
ABC110D
@author: maezawa
"""
import collections

def comb(n, r):
    if n == 0 or r == 0:
        return 1
    return comb(n, r-1)*(n-r+1)//r

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

mod = 10**9+7
np = int(10**4.5 + 10)
is_prime = [True]*(np+1)

is_prime[0] = False
is_prime[1] = False

for i in range(2, np//2):
    if is_prime[i] == True:
        for j in range(2*i,np+1,i):
            is_prime[j] = False

prime_numbers = [i for i in range(np+1) if is_prime[i]]

pds = []
for i in prime_numbers:
    if i > m/2:
        break
    if m%i == 0:
        pds.append(i)
        md = m//i
        while md%i == 0:
            pds.append(i)
            md = md//i
        #pds.append(md)

#print(pds)
cpds = collections.Counter(pds)
#print(cpds)
ans = 1
for i in cpds.values():
    ans = ans*comb(n+i-1,i)%mod

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 23 22:00:37 2018
ABC110D
@author: maezawa
"""
import collections

def comb(n, r):
    if n == 0 or r == 0:
        return 1
    return comb(n, r-1)*(n-r+1)//r

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

mod = 10**9+7
np = int(10**4.5 + 10)
is_prime = [True]*(np+1)

is_prime[0] = False
is_prime[1] = False

for i in range(2, np//2):
    if is_prime[i] == True:
        for j in range(2*i,np+1,i):
            is_prime[j] = False

prime_numbers = [i for i in range(np+1) if is_prime[i]]

pds = []
for i in prime_numbers:
    if m%i == 0:
        pds.append(i)
        md = m//i
        while md%i == 0:
            pds.append(i)
            md = md//i
        #pds.append(md)

#print(pds)
cpds = collections.Counter(pds)
#print(cpds)
ans = 1
for i in cpds.values():
    ans = ans*comb(n+i-1,i)%mod

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 23 22:00:37 2018
ABC110D
@author: maezawa
"""
import collections

def comb(n, r):
    if n == 0 or r == 0:
        return 1
    return comb(n, r-1)*(n-r+1)//r

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

mod = 10**9+7
np = int(m**0.5 + 10)
is_prime = [True]*(np+1)

is_prime[0] = False
is_prime[1] = False

for i in range(2, np//2):
    if is_prime[i] == True:
        for j in range(2*i,np+1,i):
            is_prime[j] = False

prime_numbers = [i for i in range(np+1) if is_prime[i]]

pds = []
for i in prime_numbers:
    if m%i == 0:
        pds.append(i)
        md = m//i
        while md%i == 0:
            pds.append(i)
            md = md//i
        #pds.append(md)

#print(pds)
cpds = collections.Counter(pds)
#print(cpds)
ans = 1
for i in cpds.values():
    ans = ans*comb(n+i-1,i)%mod

print(ans)

Submission status: Wrong Answer

Solution code:
print(1)

Submission status: Wrong Answer

Solution code:
import math

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

mod=10**9+7

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

p=1
for i in range(2,int(m**0.5)+2):
    while m%i==0 :
            m=m//i
            yak[i]+=1
            p=0

if p==1:
    yak.append(1)


ka=[1] # 階乗のリスト
for i in range(1,10**5*2):
    ka.append((ka[i-1]*i)%mod)

def inv(x): # mod上のxの逆数を求める関数（フェルマーの小定理）
    res=1
    k=mod-2
    y=x
    while k>0 :
        if k%2 == 1 :
            res = (res*y) % mod
        y = (y*y) % mod
        k //= 2
    return res

def modcomb(n,k): # mod上でのコンビネーションを求める関数(nCk)
    a=ka[n]
    b=ka[n-k]
    c=ka[k]

    bc=(b*c)%mod

    return a*inv(bc)%mod


    


ans=1

for i in range(10**5):
    if yak[i]>0 :
        n=nn+yak[i]-1
        k=yak[i]

        ans=(ans*modcomb(n,k))%mod

print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

mod=10**9+7

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

p=1
for i in range(2,int(m**0.5)+2):

    while m%i==0 :
            m=m//i
            yak[i]+=1
            p=0

if p==1:
    yak[i]=1


ka=[1] # 階乗のリスト
for i in range(1,10**5*2):
    ka.append((ka[i-1]*i)%mod)

def inv(x): # mod上のxの逆数を求める関数（フェルマーの小定理）
    res=1
    k=mod-2
    y=x
    while k>0 :
        if k%2 == 1 :
            res = (res*y) % mod
        y = (y*y) % mod
        k //= 2
    return res

def modcomb(n,k): # mod上でのコンビネーションを求める関数(nCk)
    a=ka[n]
    b=ka[n-k]
    c=ka[k]

    bc=(b*c)%mod

    return a*inv(bc)%mod


    


ans=1

for i in range(10**5):
    if yak[i]>0 :
        n=nn+yak[i]-1
        k=yak[i]

        ans=(ans*modcomb(n,k))%mod

print(ans)

Submission status: Wrong Answer

Solution code:
# aのp乗を求めるアルゴリズム
def modpow(a, p):
    if p == 0:
        return 1
    if p%2 == 0:
        halfp = p/2
        half = modpow(a, p/2)
        return half**2 % mod
    else:
        return a * modpow(a, p-1) % mod

def calc_comb(a, b):
    if b > a-b:
        return calc_comb(a, a-b)
    else:
        ans_mul = 1
        ans_div = 1
        for i in range(0,b):
            ans_mul *= a-i
            ans_div *= i+1
            ans_mul %= mod
            ans_div %= mod
    # ans_mul / ans_div を逆元を使って求める
    ans = ans_mul * modpow(ans_div, mod-2)
    return ans

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

m_nokori = m
ans = 1
i = 2
while i*i < m_nokori:
    if m_nokori%i == 0:
        cnt = 0
        while m_nokori%i == 0:
            cnt += 1
            m_nokori /= i
        ans *= calc_comb(n+cnt-1, n-1)
        ans %= mod
    i += 1
if m_nokori != 1:
    ans *= n
    ans %= mod
print(ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
def factor(n):
    for i in range(2, int(n)):
        if n%i == 0:
            return(i)
            break
    else:
        return(int(n))
M2 = M
dic = {}
flag = True
while flag:
    p = factor(M2)
    dic[p] = dic.get(p, 0) + 1
    M2 = M2/p
    if M2 ==1:
        flag = False

def comb(n, r):
    s = 1
    for i in range(1, r+1):
        s *= (n-r+i)/i
    return(int(s%(10**9+7)))
s = 1
for value in dic.values():
    s *= int(comb(value+N-1, value)%(10**9+7))
print(int(s%(1e9+7)))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
def factor(n):
    for i in range(2, int(n)):
        if n%i == 0:
            return(i)
            break
    else:
        return(int(n))
M2 = M
dic = {}
flag = True
while flag:
    p = factor(M2)
    dic[p] = dic.get(p, 0) + 1
    M2 = M2/p
    if M2 ==1:
        flag = False

def comb(n, r):
    s = 1
    for i in range(1, r+1):
        s *= (n-r+i)/i
    return(int(s%(10**9+7)))
s = 1
print(dic)
for value in dic.values():
    s *= int(comb(value+N-1, value)%(10**9+7))
print(s%(1e9+7))

Submission status: Wrong Answer

Solution code:
import math
import sys


mod = 1000000007
sys.setrecursionlimit(mod)
fact = {1: 1}


def run(n, m):
    ans = 1
    for i in range(2, int(math.sqrt(m))+2):
        if m % i == 0:
            cnt = 0
            while m % i == 0:
                cnt += 1
                m /= i
                m = int(m)
            ans *= comb(cnt+n-1, n-1)
            ans %= mod
            ans = int(ans)
    return ans


def comb(n, r):
    mul = math.factorial(n) // math.factorial(n - r)
    div = math.factorial(r)
    # mul = factorial(n) // factorial(n - r)
    # div = factorial(r)
    mul %= mod
    div %= mod
    mul = int(mul)
    div = int(div)
    return (mul * modpow(div, (mod-2))) % mod


'''
def factorial(n):
    if n in fact:
        return fact[n]
    else:
        fact[n] = n*factorial(n-1)
        return fact[n]
'''


def modpow(a, p):
    if p == 0:
        return 1
    if p % 2 == 0:
        halfp = p // 2
        half = modpow(a, halfp)
        return int((half * half) % mod)
    else:
        return int((a * modpow(a, p-1)) % mod)


def main():
    n, m = map(int, input().split())
    print(run(n, m))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math


mod = 1000000007


def run(n, m):
    ans = 1
    for i in range(2, int(math.sqrt(m))+2):
        if m % i == 0:
            cnt = 0
            while m % i == 0:
                cnt += 1
                m /= i
                m = int(m)
            ans *= comb(cnt+n-1, n-1)
            ans %= mod
            ans = int(ans)
    return ans


def comb(n, r):
    mul = math.factorial(n) // math.factorial(n - r)
    div = math.factorial(r)
    mul %= mod
    div %= mod
    mul = int(mul)
    div = int(div)
    return (mul * modpow(div, (mod-2))) % mod


def modpow(a, p):
    if p == 0:
        return 1
    if p % 2 == 0:
        halfp = p // 2
        half = modpow(a, halfp)
        return int((half * half) % mod)
    else:
        return int((a * modpow(a, p-1)) % mod)


def main():
    n, m = map(int, input().split())
    print(run(n, m))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math


mod = 1000000007


def run(n, m):
    ans = 1
    for i in range(2, int(math.sqrt(m))+2):
        if m % i == 0:
            cnt = 0
            while m % i == 0:
                cnt += 1
                m /= i
            ans *= comb(cnt+n-1, n-1)
            ans %= mod
            ans = int(ans)
    return ans


def comb(n, r):
    mul = math.factorial(n) // math.factorial(n - r)
    div = math.factorial(r)
    mul %= mod
    div %= mod
    return (mul * modpow(div, (mod-2))) % mod


def modpow(a, p):
    if p == 0:
        return 1
    if p % 2 == 0:
        halfp = p / 2
        half = modpow(a, halfp)
        return (half * half) % mod
    else:
        return (a * modpow(a, p-1)) % mod


def main():
    n, m = map(int, input().split())
    print(run(n, m))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import collections
def com(x,y):
    if y>x-y:
        y=x-y
    a=1
    for i in range(x,x-y,-1):
        a*=i
    b=1
    for i in range(1,y+1):
        b*=i
    return a//b
n,m=map(int,input().split())
y=[]
z=m
t=1
while(t<=m):
    t+=1
    while(z%t==0):
        y.append(t)
        z//=t
    if t<m and t**2>m:
        t=m-1
c=collections.Counter(y).values()
ans=1
mod=10**9+7
for t in c:
    ans*=com(t+n-1,t)
    ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
def com(x,y):
    if y>x-y:
        y=x-y
    a=1
    for i in range(x,x-y,-1):
        a*=i
    b=1
    for i in range(1,y+1):
        b*=i
    return a//b
n,m=map(int,input().split())
y=[]
z=m
t=1
while(t<=m):
    t+=1
    while(z%t==0):
        y.append(t)
        z//=t
    if t<m and t**2>m:
        t=m
c=collections.Counter(y).values()
ans=1
mod=10**9+7
for t in c:
    ans*=com(t+n-1,t)
    ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
def com(x,y):
    t=1
    for i in range(y):
        t*=x-i
    for i in range(y):
        t//=i+1
    return t
n,m=map(int,input().split())
y=[]
z=m
t=1
while(t<=m):
    t+=1
    while(z%t==0):
        y.append(t)
        z//=t
    if t<m and t**2>m:
        t=m
c=collections.Counter(y).values()
ans=1
mod=10**9+7
for t in c:
    ans*=com(t+n-1,t)
    ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
def com(x,y):
    t=1
    for i in range(y):
        t*=x-i
    for i in range(y):
        t//=i+1
    return t
n,m=map(int,input().split())
y=[]
z=m
t=2
while(t<=m):
    while(z%t==0):
        y.append(t)
        z//=t
    t+=1
    if t<m and t**2>m:
        t=m
c=collections.Counter(y).values()
ans=1
mod=10**9+7
for t in c:
    ans*=com(t+n-1,t)
    ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
def kaijo(x):
    a=1
    for i in range(1,x+1):
        a*=i
    return a
def perm(x,y):
    ans=1
    for i in range(x,x-y,-1):
        ans*=i
    return ans
def com(x,y):
    return perm(x,min(y,x-y))//kaijo(min(y,x-y))

nn,m=map(int,input().split())
y=[]
z=m
t=2
while(t<=m):
    while(z%t==0):
        y.append(t)
        z//=t
    t+=1
    if t<m and t**2>m:
        t=m
c=collections.Counter(y).values()
ans=1
mod=10**9+7
for t in c:
    ans*=com(t+nn-1,t)
    ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
def kaijo(x):
    a=1
    for i in range(1,x+1):
        a*=i
    return a
def perm(x,y):
    ans=1
    for i in range(x,x-y,-1):
        ans*=i
    return ans
def com(x,y):
    return perm(x,min(y,x-y))//kaijo(min(y,x-y))

nn,m=map(int,input().split())
y=[]
z=m
t=2
while(t**2<m):
    while(z%t==0):
        y.append(t)
        z//=t
    t+=1
if len(y)==0 and m>1:
    y.append(m)
c=collections.Counter(y).values()
ans=1
mod=10**9+7
for t in c:
    ans*=com(t+nn-1,t)
    ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
def kaijo(x):
    a=1
    for i in range(1,x+1):
        a*=i
    return a
def perm(x,y):
    ans=1
    for i in range(x,x-y,-1):
        ans*=i
    return ans
def com(x,y):
    ans=1
    for i in range(x,x-y,-1):
        ans*=i
    for i in range(1,y+1,1):
        ans//=i
    return ans

nn,m=map(int,input().split())
y=[]
z=m
t=1
while(t**2<=m):
    t+=1
    while(z%t==0):
        y.append(t)
        z//=t
if len(y)==0 and m>1:
    y.append(m)
c=collections.Counter(y).values()
ans=1
mod=10**9+7
for t in c:
    ans*=com(t+nn-1,t)
    ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
def kaijo(x):
    a=1
    for i in range(1,x+1):
        a*=i
    return a
def perm(x,y):
    ans=1
    for i in range(x,x-y,-1):
        ans*=i
    return ans
def com(x,y):
    return perm(x,min(y,x-y))//kaijo(min(y,x-y))

nn,m=map(int,input().split())
y=[]
z=m
t=1
while(t**2<=m):
    t+=1
    while(z%t==0):
        y.append(t)
        z//=t
if len(y)==0 and m>1:
    y.append(m)
c=collections.Counter(y).values()
ans=1
mod=10**9+7
for t in c:
    ans*=com(t+nn-1,t)
    ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
def kaijo(x):
    a=1
    for i in range(1,x+1):
        a*=i
    return a
def perm(x,y):
    ans=1
    for i in range(x,x-y,-1):
        ans*=i
    return ans
def com(x,y):
    return perm(x,min(y,x-y))//kaijo(min(y,x-y))

nn,m=map(int,input().split())
x=primes(int(m**0.5+1))
y=[]
z=m
for t in x:
    while(z%t==0):
        y.append(t)
        z//=t
if len(y)==0 and m>1:
    y.append(m)
c=collections.Counter(y).values()
ans=1
mod=10**9+7
for t in c:
    ans*=com(t+nn-1,t)
    ans%=mod
print(ans)