Language: C++

#include <bits/stdc++.h>
using namespace std;

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}



int main(){
  ll a,b;
  VI digitA(60,0);
  VI digitB(60,0);
  cin >> a >> b;
  if(a==b){
    cout << a << endl;
    return 0;
  }
  rep(i,60){
    if(a&(1LL<<i)) digitA[i] = 1;
    if(b&(1LL<<i)) digitB[i] = 1;
  }
  VI ans(60,0);
  rep(i,60){
    if(i == 0){
      if(a%2 == 1){
        ll diff = b-a+1;
        if(diff % 4 < 2) ans[i] = 1;
      }else{
        ll diff = b-a+1;
        if(diff % 4 >= 2) ans[i] = 1;
      }
      else ans[i] = (b-a+1) % 2;
    }
    if(digitA[i] == 0 && digitB[i] == 0) continue;
    else if(digitA[i] == 1 && digitB[i] == 0){
      //次の桁に上がるまでどのくらいかかるか
      ll maskA = a & ((1LL<<(i+1))-1LL);
      ans[i] = ((1LL<<(i+1)) - maskA) % 2 ;
    }else if(digitA[i] == 0 && digitB[i] == 1){
      ll maskB = b & ((1LL<<(i+1)) -1LL);
      ans[i] = (maskB - (1LL<<i) + 1LL)%2;
    }else if(digitA[i] == 1 && digitB[i] == 1){
      ll maskA = a & ((1LL<<(i+1))-1LL);
      ll maskB = b & ((1LL<<(i+1)) -1LL);
      ans[i] = ( (1LL<<(i+1)) - maskA + (maskB - (1LL<<i) + 1LL) )% 2 ;
    }
  }
  ll ansNum = 0;
  rep(i,60){
    //cout << i << ": " << ans[i] << endl;
    if(ans[i] == 1)ansNum += (1LL<<i);
  }
  cout << ansNum << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:7: error: expected '}' before 'else'
   51 |       else ans[i] = (b-a+1) % 2;
      |       ^~~~
a.cc:43:15: note: to match this '{'
   43 |     if(i == 0){
      |               ^
a.cc:53:15: error: 'i' was not declared in this scope
   53 |     if(digitA[i] == 0 && digitB[i] == 0) continue;
      |               ^
a.cc:53:42: error: continue statement not within a loop
   53 |     if(digitA[i] == 0 && digitB[i] == 0) continue;
      |                                          ^~~~~~~~
a.cc: At global scope:
a.cc:6:19: error: expected unqualified-id before 'for'
    6 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                   ^~~
a.cc:68:3: note: in expansion of macro 'rep'
   68 |   rep(i,60){
      |   ^~~
a.cc:68:7: error: 'i' does not name a type
   68 |   rep(i,60){
      |       ^
a.cc:6:34: note: in definition of macro 'rep'
    6 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                  ^
a.cc:68:7: error: 'i' does not name a type
   68 |   rep(i,60){
      |       ^
a.cc:6:48: note: in definition of macro 'rep'
    6 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                                ^
a.cc:72:3: error: 'cout' does not name a type
   72 |   cout << ansNum << endl;
      |   ^~~~
a.cc:74:1: error: expected declaration before '}' token
   74 | }
      | ^