#include using namespace std; using ll = long long; #define ALL(v) v.begin(),v.end() #define dbg(x) cerr << #x << ": " << (x) << endl; ll mod = 998244353; struct Comb { int n; ll mod; vector fac, finv, inv; Comb(int n, ll mod) : n(n), mod(mod), fac(n+1), finv(n+1), inv(n+1) { fac[0] = fac[1] = inv[1] = finv[0] = finv[1] = 1; for (int i = 2; i <= n; ++i) { fac[i] = (fac[i-1] * i) % mod; inv[i] = mod - inv[mod%i] * (mod/i) % mod; finv[i] = finv[i-1] * inv[i] % mod; } } ll c(int n, int k) { if (n < k || k < 0) return 0; return fac[n] * finv[k] % mod * finv[n-k] % mod; } } cb(17e5, mod); int q; int main() { cin >> q; int cnt = 0; while (q--) { int a,b; cin >> a >> b; for (int i = 2; i*i <= a; ++i) { while (a % i == 0) { ++cnt; a /= i; } } if (a > 1) ++cnt; cout << cb.c(cnt-1, b-1) << '\n'; } }