fork download
  1. #include<iostream>
  2. using namespace std;
  3. int main(){
  4. int a,b;
  5. cin>>a>>b;
  6. int xr = a^b;
  7. int msbpos=0;
  8. while(xr){
  9. msbpos++;
  10. xr = xr>>1;
  11. }
  12. int maxxr=0;
  13. int x=1;
  14. while(msbpos--){
  15. maxxr+=x;
  16. x = x<<1;
  17. }
  18.  
  19. cout<<maxxr;
  20. return 0;
  21.  
  22. }
Success #stdin #stdout 0s 4512KB
stdin
89 108
stdout
63