#include<bits/stdc++.h> using namespace std; int main(){ int t;cin>>t; while(t--){ int n,k;cin>>n>>k; cout<<(n*(n+1)/2)/k<<endl; } }