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: Time Limit Exceeded)

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)*}
    };
}

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)*}
    };
}

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, usize1) => {
        read_value!($next, usize) - 1
    };

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

fn main() {
    input!{
        n: usize,
        m: usize
    }
    let mut x = m;
    let mut ans = 1;
    let d = 1000000007;
    let mut c = 0;
    while x % 2 == 0 {
        c += 1;
        x /= 2;
    }
    ans = ans * h_m(n,c,d) % d;
    let mut ps: Vec<usize> = Vec::new();
    let mut p = 1;
    while x > 1 {
        c = 0;
        next_prime(&mut p, &mut ps);
        while x % p == 0 {
            c += 1;
            x /= p;
        }
        ans = ans * h_m(n,c,d) % d;
    }
    println!("{}",ans);
}

fn next_prime(p: &mut usize, ps: &mut Vec<usize>) {
    let mut is_prime = false;
    'next: while !is_prime {
        *p += 2;
        for x in ps.clone() {
            if *p % x == 0 {
                continue 'next;
            }
        }
        is_prime = true;
    }
    ps.push(*p);
}

fn h_m(n: usize, m: usize, d: usize) -> usize {
    comb_m(n+m-1, m, d)
}

fn stair_m(n: usize, m: usize, d: usize) -> usize {
    (n..m+1).fold(1, |ac,x| ac * x % d)
}

fn comb_m(n: usize, r: usize, d: usize) -> usize {
    stair_m(n+1-r, n, d) * inv_m(stair_m(1, r, d),d) % d
}

fn inv_m(n: usize, d: usize) -> usize {
    pow_m(n,d-2,d)
}

fn pow_m(n: usize, mut p: usize, d: usize) -> usize {
    let mut r = n;
    let mut ret = 1;
    while p > 0 {
        if p % 2 == 0 {
            r = r * r % d;
            p /= 2;
        } else {
            ret = ret * r % d;
            p -= 1;
        }
    }
    ret
}