fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. long long xorTo(long long x) {
  5. if (x % 4 == 0) return x;
  6. if (x % 4 == 1) return 1;
  7. if (x % 4 == 2) return x + 1;
  8. return 0;
  9. }
  10.  
  11. int main() {
  12. long long A, B;
  13. cin >> A >> B;
  14.  
  15. long long result = xorTo(B) ^ xorTo(A - 1);
  16.  
  17. cout << result << endl;
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
140737041238768