CodeforcesJun 10, 2025

Cloning Toys

Hazrat Ali

Codeforces

Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more original toy and one copy, and if he applies the machine to a copied toy, he gets two additional copies.

Initially, Imp has only one original toy. He wants to know if it is possible to use machine to get exactly x copied toys and y original toys? He can't throw toys away, and he can't apply the machine to a copy if he doesn't currently have any copies.

Input

The only line contains two integers x and y (0 ≤ x, y ≤ 109) — the number of copies and the number of original toys Imp wants to get (including the initial one).

Output

Print "Yes", if the desired configuration is possible, and "No" otherwise.

You can print each letter in arbitrary case (upper or lower).

 

Examples
Input
6 3
Output
Yes
Input
4 2
Output
No
Input
1000 1001
Output
Yes


Solution
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long x, y;
  cin >> x >> y;
  if (y == 0) {
    cout << "No" << endl;
    return 0;
  }
  long long originals = 1, copies = 0;
  while (originals < y) {
    originals++;
    copies++;
  }

  while (copies > 0 and copies < x) {
    copies += 2;
  }
  if (y == originals and x == copies) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}




Comments