#include using namespace std; typedef long long ll; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b>D; ll left=0,right=D; while(right-left>1){ ll mid=(left+right)/2; ll sum=0; ll now=mid; while(now){ sum+=now; now/=2; } if(sum>=D) right=mid; else left=mid; } for(ll i=right;i<=D;i++){ ll sum=0; ll now=i; while(now){ sum+=now; now/=2; if(sum>D) break; if(sum==D){ cout<