prithivMLmods/Coder-Stat huggingface dataset:
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;

  vector<int> vec(N);

  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;

    vector<int> vec2(d);
    for (int j = 0; j < d; j++) {
      cin >> vec2.at(j);
      vec.at(vec.at(j) - 1)++;
    }
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (vec.at(i) == 0) {
      ans++;
    }
  }

  cout << ans << endl;
}

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

int main() {
  int N, K;
  cin >> N >> K;

  vector<int> vec(N);

  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;

    vector<int> vec2(d);
    for (int j = 0; j < d; j++) {
      cin >> vec2.at(j);
      vec.at(vec2.at(j) - 1)++;
    }
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (vec.at(i) == 0) {
      ans++;
    }
  }

  cout << ans << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

int main() {
  ll n, k, d, i, j, a_tmp, cnt = 0;
  cin >> n >> k;
  vector<ll> a(n, false);
  for (i = 0; i < k; ++i) {
    cin >> d;
    for (j = 0; j < d; ++j) {
      cin >> a_tmp;
      a[a_tmp - 1] = true;
    }
  }
  for (i = 0; i < k; ++i) {
    if (a[i] == false)
      cnt++;
  }
  cout << cnt << endl;
}


Fixed submission:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

int main() {
  ll n, k, d, i, j, a_tmp, cnt = 0;
  cin >> n >> k;
  vector<ll> a(n, false);
  for (i = 0; i < k; ++i) {
    cin >> d;
    for (j = 0; j < d; ++j) {
      cin >> a_tmp;
      a[a_tmp - 1] = true;
    }
  }
  for (i = 0; i < n; ++i) {
    if (a[i] == false)
      cnt++;
  }
  cout << cnt << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> d(k), b(n);
  vector<vector<int>> a(k, vector<int>(k));
  rep(i, k) {
    cin >> d[i];
    rep(j, d[i]) {
      cin >> a[i][j];
      a[i][j]--;
      b[a[i][j]]++;
    }
  }
  int ans = 0;
  rep(i, n) {
    if (b[i] == 0)
      ans++;
  }
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> d(k), b(n);
  vector<vector<int>> a(k, vector<int>(n));
  rep(i, k) {
    cin >> d[i];
    rep(j, d[i]) {
      cin >> a[i][j];
      a[i][j]--;
      b[a[i][j]]++;
    }
  }
  int ans = 0;
  rep(i, n) {
    if (b[i] == 0)
      ans++;
  }
  cout << ans << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n, 0);

  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;
    vector<int> b(d);
    for (int j = 0; j < d; j++) {
      cin >> b[j];
      a[b[j]] = 1;
    }
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0)
      ans++;
  }

  cout << ans << endl;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n, 0);

  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;
    vector<int> b(d);
    for (int j = 0; j < d; j++) {
      cin >> b[j];
      a[b[j] - 1] = 1;
    }
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0)
      ans++;
  }

  cout << ans << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll = long long;
int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> vec(N, 0);
  for (ll i = 0; i < K; i++) {
    ll a;
    cin >> a;
    for (ll j = 0; j < a; j++) {
      ll b;
      cin >> b;
      vec.at(b - 1) = 1;
    }
  }
  ll c = 0;
  for (ll i = 0; i < K; i++) {
    if (vec.at(i) == 0) {
      c += 1;
    }
  }
  cout << c << endl;
}


Fixed submission:
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll = long long;
int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> vec(N, 0);
  for (ll i = 0; i < K; i++) {
    ll a;
    cin >> a;
    for (ll j = 0; j < a; j++) {
      ll b;
      cin >> b;
      vec.at(b - 1) = 1;
    }
  }
  ll c = 0;
  for (ll i = 0; i < N; i++) {
    if (vec.at(i) == 0) {
      c += 1;
    }
  }
  cout << c << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;

  vector<bool> chk(N, false);
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int A;
      cin >> A;
      chk.at(A - 1) = true;
    }
  }

  int ans = 0;
  for (int i = 0; i < K; i++) {
    if (!chk.at(i)) {
      ans++;
    }
  }

  cout << ans << endl;
}

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

int main() {
  int N, K;
  cin >> N >> K;

  vector<bool> chk(N, false);
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int A;
      cin >> A;
      chk.at(A - 1) = true;
    }
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (!chk.at(i)) {
      ans++;
    }
  }

  cout << ans << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  int d[n];
  int a[n][n];
  for (int i = 0; i < k; i++) {
    cin >> d[i];
    for (int j = 0; j < d[i]; j++) {
      cin >> a[i][j];
      a[i][j]--;
    }
  }

  bool judge[n];
  for (int i = 0; i < n; i++) {
    judge[i] = false;
  }
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < d[i]; j++) {
      for (int p = 0; p < n; p++) {
        if (a[i][j] == p) {
          judge[p] = true;
        }
      }
    }
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (judge[i] == false)
      count++;
  }
  cout << count << endl;
}

Fixed submission:
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  int d[100];
  int a[100][100];
  for (int i = 0; i < k; i++) {
    cin >> d[i];
    for (int j = 0; j < d[i]; j++) {
      cin >> a[i][j];
      a[i][j]--;
    }
  }

  bool judge[n];
  for (int i = 0; i < n; i++) {
    judge[i] = false;
  }
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < d[i]; j++) {
      for (int p = 0; p < n; p++) {
        if (a[i][j] == p) {
          judge[p] = true;
        }
      }
    }
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (judge[i] == false)
      count++;
  }
  cout << count << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <cstdint> // int64_t, int*_t
#include <cstdio>  // printf
#include <cstring>
#include <deque>    // deque
#include <iostream> // cout, endl, cin
#include <map>      // map
#include <numeric>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef unsigned long long ll;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> d(N);
  set<int> S;
  vector<vector<int>> A(101, vector<int>(101));
  rep(i, K) {
    cin >> d[i];
    rep(j, d[i]) {
      cin >> A[i][j];
      S.insert(A[i][j]);
    }
  }

  int count = 0;
  for (int i = 1; i <= N; i++) {
    if (S.count(i)) {
      count++;
    }
  }
  cout << N - count << endl;
}

Fixed submission:
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <cstdint> // int64_t, int*_t
#include <cstdio>  // printf
#include <cstring>
#include <deque>    // deque
#include <iostream> // cout, endl, cin
#include <map>      // map
#include <numeric>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef unsigned long long ll;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> d(101);
  set<int> S;
  vector<vector<int>> A(101, vector<int>(101));
  rep(i, K) {
    cin >> d[i];
    rep(j, d[i]) {
      cin >> A[i][j];
      S.insert(A[i][j]);
    }
  }

  int count = 0;
  for (int i = 1; i <= N; i++) {
    if (S.count(i)) {
      count++;
    }
  }
  cout << N - count << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int n, m, q;
vector<int> a, b, c, d;
int ans;

template <typename T> void printVec(vector<T> &vec) {
  cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    cout << *it << " ";
  }
  cout << endl;
}

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> sunuke(n, 0);
  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;
    vector<int> a(d);

    for (int j = 0; j < d; j++) {
      cin >> a[i];
      sunuke[a[i] - 1] = 1;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (sunuke[i] == 0) {
      ans = ans + 1;
    }
  }
  // printVec(sunuke);
  cout << ans << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int n, m, q;
vector<int> a, b, c, d;
int ans;

template <typename T> void printVec(vector<T> &vec) {
  cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    cout << *it << " ";
  }
  cout << endl;
}

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> sunuke(n, 0);
  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;
    vector<int> a(d);

    for (int j = 0; j < d; j++) {
      cin >> a[j];
      sunuke[a[j] - 1] = 1;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (sunuke[i] == 0) {
      ans = ans + 1;
    }
  }
  // printVec(sunuke);
  cout << ans << endl;
  return 0;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, k;
  int d[100];
  cin >> n >> k;

  vector<int> A(n, 0);
  int nu[100][100];

  for (int i = 0; i < k; i++) {
    cin >> d[i];

    for (int j = 0; j < d[i]; j++) {
      cin >> nu[i][j];
    }
  }

  for (int i = 0; i < k; i++) {
    for (int j = 0; j < d[i]; j++) {
      A.at(nu[i][j])++;
    }
  }

  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (A.at(i) == 0)
      sum++;
  }

  cout << sum << endl;

  return 0;
}


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

int main() {
  int n, k;
  int d[100];
  cin >> n >> k;

  vector<int> A(n, 0);
  int nu[100][100];

  for (int i = 0; i < k; i++) {
    cin >> d[i];

    for (int j = 0; j < d[i]; j++) {
      cin >> nu[i][j];
    }
  }

  for (int i = 0; i < k; i++) {
    for (int j = 0; j < d[i]; j++) {
      A.at(nu[i][j] - 1)++;
    }
  }

  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (A.at(i) == 0)
      sum++;
  }

  cout << sum << endl;

  return 0;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> sunu(n, 0);
  int d;
  int a;
  for (int i = 0; i < k; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      cin >> a;
      sunu.at(a) = 1;
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (sunu.at(i) == 0) {
      sum++;
    }
  }
  cout << sum;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> sunu(n, 0);
  int d;
  int a;
  for (int i = 0; i < k; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      cin >> a;
      sunu.at(a - 1) = 1;
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (sunu.at(i) == 0) {
      sum++;
    }
  }
  cout << sum;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, k, d, a[1000], i, f[1000] = {0}, k1 = 0, p[1000] = {0};
  map<int, int> m;
  cin >> n >> k;
  int j = 0;
  while (k--) {
    cin >> d;
    for (i = 0; i < d; i++) {
      cin >> a[i];
      p[j] = a[i];
      j++;
    }
  }
  for (i = 0; i < j; i++) {
    // cout<<p[i]<<endl;
    f[p[i]]++;
  }
  for (i = 0; i < j; i++) {
    if (f[p[i]] != 0) {
      //  cout<<p[i]<<" "<<f[p[i]]<<endl;
      k1++;
      f[p[i]] = 0;
    }
  }
  cout << n - k1 << endl;
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, k, d, a[10000], i, f[100000] = {0}, k1 = 0, p[100000] = {0};
  map<int, int> m;
  cin >> n >> k;
  int j = 0;
  while (k--) {
    cin >> d;
    for (i = 0; i < d; i++) {
      cin >> a[i];
      p[j] = a[i];
      j++;
    }
  }
  for (i = 0; i < j; i++) {
    // cout<<p[i]<<endl;
    f[p[i]]++;
  }
  for (i = 0; i < j; i++) {
    if (f[p[i]] != 0) {
      //  cout<<p[i]<<" "<<f[p[i]]<<endl;
      k1++;
      f[p[i]] = 0;
    }
  }
  cout << n - k1 << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<bool> vec(n);
  for (int i = 0; i < n; i++) {
    vec.at(i) = false;
  }

  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int a;
      cin >> a;
      vec.at(a) = true;
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (vec.at(i) == false) {
      cnt++;
    }
  }
  cout << cnt << endl;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  vector<bool> vec(n);
  for (int i = 0; i < n; i++) {
    vec.at(i) = false;
  }

  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int a;
      cin >> a;
      vec.at(a - 1) = true;
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (vec.at(i) == false) {
      cnt++;
    }
  }
  cout << cnt << endl;
}
Problem p02688 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <iostream>
#include <set>
#include <string>
#define ll long long
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  set<int> s;
  for (ll i = 1; i <= k; i++) {
    int d;
    cin >> d;
    while (d) {
      ll t;
      cin >> t;
      s.insert(t);
    }
  }
  cout << n - s.size() << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#include <iostream>
#include <set>
#include <string>
#define ll long long
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  set<int> s;
  for (ll i = 1; i <= k; i++) {
    int d;
    cin >> d;
    while (d) {
      ll t;
      cin >> t;
      s.insert(t);
      d--;
    }
  }
  cout << n - s.size() << endl;
  return 0;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    vec.at(i) = 0;
  }
  for (int i = 0; i < K; i++) {
    int j;
    cin >> j;
    for (int k = 0; k < j; k++) {
      int l;
      cin >> l;
      vec.at(l)++;
    }
  }
  int A = 0;
  for (int i = 0; i < N; i++) {
    if (vec.at(i) == 0) {
      A++;
    }
  }
  cout << A;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    vec.at(i) = 0;
  }
  for (int i = 0; i < K; i++) {
    int j;
    cin >> j;
    for (int k = 0; k < j; k++) {
      int l;
      cin >> l;
      vec.at(l - 1) = vec.at(l - 1) + 1;
    }
  }
  int A = 0;
  for (int i = 0; i < N; i++) {
    if (vec.at(i) == 0) {
      A++;
    }
  }
  cout << A;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;

  vector<bool> s(n, false);

  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;
    vector<int> a(d);
    for (int j = 0; j < d; j++)
      cin >> a.at(j);

    for (int j = 0; j < d; j++) {
      s.at(a.at(j)) = true;
    }
  }

  int count = 0;
  for (int i = 0; i < n; i++) {
    if (s.at(i) == false)
      count++;
  }
  cout << count << endl;
}

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

int main() {
  int n, k;
  cin >> n >> k;

  vector<bool> s(n, false);

  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;
    vector<int> a(d);
    for (int j = 0; j < d; j++)
      cin >> a.at(j);

    for (int j = 0; j < d; j++) {
      s.at(a.at(j) - 1) = true;
    }
  }

  int count = 0;
  for (int i = 0; i < n; i++) {
    if (s.at(i) == false)
      count++;
  }
  cout << count << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
const unsigned int M = 1000000007;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> d(k);
  rep(i, k) {
    int m;
    cin >> m;
    rep(j, m) {
      int a;
      cin >> a;
      d[a - 1] = 1;
    }
  }
  int ans = 0;
  rep(i, n) if (d[i] == 0)++ ans;
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
const unsigned int M = 1000000007;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> d(n);
  rep(i, k) {
    int m;
    cin >> m;
    rep(j, m) {
      int a;
      cin >> a;
      d[a - 1] = 1;
    }
  }
  int ans = 0;
  rep(i, n) if (d[i] == 0)++ ans;
  cout << ans << endl;
  return 0;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> vec(n, 1);

  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int a;
      cin >> a;
      vec.at(a) = 0;
    }
  }

  int ans = 0;

  for (int i = 0; i < n; i++) {
    ans += vec.at(i);
  }

  cout << ans << endl;
}

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

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> vec(n, 1);

  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int a;
      cin >> a;
      vec.at(a - 1) = 0;
    }
  }

  int ans = 0;

  for (int i = 0; i < n; i++) {
    ans += vec.at(i);
  }

  cout << ans << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include "bits/stdc++.h"
#include <cstring>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
  int n, k;
  int ans = 0;
  cin >> n >> k;
  vector<int> flag_n(n);
  rep(i, k) { flag_n[i] = 0; }
  rep(i, k) {
    int tcnt;
    cin >> tcnt;
    rep(j, tcnt) {
      int temp;
      cin >> temp;
      if (flag_n[temp - 1] == 0)
        flag_n[temp - 1] = 1;
    }
  }
  rep(i, n) {
    if (flag_n[i] == 0)
      ans++;
  }
  cout << ans << endl;

  return 0;
}

Fixed submission:
#include "bits/stdc++.h"
#include <cstring>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
  int n, k;
  int ans = 0;
  cin >> n >> k;
  vector<int> flag_n(n);
  rep(i, n) { flag_n[i] = 0; }
  rep(i, k) {
    int tcnt;
    cin >> tcnt;
    rep(j, tcnt) {
      int temp;
      cin >> temp;
      if (flag_n[temp - 1] == 0)
        flag_n[temp - 1] = 1;
    }
  }
  rep(i, n) {
    if (flag_n[i] == 0)
      ans++;
  }
  cout << ans << endl;

  return 0;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
  /* Input */
  int N, K;
  cin >> N >> K;

  vector<bool> snukes(N);
  rep(i, N) snukes.at(i) = false;

  rep(i, K) {
    int d;
    cin >> d;
    rep(j, d) {
      int a;
      cin >> a;
      snukes.at(a - 1) = true;
    }
  }
  int ans = 0;
  rep(i, K) if (!snukes.at(i)) ans++;

  /* Output */
  cout << ans << endl;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
  /* Input */
  int N, K;
  cin >> N >> K;

  vector<bool> snukes(N);
  rep(i, N) snukes.at(i) = false;

  rep(i, K) {
    int d;
    cin >> d;
    rep(j, d) {
      int a;
      cin >> a;
      snukes.at(a - 1) = true;
    }
  }
  int ans = 0;
  rep(i, N) if (!snukes.at(i)) ans++;

  /* Output */
  cout << ans << endl;

  return 0;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

void Main() {
  int n, k;
  cin >> n >> k;
  int d[k];
  int a[n][n];
  int count = 0;

  for (int i = 0; i < k; i++) {
    cin >> d[i];
    // printf("%d\n", d[i]);

    for (int j = 0; j < d[i]; j++) {
      cin >> a[i][j];
      // printf("%d ", a[i][j]);
    }
  }

  int s[n];

  for (int i = 0; i < n; i++) {
    s[i] = i + 1;
  }

  for (int i = 0; i < k; i++) {
    for (int j = 0; j < d[i]; j++) {
      for (int l = 0; l < n; l++) {
        if (a[i][j] == s[l]) {
          s[l] = 0;
        }
      }
    }
  }

  for (int i = 0; i < n; i++) {
    if (s[i] != 0)
      count++;
  }

  printf("%d", count);
}

int main() {
  std::cout << std::fixed << std::setprecision(15);
  Main();
}


Fixed submission:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

void Main() {
  int n, k;
  cin >> n >> k;
  int d[k];
  int a[k][n];
  int count = 0;

  for (int i = 0; i < k; i++) {
    cin >> d[i];
    // printf("%d\n", d[i]);

    for (int j = 0; j < d[i]; j++) {
      cin >> a[i][j];
      // printf("%d ", a[i][j]);
    }
  }

  int s[n];

  for (int i = 0; i < n; i++) {
    s[i] = i + 1;
  }

  for (int i = 0; i < k; i++) {
    for (int j = 0; j < d[i]; j++) {
      for (int l = 0; l < n; l++) {
        if (a[i][j] == s[l]) {
          s[l] = 0;
        }
      }
    }
  }

  for (int i = 0; i < n; i++) {
    if (s[i] != 0)
      count++;
  }

  printf("%d", count);
}

int main() {
  std::cout << std::fixed << std::setprecision(15);
  Main();
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define PRINT(V)                                                               \
  for (auto v : (V))                                                           \
  cout << v << " "
const long long INF = 1LL << 60;
using namespace std;
void debug_out() { cout << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

int main() {

  int n, k;
  cin >> n >> k;
  vector<int> x(n);
  rep(i, n) { x[i] = 0; }
  rep(i, k) {
    int d;
    cin >> d;
    vector<int> a(d);
    rep(i, d) {
      cin >> a[i];
      x[a[i]] = 1;
    }
  }
  int cnt = 0;
  rep(i, n) {
    if (x[i] == 0) {
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define PRINT(V)                                                               \
  for (auto v : (V))                                                           \
  cout << v << " "
const long long INF = 1LL << 60;
using namespace std;
void debug_out() { cout << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

int main() {

  int n, k;
  cin >> n >> k;
  vector<int> x(n);
  rep(i, n) { x[i] = 0; }
  rep(i, k) {
    int d;
    cin >> d;
    vector<int> a(d);
    rep(i, d) {
      cin >> a[i];
      x[a[i] - 1] = 1;
    }
  }
  int cnt = 0;
  rep(i, n) {
    if (x[i] == 0) {
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;

  vector<int> vec1(N, 0);

  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;

    vector<int> vec2(d);

    for (int j = 0; j < d; j++) {
      cin >> vec2.at(j);
    }

    for (int j = 0; j < d; j++) {
      vec1.at(vec2.at(j) - 1)++;
    }
  }

  int count = 0;

  for (int i = 0; i < K; i++) {
    if (vec1.at(i) == 0) {
      count++;
    }
  }

  cout << count << endl;
}

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

int main() {
  int N, K;
  cin >> N >> K;

  vector<int> vec1(N, 0);

  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;

    vector<int> vec2(d);

    for (int j = 0; j < d; j++) {
      cin >> vec2.at(j);
    }

    for (int j = 0; j < d; j++) {
      vec1.at(vec2.at(j) - 1)++;
    }
  }

  int count = 0;

  for (int i = 0; i < N; i++) {
    if (vec1.at(i) == 0) {
      count++;
    }
  }

  cout << count << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b;
  vector<int> m(a + 1, 0);
  m[0] = 1;
  for (int i = 0; i < b; i++) {
    cin >> c;
    vector<int> n(c);
    for (int j = 0; j < c; j++) {
      cin >> n[i];
      m[n[i]]++;
    }
  }
  int p = 0;
  for (int k = 0; k < a + 1; k++) {
    if (m[k] == 0)
      p++;
  }
  cout << p << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b;
  vector<int> m(a + 1, 0);
  m[0] = 1;
  for (int i = 0; i < b; i++) {
    cin >> c;
    vector<int> n(c);
    for (int j = 0; j < c; j++) {
      cin >> n[j];
      m[n[j]]++;
    }
  }
  int p = 0;
  for (int k = 0; k < a + 1; k++) {
    if (m[k] == 0)
      p++;
  }
  cout << p << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
// #define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL << 60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) FOR(i, 0, (n))
#define RREP(i, n) RFOR(i, 0, (n))
#define ITR(itr, mp) for (auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr, mp) for (auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i, a, b) ((a) <= (i) && (i) < (b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define SP << " " <<
typedef pair<int, int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);

  int n, k;
  cin >> n >> k;
  vec d(k);
  mat a(k);
  REP(i, k) {
    cin >> d[k];
    REP(j, d[k]) {
      int t;
      cin >> t;
      t--;
      a[i].push_back(t);
    }
  }

  vec b(n, 0);
  REP(i, a.size()) REP(j, a[i].size()) { b[a[i][j]]++; }

  int ans = 0;
  REP(i, n) {
    if (b[i] == 0)
      ans++;
  }

  cout << ans << endl;

  return 0;
}

Fixed submission:
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
// #define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL << 60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) FOR(i, 0, (n))
#define RREP(i, n) RFOR(i, 0, (n))
#define ITR(itr, mp) for (auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr, mp) for (auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i, a, b) ((a) <= (i) && (i) < (b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define SP << " " <<
typedef pair<int, int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);

  int n, k;
  cin >> n >> k;
  vec d(k);
  mat a(k);
  REP(i, k) {
    cin >> d[i];
    REP(j, d[i]) {
      int t;
      cin >> t;
      t--;
      a[i].push_back(t);
    }
  }

  vec b(n, 0);
  REP(i, a.size()) REP(j, a[i].size()) { b[a[i][j]]++; }

  int ans = 0;
  REP(i, n) {
    if (b[i] == 0)
      ans++;
  }

  cout << ans << endl;

  return 0;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <cstdlib>
#include <iostream>
#include <vector>

int main() {
  int N, K;
  std::cin >> N >> K;
  std::vector<int> okashi(N - 1, 0);

  for (int i = 0; i < K; i++) {
    int d;
    std::cin >> d;
    for (int j = 0; j < d; j++) {
      int A;
      std::cin >> A;
      okashi[A - 1]++;
    }
  }

  int ninzuu = 0;
  for (int i = 0; i < N; i++) {
    if (okashi[i] == 0) {
      ninzuu++;
    }
  }
  std::cout << ninzuu << std::endl;
}


Fixed submission:
#include <cstdlib>
#include <iostream>
#include <vector>

int main() {
  int N, K;
  std::cin >> N >> K;
  std::vector<int> okashi(N, 0);

  for (int i = 0; i < K; i++) {
    int d;
    std::cin >> d;
    for (int j = 0; j < d; j++) {
      int A;
      std::cin >> A;
      okashi[A - 1]++;
    }
  }

  int ninzuu = 0;
  for (int i = 0; i < N; i++) {
    if (okashi[i] == 0) {
      ninzuu++;
    }
  }
  std::cout << ninzuu << std::endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end)                                                     \
  for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end)                                                    \
  for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main() {
  int n, k;
  char dat[n];
  REP(i, n) { dat[i] = 0; }
  cin >> n >> k;
  REP(i, k) {
    int d;
    cin >> d;
    int a;
    REP(j, d) {
      cin >> a;
      dat[a - 1] = 1;
    }
  }
  int res = 0;
  REP(i, n) {
    if (dat[i] == 0) {
      res++;
    }
  }
  cout << res << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end)                                                     \
  for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end)                                                    \
  for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main() {
  int n, k;
  char dat[10000];
  REP(i, n) { dat[i] = 0; }
  cin >> n >> k;
  REP(i, k) {
    int d;
    cin >> d;
    int a;
    REP(j, d) {
      cin >> a;
      dat[a - 1] = 1;
    }
  }
  int res = 0;
  REP(i, n) {
    if (dat[i] == 0) {
      res++;
    }
  }
  cout << res << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, K;
  cin >> N >> K;
  int d, a;
  int count = 0;
  vector<int> sunuke(N, 0);
  for (int i = 0; i < K; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      cin >> a;
      sunuke.at(a - 1)++;
    }
  }
  for (int i = 0; i < K; i++) {
    if (sunuke.at(i) == 0) {
      count++;
    }
  }
  cout << count << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, K;
  cin >> N >> K;
  int d, a;
  int count = 0;
  vector<int> sunuke(N, 0);
  for (int i = 0; i < K; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      cin >> a;
      sunuke.at(a - 1)++;
    }
  }
  for (int i = 0; i < N; i++) {
    if (sunuke.at(i) == 0) {
      count++;
    }
  }
  cout << count << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;
// int choose2(ll x){
//	return x*(x-1)/2;}
const int INF = 1001001001;

int main() {
  int N, K;
  int ans = 0;
  cin >> N >> K;
  vector<int> d(N);
  vector<int> A(N);
  vector<int> B(N);
  rep(i, N) B[i] = 0;
  rep(i, K) {
    cin >> d[i];
    rep(j, d[i]) {
      cin >> A[j];
      B[A[j] - 1]++;
    }
  }
  rep(i, N) {
    if (B[i] == 0)
      ans++;
  }
  cout << ans;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;
// int choose2(ll x){
//	return x*(x-1)/2;}
const int INF = 1001001001;

int main() {
  int N, K;
  int ans = 0;
  cin >> N >> K;
  vector<int> d(K);
  vector<int> A(N);
  vector<int> B(N);
  rep(i, N) B[i] = 0;
  rep(i, K) {
    cin >> d[i];
    rep(j, d[i]) {
      cin >> A[j];
      B[A[j] - 1]++;
    }
  }
  rep(i, N) {
    if (B[i] == 0)
      ans++;
  }
  cout << ans;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0, N, K, d, a;
  cin >> N >> K;
  vector<bool> people(N, 1);

  for (int i = 0; i < K; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      cin >> a;
      if (people.at(a - 1))
        people.at(a - 1) = 0;
    }
  }

  for (int i = 0; i < K; i++) {
    if (people.at(i))
      ans++;
  }

  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0, N, K, d, a;
  cin >> N >> K;
  vector<bool> people(N, 1);

  for (int i = 0; i < K; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      cin >> a;
      if (people.at(a - 1))
        people.at(a - 1) = 0;
    }
  }

  for (int i = 0; i < N; i++) {
    if (people.at(i))
      ans++;
  }

  cout << ans << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;

  vector<int> children;
  for (int i = 0; i < N; i++)
    children.at(i) = i + 1;

  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;

    for (int j = 0; j < d; j++) {
      int num;
      cin >> num;

      for (int k = 0; k < children.size(); k++) {
        if (children.at(k) == num)
          children.at(k) = 0;
      }
    }
  }

  int count;
  for (int i = 0; i < children.size(); i++) {
    if (children.at(i) != 0)
      count++;
  }
  cout << count << endl;
}


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

int main() {
  int N, K;
  cin >> N >> K;

  vector<int> children(N);
  for (int i = 0; i < N; i++)
    children.at(i) = i + 1;

  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;

    for (int j = 0; j < d; j++) {
      int num;
      cin >> num;

      for (int k = 0; k < children.size(); k++) {
        if (children.at(k) == num)
          children.at(k) = 0;
      }
    }
  }

  int count;
  for (int i = 0; i < children.size(); i++) {
    if (children.at(i) != 0)
      count++;
  }
  cout << count << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>

using namespace std;

int N, K;

int main() {
  cin >> N >> K;
  int d[K], A[K][N];
  int su[N + 1];
  int sum = 0;
  for (int i = 1; i <= N; i++) {
    su[i] = 1;
  }

  for (int i = 1; i <= K; i++) {
    cin >> d[i];
    for (int j = 1; j <= d[i]; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 1; i <= K; i++) {
    for (int j = 1; j <= d[i]; j++) {
      su[A[i][j]] = 0;
    }
  }
  for (int i = 1; i <= N; i++) {
    sum += su[i];
  }
  cout << sum << endl;
}


Fixed submission:
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>

using namespace std;

int N, K;

int main() {
  cin >> N >> K;
  int d[K + 1], A[K + 1][N + 1];
  int su[N + 1];
  int sum = 0;
  for (int i = 1; i <= N; i++) {
    su[i] = 1;
  }

  for (int i = 1; i <= K; i++) {
    cin >> d[i];
    for (int j = 1; j <= d[i]; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 1; i <= K; i++) {
    for (int j = 1; j <= d[i]; j++) {
      su[A[i][j]] = 0;
    }
  }
  for (int i = 1; i <= N; i++) {
    sum += su[i];
  }
  cout << sum << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> d(k);
  vector<int> ansv(n, 1);
  for (int i = 0; i < k; i++) {
    cin >> d.at(i);
    vector<int> a(d.at(i));
    for (int j = 0; j < d.at(i); j++) {
      cin >> a.at(j);
    }

    for (int j = 0; j < d.at(i); j++) {
      ansv.at(a.at(j) - 1) = 0;
    }
  }
  int ans = 0;

  for (int i = 0; i < k; i++) {
    ans += ansv.at(i);
  }

  cout << ans << endl;
}

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

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> d(k);
  vector<int> ansv(n, 1);
  for (int i = 0; i < k; i++) {
    cin >> d.at(i);
    vector<int> a(d.at(i));
    for (int j = 0; j < d.at(i); j++) {
      cin >> a.at(j);
    }

    for (int j = 0; j < d.at(i); j++) {
      ansv.at(a.at(j) - 1) = 0;
    }
  }
  int ans = 0;

  for (int i = 0; i < n; i++) {
    ans += ansv.at(i);
  }

  cout << ans << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<bool> cnt(N);
  int d;
  int count = 0;
  for (int i = 0; i < K; i++) {
    cin >> d;
    vector<int> A(d);
    for (int j = 0; j < d; j++) {
      cin >> A.at(j);
      cnt.at(A.at(j) - 1) = true;
    }
  }
  for (int i = 0; i < K; i++) {
    if (cnt.at(i) == false) {
      count++;
    }
  }
  cout << count << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<bool> cnt(N);
  int d;
  int count = 0;
  for (int i = 0; i < K; i++) {
    cin >> d;
    vector<int> A(d);
    for (int j = 0; j < d; j++) {
      cin >> A.at(j);
      cnt.at(A.at(j) - 1) = true;
    }
  }
  for (int i = 0; i < N; i++) {
    if (cnt.at(i) == false) {
      count++;
    }
  }
  cout << count << endl;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i < n; i++)
#define ll long long
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  int d[k];
  int ans = 0;
  map<int, int> mp;
  rep(i, n) {
    cin >> d[i];
    int tmp[d[i]];
    rep(j, d[i]) {
      cin >> tmp[j];
      mp[tmp[j] - 1]++;
    }
  }
  for (auto p : mp) {
    ans++;
  }
  cout << n - ans;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i < n; i++)
#define ll long long
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  int d[k];
  int ans = 0;
  map<int, int> mp;
  rep(i, k) {
    cin >> d[i];
    int tmp[d[i]];
    rep(j, d[i]) {
      cin >> tmp[j];
      mp[tmp[j] - 1]++;
    }
  }
  for (auto p : mp) {
    ans++;
  }
  cout << n - ans;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ios                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
const int mod = 1000000007;
int main() {
  int n, k, i, d, j, x, c = 0;
  cin >> n >> k;
  int f[k];
  for (i = 0; i < n; i++)
    f[i] = 0;
  for (i = 0; i < k; i++) {
    cin >> d;
    for (j = 0; j < d; j++) {
      cin >> x;
      f[x - 1] = 1;
    }
  }
  for (i = 0; i < n; i++) {
    if (f[i] == 0)
      c++;
  }
  cout << c;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ios                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
const int mod = 1000000007;
int main() {
  int n, k, i, d, j, x, c = 0;
  cin >> n >> k;
  int f[n];
  for (i = 0; i < n; i++)
    f[i] = 0;
  for (i = 0; i < k; i++) {
    cin >> d;
    for (j = 0; j < d; j++) {
      cin >> x;
      f[x - 1] = 1;
    }
  }
  for (i = 0; i < n; i++) {
    if (f[i] == 0)
      c++;
  }
  cout << c;
  return 0;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define put(i) cout << fixed << i << endl
using namespace std;
using ll = long long;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> d(k);
  map<int, int> mp;

  rep(i, k) {
    cin >> d[i];
    int a[k][d[k]];
    rep(j, d[i]) {
      cin >> a[i][j];
      mp[a[i][j]]++;
    }
  }

  put(n - mp.size());
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define put(i) cout << fixed << i << endl
using namespace std;
using ll = long long;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> d(k);
  map<int, int> mp;

  rep(i, k) {
    cin >> d[i];
    int a[k][d[i]];
    rep(j, d[i]) {
      cin >> a[i][j];
      mp[a[i][j]]++;
    }
  }

  put(n - mp.size());
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a) (a).begin(), (a).end()

const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;

template <class T> void Swap(T &r, T &l) {
  T tmp = r;
  r = l;
  l = tmp;
}

template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec)
    is >> x; // for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}

ll bi(ll num) {
  if (num == 1)
    return 1;
  ll ret = bi(num - 1);
  ret = (ret * num) % mod;
  return ret;
}

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> d(n);
  // vector<vector<ll>> a(k);
  vector<ll> s(n, 0);

  for (ll i = 0; i < k; i++) {
    cin >> d[i];
    for (ll j = 0; j < d[i]; j++) {
      ll a;
      cin >> a;
      s[a - 1]++;
    }
  }

  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    if (s[i] == 0)
      ans++;
  }

  cout << ans;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a) (a).begin(), (a).end()

const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;

template <class T> void Swap(T &r, T &l) {
  T tmp = r;
  r = l;
  l = tmp;
}

template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec)
    is >> x; // for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}

ll bi(ll num) {
  if (num == 1)
    return 1;
  ll ret = bi(num - 1);
  ret = (ret * num) % mod;
  return ret;
}

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> d(k);
  // vector<vector<ll>> a(k);
  vector<ll> s(n, 0);

  for (ll i = 0; i < k; i++) {
    cin >> d[i];
    for (ll j = 0; j < d[i]; j++) {
      ll a;
      cin >> a;
      s[a - 1]++;
    }
  }

  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    if (s[i] == 0)
      ans++;
  }

  cout << ans;
}
Problem p02688 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K, ans = 0;
  cin >> N >> K;
  vector<int> vec(K + 1, 0);
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int a;
      cin >> a;
      vec[a - 1] = 1;
    }
  }
  for (int i = 0; i < N; i++) {
    if (vec[i] == 0) {
      ans++;
    }
  }
  cout << ans << endl;
}


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

int main() {
  int N, K, ans = 0;
  cin >> N >> K;
  vector<int> vec(N, 0);
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int a;
      cin >> a;
      vec[a - 1] = 1;
    }
  }
  for (int i = 0; i < N; i++) {
    if (vec[i] == 0) {
      ans++;
    }
  }
  cout << ans << endl;
}