#include using namespace std; using ll = long long; const int N = 1e5 + 10, M = 1e7 + 10, mod = 998244353; int q, prime[N], cnt, id[M], sum; ll inv[M], fact[M], factinv[M]; bool f[N]; ll C(int n, int m) { return fact[n] * factinv[m] % mod * factinv[n - m] % mod; } int main() { ios::sync_with_stdio(0), cin.tie(0); f[1] = 1; for (int i = 2; i < N; i++) { if (!f[i]) prime[++cnt] = i, id[i] = cnt; for (int j = 1; j <= cnt && 1ll * prime[j] * i < N; j++) { f[i * prime[j]] = 1; } } inv[1] = 1; for (int i = 2; i < M; i++) { inv[i] = (mod - mod / i) * inv[mod % i] % mod; } fact[0] = factinv[0] = 1; for (int i = 1; i < M; i++) { fact[i] = fact[i - 1] * i % mod; factinv[i] = factinv[i - 1] * inv[i] % mod; } cin >> q; while (q--) { int x, y; cin >> x >> y; for (int i = 2; i * i <= x; i++) { while (x % i == 0) x /= i, sum++; } if (x > 1) sum++; if (sum < y) cout << 0 << '\n'; else cout << C(sum - 1, y - 1) << '\n'; } return 0; }