alexjercan/bugnet huggingface dataset:
Problem p02688 (C++) — buggy submission, verdict: 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 - 1) = vec.at(l - 1) + 1;
    }
  }
  int A = 0;
  for (int i = 0; i < N; i++) {
    if (vec.at(i) == 0) {
      A++;
    }
  }
  cout << A;
}

Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)


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)++;
    }
  }
  int A = 0;
  for (int i = 0; i < N; i++) {
    if (vec.at(i) == 0) {
      A++;
    }
  }
  cout << A;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K, karicount, count = 0;

  cin >> N >> K;

  vector<int> d(K);

  vector<int> NIN(N, 0);

  for (int i = 0; i < K; i++) {
    cin >> d[i];
    for (int j = 0; j < d[i]; j++) {
      cin >> karicount;
      NIN[karicount - 1] = 1;
    }
  }

  for (int i = 0; i < N; i++) {
    if (NIN[i] == 0)
      count++;
  }

  cout << count << endl;

  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  long N, K, count = 0;

  cin >> N >> K;

  vector<long> d(K);

  vector<long> NIN(N, 0);

  vector<vector<long>> A(K, vector<long>(K, 0));

  for (long i = 0; i < K; i++) {
    cin >> d[i];
    for (long j = 0; j < d[i]; j++) {
      cin >> A[i][j];
      NIN[A[i][j] - 1] = 1;
    }
  }

  for (long i = 0; i < N; i++) {
    if (NIN[i] == 0)
      count++;
  }

  cout << count << flush;

  return 0;
}
Problem p02688 (C++) — buggy submission, verdict: 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);
      d--;
    }
  }
  cout << n - s.size() << endl;
  return 0;
}

Error: TLE

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);
    }
  }
  cout << n - s.size() << endl;
  return 0;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>

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

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}

int main() {
  int N, K, t;

  cin >> N >> K;
  vector<int> Dk(K, 0);
  vector<bool> bucket(110, false);

  rep(i, K) {
    cin >> Dk.at(i);
    rep(j, Dk.at(i)) {
      cin >> t;
      if (bucket.at(t - 1) == false)
        bucket.at(t - 1) = true;
    }
  }

  int cnt = 0;
  rep(i, N) {
    if (!bucket.at(i))
      ++cnt;
  }

  cout << cnt << endl;

  return 0;
}

Error: 0

Fixed submission:


#include <algorithm>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>

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

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}

int main() {
  int N, K, t;

  cin >> N >> K;
  vector<int> Dk(N, 0);
  vector<bool> bucket(110, false);

  rep(i, K) {
    cin >> Dk.at(i);
    rep(j, Dk.at(i)) {
      cin >> t;
      if (bucket.at(t - 1) == false)
        bucket.at(t - 1) = true;
    }
  }

  int cnt = 0;
  rep(i, N) {
    if (!bucket.at(i))
      ++cnt;
  }

  cout << cnt << endl;

  return 0;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> d(K);
  vector<vector<int>> A(K);
  for (int i = 0; i < K; ++i) {
    int dt;
    cin >> dt;
    d[i] = dt;
    A[i].reserve(d[i]);
    for (int j = 0; j < d[i]; ++j) {
      int temp;
      cin >> temp;
      --temp;
      A[i][j] = temp;
    }
  }

  vector<int> num(N, 0);
  for (int i = 0; i < K; ++i)
    for (int j = 0; j < d[i]; ++j)
      ++num[A[i][j]];
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    if (num[i] == 0)
      ++ans;
  }
  cout << ans << endl;
  return 0;
}


Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> d(N);
  vector<vector<int>> A(K);
  for (int i = 0; i < K; ++i) {
    cin >> d[i];
    A[i].reserve(d[i]);
    for (int j = 0; j < d[i]; ++j) {
      int temp;
      cin >> temp;
      --temp;
      A[i][j] = temp;
    }
  }

  vector<int> num(N, 0);
  for (int i = 0; i < K; ++i)
    for (int j = 0; j < d[i]; ++j)
      ++num[A[i][j]];
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    if (num[i] == 0)
      ++ans;
  }
  cout << ans << endl;
  return 0;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

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

int main() {
  int n, k;
  cin >> n >> k;
  int d[k];
  map<int, int> m;
  rep(i, k) {
    cin >> d[i];
    int A[k][d[i]];
    rep(j, d[i]) {
      cin >> A[i][j];
      m[A[i][j]]++;
    }
  }
  int count = 0;
  for (int i = 1; i <= n; i++) {
    if (m[i] == 0) {
      count++;
    }
  }

  cout << count << endl;

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>

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

int main() {
  int n, k;
  cin >> n >> k;
  int d[k];
  map<int, int> m;
  rep(i, k) {
    cin >> d[i];
    int A[k][d[i]];
    rep(j, d[i]) {
      cin >> A[i][j];
      m[A[i][j]]++;
    }
  }
  int count = 0;
  rep(i, n) {
    if (m[i] == 0) {
      count++;
    }
  }

  cout << count << endl;

  return 0;
}
Problem p02688 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <vector>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> snukes(N, 0);
  int i;
  int d;
  for (i = 0; i < K; i++) {
    cin >> d;
    int j;
    while (d > 0) {
      cin >> j;
      snukes[j - 1]++;
      d--;
    }
  }
  int total = 0;
  for (i = 0; i < N; i++) {
    if (snukes[i] == 0)
      total++;
  }
  cout << total << "\\n";
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <vector>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> snukes(N, 0);
  int i;
  int d;
  for (i = 0; i < K; i++) {
    cin >> d;
    int j;
    while (d >= 0) {
      cin >> j;
      snukes[j - 1]++;
    }
  }
  for (i = 0; i < N; i++) {
    if (snukes[i] == 0)
      cout << i + 1 << "\\n";
  }
  return 0;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

// テンプレ
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  rep(i, K) {
    int d;
    cin >> d;
    rep(j, d) {
      int x;
      cin >> x;
      a.at(x - 1)++;
    }
  }
  int ans = 0;
  rep(i, N) {
    if (a.at(i) == 0) {
      ans++;
    }
  }
  cout << ans << endl;
}

Error: -6
terminate called after throwing an instance of 'std::length_error'
  what():  cannot create std::vector larger than max_size()


Fixed submission:

// テンプレ
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N, K;
  vector<int> a(N);
  cin >> N >> K;
  rep(i, K) {
    int d;
    cin >> d;
    rep(j, d) {
      int x;
      cin >> x;
      a.at(x - 1)++;
    }
  }
  int ans = 0;
  rep(i, N) {
    if (a.at(i) == 0) {
      ans++;
    }
  }
  cout << ans << endl;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int N, K;
  cin >> N >> K;
  int n;
  int m;
  int sum = 0;
  vector<int> C(N);
  for (int i = 0; i < N; i++) {
    C.at(i) = 0;
  }
  for (int i = 0; i < N; i++) {
    cin >> n;
    for (int j = 0; j < n; j++) {
      cin >> m;
      C.at(m - 1) = 1;
    }
  }
  for (int i = 0; i < N; i++) {
    if (C.at(i) == 0) {
      sum++;
    }
  }
  cout << sum << endl;
}

Error: 0

Fixed submission:

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> d(K); // 各お菓子を持っている人数
  vector<vector<int>> A(K, vector<int>(N)); //
  vector<int> c(N); // 入ったら１、入ってなかったら０
  int sum = 0;
  int m = 0;

  for (int i = 0; i < K; i++) {
    c.at(i) = 0;
  }

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

  for (int i = 0; i < K; i++) {
    for (int j = 0; j < d.at(i); j++) {
      m = A.at(i).at(j);
      c.at(m - 1) = 1;
    }
  }

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

  cout << sum << endl;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <fstream>
#include <functional>
#include <iostream>
#include <stdio.h>
#include <tuple>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, k, d, tmp, ans = 0;
  cin >> n >> k;
  int a[n];
  REP(i, n) a[i] = 0;

  REP(i, k) {
    d = 0;
    cin >> d;
    REP(j, d) {
      cin >> tmp;
      a[tmp - 1]++;
    }
  }

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

  cout << ans;
}


Error: WA

Fixed submission:

#include <algorithm>
#include <cmath>
#include <fstream>
#include <functional>
#include <iostream>
#include <stdio.h>
#include <tuple>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

int main() {
  // input from txt ***提出時に削除***
  std::ifstream in("input.txt");
  std::cin.rdbuf(in.rdbuf());

  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, k, d, tmp, ans = 0;
  cin >> n >> k;
  int a[n];
  REP(i, n) a[i] = 0;

  REP(i, k) {
    d = 0;
    cin >> d;
    REP(j, d) {
      cin >> tmp;
      a[tmp]++;
    }
  }

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

  cout << ans;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

// #define _GLIBCXX_DEBUG
#include <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod = 1e+9 + 7;

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


Error: 0

Fixed submission:

// #define _GLIBCXX_DEBUG
#include <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod = 1e+9 + 7;

int main() {
  ll n, k;
  cin >> n >> k;
  map<ll, ll> mp;
  rep(i, k) {
    ll d;
    cin >> d;
    vector<ll> a(d);
    rep(j, d) {
      cin >> a[i];
      mp[a[i]]++;
    }
  }
  ll ans = 0;
  for (auto p : mp) {
    ans++;
  }
  cout << n - ans << endl;
}
Problem p02688 (C++) — buggy submission, verdict: 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(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;
}


Error: WA

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(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;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

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

  rep(i, k) {
    int d;
    cin >> d;
    rep(j, d) {
      ll x;
      cin >> x;
      v[x - 1] = 1;
    }
  }
  ll ans = 0;
  rep(i, n) if (v[i] == 0) ans++;
  std::cout << ans << std::endl;
  return 0;
}


Error: -6
terminate called after throwing an instance of 'std::length_error'
  what():  cannot create std::vector larger than max_size()


Fixed submission:

#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

int main() {
  int n, k;
  vector<ll> v(n, 0);
  cin >> n >> k;
  rep(i, k) {
    int d;
    cin >> d;
    rep(j, d) {
      ll x;
      cin >> x;
      v[x - 1] = 1;
    }
  }
  ll ans = 0;
  rep(i, n) if (v[i] == 0) ans++;
  std::cout << ans << std::endl;
  return 0;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#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;
}


Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)


Fixed submission:

#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;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string.h>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main() {
  int N, K;
  cin >> N >> K;
  vector<vector<int>> A(K, vector<int>(N, 0));
  int d, a;
  rep(0, i, K) {
    cin >> d;
    rep(0, j, d) {
      cin >> a;
      a--;
      A.at(i).at(a) = 1;
    }
  }
  int ans = 0;
  rep(0, i, N) {
    int f = 0;
    rep(0, j, K) {
      if (A.at(j).at(i) != 0) {
        f++;
      }
    }
    if (f == 0) {
      ans++;
    }
  }
  cout << ans << endl;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string.h>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main() {
  int N, K;
  cin >> N >> K;
  vector<vector<int>> A(N, vector<int>(N, 0));
  int d, a;
  rep(0, i, K) {
    cin >> d;
    rep(0, j, d) {
      cin >> a;
      a--;
      A.at(i).at(a) = 1;
    }
  }
  int ans = 0;
  rep(0, i, N) {
    bool f = true;
    rep(0, j, N) {
      if (A.at(j).at(i) != 0) {
        f = false;
      }
    }
    if (f) {
      ans++;
    }
  }
  cout << ans << endl;
}
Problem p02688 (C++) — buggy submission, verdict: 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 < N; i++) {
    if (people.at(i))
      ans++;
  }

  cout << ans << endl;
}

Error: 0

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 < K; i++) {
    if (people.at(i))
      ans++;
  }

  cout << ans << endl;
}
Problem p02688 (C++) — buggy submission, verdict: 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(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;
}

Error: WA

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(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;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
int d[10000];
int A[10000][10000];
int main() {
  int N, K;
  cin >> N >> K;

  for (int i = 0; i < K; i++) {
    cin >> d[i];
    for (int j = 0; j < d[i]; j++) {
      cin >> A[i][j];
    }
  }
  ll sum = 0;
  vector<int> b(N);
  for (int i = 0; i < K; i++) {

    for (int j = 0; j < d[i]; j++) {
      b[A[i][j] - 1] += 1;
    }
  }

  for (int i = 0; i < N; i++) {
    if (b[i] == 0)
      sum++;
  }

  cout << sum;
  return 0;
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;

int main() {
  int N, K;
  cin >> N >> K;
  int d[10000];
  int A[10000][10000];
  for (int i = 0; i < K; i++) {
    cin >> d[i];
    for (int j = 0; j < d[i]; j++) {
      cin >> A[i][j];
    }
  }
  ll sum = 0;
  vector<int> b(N);
  for (int i = 0; i < K; i++) {

    for (int j = 0; j < d[i]; j++) {
      b[A[i][j] - 1] += 1;
    }
  }

  for (int i = 0; i < N; i++) {
    if (b[i] == 0)
      sum++;
  }

  cout << sum;
  return 0;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> d(K);

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

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

  vector<int> b(N);
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < d[i]; j++) {
      b[A[i][j] - 1] += 1;
    }
  }
  int sum = 0;
  for (int i = 0; i < N; i++) {
    if (b[i] == 0)
      sum += 1;
  }
  cout << sum;
  return 0;
}


Error: -11

Fixed submission:

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> d(K);
  int A[10000][10000];

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

  vector<int> b(N);
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < d[i]; j++) {
      b[A[i][j] - 1] += 1;
    }
  }
  int sum = 0;
  for (int i = 0; i < N; i++) {
    if (b[i] == 0)
      sum += 1;
  }
  cout << sum;
  return 0;
}