// Problem: C. Floor and Mod// Contest: Codeforces - Codeforces Round #701 (Div. 2)// URL: https://codeforces.com/problemset/problem/1485/C// Memory Limit: 256 MB// Time Limit: 2000 ms// // Powered by CP Editor (https://cpeditor.org)#include <bits/stdc++.h>using namespace std;
using ll = long long;
const int N = 1e5 + 7;
int n, m, t;
int x, y;
int main()
{
scanf("%d", &t);
while(t -- ) {
scanf("%d%d", &x, &y);
int a = 1, b = 1;
ll ans = 0;
for(; b * b + b - 1 < x && b <= y; ++ b)
ans += (b * b + b - 1) / (b + 1);
int l = b + 1, r;
for(; l <= x && l <= y + 1; l = r + 1) {
r = min(x / (x / l), y + 1);
ans += x / l * (r - l + 1);
if(r == y + 1) break;
}
cout << ans << endl;
}
return 0;
}