#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>n>>k; if(k==0){ cout<<1<=0;i--){ if((n>>i)&1){ Int x=((2LL<=(2LL< dfs= [&](Int x,Int s){ if(x<0){ if(0<=s&&s<=k) ans++; return; } Int d=2LL<k||s+d<0) return; dfs(x-1,s); if((n>>x)&1) return; dfs(x-1,s+(1LL<