Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well.

You are given a range of integers $\{L, L+1, \ldots, R\}$. An integer $X$ is said to be *reachable* if it can be represented as a sum of two not necessarily distinct integers in this range. Find the number of distinct reachable integers.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains two space-separated integers $L$ and $R$.

------  Output ------
For each test case, print a single line containing one integer — the number of reachable integers.

------  Constraints ------
$1 ≤ T ≤ 10^{5}$
$1 ≤ L ≤ R ≤ 10^{6}$

----- Sample Input 1 ------ 
2

2 2

2 3
----- Sample Output 1 ------ 
1

3
----- explanation 1 ------ 
Example case 1: The only reachable integer is $2 + 2 = 4$.

Example case 2: $4$, $5$ and $6$ are reachable, since $2+2=4$, $2+3=5$ and $3+3=6$.

Source: codechef | Difficulty: MEDIUM
Tags: Mathematics


Solutions:
T = int(input())
for i in range(T):
	user_input = input().split()
	L = int(user_input[0])
	R = int(user_input[1])
	L = 2 * L
	R = 2 * R
	print(R - L + 1)


testcases = int(input())
while testcases:
	[L, R] = list(map(int, input().split(' ')))
	print(2 * R - 2 * L + 1)
	testcases -= 1


t = int(input())
for t in range(t):
	(n, m) = map(int, input().split())
	print(1 if abs(2 * n - 2 * m) == 0 else abs(2 * n - 2 * m) + 1)


from sys import stdin, stdout
input = stdin.readline
r_int = lambda : int(input())
m_int = lambda : map(int, input().split())
l_int = lambda : list(map(int, input()).split())

def solve():
	(l, r) = m_int()
	print(2 * (r - l) + 1)

def main():
	n_cases = r_int()
	for _ in range(n_cases):
		solve()
main()


t = int(input())
for _ in range(t):
	(l, r) = map(int, input().split())
	n = r - l + 1
	print(2 * n - 1)


t = int(input())
while t > 0:
	(a, b) = list(map(int, input().split()))
	d = b - a + 1
	print(2 * d - 1)
	t -= 1


import math
t = int(input())
for _ in range(t):
	(l, r) = map(int, input().split())
	totalDigits = r - l + 1
	if totalDigits > 1:
		Combinations = totalDigits * totalDigits - (totalDigits - 1) * (totalDigits - 1)
	else:
		Combinations = 1
	print(Combinations)


t = int(input())
for _ in range(0, t):
	(l, r) = map(int, input().split())
	n = r - l + 1
	if n == 0:
		print(1)
	else:
		print(2 * n - 1)


import math
T = int(input())
for var in range(0, T):
	temp = input().split(' ')
	L = int(temp[0])
	R = int(temp[1])
	length = R - L
	result = 2 * length + 1
	print(result)


T = int(input())
for i in range(T):
	(l, r) = map(int, input().split())
	print(2 * r - 2 * l + 1)


t = int(input())
for t in range(t):
	lr = list(map(int, input().split(' ')))
	l = lr[0]
	r = lr[1]
	print(2 * (r - l) + 1)


for i in range(int(input())):
	l = list(map(int, input().split()))
	a = 2 * l[0]
	b = 2 * l[1]
	print(b - a + 1)


for _ in range(int(input())):
	(l, r) = map(int, input().split())
	s = r - l + 1
	if s == 0:
		print(1)
	else:
		print(2 * s - 1)


for _ in range(int(input())):
	(L, R) = map(int, input().split())
	print(R - L + (R - L + 1))


for j in range(int(input())):
	l = list(map(int, input().split()))
	n = len(l)
	print(2 * l[n - 1] - 2 * l[0] + 1)


test = int(input())
for i in range(test):
	(l, r) = list(map(int, input().split()))
	k = r - l + 1
	count = 0
	if l == r:
		count = 1
	else:
		count = 2 * k - 1
	print(count)


t = int(input())
while t:
	li = []
	(a, b) = map(int, input().split())
	if a == b:
		print(1)
	else:
		print(2 * b - 2 * a + 1)
	t -= 1


for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(b * 2 - a * 2 + 1)


for i in range(int(input())):
	(l, r) = map(int, input().split())
	c = r - l + 1
	print(c + c - 1)


for _ in range(int(input())):
	(l, r) = map(int, input().split())
	d = r - l
	x = d + 1 + d
	print(x)


for _ in range(int(input())):
	(l, r) = map(int, input().split())
	first_number = r - l + 1
	print(first_number + (r - l))


n = int(input())
for i in range(n):
	a = list(map(int, input().split()))
	print(2 * a[1] - 2 * a[0] + 1)


t = int(input())
for _ in range(t):
	x = list(map(int, input().split()))
	print(2 * x[1] - 2 * x[0] + 1)


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	n = n + n
	s = s + s
	if n != s:
		print(s - n + 1)
	else:
		print(1)


tests = int(input())
for i in range(tests):
	(l, r) = map(int, input().split())
	numbers = r - l
	print(2 * numbers + 1)


T = int(input())
for i in range(T):
	(L, R) = map(int, input().split())
	print(2 * R - 2 * L + 1)


t = int(input())
for _ in range(t):
	(L, R) = [int(i) for i in input().split()]
	d = R - L + 1
	print(2 * d - 1)


for _ in range(int(input())):
	count = 0
	(a, b) = map(int, input().split())
	print((b - a) * 2 + 1)


for t in range(int(input())):
	(l, r) = (int(x) for x in input().split())
	j = r - l
	j = j + 1 + int((j + 1) / 2) + int(j / 2)
	print(j)


def nSum(n):
	return n * (n + 1) / 2
t = int(input())
while t > 0:
	inputs = list(map(int, input().split(' ')))
	print(int(2 * inputs[1] - 2 * inputs[0] + 1))
	t -= 1


t = int(input())
for i in range(t):
	l = list(map(int, input().split(' ')))
	c = l[1] - l[0] + 1
	u = c * 2 - 1
	print(u)


def main():
	for _ in range(int(input())):
		(l, r) = map(int, input().split())
		print(2 * r - 2 * l + 1)
main()


import collections as clts
import math
import heapq
MOD = 10 ** 9 + 7

def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)

def lcm(x, y):
	return int(x / gcd(x, y) * y)

def take_input(type='list-int'):
	if type == 'list-int':
		return list(map(int, input().split()))
	elif type == 'list-float':
		return list(map(float, input().split()))
	else:
		return None
for _ in range(int(input())):
	(L, R) = take_input()
	diff = R - L
	print(2 * diff + 1)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	n = m - n + 1
	print(2 * n - 1)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	sum = m - n + 1
	print(2 * sum - 1)


def distinctPair(l, r):
	print(2 * r - 2 * l + 1)
	return None
for _ in range(int(input())):
	(l, r) = map(int, input().split())
	distinctPair(l, r)


def solve():
	(L, R) = map(int, input().split())
	if L == R:
		print(1)
		return
	else:
		x = R - L + 1
		print(x + (x - 1))
for _ in range(int(input())):
	solve()


for i in range(int(input())):
	(l, r) = [int(x) for x in input().split()]
	if l == r:
		print(1)
	else:
		print(int(2 * r - 2 * l + 1))


for _ in range(int(input())):
	(l, r) = map(int, input().split())
	ans = 2 * (r - l) + 1
	print(ans)


for _ in range(int(input())):
	(l, r) = map(int, input().split(' '))
	a = []
	if l == r:
		print(1)
	else:
		n = r - l + 1
		print(2 * n - 1)


def manysums(arr):
	count = 2 * (int(arr[-1]) - int(arr[0]) + 1) - 1
	print(count)
T = int(input())
for _ in range(T):
	arr = input().split(' ')
	manysums(arr)


T = int(input())
for _ in range(T):
	(l, r) = map(int, input().split())
	a = r * 2 - l * 2 + 1
	print(a)


N = int(input())
for i in range(N):
	(L, R) = [int(i) for i in input().split()]
	length = R - L + 1
	print(length * 2 - 1)


for i in range(int(input())):
	(l, r) = map(int, input().split())
	count = 0
	if l == r:
		print('1')
	else:
		print(r - l + 1 + (r - l))