#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } #include using mint = atcoder::modint998244353; const int M = 5e6; mint fact[M], inv[M]; void init() { fact[0] = 1; for (int i = 1; i < M; i++) { fact[i] = fact[i - 1] * i; } inv[M - 1] = fact[M - 1].inv(); for (int i = M - 2; i >= 0; i--) { inv[i] = inv[i + 1] * (i + 1); } } mint binom(int n, int k) { if (k < 0 || n < 0 || n < k) { return 0; } return fact[n] * inv[k] * inv[n - k]; } int main() { fast_io(); init(); int q; cin >> q; int cnt = 0; for (; q--;) { int a, b; cin >> a >> b; for (int i = 2; i * i <= a; i++) { if (a % i == 0) { int c = 0; while (a % i == 0) { a /= i; c++; } cnt += c; } } if (a > 1) { cnt++; } cout << binom(cnt - 1, b - 1).val() << "\n"; } }