#include<stdio.h>
int main()
{
int n,a,b;
scanf("%d",&n);
while(n--)
{
scanf("%d%d",&a,&b);
int s;
s=b-a;
int sum=0;
int i=1;
while(s>=(i*2))
{
s=s-i*2;
i++;
sum=sum+2;
}
if(s>=i)
{
s=s-i;
sum++;
}
if(s)
sum=sum+1;
printf("%d\n",sum);
}
return 0;
}
int main()
{
int n,a,b;
scanf("%d",&n);
while(n--)
{
scanf("%d%d",&a,&b);
int s;
s=b-a;
int sum=0;
int i=1;
while(s>=(i*2))
{
s=s-i*2;
i++;
sum=sum+2;
}
if(s>=i)
{
s=s-i;
sum++;
}
if(s)
sum=sum+1;
printf("%d\n",sum);
}
return 0;
}