<p>You are given a 2D integer array, <code>queries</code>. For each <code>queries[i]</code>, where <code>queries[i] = [n<sub>i</sub>, k<sub>i</sub>]</code>, find the number of different ways you can place positive integers into an array of size <code>n<sub>i</sub></code> such that the product of the integers is <code>k<sub>i</sub></code>. As the number of ways may be too large, the answer to the <code>i<sup>th</sup></code> query is the number of ways <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>

<p>Return <em>an integer array </em><code>answer</code><em> where </em><code>answer.length == queries.length</code><em>, and </em><code>answer[i]</code><em> is the answer to the </em><code>i<sup>th</sup></code><em> query.</em></p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> queries = [[2,6],[5,1],[73,660]]
<strong>Output:</strong> [4,1,50734910]
<strong>Explanation:</strong>&nbsp;Each query is independent.
[2,6]: There are 4 ways to fill an array of size 2 that multiply to 6: [1,6], [2,3], [3,2], [6,1].
[5,1]: There is 1 way to fill an array of size 5 that multiply to 1: [1,1,1,1,1].
[73,660]: There are 1050734917 ways to fill an array of size 73 that multiply to 660. 1050734917 modulo 10<sup>9</sup> + 7 = 50734910.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> queries = [[1,1],[2,2],[3,3],[4,4],[5,5]]
<strong>Output:</strong> [1,2,3,10,5]
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= queries.length &lt;= 10<sup>4</sup> </code></li>
	<li><code>1 &lt;= n<sub>i</sub>, k<sub>i</sub> &lt;= 10<sup>4</sup></code></li>
</ul>

#define ll long long

const ll mod = 1e9+7;
const ll N = 1e5+1;
vector<ll> fact(N+1), inv(N+1);
 
ll binaryexpo(ll a, ll b){
    ll ans = 1ll;
    ll temp = b;
    while(temp){
        if(temp&1ll){
            temp--;
            ans = (ans*(ll)a)%mod;
        }
        else{
            temp /= 2ll;
            a = (a*a)%mod;
        }
    }
    return ans;
}
 
void findinverse(){
    for(int i=0; i<=N; i++){
        inv[i] = binaryexpo(fact[i], mod-2ll);
    }
}
 
void findfact(){
    fact[0] = 1ll;
    for(int i=1; i<=N; i++){
        fact[i] = (fact[i-1]*(ll)i)%mod;
    }
}
 
ll nCr(ll n, ll r){
    if(r > n || n < 0 || r < 0) return 0;
    ll temp = (inv[n-r] * inv[r])%mod;
    return (temp*fact[n])%mod;
}
vector<int> spf(N+1, 0);

class Solution {
    void sieve(){
        for(int i=1; i<N; i++){
            spf[i] = i;
        }
        for(int i=2; i*i<N; i++){
            if(spf[i] == i){
                for(int j=i+i; j<N; j+=i){
                    if(spf[j] == j) spf[j] = i;
                }
            }
        }
    }
public:
    vector<int> waysToFillArray(vector<vector<int>>& queries) {
        vector<int> v;
        
        sieve();
        findfact();
    findinverse();
        for(auto it: queries){
            ll n = it[1];
            if(n== 1){
                v.push_back(1);
                continue;
            }
            ll k = it[0];
            ll ans = 1;
            while(n){
                ll temp = spf[n];
                if(temp == 1) break;
                ll cnt = 0;
                while(n % temp == 0){
                    n = n/temp;
                    cnt++;
                }
                if(cnt != 0){
                    ans = (ans * nCr(k+cnt-1, cnt))%mod;
                }
            }

            v.push_back((int)ans);
        }
        return v;
    }
};
36100