#include #include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int x, y; cin >> x >> y; pair aimPos = make_pair(x, y); pair knightPos(0, 0); vector> knightMove{make_pair(-2,-1), make_pair(-2,1), make_pair(-1, 2), make_pair(1,2), make_pair(2,1), make_pair(2,-1), make_pair(1,-2), make_pair(-1,-2) }; bool arrival = false; queue> q; q.push(knightPos); int count = 512; //8^3 while (1) { if (count == 0) break; count--; knightPos = q.front(); if (knightPos == aimPos) { arrival = true; break; } q.pop(); for (int i = 0; i < 8; ++i) { q.push(make_pair(knightPos.first + knightMove.at(i).first, knightPos.second + knightMove.at(i).second)); } } cout << (arrival ? "YES" : "NO") << endl; return 0; }