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

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;
#define MOD 1000000007

ll modncr(ll n, ll r){
  auto modbeki = [](ll x, ll nn){
    ll res = 1;
    while(nn > 0){
      if(nn & 1) res = res * x % MOD;
      x = x * x % MOD;
      nn >>= 1;
    }
    return res;
  };

  if(n < r) return 0;
  if(r == 0 || r == n) return 1;
  if(r > n-r) r = n-r;

  ll a = 1, b = 1;
  for(int i = 0; i < r; i++){
    a *= (n - i);
    a %= MOD;
  }
  for(int i = 0; i < r; i++){
    b *= (i + 1);
    b %= MOD;
  }
  ll c = modbeki(b, MOD-2);
  return a * c % MOD;
}

ll nhr(ll n, ll r){
  return modncr(n+r-1, r);
}

int main(){
  ll N, M;
  cin >> N >> M;
  ll ans = 1;
  map<ll, ll> factor;
  for(int i = 2; i*i < M; i++){
    ll counter = 0;
    while(M%i==0){
      M /= i;
      if(!factor.count(i)) factor[i] = 1;
      else factor.at(i)++;
    }
  }
  if(M != 1){
    if(!factor.count(M)) factor[M] = 1;
    else factor.at(M)++;
  }
  for(auto ite = factor.begin(); ite != factor.end(); ite++){
    ll r = ite->second;
    ans *= nhr(N, r);
    ans %= MOD;
  }
  cout << ans << endl;
}