https://www.acmicpc.net/problem/1011
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
for(int i=0;i<n;i++){
int x=s.nextInt();
int y=s.nextInt();
int k=1;
int count=0;
while(x<y){
x+=k;
count++;
if(x>=y){
break;
}
y-=k;
count++;
k++;
}
System.out.println(count);
}
}
}