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:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    _, _, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    s = S()
    t = S()
    ds = defaultdict(int)
    dt = defaultdict(int)
    for i in range(len(s)):
        if ds[s[i]]:
            if ds[s[i]] == ord(t[i]):
                continue
            print("No")
            return
        if dt[t[i]]:
            if dt[t[i]] == ord(s[i]):
                continue
            print("No")
            return
        ds[s[i]] = ord(t[i])
        dt[t[i]] = ord(s[i])
    print("Yes")
    return

#D
def D():
    n, m = LI()
    def power_func(a, b, mod):
        """ a^b mod p を求める """
        """ bを2進数分解して高速累乗 """

        if b == 0: return 1
        if b % 2 == 0:
            d = power_func(a, b // 2, mod)
            return d * d % mod
        if b % 2 == 1:
            return (a * power_func(a, b - 1, mod)) % mod

    def combination_mod(n, k, mod):
        """ power_funcを用いて(nCk) mod p を求める """ 
        """ nCk = n!/((n-k)!k!)を使用 """
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        a = factorial[n] % mod
        b = factorial[k] % mod
        c = factorial[n - k] % mod
        return (a * power_func(b, mod - 2, mod) * power_func(c, mod - 2, mod)) % mod

    factorial = [i for i in range(10 ** 7)]
    factorial[0] = 1
    for i in range(1, 10 ** 7):
        factorial[i] *= factorial[i - 1]
        factorial[i] %= mod
    lis = []
    for i in range(2, 10 ** 6):
        tmp = 0
        while m % i == 0:
            tmp += 1
            m //= i
        if tmp:
            lis.append(tmp)
    ans = 1
    for a in lis:
        a = combination_mod(a + n - 1, a, mod)
        ans *= a
        ans %= mod
    print(ans % mod)

    return

#Solve
if __name__ == '__main__':
    D()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    _, _, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    s = S()
    t = S()
    ds = defaultdict(int)
    dt = defaultdict(int)
    for i in range(len(s)):
        if ds[s[i]]:
            if ds[s[i]] == ord(t[i]):
                continue
            print("No")
            return
        if dt[t[i]]:
            if dt[t[i]] == ord(s[i]):
                continue
            print("No")
            return
        ds[s[i]] = ord(t[i])
        dt[t[i]] = ord(s[i])
    print("Yes")
    return

#D
def D():
    n, m = LI()
    def power_func(a, b, mod):
        """ a^b mod p を求める """
        """ bを2進数分解して高速累乗 """

        if b == 0: return 1
        if b % 2 == 0:
            d = power_func(a, b // 2, mod)
            return d * d % mod
        if b % 2 == 1:
            return (a * power_func(a, b - 1, mod)) % mod

    def combination_mod(n, k, mod):
        """ power_funcを用いて(nCk) mod p を求める """ 
        """ nCk = n!/((n-k)!k!)を使用 """
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        a = factorial[n] % mod
        b = factorial[k] % mod
        c = factorial[n - k] % mod
        return (a * power_func(b, mod - 2, mod) * power_func(c, mod - 2, mod)) % mod

    factorial = [i for i in range(10 ** 6)]
    factorial[0] = 1
    for i in range(1, 10 ** 6):
        factorial[i] *= factorial[i - 1]
        factorial[i] %= mod
    lis = []
    for i in range(2, 10 ** 6):
        tmp = 0
        while m % i == 0:
            tmp += 1
            m //= i
        if tmp:
            lis.append(tmp)
    ans = 1
    for a in lis:
        a = combination_mod(a + n - 1, a, mod)
        ans *= a
        ans %= mod
    print(ans % mod)

    return

#Solve
if __name__ == '__main__':
    D()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    _, _, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    s = S()
    t = S()
    ds = defaultdict(int)
    dt = defaultdict(int)
    for i in range(len(s)):
        if ds[s[i]]:
            if ds[s[i]] == ord(t[i]):
                continue
            print("No")
            return
        if dt[t[i]]:
            if dt[t[i]] == ord(s[i]):
                continue
            print("No")
            return
        ds[s[i]] = ord(t[i])
        dt[t[i]] = ord(s[i])
    print("Yes")
    return

#D
def D():
    n, m = LI()
    def power_func(a, b, mod):
        """ a^b mod p を求める """
        """ bを2進数分解して高速累乗 """

        if b == 0: return 1
        if b % 2 == 0:
            d = power_func(a, b // 2, mod)
            return d * d % mod
        if b % 2 == 1:
            return (a * power_func(a, b - 1, mod)) % mod

    def combination_mod(n, k, mod):
        """ power_funcを用いて(nCk) mod p を求める """ 
        """ nCk = n!/((n-k)!k!)を使用 """
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        a = factorial[n] % mod
        b = factorial[k] % mod
        c = factorial[n - k] % mod
        return (a * power_func(b, mod - 2, mod) * power_func(c, mod - 2, mod)) % mod
    factorial = [i for i in range(10 ** 6)]
    factorial[0] = 1
    for i in range(1, 10 ** 6):
        factorial[i] *= factorial[i - 1]
        factorial[i] %= mod
    lis = []
    for i in range(2, 10 ** 6):
        tmp = 0
        while not (m % i):
            tmp += 1
            m //= i
        if tmp:
            lis.append(tmp)
    ans = 1
    for a in lis:
        a = combination_mod(a+n-1, a, mod)
        ans *= a
        ans %= mod
    print(ans)

    return

#Solve
if __name__ == '__main__':
    D()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    _, _, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    s = S()
    t = S()
    ds = defaultdict(int)
    dt = defaultdict(int)
    for i in range(len(s)):
        if ds[s[i]]:
            if ds[s[i]] == ord(t[i]):
                continue
            print("No")
            return
        if dt[t[i]]:
            if dt[t[i]] == ord(s[i]):
                continue
            print("No")
            return
        ds[s[i]] = ord(t[i])
        dt[t[i]] = ord(s[i])
    print("Yes")
    return

#D
def D():
    n, m = LI()
    def power_func(a, b, mod):
        """ a^b mod p を求める """
        """ bを2進数分解して高速累乗 """

        if b == 0: return 1
        if b % 2 == 0:
            d = power_func(a, b // 2, mod)
            return d * d % mod
        if b % 2 == 1:
            return (a * power_func(a, b - 1, mod)) % mod

    def combination_mod(n, k, mod):
        """ power_funcを用いて(nCk) mod p を求める """ 
        """ nCk = n!/((n-k)!k!)を使用 """
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        a = factorial[n] % mod
        b = factorial[k] % mod
        c = factorial[n - k] % mod
        return (a * power_func(b, mod - 2, mod) * power_func(c, mod - 2, mod)) % mod
    d = defaultdict(int)
    factorial = [i for i in range(10 ** 6)]
    factorial[0] = 1
    for i in range(1, 10 ** 6):
        factorial[i] *= factorial[i - 1]
        factorial[i] %= mod
    for i in range(2,10 ** 6):
        while not (m % i):
            d[i] += 1
            m //= i
    ans = 1
    for a in map(lambda x: combination_mod(x + n - 1, x, mod), d.values()):
        ans *= a
        ans %= mod
    print(ans)

    return

#Solve
if __name__ == '__main__':
    D()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    _, _, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    s = S()
    t = S()
    ds = defaultdict(int)
    dt = defaultdict(int)
    for i in range(len(s)):
        if ds[s[i]]:
            if ds[s[i]] == ord(t[i]):
                continue
            print("No")
            return
        if dt[t[i]]:
            if dt[t[i]] == ord(s[i]):
                continue
            print("No")
            return
        ds[s[i]] = ord(t[i])
        dt[t[i]] = ord(s[i])
    print("Yes")
    return

#D
def D():
    n, m = LI()
    def power_func(a, b, mod):
        """ a^b mod p を求める """
        """ bを2進数分解して高速累乗 """

        if b == 0: return 1
        if b % 2 == 0:
            d = power_func(a, b // 2, mod)
            return d * d % mod
        if b % 2 == 1:
            return (a * power_func(a, b - 1, mod)) % mod

    def combination_mod(n, k, mod):
        """ power_funcを用いて(nCk) mod p を求める """ 
        """ nCk = n!/((n-k)!k!)を使用 """
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        a = factorial[n] % mod
        b = factorial[k] % mod
        c = factorial[n - k] % mod
        return (a * power_func(b, mod - 2, mod) * power_func(c, mod - 2, mod)) % mod
    b = m
    d = defaultdict(int)
    factorial = [i for i in range(10 ** 6)]
    factorial[0] = 1
    for i in range(1, 10 ** 6):
        factorial[i] *= factorial[i - 1]
        factorial[i] %= mod
    while not m & 1:
        d[2] += 1
        m = m >> 1
    for i in range(3, 10 ** 6, 2):
        while not (m % i):
            d[i] += 1
            m //= i
    ans = 1
    for a in map(lambda x: combination_mod(x + n - 1, x, mod), d.values()):
        ans *= a
        ans %= mod
    print(ans)

    return

#Solve
if __name__ == '__main__':
    D()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    _, _, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    s = S()
    t = S()
    ds = defaultdict(int)
    dt = defaultdict(int)
    for i in range(len(s)):
        if ds[s[i]]:
            if ds[s[i]] == ord(t[i]):
                continue
            print("No")
            return
        if dt[t[i]]:
            if dt[t[i]] == ord(s[i]):
                continue
            print("No")
            return
        ds[s[i]] = ord(t[i])
        dt[t[i]] = ord(s[i])
    print("Yes")
    return

#D
def D():
    n, m = LI()
    def power_func(a, b, mod):
        """ a^b mod p を求める """
        """ bを2進数分解して高速累乗 """

        if b == 0: return 1
        if b % 2 == 0:
            d = power_func(a, b // 2, mod)
            return d * d % mod
        if b % 2 == 1:
            return (a * power_func(a, b - 1, mod)) % mod

    def combination_mod(n, k, mod):
        """ power_funcを用いて(nCk) mod p を求める """ 
        """ nCk = n!/((n-k)!k!)を使用 """
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        a = factorial[n] % mod
        b = factorial[k] % mod
        c = factorial[n - k] % mod
        return (a * power_func(b, mod - 2, mod) * power_func(c, mod - 2, mod)) % mod
    b = m
    d = defaultdict(int)
    factorial = [i for i in range(10 ** 6)]
    factorial[0] = 1
    for i in range(1, 10 ** 6):
        factorial[i] *= factorial[i - 1]
        factorial[i] %= mod
    while not m & 1:
        d[2] += 1
        m = m >> 1
    for i in range(3, 10 ** 6):
        while not (m % i):
            d[i] += 1
            m //= i
    ans = 1
    for a in map(lambda x: combination_mod(x + n - 1, x, mod), d.values()):
        ans *= a
        ans %= mod
    print(ans)

    return

#Solve
if __name__ == '__main__':
    D()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    _, _, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    s = S()
    t = S()
    ds = defaultdict(int)
    dt = defaultdict(int)
    for i in range(len(s)):
        if ds[s[i]]:
            if ds[s[i]] == ord(t[i]):
                continue
            print("No")
            return
        if dt[t[i]]:
            if dt[t[i]] == ord(s[i]):
                continue
            print("No")
            return
        ds[s[i]] = ord(t[i])
        dt[t[i]] = ord(s[i])
    print("Yes")
    return

#D
def D():
    n, m = LI()
    def power_func(a, b, mod):
        """ a^b mod p を求める """
        """ bを2進数分解して高速累乗 """

        if b == 0: return 1
        if b % 2 == 0:
            d = power_func(a, b // 2, mod)
            return d * d % mod
        if b % 2 == 1:
            return (a * power_func(a, b - 1, mod)) % mod

    def combination_mod(n, k, mod):
        """ power_funcを用いて(nCk) mod p を求める """ 
        """ nCk = n!/((n-k)!k!)を使用 """
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        a = factorial[n] % mod
        b = factorial[k] % mod
        c = factorial[n - k] % mod
        return (a * power_func(b, mod - 2, mod) * power_func(c, mod - 2, mod)) % mod
    b = m
    d = defaultdict(int)
    factorial = [i for i in range(10 ** 6)]
    factorial[0] = 1
    for i in range(1, 10 ** 6):
        factorial[i] *= factorial[i - 1]
        factorial[i] %= mod
    while not m & 1:
        d[2] += 1
        m = m >> 1
    for i in range(3, int(math.sqrt(b)) + 10, 2):
        while not m % i:
            d[i] += 1
            m //= i
    ans = 1
    for a in map(lambda x: combination_mod(x + n - 1, x, mod), d.values()):
        ans *= a
        ans %= mod
    print(ans)

    return

#Solve
if __name__ == '__main__':
    D()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    _, _, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    s = S()
    t = S()
    ds = defaultdict(int)
    dt = defaultdict(int)
    for i in range(len(s)):
        if ds[s[i]]:
            if ds[s[i]] == ord(t[i]):
                continue
            print("No")
            return
        if dt[t[i]]:
            if dt[t[i]] == ord(s[i]):
                continue
            print("No")
            return
        ds[s[i]] = ord(t[i])
        dt[t[i]] = ord(s[i])
    print("Yes")
    return

#D
def D():
    n, m = LI()
    def power_func(a, b, mod):
        """ a^b mod p を求める """
        """ bを2進数分解して高速累乗 """

        if b == 0: return 1
        if b % 2 == 0:
            d = power_func(a, b // 2, mod)
            return d * d % mod
        if b % 2 == 1:
            return (a * power_func(a, b - 1, mod)) % mod

    def combination_mod(n, k, mod):
        """ power_funcを用いて(nCk) mod p を求める """ 
        """ nCk = n!/((n-k)!k!)を使用 """
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        a = factorial[n] % mod
        b = factorial[k] % mod
        c = factorial[n - k] % mod
        return (a * power_func(b, mod - 2, mod) * power_func(c, mod - 2, mod)) % mod
    b = m
    d = defaultdict(int)
    factorial = [i for i in range(10 ** 6)]
    factorial[0] = 1
    for i in range(1, 10 ** 6):
        factorial[i] *= factorial[i - 1]
        factorial[i] %= mod
    while not m % 2:
        d[2] += 1
        m //= 2
    for i in range(3, int(math.sqrt(b)) + 10, 2):
        while not m % i:
            d[i] += 1
            m //= i
    ans = 1
    for a in map(lambda x: combination_mod(x + n - 1, x, mod), d.values()):
        ans *= a
        ans %= mod
    print(ans)

    return

#Solve
if __name__ == '__main__':
    D()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    _, _, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    s = S()
    t = S()
    ds = defaultdict(int)
    dt = defaultdict(int)
    for i in range(len(s)):
        if ds[s[i]]:
            if ds[s[i]] == ord(t[i]):
                continue
            print("No")
            return
        if dt[t[i]]:
            if dt[t[i]] == ord(s[i]):
                continue
            print("No")
            return
        ds[s[i]] = ord(t[i])
        dt[t[i]] = ord(s[i])
    print("Yes")
    return

#D
def D():
    n, m = LI()
    def power_func(a, b, mod):
        """ a^b mod p を求める """
        """ bを2進数分解して高速累乗 """

        if b == 0: return 1
        if b % 2 == 0:
            d = power_func(a, b // 2, mod)
            return d * d % mod
        if b % 2 == 1:
            return (a * power_func(a, b - 1, mod)) % mod

    def combination_mod(n, k, mod):
        """ power_funcを用いて(nCk) mod p を求める """ 
        """ nCk = n!/((n-k)!k!)を使用 """
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        a = factorial[n] % mod
        b = factorial[k] % mod
        c = factorial[n - k] % mod
        return (a * power_func(b, mod - 2, mod) * power_func(c, mod - 2, mod)) % mod
    b = m
    d = defaultdict(int)
    factorial = [i for i in range(10 ** 6)]
    factorial[0] = 1
    for i in range(1, 10 ** 6):
        factorial[i] *= factorial[i - 1]
        factorial[i] %= mod
    while not m % 2:
        d[2] += 1
        m //= 2
    for i in range(3, int(math.sqrt(b)) + 2, 2):
        while not m % i:
            d[i] += 1
            m //= i
    ans = 1
    for a in map(lambda x: combination_mod(x + n - 1, x, mod), d.values()):
        ans *= a
        ans %= mod
    print(ans)

    return

#Solve
if __name__ == '__main__':
    D()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    _, _, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    s = S()
    t = S()
    ds = defaultdict(int)
    dt = defaultdict(int)
    for i in range(len(s)):
        if ds[s[i]]:
            if ds[s[i]] == ord(t[i]):
                continue
            print("No")
            return
        if dt[t[i]]:
            if dt[t[i]] == ord(s[i]):
                continue
            print("No")
            return
        ds[s[i]] = ord(t[i])
        dt[t[i]] = ord(s[i])
    print("Yes")
    return

#D
def D():
    n, m = LI()
    def power_func(a, b, mod):
        """ a^b mod p を求める """
        """ bを2進数分解して高速累乗 """

        if b == 0: return 1
        if b % 2 == 0:
            d = power_func(a, b // 2, mod)
            return d * d % mod
        if b % 2 == 1:
            return (a * power_func(a, b - 1, mod)) % mod

    def combination_mod(n, k, mod):
        """ power_funcを用いて(nCk) mod p を求める """ 
        """ nCk = n!/((n-k)!k!)を使用 """

        from math import factorial
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        a = factorial(n) % mod
        b = factorial(k) % mod
        c = factorial(n - k) % mod
        return (a * power_func(b, mod - 2, mod) * power_func(c, mod - 2, mod)) % mod
    b = m
    d = defaultdict(int)
    while not m % 2:
        d[2] += 1
        m //= 2
    for i in range(3, int(math.sqrt(b)) + 2, 2):
        while not m % i:
            d[i] += 1
            m //= i
    ans = 1
    for a in map(lambda x: combination_mod(x + n - 1, x, mod), d.values()):
        ans *= a
        ans %= mod
    print(ans)

    return

#Solve
if __name__ == '__main__':
    D()