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 Rust (1.15.1) (judge verdict: Wrong Answer)

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let v: Vec<u64> = read_vec();
    let big_int = 1000_000_000 + 7;
    let (n, m) = (v[0], v[1]);
    if m == 1 {
        println!("1");
        return;
    }
    let n = n as usize;
    let msize = (m as f64).sqrt() as usize + 10000;

    let mut is_prime = vec![true; msize + 1];
    let mut primes = Vec::new();
    is_prime[0] = false;
    is_prime[1] = false;

    for i in 2..msize + 1 {
        if is_prime[i] {
            primes.push(i);
            let mut j = 2 * i;
            while j < msize {
                is_prime[j] = false;
                j += i;
            }
        }
    }

    let mut dict = std::collections::HashMap::new();
    let mut m = m;
    for &p in primes.iter() {
        while m % p as u64 == 0 {
            *dict.entry(p).or_insert(0) += 1usize;
            m /= p as u64;
        }
        if m == 1 {
            break;
        }
    }

    let mut max_num = dict.values().max().unwrap();

    let mut dp = vec![vec![0u64; max_num + 1]; n + 1];
    dp[0][0] = 1;
    let mut sum = vec![1u64; max_num + 1];

    for i in 0..n {
        for j in 0..max_num + 1 {
            dp[i + 1][j] += sum[j];
            dp[i + 1][j] %= big_int;
            // for k in 0..j + 1 {
            // dp[i + 1][j] += dp[i][k];
            // dp[i + 1][j] %= big_int;
            // }
        }
        sum[0] = dp[i + 1][0];
        for j in 1..max_num + 1 {
            sum[j] = sum[j - 1] + dp[i + 1][j];
            sum[j] %= big_int;
        }
    }
    let mut ans = 1;
    for &val in dict.values() {
        ans *= dp[n][val];
        ans %= big_int;
    }
    println!("{}", ans);
}