def min_num(a,b):
num = b-a
left = 1
right = 1
l_stack = list()
r_stack = list()
rlt = list()
while num > 0:
num -= left
l_stack.append(left)
left += 1
if num >= right:
num -= right
r_stack.append(right)
right += 1
#print(l_stack, r_stack[::-1])
rlt = l_stack + r_stack[::-1]
# print(rlt)
return len(rlt)
case_num = int(input())
for i in range(case_num):
start, end = [int(x) for x in input().split()]
print(min_num(start,end))
case_num = int(input())
ans = []
for i in range(case_num):
a, b = map(int, input().split())
num = b-a
k = 1
p = 1
while num > 0:
num -= k
k += 1
if num >= p:
num -= p
p += 1
ans.append(k+p-2)
for i in ans:
print(i)
[1 ... 1]
[1 2 ... 2 1]