Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
ll a[200005],b[200005];
ll one[30];
ll two[30];
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;cin>>N;
  FOR(i,0,N)cin>>a[i];
  FOR(i,0,N)cin>>b[i];
  // 2^kの位が1となる個数を数える
  two[0]=1;
  FOR(i,1,30)two[i]=two[i-1]*2;
  FOR(k,0,28){
    // aiと足して1になるbjの個数を一気に求める
    // 2^(k+1)以上のくらいは意味ないので2^(k+1)で割っておく
    vector<ll> bb(N);
    FOR(i,0,N)bb[i]=b[i]%two[k+1];
    sort(bb.begin(),bb.end());
    ll cnt=0;
    FOR(i,0,N){
      int aa=a[i]%two[k+1];
      cnt+=lower_bound(bb.begin(),bb.end(),max(0,2*two[k]-aa))-lower_bound(bb.begin(),bb.end(),max(0,two[k]-aa));
      cnt+=lower_bound(bb.begin(),bb.end(),max(0,4*two[k]-1-aa))-lower_bound(bb.begin(),bb.end(),max(0, 3*two[k]-aa));
    }
    one[k]+=cnt%2==1;
  }
  ll ans=0;
  FOR(i,0,30){
    if(one[i]%2)ans+=two[i];
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:47: error: no matching function for call to 'max(int, ll)'
   46 |       cnt+=lower_bound(bb.begin(),bb.end(),max(0,2*two[k]-aa))-lower_bound(bb.begin(),bb.end(),max(0,two[k]-aa));
      |                                            ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:46:47: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   46 |       cnt+=lower_bound(bb.begin(),bb.end(),max(0,2*two[k]-aa))-lower_bound(bb.begin(),bb.end(),max(0,two[k]-aa));
      |                                            ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:46:47: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   46 |       cnt+=lower_bound(bb.begin(),bb.end(),max(0,2*two[k]-aa))-lower_bound(bb.begin(),bb.end(),max(0,two[k]-aa));
      |                                            ~~~^~~~~~~~~~~~~~~
a.cc:46:99: error: no matching function for call to 'max(int, ll)'
   46 |       cnt+=lower_bound(bb.begin(),bb.end(),max(0,2*two[k]-aa))-lower_bound(bb.begin(),bb.end(),max(0,two[k]-aa));
      |                                                                                                ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:46:99: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   46 |       cnt+=lower_bound(bb.begin(),bb.end(),max(0,2*two[k]-aa))-lower_bound(bb.begin(),bb.end(),max(0,two[k]-aa));
      |                                                                                                ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:46:99: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   46 |       cnt+=lower_bound(bb.begin(),bb.end(),max(0,2*two[k]-aa))-lower_bound(bb.begin(),bb.end(),max(0,two[k]-aa));
      |                                                                                                ~~~^~~~~~~~~~~~~
a.cc:47:47: error: no matching function for call to 'max(int, ll)'
   47 |       cnt+=lower_bound(bb.begin(),bb.end(),max(0,4*two[k]-1-aa))-lower_bound(bb.begin(),bb.end(),max(0, 3*two[k]-aa));
      |                                            ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:47:47: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   47 |       cnt+=lower_bound(bb.begin(),bb.end(),max(0,4*two[k]-1-aa))-lower_bound(bb.begin(),bb.end(),max(0, 3*two[k]-aa));
      |                                            ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:47:47: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   47 |       cnt+=lower_bound(bb.begin(),bb.end(),max(0,4*two[k]-1-aa))-lower_bound(bb.begin(),bb.end(),max(0, 3*two[k]-aa));
      |                                            ~~~^~~~~~~~~~~~~~~~~
a.cc:47:101: error: no matching function for call to 'max(int, ll)'
   47 |       cnt+=lower_bound(bb.begin(),bb.end(),max(0,4*two[k]-1-aa))-lower_bound(bb.begin(),bb.end(),max(0, 3*two[k]-aa));
      |                                                                                                  ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:47:101: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   47 |       cnt+=lower_bound(bb.begin(),bb.end(),max(0,4*two[k]-1-aa))-lower_bound(bb.begin(),bb.end(),max(0, 3*two[k]-aa));
      |                                                                                                  ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:47:101: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   47 |       cnt+=lower_bound(bb.begin(),bb.end(),max(0,4*two[k]-1-aa))-lower_bound(bb.begin(),bb.end(),max(0, 3*two[k]-aa));
      |                                                                                                  ~~~^~~~~~~~~~~~~~~~