#include #include using namespace std; using namespace atcoder; using ll = long long; using mint = modint998244353; vector spf; map prime; void osa_k(ll n){ spf.resize(n+1); for (ll i=0; i<=n; i++) spf[i] = i; for (ll i=2; i*i<=n; i++){ if (spf[i] == i){ for (ll j=2; i*j <= n; j++){ spf[i*j] = min(spf[i*j], i); } } } } void prime_factor(ll n){ prime.clear(); while(n != 1){ prime[spf[n]]++; n /= spf[n]; } } const ll MAX=1000000; vector f, finv; void init(){ f.resize(MAX+1); finv.resize(MAX+1); f[0] = 1; for (int i=1; i<=MAX; i++) f[i] = f[i-1]*i; finv[MAX] = f[MAX].inv(); for (int i=MAX-1; i>=0; i--) finv[i] = finv[i+1] * (i+1); } mint C(ll n, ll k){ if (n < k || k < 0) return 0; return f[n] * finv[k] * finv[n-k] ; } int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); init(); osa_k(1e5); ll Q, A, B, cnt=0; cin >> Q; //全素因数を各要素に1つずつ配る。 while(Q--){ cin >> A >> B; prime_factor(A); for (auto [p, e] : prime) cnt += e; cout << C(cnt-1, B-1).val() << endl; } return 0; }