Language: C++

# include <iostream>
# include <vector>


using namespace std;


int n, m;

vector<int> q;
vector<int> p;
vector<vector<int>> ss;


bool valid(int query) {
    fill(q.begin(), q.end(), 0);

    for (int i=0; i<n; i++) {
        // whether i'th switch is pushed
        if (!(query>>i & 1)) continue;

        // i'th switch is pushed.
        // then which lights are incremented?
        for (int j=0; j<m; j++) {
            if (find(ss.at(i).begin(), ss[i].end(), j) != ss[i].end()) {
                q[j]++;
            }
        }
    }

    // cout << "# r ---" << endl;
    // for (int q_i: q) {
    //     cout << q_i << " ";
    // }
    // cout << endl;
    // cout << "# ---" << endl;

    // cout << "# p ---" << endl;
    // for (int p_i: p) {
    //     cout << p_i << " ";
    // }
    // cout << endl;
    // cout << "# ---" << endl;

    int cnt = 0;
    for (int i=0; i<m; i++) {
        if (q[i] % 2 == p[i]) cnt++;
    }
    return cnt == m;
}


int main() {
    cin >> n >> m;

    int k, v;
    ss.resize(n);
    for (int i=0; i<m; i++) {
        cin >> k;

        for (int j=0; j<k; j++) {
            cin >> v; v--;
            ss[v].push_back(i);
        }
    }

    q.resize(m);
    p.resize(m);
    for (int i=0; i<m; i++) cin >> p[i];

    // cout << "# ---" << endl;
    // for (vector<int> ss_i: ss) {
    //     for (int ss_ij: ss_i) cout << ss_ij << ' '; cout << endl;
    // }
    // cout << "# ---" << endl;

    int ans = 0;
    for (int i=0; i<(int)pow(2, n); i++) {
        // cout << "query: " << i << endl;
        if (valid(i)) ans++;
    }

    cout << ans << endl;
    return 0;
}



Compiler output:
a.cc: In function 'bool valid(int)':
a.cc:25:21: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   25 |             if (find(ss.at(i).begin(), ss[i].end(), j) != ss[i].end()) {
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:25:21: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   25 |             if (find(ss.at(i).begin(), ss[i].end(), j) != ss[i].end()) {
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:78:26: error: 'pow' was not declared in this scope
   78 |     for (int i=0; i<(int)pow(2, n); i++) {
      |                          ^~~