//Δ_1003 #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long LL; typedef double DB; LL c(int x){ if(x<0) return 0; return (LL)x*(x-1)/2; } int main() { int T,n,m; scanf("%d",&T); while(T--){ scanf("%d%d",&n,&m); cout<