Under construction

Still being built. Things may change

Chunbae's Special Heart

Interview

Time limit1sMemory limit1024 MB

Summary
Given N and M, decide whether repeatedly splitting a heart into floor and ceiling halves and keeping one half can end at exactly M grams.
Level

Medium5 of 10

Topics
Divide and conquer, Recursion, Math
Solved
No attempts yet

문제

Chunbae has one heart that weighs NNg. The kind Chunbae wants to split this heart and give a heart weighing MMg to Nabi as a gift!

Chunbae can split his AAg heart into 2 hearts. If AA is even, it splits into two hearts of A2\frac{A}{2}g each. If AA is odd, it splits into one heart of A−12\frac{A-1}{2}g and one heart of (A−12+1)(\frac{A-1}{2}+1)g. Then Chunbae must choose one of the two hearts and discard it. He repeats this process until the one heart he keeps weighs MMg. However, once a heart weighs 11g, Chunbae cannot split it any further.

Before he splits his heart, Chunbae wants to know whether he can end up with a heart weighing MMg. Help him find out.

입력

The first line contains the weight NN of Chunbae's heart and the weight MM of the heart to give to Nabi, separated by a space. (1≤M≤N≤1018(1 \le M \le N \le 10^{18}, NN and MM are positive integers))

출력

If Chunbae can make a heart weighing MMg, print YES. Otherwise, print NO.

Examples2

  1. Example 1

    Input
    13 4
    
    Expected output
    YES
    
  2. Example 2

    Input
    13 5
    
    Expected output
    NO