https://www.acmicpc.net/problem/1011
n=int(input())
for i in range(n):
x,y=map(int,input().split())
k=1
count=0
while x<y:
x+=k
count+=1
if x>=y: break
y-=k
count+=1
k+=1
print(count)