Language: C++

#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

using P = pair<ll, ll>;
int main(){
  int n; cin >> n;
  vector<vector<P>> xy(n);
  rep(i, n){
    int a; cin >> a;
    xy[i].resize(a);
    rep(j, a){
      cin >> xy[i][j].first >> xy[i][j].second;
      xy[i][j].first--;
    }
  }

  ll res = 0;
  for (int bit = 0; bit < (1<<n); ++bit){
    vector<ll> h(n, 0); //仮定した時
    vector<ll> x(n, 0); //仮定した正直者の発言からそれぞれの真偽
    for (int i = 0; i < n; ++i){
      if (bit & (1<<i)) h[i] = 1;
    }

    rep(i, n){
      rep(j, xy[i].size()){
        if (h[i] == 0){ //嘘つきと仮定した場合
          if (xy[i][j].second == 0) x[xy[i][j].first] = 1;
          else x[xy[i][j].first] = 0;
        }else{ //正直者と仮定した場合
          if (xy[i][j].second == 0) x[xy[i][j].first] = 0;
          else x[xy[i][j].first] = 1;
        }
      }
    }
    int sum_same = 0;
    rep(i, n){
      if (h[i] == x[i]) sum_same++;
    }
    if (sum_same == n){
      int cnt = count(h.begin(), h.end(), 1);
      res = max(res, cnt);
    }
  }
  cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:16: error: no matching function for call to 'max(ll&, int&)'
   56 |       res = max(res, cnt);
      |             ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:56:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   56 |       res = max(res, cnt);
      |             ~~~^~~~~~~~~~
/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,
                 from a.cc:2:
/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:56:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   56 |       res = max(res, cnt);
      |             ~~~^~~~~~~~~~