#include using namespace std; const int N = 2e6 + 5, mod = 998244353; int f[N], g[N], inv[N], p[N], a, b, cnt, vis[N], q; vectore; int C(int n, int m){ if(m > n)return 0; return 1ll * f[n] * g[m] % mod * g[n - m] % mod; } int main(){ f[0] = g[0] = inv[1] = 1; for(int i = 1; i <= 2000000; i++){ f[i] = 1ll * f[i - 1] * i % mod; if(i > 1){ inv[i] = 1ll * inv[mod % i] * (mod - mod / i) % mod; } g[i] = 1ll * g[i - 1] * inv[i] % mod; } for(int i = 2; i <= 100000; ++i){ if(!vis[i]){ e.push_back(i); p[i] = i; } for(auto v : e){ if(1ll * v * i > 100000)break; vis[v * i] = 1; p[v * i] = v; if(i % v == 0)break; } } cin >> q; while(q--){ cin >> a >> b; for(; a > 1; a /= p[a], cnt++){ } cout << C(cnt - 1, b - 1) << '\n'; } return 0; }