CF1245F Daniel and Spring Cleaning

题目描述

给定 $l,r$,求 $$\sum_{a=l}^r\sum_{b=l}^r[a+b=a\oplus b]$$

输入格式

第一行 $t$($1\le t\le100$),表示数据组数。 接下来 $t$ 行,每行两个整数 $l,r$($0 \le l \le r \le 10 ^ 9$)。

输出格式

共 $t$ 行,答案为题目所述。

说明/提示

$ a \oplus b $ denotes the bitwise XOR of $ a $ and $ b $ . For the first testcase, the pairs are: $ (1, 2) $ , $ (1, 4) $ , $ (2, 1) $ , $ (2, 4) $ , $ (3, 4) $ , $ (4, 1) $ , $ (4, 2) $ , and $ (4, 3) $ .