#include #include #define INF 1000000000LL using namespace std; typedef long long ll; typedef pair P; std::random_device rd; ll mod_pow(ll x,ll n,ll mod){ ll res=1; while(n>0){ if(n&1LL)res=res*x%mod; x=x*x%mod; n>>=1; } return res; } ll calc(ll v,ll tgt,int po){ ll ans=1; for(int i=0;itgt)return false; } if(anstgt)return false; return true; } bool is_prime(ll val){ if(val==1LL)return false; for(int i=0;i<5000;i++){ ll v=0; while(v<=1){ v=rd()%val; v=v*rd()%val; } if(mod_pow(v,val-1LL,val)!=1LL)return false; } return true; } bool C(ll v,ll tgt,int po){ ll res=1; for(int i=0;i0LL){ ll rest=n-tw; for(int i=1;i<=60;i++){ if(check(rest,i))flag=true; } if(flag)break; if(n-tw<=tw)break; tw*=2LL; } printf("%s\n",flag?"Yes":"No"); } } return 0; }