题目描述
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$.
输入格式
见题面
输出格式
见题面