/* * Author: nskybytskyi * Time: 2022-01-07 14:20:00 */ #include using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); int t; cin >> t; while (t--) { int n, m; cin >> n >> m; if (m <= n) { cout << m / 2 << "\n"; } else { cout << ((m - n) * 1ll * (m - n + 5)) / 2 + m + 1 << "\n"; } } return 0; }