#include using namespace std; #define rep(i, l, r) for (int i = (int)(l); i<(int)(r); i++) #define ll long long void solve() { int A, B; cin >> A >> B; int ans = 0; for (int i = 1; i <= B; i++) if (A%i >= B%i) ans++; cout << ans << endl; } int main() { int T; cin >> T; for (int i = 0; i < T; i++) { solve(); } }