#include using namespace std; const int MAXN = 1e5 + 5, MAXV = 7e5 + 3, Mod = 998244353; int T, c, fac[MAXV] = {1, 1}, inv[MAXV] = {0, 1}, facinv[MAXV] = {1, 1}; int C(int n, int m) { if (n < m) return 0; return 1ll * fac[n] * facinv[m] % Mod * facinv[n - m] % Mod; } int main() { ios::sync_with_stdio(0), cin.tie(0); for (int i = 2; i < MAXV; i++) { fac[i] = 1ll * fac[i - 1] * i % Mod; inv[i] = 1ll * (Mod - Mod / i) * inv[Mod % i] % Mod; facinv[i] = 1ll * facinv[i - 1] * inv[i] % Mod; } cin >> T; for (int x, n; T--; ) { cin >> x >> n; for (int i = 2, t = x; i * i <= t; i++) { for (; x % i == 0; x /= i) { c++; } } c += (x > 1); cout << C(c - 1, n - 1) << '\n'; } return 0; }