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:
N,M = map(int, input().split())
mod = 10 ** 9 + 7

def primes_sieve(n):
    sieve = [True] * (n + 1)
    for i in range(2, n + 1):
        if sieve[i]:
            for j in range(i + i, n + 1, i):
                sieve[j] = False
    return [i for i, x in enumerate(sieve[2:], 2) if x]

import math
primes = primes_sieve(int(math.sqrt(10**9)))

ps = []
t = M
for p in primes:
    u = 0
    while True:
        d, m = divmod(t, p)
        if m == 0:
            u += 1
            t = d
        else:
            break
    if u != 0:
        ps.append((p, u))

import itertools, operator, math
class Combination:
    def __init__(self, fact=math.factorial, div=operator.itruediv):
        self.fact = fact
        self.div = div
    def comb(self, n, m):
        if n < m: return 0
        if m == 0 or n == m: return 1
        return self.div(
                self.fact(n),
                self.fact(n - m) * self.fact(m)
            )

class GFp:
    def __init__(self, p):
        self.p = p
    def inv(self, v):
        return pow(v, self.p - 2, self.p)

class CachedFactorial:
    def __init__(self, n, mod):
        self.mod = mod
        self.fact_cache = list(
                itertools.accumulate(
                        itertools.chain(
                                [1],
                                range(1, n+1)
                        ),
                        lambda a,x: (a * x) % mod
                )
        )
    def factorial(self, n):
        return self.fact_cache[n]

class CachedComb(Combination):
    def __init__(self, n, mod):
        self.mod = mod
        self.gfp = GFp(mod)

        self.n = n
        self.fact = CachedFactorial(n, mod)
        super().__init__(
             self.fact.factorial,
             lambda x, y: (x * self.gfp.inv(y)) % self.mod
        )

cc = CachedComb(N + max([x[1] for x in ps] or [0]), mod)
ans = 1
for p, c in ps:
    cmb = cc.comb(N - 1 + c, c)
    ans = ans * cmb % mod
print(ans)

Submission status: Wrong Answer

Solution code:

import math
import collections

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table

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

factors = collections.Counter(prime_decomposition(M))
#print(factors)
num_pattern = 1;
for exponent in factors.values():
    if exponent < N:
        tmp_num_pattern = int(math.factorial(exponent + N -1) \
                            / (math.factorial(N-1)*math.factorial(exponent)))
    else:
        tmp_num_pattern = int(math.factorial(exponent + N -1) \
                            / (math.factorial(exponent)*math.factorial(N-1)))
        
    num_pattern = num_pattern * int(tmp_num_pattern)
print(int(num_pattern%(10**9 +7)))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
i=2
s=[]
while i*i<=m:
  j=0
  while m % (i**(j+1))==0:
    j+=1
  if j:
    m//=i**j
    s+=[j]
  i+=1
a=1
for v in s:
  c = 1
  for i in range(v):
    c = c * (n+i) // (1+i)
  a = a * c % (10**9+7)
print(a)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
x=m
i=2
s=[]
while 1<m :
  j=0
  while m % (i**(j+1))==0:
    j+=1
  if j:
    m//=i**j
    s+=[j]
  i+=1
  if i*i>x:
    break
a=1
for v in s:
  c = 1
  for i in range(v):
    c = c * (n+i) // (1+i)
  a = a * c % (10**9+7)
print(a)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
x=m
i=2
s=[]
while 1<m and i**2<=x:
  j=0
  while m % (i**(j+1))==0:
    j+=1
  if j:
    m//=i**j
    s+=[j]
  i+=1
a=1
for v in s:
  c = 1
  for i in range(v):
    c = c * (n+i) // (1+i)
  a = a * c % (10**9+7)
print(a)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
i=2
s=[]
while i**2<=m:
  j=0
  while m % (i**(j+1))==0:
    j+=1
  if j:
    m//=i**j
    s+=[j]
  i+=1
a=1
for v in s:
  c = 1
  for i in range(v):
    c = c * (n+i) // (1+i)
  a = a * c % (10**9+7)
print(a)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
i=2
s=[]
while i**2>m:
  j=0
  while m % (i**(j+1))==0:
    j+=1
  if j:
    m//=i**j
    s+=[j]
  i+=1
a=1
for v in s:
  c = 1
  for i in range(v):
    c = c * (n+i) // (1+i)
  a = a * c % (10**9+7)
print(a)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
i=2
s=[]
while i**2<m:
  j=0
  while m % (i**(j+1))==0:
    j+=1
  if j:
    m//=i**j
    s+=[j]
  i+=1
a=1
for v in s:
  c = 1
  for i in range(v):
    c = c * (n+i) // (1+i)
  a = a * c % (10**9+7)
print(a)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
import math

mod = 10**9 + 7

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

def factorization(n):
    l = []
    if n == 1:
        return l
    else:
        d = 2
        m = n
        while m >= (d-1) ** 2:
            if n % d == 0:
                count = 0
                while n % d == 0:
                    count += 1
                    n //= d
                l.append(count)
            d += 1
        return l

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

l = factorization(m)

ans = 1

combl = [None for _ in range(31)]
for v in l:
    if combl[v] == None:
        combl[v] = comb(v+n-1, v)
    ans *= combl[v]
    ans %= mod

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

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

# nの逆元のリスト
def inv_mod(n:int, mod:int) -> list:
    inv = [0,1]
    for i in range(2,n+1):
        inv.append(mod - ((mod//i)*inv[mod%i]) % mod)
    return inv
       
# nの階乗のリスト
def fact(n:int, mod:int) -> list:
    fac = [1,1]
    res = 1
    for i in range(2,n+1):
        res = res*i%mod
        fac.append(res)
    return fac

# nの階乗の逆元のリスト
def fact_inv(n:int, inv:list, mod:int) -> list:
    facInv = [1,1]
    for i in range(2,n+1):
        facInv.append(facInv[i-1]*inv[i] % mod)
    return facInv
        
# 二項係数
def nCr(n:int, r:int, mod:int, fac:list, facInv:list) -> int:
    if not (0<=r and r<=n):
        return 0
    
    return ((fac[n]*facInv[r]) % mod) * facInv[n-r] % mod

# 重複組み合わせ
def nHr(n:int, r:int, mod:int, fac:list, facInv:list) -> int:
    if r<0 or n<0:
        return 0
    
    else:
        return nCr(n+r-1,r,mod,fac,facInv)
    
MOD = 10**9+7

n,m = li()

# 二項係数の準備
inv = inv_mod(n+100,MOD)
fac = fact(n+100,MOD)
fac_inv = fact_inv(n+100,inv,MOD)

primes = factorize(n)
ans = 1
for p in primes.values():
    ans = ans * nHr(n,p,MOD,fac,fac_inv) % MOD
    
print(ans)

Submission status: Wrong Answer

Solution code:
import math

N,M = map(int,input().split())
L = []
S = []
k = 0
for i in range(2,int(math.sqrt(M))+2):
  while(M%i == 0):
    k += 1
    M = M//i
  else:
    if (k != 0):
      L.append(k)
      S.append(i)
      i += 1
      k = 0
    else:
      i += 1
ans = 1
for j in range(len(L)):
  ans *= ((math.factorial(L[j]+N-1)//math.factorial(N-1))//math.factorial(L[j]))%((10**9)+7)
print(ans%((10**9)+7))

Submission status: Wrong Answer

Solution code:
import math
from scipy.misc import comb
n,m = map(int,input().split(" "))

m2 = int(math.sqrt(m))
mod = 10**9+7
n_so = {}
for i in range(2,m2+2):
    t = 0
    while m%i == 0:
        m = int(m/i)
        t += 1
    if t > 0:
        n_so[i] = t
        if m == 1:
            break
ans = 1
su = n_so.values() if not n_so == {} else [1]
for i in su:
    ans = ans * comb(n-1+i,n-1,exact = True) % mod
print(ans%mod)

Submission status: Wrong Answer

Solution code:
import math
from scipy.misc import comb
n,m = map(int,input().split(" "))

m2 = int(math.sqrt(m))
mod = 10**9+7

n_so = {}

for i in range(2,m2+2):
    t = 0
    while m%i == 0:
        m = int(m/i)
        t += 1
    if t > 0:
        n_so[i] = t
        if m == 1:
            break

ans = 1
su = n_so.values() if not n_so == {} else [1]

print(n_so)

for i in su:
    ans = ans * comb(n-1+i,n-1,exact = True) % mod

print(ans%mod)

Submission status: Wrong Answer

Solution code:
import math
from scipy.misc import comb
n,m = map(int,input().split(" "))

m2 = int(math.sqrt(m))
mod = 10**9+7

n_so = {}

for i in range(2,m2+2):
    t = 0
    while m%i == 0:
        m = int(m/i)
        t += 1
    if t > 0:
        n_so[i] = t
        if m == 1:
            break

ans = 1
su = n_so.values()

for i in su:
    ans = ans * comb(n-1+i,n-1,exact = True) % mod

print(ans%mod)

Submission status: Wrong Answer

Solution code:

iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法


def fPrimeCounter(iM):
    iS = int(iM ** 0.5) + 1
    aRet = []
    for i in range(2,iS + 1):
        iCounter = 0
        while iM % i == 0:
            iM = iM / i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        if iM == 1 : break
    if iM > 1 : aRet = [1]
    return aRet



#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)

Submission status: Wrong Answer

Solution code:

iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    iS = int(iM ** 0.5) + 1
    aRet = []
    for i in range(2,iS + 1):
        iCounter = 0
        while iM % i == 0:
            iM = iM / i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        if iM == 1 : break
    return aRet



#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法


def fPrimeCounter(iM):
    iS = int(iM ** 0.5) + 1
    aRet = []
    for i in range(2,iS + 1):
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        if iM == 1 : break
    if aRet == [] : aRet =[1]
    return aRet



#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    i = 2
    iS = int(iM ** 0.5) + 1
    aRet = []
    while i <= iS:
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        i += 1

    return aRet

#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    i = 2
    iS = int(iM ** 0.5) + 1
    aRet = []
    while i < iS:
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        i += 1

    return aRet

#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    i = 2
    iS = int(iM ** 0.5) + 1
    aRet = []
    while i < iS:
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        i += 1
        if iM == 1: break

    return aRet

#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    iS = int(iM ** 0.5) + 1
    aRet = []
    for i in range(2,iS + 1):
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter :
            aRet.append(iCounter)
        if iM == 1 : break
    return aRet
#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)

Submission status: Wrong Answer

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

#x以下の素数の列挙   
import math
x=math.floor(math.sqrt(10**9))
L=math.floor(math.sqrt(x))#平方根を求める
Primelist=[i for i in range(x+1)]
Primelist[1]=0#素数でないものは0にする.
for i in Primelist:
    if i>L:
        break
    if i==0:
        continue
    for j in range(2*i,x+1,i):
        Primelist[j]=0
Primes=[Primelist[j] for j in range(x+1) if Primelist[j]!=0]

def fact(M):#約数の列挙
    LIST=[]
    i=0
    while M!=1 and i<len(Primes):
        if M%Primes[i]==0:
            LIST.append(Primes[i])
            M=M//Primes[i]
        else:
            i+=1

    if M!=1:
        LIST.append(M)

    PE=list(itertools.product(range(0,2),repeat=len(LIST)))

    SET={1}

    for pe in PE:
        ANS=1

        for j in range(len(LIST)):
            if pe[j]==1:
                ANS=ANS*LIST[j]
        SET=SET|{ANS}
    return SET

def Combi2(a,b):#aは大きいが、bは小さいとき
    ANS=1
    for i in range(min(b,a-b)):
        ANS=ANS*(a-i)%mod*pow(min(b,a-b)-i,mod-2,mod)%mod

    return ANS%mod



SET=fact(M)
factor=dict()

for j in SET:
    factor[j]=fact(j)

DP=dict()
defaultans=[0 for i in range(40)]
defaultans[1]=1
defaultans=tuple(defaultans)

def dp(m):
    ANS=[0 for i in range(40)]
    if m==1:
        return defaultans
    
    for j in factor[m]:
        #print(j,factor[m])

        if j==1:
            continue
        else:
            if DP.get(m//j,-1)!=-1:
                NEXT=DP[m//j]
            else:
                NEXT=dp(m//j)

            for k in range(39):
                ANS[k+1]=(ANS[k+1]+NEXT[k])%mod

            #print(m//j,ANS,NEXT)

        DP[m]=ANS
    return ANS
            
LIST=dp(M)
ANS=0
for i in range(40):
    if LIST[i]!=0:
        ANS=ANS+Combi2(N,i-1)*LIST[i]%mod

print(ANS%mod)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    iS = int(iM ** 0.5) + 2
    aRet = []
    for i in range(2,iS):
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        if iM == 1 : break
    return aRet

#ABC042Dの流用
#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    iS = int(iM ** 0.5) + 2
    aRet = []
    for i in range(2,iS):
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        if iM < i : break
    return aRet

#ABC042Dの流用
#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    iS = int(iM ** 0.5) + 2
    aRet = []
    for i in range(2,iS):
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        if iM <= i : break
    return aRet

#ABC042Dの流用
#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    iS = int(iM ** 0.5) + 2
    aRet = []
    for i in range(2,iS):
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
    return aRet

#ABC042Dの流用
#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    iS = int(iM ** 0.5) + 1
    aRet = []
    for i in range(2,iS):
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
    return aRet

#ABC042Dの流用
#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    i = 2
    iS = iM ** 0.5 + 1
    aRet = []
    while i < iS or i <= iM  :
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        i += 1
    if aRet == [] : aRet = [1]
    return aRet

#ABC042Dの流用
#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
iMax = max(aP) + iN - 1
aM = [1] * (iMax + 1)
#階乗 iD を法とした
for i in range(1,iMax + 1):
    aM[i] = aM[i-1] * i  % iD
aInvM = [1]* (iMax + 1)
aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
#階乗の逆元 iD を法とした
for i in range(iMax,0,-1):
    aInvM[i-1] = aInvM[i]*i % iD

iRet = 1
for i in aP:
    # i + iN -1  C  iN -1
    iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
iRet %= iD
print(iRet)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    i = 2
    iS = iM ** 0.5 + 1
    aRet = []
    while i < iS or i <= iM  :
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        i += 1
    return aRet

#ABC042Dの流用
#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if  0 < len(aP):
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)
else:
    print(iN % iD)

Submission status: Wrong Answer

Solution code:
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    i = 2
    iS = iM ** 0.5 + 1
    aRet = []
    while i < iS or i <= iM  :
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        i += 1
    return aRet

#ABC042Dの流用
#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if  0 < len(aP):
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)
else:
    print( iN )

Submission status: Wrong Answer

Solution code:
import math


def modinv(a, b, m):
    # a / b (mod m) を求める。
    # 例えば、 9 / 4 (mod 13) = 12となる。
    # まず、 1 / b (mod m) を求める。
    for i in range(m):
        if (i * m + 1) % b == 0:
            tmp = int((i * m + 1) / b)
            break

    # a / b (mod m) は、 1 / b (mod m) に a を掛けて余りを取れば求められる。
    return (tmp * a) % m


def factoring(n):
    pf = {}
    num = n
    while True:
        flag = 0

        for i in range(2, math.floor(math.sqrt(n)) + 1):
            if num % i == 0:
                num = num / i
                flag = 1
                if i in pf:
                    pf[i] += 1
                else:
                    pf[i] = 1

                if num == 1.0:
                    return pf
                else:
                    break

        if flag == 0:
            if num in pf:
                pf[num] += 1
            else:
                pf[num] = 1
            return pf


N, M = map(int, input().split())
# 仕切りの数: N - 1 個
# 素数の約数p1の数: n1 個
# p2の数: n2個
# ... の重複組合せの個数を求める。
MOD = 10 ** 9 + 7

# まず、素因数分解を行う。
pf = factoring(M)

ans = 1
for key in pf:
    for i in range(pf[key]):
        ans = ans * (N - 1 + pf[key] - i) % MOD
    for i in range(2, pf[key] + 1):
        ans = modinv(ans, i, MOD)

print(ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
pw = []
d = 2
while d*d <= m:
  e = 0
  while m % d == 0:
    e += 1
    m //= d
  if e > 0: pw.append(e)
  d += 1
if m > 1: pw.append(1)
print(pw)
ans = 1
for e in pw:
  comb = 1
  for i in range(e):
    comb = comb * (n+i) // (1+i)
  ans = ans * comb % 1000000007
print(ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
pw = []
d = 2
m0 = m
while d*d <= m0:
  e = 0
  while m % d == 0:
    e += 1
    m //= d
  if e > 0: pw.append(e)
  d += 1
ans = 1
for e in pw:
  comb = 1
  for i in range(e):
    comb = comb * (n+i) // (1+i)
  ans = ans * comb % 1000000007
print(ans)