#include #include using namespace std; using mint = atcoder::modint998244353; int main(){ ios::sync_with_stdio(false); cin.tie(0); constexpr int r = 100'000, r2 = 1600'000; int idx = 0, tot = 0; vector tb(r + 1, 1), cnt(r + 1); for(int i = 2; i <= r; i++){ if (tb[i] == i) continue; const int coef = i / tb[i]; for(int j = i; j <= r; j += i){ tb[j] *= coef; cnt[j]++; } } vector fact(r2 + 1), inv(r2 + 1); fact[0] = 1; for(int i = 1; i <= r2; i++) fact[i] = i * fact[i - 1]; inv[r2] = 1 / fact[r2]; for(int i = r2; i >= 1; i--) inv[i - 1] = i * inv[i]; int q; cin >> q; while(q--){ int a, b; cin >> a >> b; tot += cnt[a]; cout << (tot >= b ? (fact[tot - 1] * inv[tot - b] * inv[b - 1]).val() : 0) << '\n'; } }