Training Site
Sideways banner


Input: Standard Input (stdin)
Output: Standard Output (stdout)
Memory limit: 100 megabytes
Time limit: 1.0 seconds

Evan believes that even numbers are generally more beautiful than odd numbers. Naturally, since Evan is biased, he has devised a beauty rating based on some measure of evenness.

The rating for a whole number is the number of unique even numbers encountered when taking that number and repeatedly dividing it by two (but rounding down to the nearest whole number) until the value becomes zero. For example, 0, 6, and 7 have respective beauty ratings of 1, 2, and 1.

Evan wants you to verify his theory of beauty. He creates a sequence of n consecutive even numbers starting with the even number x, and another sequence of n consecutive odd numbers starting at the odd number x+1. Evan's hypothesis is that the sum of beauty ratings in the even sequence will always be strictly greater than the sum of beauty ratings in the odd sequence. For example, the even number sequence of length n=3 starting at x=10 is {10, 12, 14} and has a combined rating of 8, which is indeed higher than the combined rating of 5 for the odd number sequence {11, 13, 15}.

Calculating Beauty Numbers

Let's use the example where 6 has a beauty number of 2...

Dividing 6 by two gives 3, then dividing again gives 1, and again leaves 0. Since we encountered two even numbers 0 and 6, the rating of 6 is 2. Notice that when dividing 3 by 2, we round down from 1.5 to 1. This is also called integer division.


The input is a single line consisting of two integers, n and x, where x is divisible by two.

It is guaranteed that 1 \le n \le 100,000,000 and 0 \le x \le 2^{64}.


Output YES if the combined ratings for the sequences specified by n and x are consistent with Evan's hypothesis that even numbers tend to be more beautiful than odd numbers. Otherwise, output NO.


You can get 20% by passing cases where n \lt 10,000.

Remember to move on to other questions if you get stuck :)

  • Sample Input 1

    3 10

    Sample Output 1

  • Sample Input 2

    1 0

    Sample Output 2