#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=w){ ans+=(h-(w-1)); h=w-1; } for(Int i=1;i<=h;i<<=1){ Int j=min((i<<1)-1,h); Int len=j-i+1; ans+=len*(w/i); Int res=w%i; ans+=res; } return ans; } Int solve3(Int h,Int w){ if(w>=1e7) return 0; auto start=clock(); Int num=0; vector cnt(w+1,0); cnt[0]=h; while(1){ if((double)(clock()-start)/CLOCKS_PER_SEC>=1.0) break; if(cnt[w]==h){ return num; } for(Int i=0;i>h>>w; cout<