Language: C++

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

using ll=long long;
void chmin(ll &a,ll b){
  if(a>b)a=b;
}
void add(vector<ll> &now,ll a){
  for(int p:now)chmin(a,a^p);
  if(a)now.insert(-a);
}
bool out(set<ll> &now,ll a){
  for(int p:now)chmin(a,a^p);
  return a;
}

int main(){
  int t;cin>>t;
  while(t--){
    int n,ans=0;cin>>n;
    vector<ll>v(n),now;
    for(int &p:v)cin>>p;
    string s;cin>>s;
    for(int i=n-1;i>=0;i--){
      if(s[i]=='0')add(now,v[i]);
      else ans|=out(now,v[i]));
    }
    cout<<ans<<endl;
  }
}


Compiler output:
a.cc: In function 'void add(std::vector<long long int>&, ll)':
a.cc:10:18: error: no matching function for call to 'std::vector<long long int>::insert(ll)'
   10 |   if(a)now.insert(-a);
      |        ~~~~~~~~~~^~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = long long int; _Alloc = std::allocator<long long int>]'
 1484 |         insert(const_iterator __position, _InputIterator __first,
      |         ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1484:9: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/vector:72:
/usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator; value_type = long long int]'
  133 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:133:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator; value_type = long long int]'
 1395 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator]'
 1413 |       insert(const_iterator __position, initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator; size_type = long unsigned int; value_type = long long int]'
 1439 |       insert(const_iterator __position, size_type __n, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note:   candidate expects 3 arguments, 1 provided
a.cc: In function 'int main()':
a.cc:22:16: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int'
   22 |     for(int &p:v)cin>>p;
      |                ^
a.cc:26:21: error: invalid initialization of reference of type 'std::set<long long int>&' from expression of type 'std::vector<long long int>'
   26 |       else ans|=out(now,v[i]));
      |                     ^~~
a.cc:12:19: note: in passing argument 1 of 'bool out(std::set<long long int>&, ll)'
   12 | bool out(set<ll> &now,ll a){
      |          ~~~~~~~~~^~~