#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<queue>
#include<map>
#define l(x) (x<<1)
#define r(x) ((x<<1)|1)
#define IL inline
#define reg register
#define LL long long
#define INF 0x3f3f3f3f
using namespace std;

LL T,l,r,x,y,z,cnt,Ans;

IL int Abs(int x){return (x<0)?-x:x;}
IL void Swap(int &a,int &b){a^=b^=a^=b;}
IL int Min(int a,int b){return (a<b)?a:b;}
IL int Max(int a,int b){return (a>b)?a:b;}

IL LL read(){
	LL p=0,f=1;	char	c=getchar();
	while (c<48||c>57)	{if (c=='-')	f=-1;	c=getchar();}
	while (c>=48&&c<=57)	p=(p<<1)+(p<<3)+c-48,c=getchar();
	return p*f;
}

int main(){
	#ifdef __Marvolo
	freopen("zht.in","r",stdin);
	freopen("zht.out","w",stdout);
	#endif
	T=read();
	while (T--){
		l=read();	r=read();
		if ((l<<1) > r)	{
			puts("0");
			continue;
		}
		x=r-(l<<1)+1;
		Ans=x*(x+1)>>1;
		printf("%lld\n",Ans);
	}
	return 0;
}
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
const long long MAXVAL = (long long) 1e18 + 1;
//const long long MOD = 1000000007ll;
//const long long MOD = 998244353ll;
const int INF = 1000000001;
 
ll poww(ll x, ll pow, ll mod) {
  if (pow == 0ll ) return 1ll;
  if (pow == 1ll) return x % mod;
  ll ans = poww(x, pow >> 1, mod);
  ans = (ans * ans) % mod;
  if ((pow & 1) == 1) {
    ans = (ans * x) % mod;
  }
  return ans % mod;
}
 
ll gcd(ll x, ll y) {
  if (x == 0) return y;
  while (y) {
    x %= y;
    swap(x, y);
  }
  return x;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int q = 1;
  //cin >> q;
  while (q-- >0) {
    int x, y;
    cin >> x >> y;
    if (x < y) swap(x, y);
    if (y + 3 > x) {
      cout << "Yes\n";
    } else cout << "No\n";
  }
 
  return 0;
}
