Snake


Submit solution

Points: 25 (partial)
Time limit: 1.0s
Memory limit: 250M

Author:
Problem type

In the world of snakes, Cassandra said to Snooky "hsssch-hssch" and that means Snooky have to meet casandra at her house.

The world of snakes is modelled as a coordinate plane, Snooky's position is (0,0) , And casandra's house position is (X,Y).

The problem is in each second Snooky may move in only two ways:

  • Move 2 steps up , 1 step right.
  • Move 1 step up , 2 steps right.

Can you help him find if it is possible to reach casandra's house and the shortest time to achieve that?

Input Specification

The first line of the input will contain a number \(T\) , number of testcases T<=10^4.

Each of the next \(T\) lines contains two numbers X,Y , \(0 \le X,Y \le 10^8\).

Output Specification

If it is possible output YES, then in the next line the shortest possible time, Else output NO.

Scoring

  • (20 points) \(1 \le X,Y \le 1000\).
  • (80 points) No additional constraint.

Sample Input

Sample Input

    3
    1 2
    3 3
    4 1

Sample Output

    YES
    1
    YES
    2
    NO

Comments

There are no comments at the moment.