#abc238d. D - AND and SUM

D - AND and SUM

Score : 400400 points

问题描述

对于 TT 个测试用例,解决以下问题。

给定非负整数 aass。是否存在一对非负整数 (x,y)(x, y) 满足以下两个条件?

  • x AND y=ax\ \text{AND}\ y=a
  • x+y=sx+y=s

什么是按位 AND\mathrm{AND}

整数 AABB 的按位 AND\mathrm{AND}(记作 A AND BA\ \mathrm{AND}\ B)定义如下:

  • A AND BA\ \mathrm{AND}\ B 以二进制形式表示时,在 2k2^k 位(k0k \geq 0)上的数字是:如果 AABB 在该位上都是 11,则为 11,否则为 00

例如,我们有 4 AND 6=44\ \mathrm{AND}\ 6 = 4(以二进制表示:100 AND 110=100100\ \mathrm{AND}\ 110 = 100)。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Solve the following problem for TT test cases.

Given are non-negative integers aa and ss. Is there a pair of non-negative integers (x,y)(x,y) that satisfies both of the conditions below?

  • x AND y=ax\ \text{AND}\ y=a
  • x+y=sx+y=s

What is bitwise AND\mathrm{AND}?

The bitwise AND\mathrm{AND} of integers AA and BB, A AND BA\ \mathrm{AND}\ B, is defined as follows:

  • When A AND BA\ \mathrm{AND}\ B is written in base two, the digit in the 2k2^k's place (k0k \geq 0) is 11 if those of AA and BB are both 11, and 00 otherwise.

For example, we have 4 AND 6=44\ \mathrm{AND}\ 6 = 4 (in base two: 100 AND 110=100100\ \mathrm{AND}\ 110 = 100).

Constraints

  • 1T1051 \leq T \leq 10^5
  • 0a,s<2600 \leq a,s \lt 2^{60}
  • All values in input are integers.

Input

Input is given from Standard Input. The first line is in the following format:

TT

Then, TT test cases follow. Each test case is in the following format:

aa ss

Output

Print TT lines. The ii-th line (1iT)(1 \leq i \leq T) should contain Yes if, in the ii-th test case, there is a pair of non-negative integers (x,y)(x,y) that satisfies both of the conditions in the Problem Statement, and No otherwise.

Sample Input 1

2
1 8
4 2

Sample Output 1

Yes
No

In the first test case, some pairs such as (x,y)=(3,5)(x,y)=(3,5) satisfy the conditions.

In the second test case, no pair of non-negative integers satisfies the conditions.

Sample Input 2

4
201408139683277485 381410962404666524
360288799186493714 788806911317182736
18999951915747344 451273909320288229
962424162689761932 1097438793187620758

Sample Output 2

No
Yes
Yes
No

update @ 2024/3/10 10:17:23