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)

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n : usize,
        mut m : u64,
    }

    let MOD = 1000000007;

    let primes: Vec<u64> = (0..)
        .scan(Vec::<u64>::new(), |state, _| {
            let np = match state.last() {
                None => Some(2),
                Some(&2) => Some(3),
                Some(&n) => (1..).map(|x| x * 2 + n).find(|&x| {
                    state
                        .iter()
                        .take_while(|&p| p * p <= x)
                        .all(|&p| x % p != 0)
                }),
            };
            state.push(np.unwrap());
            np
        })
        .take_while(|&x| x < (MOD as f64).sqrt() as u64)
        .collect();

    // print!("{:?}", primes);

    let comb = Combinaton::new(101010, MOD);

    let mut ans: usize = 1;
    for p in primes.iter() {
        let mut count: usize = 0;
        while m % p == 0 {
            count += 1;
            m /= *p;
        }
        if count > 0 {
            ans = ans * comb.get(count + n - 1, count) % MOD;
        }
    }

    println!("{}", ans);
}

pub struct Combinaton {
    fact: Vec<usize>,
    modulo: usize,
}

impl Combinaton {
    pub fn new(max: usize, modulo: usize) -> Combinaton {
        let mut fact = vec![0; max + 1];
        fact[0] = 1;
        fact[1] = 1;
        for i in 2..(max + 1) {
            fact[i] = i * fact[i - 1] % modulo;
        }
        Combinaton {
            fact: fact,
            modulo: modulo,
        }
    }

    pub fn mod_inverse(a: usize, m: usize) -> usize {
        let (_, x, _) = Self::extgcd(a as i64, m as i64);
        (((m as i64 + x) as usize % m) % m) as usize
    }

    fn extgcd(a: i64, b: i64) -> (i64, i64, i64) {
        if b == 0 {
            (a, 1, 0)
        } else {
            let (gcd, x, y) = Self::extgcd(b, a % b);
            (gcd, y, x - (a / b) * y)
        }
    }

    pub fn get(&self, x: usize, y: usize) -> usize {
        assert!(x >= y);
        self.fact[x] * Self::mod_inverse(self.fact[y] * self.fact[x - y] % self.modulo, self.modulo)
            % self.modulo
    }
}