#include using namespace std; using ll=long long; using Pa=pair; using Vll=vector; using VVll=vector; using Vb=vector; using VVb=vector>; using Vs=vector; using VVs =vector>; using Vc=vector; using VVc =vector>; const ll MOD=1000000007; const ll INF=(ll)1<<60;// 10^18 < 1<<60 = 1152921504606846976 // VVll G(N+1,Vll(0)); // vector event; event.emplace_back(a,b); // 以下の関数 oi:エラー出力 OI:正出力 OIV:1次元vector正出力 OIVV:2次元vector正出力 template bool chmax(t&a,u b){if(a bool chmin(t&a,u b){if(bvoid oi(Head&& head,Tail&&... tail){if(sizeof...(tail)!=0){cerr<void OI(Head&& head,Tail&&... tail){if(sizeof...(tail)!=0){cout< void OIV(T &a){if(a.empty()){cout<<"\n"; return;} for(ll i00=0;i00<(a).size();i00++){if(a[i00]==(ll)1<<60){cout<<"I";} else{cout< void OIVV(T &a){if(a.empty()){cout<<"\n"; return;} for(ll i00=0;i00<(a).size();i00++){for(ll j00=0;j00<(a[i00]).size();j00++){if(a[i00][j00]==(ll)1<<60){cout<<"I";} else{cout<>A>>B; if(A<1000 and B<1000){ ll ans=0; FOR(i,0,A +1){ FOR(j,0,B +1){ ll z=min({i,j,i^j}); chmax(ans,z); } } OI(ans); return 0; } if(B>A) swap(A,B); bitset<64> s(A),t(B); oi(s); oi(t); ll n=0; for(ll i=63; i>=0; i--){ if(s[i]==0 and t[i]==0) continue; else if(s[i]==1 and t[i]==0){ OI(B);// Aの残りをBの方のビットの反転にすればよい return 0; } else if(s[i]==1 and t[i]==1){ n=i;// 同じ桁なので OI((1<