Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int,vector<int>,greater<int>>?//小さい順
#define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>>
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define all(a)  (a).begin(),(a).end()
#define elif else if

int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
bool prime(int a){
  if (a < 2)
    return false;
  else if (a == 2)
      return true;
  else if (a % 2 == 0)
      return false;
  for (int i = 3; i <= sqrt(a) + 1; i += 2){
      if (a % i == 0)
          return false;
  }
  return true;
}
int INF=1000000007;
int modinv(int a, int m){
  int b = m, u = 1, v = 0;
  while (b){
    int t = a / b;
    a -= t * b;
    swap(a, b);unique;
    u-= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0)
    u += m;
  return u;
}
int lcm(int a, int b){
    int c = modinv(gcm(a, b), INF);
    return ((a * c) % INF) * (b % INF) % INF;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int kaijou(int a){
  int b=1;
  fo(i,a)
    b*=i+1;
  return b;
}

V<P<int,int>> factorize(int n){
  V<P<int,int>> res;
  for(int i=2; i*i<=n; i++){
    if(n%i)
      continue;
    res.emplace_back(i,0);
    while(n%i==0){
      n/=i;
      res.back().second++;
    }
  }
  if(n!=1)
    res.emplace_back(n,1);
  return res;
}
int pow_kai(int a, int b){
  int c=1;
  while(b>0){//bit全部捨てるまで
    if(b%2){//一番右のbitが1
      c=c*a;
    }
    a=a*a;
    b>>=1;//全体右に1つシフト
  }
  return c;
}

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int n;

P<int,int> p;
V<V<p>> a;
bool judge(int bit){
  fo(i,n){
    if(!(bit&(1<<i)))
      continue;
    for(q:a[i]){
      int b=q.fi;
      int c=q.se;
      if(c==1&&!(bit&(1<<b)))
        return false;
      if(c==0&&(bit&(1<<b)))
        return false;
    }
  }
  return true;
}


signed main(){
  cin>>n;
  V<int> d(n);
  fo(i,n){
    cin>>d[i];
    fo(j,d[i]){
      cin>>b[i][j].fi>>b[i][j].se;
      --b[i][j].fi;
    }
  }
  int ans=0;
  for(int bit=0; bit<(1<<n); bit++){
    if(judge(bit)){
      int cnt=0;
      fo(i,n){
        if(bit&(1<<i))
          cnt++;
      }
      ans=max(ans,cnt);
    }
  }
  cout<<ans<<endl;
}



Compiler output:
a.cc: In function 'long long int modinv(long long int, long long int)':
a.cc:63:22: error: statement cannot resolve address of overloaded function
   63 |     swap(a, b);unique;
      |                      ^
a.cc: In function 'long long int lcm(long long int, long long int)':
a.cc:73:20: error: 'gcm' was not declared in this scope; did you mean 'lcm'?
   73 |     int c = modinv(gcm(a, b), INF);
      |                    ^~~
      |                    lcm
a.cc: At global scope:
a.cc:121:5: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
  121 | V<V<p>> a;
      |     ^
a.cc:121:5: note:   expected a type, got 'p'
a.cc:121:5: error: template argument 2 is invalid
a.cc:121:6: error: template argument 1 is invalid
  121 | V<V<p>> a;
      |      ^~
a.cc:121:6: error: template argument 2 is invalid
a.cc: In function 'bool judge(long long int)':
a.cc:126:10: error: found ':' in nested-name-specifier, expected '::'
  126 |     for(q:a[i]){
      |          ^
      |          ::
a.cc:126:9: error: 'q' has not been declared
  126 |     for(q:a[i]){
      |         ^
a.cc:134:3: error: expected primary-expression before '}' token
  134 |   }
      |   ^
a.cc:133:6: error: expected ';' before '}' token
  133 |     }
      |      ^
      |      ;
  134 |   }
      |   ~   
a.cc:134:3: error: expected primary-expression before '}' token
  134 |   }
      |   ^
a.cc:133:6: error: expected ')' before '}' token
  133 |     }
      |      ^
      |      )
  134 |   }
      |   ~   
a.cc:126:8: note: to match this '('
  126 |     for(q:a[i]){
      |        ^
a.cc:134:3: error: expected primary-expression before '}' token
  134 |   }
      |   ^
a.cc: In function 'int main()':
a.cc:145:12: error: 'b' was not declared in this scope
  145 |       cin>>b[i][j].fi>>b[i][j].se;
      |            ^