// AVADAKEDAVRA !!!!!
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
double eps = 1e-9;
int gcd(int a,int b)
{
if(a<b)return gcd(b,a);
if(b==0)return a;
return gcd(b,a%b);
}
int issqr(int x)
{
int w = sqrt(x);
if(w*w==x)return w;
w++;
if(w*w==x)return w;
return 0;
}
class KnightOfIntegerland {
public:
string able(int, int, int);
};
vector<pii > sums;
string KnightOfIntegerland::able(int d, int x, int y) {
if(x<0)x=-x;
if(y<0)y=-y;
if( x == 0 && y == 0)return "YES";
for(int i=0;i*i<=d;i++)
{
int w = d-i*i;
if(issqr(w))
{
sums.push_back(pii(i,issqr(w)));
}
}
vi alsteps,sparity;
for(int i=0;i<sums.size();i++)
{
int x = sums[i].first, y = sums[i].second;
int g = gcd(x,y);
x/=g;y/=g;
if( (y-x)& 1)
{
alsteps.push_back(g);
}
else sparity.push_back(g);
}
int a = 0;
for(int i=0;i<alsteps.size();i++)
a = gcd(a,alsteps[i]);
for(int i=0;i<sparity.size();i++)
a = gcd(a,2*sparity[i]);
int b = 0;
for(int i=0;i<sparity.size();i++)
{
b = gcd(b, sparity[i]);
}
if(a==0)return "NO";
if( (x-y)%a != 0)return "NO";
for(int k=0;k<a;k++)
{
if( (x-b*k)%a==0)return "YES";
}
return "NO";
}
<%:testing-code%>
//Powered by [KawigiEdit] 2.0!
Ly8gQVZBREFLRURBVlJBICEhISEhCiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0eXBlZGVmIGxvbmcgbG9uZyBpbnQgbGw7CnR5cGVkZWYgdmVjdG9yPGludD4gdmk7CnR5cGVkZWYgcGFpcjxpbnQsaW50PiBwaWk7CmRvdWJsZSBlcHMgPSAxZS05OwoKaW50IGdjZChpbnQgYSxpbnQgYikKewoJaWYoYTxiKXJldHVybiBnY2QoYixhKTsKCWlmKGI9PTApcmV0dXJuIGE7CglyZXR1cm4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