alexjercan/bugnet huggingface dataset:
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n, k;
  int d = 0;
  cin >> n >> k;
  vector<int> v(n, 1);
  vector<int> vec(10000);

  for (int i = 0; i < k; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      cin >> vec.at(j);
      v.at(vec.at(j) - 1) = 0;
    }
  }
  int value_to_remove = 0;
  v.erase(std::remove(v.begin(), v.end(), value_to_remove), v.end());
  cout << v.size() << endl;
}

Error: 0

Fixed submission:

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

int main() {
  int n, k;
  int d = 0;
  cin >> n >> k;
  vector<int> v(n);
  iota(v.begin(), v.end(), 1);
  vector<int> vec(10000);

  for (int i = 0; i < k; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      cin >> vec.at(j);
      if (v.at(j + 1) == vec.at(j)) {
        v.erase(v.begin() + j);
      }
    }
  }
  cout << v.size() << endl;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n, k, d;
  cin >> n >> k;
  vector<int> snk(n);
  for (int i = 0; i < n; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      int a;
      cin >> a;
      snk.at(a - 1)++;
    }
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (snk.at(i) == 0) {
      count++;
    }
  }
  cout << count << endl;
}

Error: 0

Fixed submission:

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

int main() {
  int n, k, d;
  cin >> n >> k;
  vector<int> snk(100);
  for (int i = 0; i < n; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      int a;
      cin >> a;
      snk.at(a) = 1;
    }
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (snk.at(i) == 0) {
      count++;
    }
  }
  cout << count - 1 << endl;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

int n, k, d, a;
int counter = 0;

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

  vector<int> num(n);
  for (int i = 0; i < n; i++) {
    num[i] = 0;
  }

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

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

  cout << counter << endl;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

int n, k;

int main() {
  cin >> n >> k;
  vector<int> d(n);
  int a;
  vector<int> num(n);
  int counte = 0;

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

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

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

  cout << counte << 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 d;
  int a;
  vector<bool> S(N, true);
  for (int i = 0; i < K; i++) {
    cin >> d;
    for (int i = 0; i < d; i++) {
      cin >> a;
      S.at(a - 1) = false;
    }
  }
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i)) {
      count++;
    }
  }
  cout << count << endl;
}


Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector<bool>::_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;
  int d;
  int a;
  vector<bool> S(N, true);
  for (int i = 0; i < K; i++) {
    cin >> d;
    for (int i = 0; i < d; i++) {
      cin >> a;
      S.at(a) = false;
    }
  }
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i)) {
      count++;
    }
  }
  cout << count << endl;
}
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> S(N);
  for (int i = 0; i < N; i++) {
    S.at(i) = i + 1;
  }

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

  for (int i = 0; i < K; i++) {
    for (int j = 0; j < A.at(i).size(); j++) {
      for (int k = 0; k < N; k++) {
        if (S.at(k) == A.at(i).at(j)) {
          S.at(k) = 0;
        }
      }
    }
  }

  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i) != 0) {
      cnt++;
    }
  }
  cout << cnt << 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> S(N);
  for (int i = 0; i < N; i++) {
    S.at(i) = i + 1;
  }
  for (int i = 0; i < N; i++) {
    cout << S.at(i);
  }

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

  //   for(int i = 0; i < K; i++) {
  //       for(int j = 0; j < A.at(i).size(); j++) {
  //           for(int k = 0; k < N; k++) {
  //               if(S.at(k) == A.at(i).at(j)) {
  //                   S.at(k) = 0;
  //               }
  //           }
  //       }
  //   }

  //   int cnt = 0;
  //   for(int i = 0; i < N; i++) {
  //       if(S.at(i) != 0) {
  //           cnt++;
  //       }
  //   }
  //   cout << cnt <<endl;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long INF = 1LL << 60;

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

  vector<bool> have(N, false);
  rep(i, K) rep(j, d[i]) { have[A[i][j]] = true; }

  int res = 0;
  for (int i = 1; i <= N; i++) {
    if (!have[i])
      res++;
  }
  cout << res << endl;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long INF = 1LL << 60;

int main() {
  // input
  int N, K;
  cin >> N >> K;
  vector<int> d(K);
  vector<vector<int>> A(K, vector<int>(N));
  rep(i, K) {
    cin >> d[i];
    rep(j, d[i]) { cin >> A[i][j]; }
  }
  // solve
  vector<bool> have(N, false);
  rep(i, K) rep(j, K) { have[A[i][j]] = true; }

  int res = 0;
  for (int i = i; i <= N; i++) {
    if (!have[i])
      res++;
  }
  cout << res << endl;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
// 型名省略
typedef long long ll;
typedef vector<long long> vl;
typedef vector<vector<long long>> vvl;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
// マクロ
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define rep2(i, x, n) for (ll i = (ll)x; i < (ll)n; i++)
#define all(A) A.begin(), A.end()
// 正誤判定
void Yes(bool ans) { cout << (ans ? "Yes" : "No") << endl; }
void YES(bool ans) { cout << (ans ? "YES" : "NO") << endl; }

// main関数
int main() {
  ll n, k;
  cin >> n >> k;
  vl have(n), d(k);
  vvl a(k, vl(n));
  rep(i, k) {
    cin >> d[i];
    rep(j, d[i]) {
      cin >> a[i][j];
      a[i][j]--;
      have[a[i][j]]++;
    }
  }

  ll ans = 0;
  rep(i, n) {
    if (have[i] == 0)
      ans++;
  }

  cout << ans << endl;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
// 型名省略
typedef long long ll;
typedef vector<long long> vl;
typedef vector<vector<long long>> vvl;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
// マクロ
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define rep2(i, x, n) for (ll i = (ll)x; i < (ll)n; i++)
#define all(A) A.begin(), A.end()
// 正誤判定
void Yes(bool ans) { cout << (ans ? "Yes" : "No") << endl; }
void YES(bool ans) { cout << (ans ? "YES" : "NO") << endl; }

// main関数
int main() {
  ll n, k;
  cin >> n >> k;
  vl have(n), d(k);
  vvl a(n, vl(k));
  rep(i, k) {
    cin >> d[i];
    rep(j, d[i]) {
      cin >> a[i][j];
      a[i][j]--;
      have[a[i][j]]++;
    }
  }

  ll ans = 0;
  rep(i, n) {
    if (have[i] == 0)
      ans++;
  }

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

// I'm a f*cking looser
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fasino                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);
#define asc(A) sort(A.begin(), A.end())
#define dsc(A) sort(A.begin(), A.end(), greater<ll>())
#define input(A, N)                                                            \\
  for (ll i = 0; i < N; i++)                                                   \\
    cin >> A[i];
int main() {
  fasino
#ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
#endif
      ll n,
      k, count = 0;
  cin >> n >> k;
  bool A[n];
  memset(A, false, sizeof A);
  for (ll i = 0; i < k; i++) {
    ll tm, tmp;
    cin >> tm;
    for (ll j = 0; j < tm; j++) {
      cin >> tmp;
      if (!A[tmp - 1])
        A[tmp - 1] = true;
    }
  }
  for (ll i = 0; i < n; i++)
    if (A[i] == false)
      count++;
  cout << count;
  return 0;
}

Error: WA

Fixed submission:

// I'm a f*cking looser
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fasino                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);
#define asc(A) sort(A.begin(), A.end())
#define dsc(A) sort(A.begin(), A.end(), greater<ll>())
#define input(A, N)                                                            \\
  for (ll i = 0; i < N; i++)                                                   \\
    cin >> A[i];
int main() {
  fasino
#ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
#endif
      ll n,
      k, count = 0;
  cin >> n >> k;
  bool flag[k + 1];
  memset(flag, false, sizeof flag);
  for (int i = 0; i < k; i++) {
    int dk, tm;
    cin >> dk;
    for (int j = 0; j < dk; j++) {
      cin >> tm;
      flag[tm] = true;
    }
  }
  for (int i = 1; i <= k; i++)
    if (flag[i] == false)
      count++;
  cout << count;
  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> vec(n);

  int d;
  for (int i = 0; i < k; ++i) {
    cin >> d;
    vector<int> a(d);
    for (int j = 0; j < d; ++j) {
      cin >> a[j];
      vec[a[j] - 1]++;
    }
  }
  int count = 0;
  for (int i = 0; i < n; ++i) {
    if (vec[i] == 0) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}

Error: 0

Fixed submission:

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

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

  int d;
  for (int i = 0; i < k; ++i) {
    cin >> d;
    if (d != 0) {
      vector<int> a(d);
      for (int j = 0; j < d; ++j) {
        cin >> a[i];
        vec[a[i] - 1]++;
      }
    }
  }
  int count = 0;
  for (int i = 0; i < n; ++i) {
    if (vec[i] == 0) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

// C ++
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <valarray>
#include <vector>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using p = pair<int, int>;
#define N 101

int main() {
  int n, k, ans = 0;
  cin >> n >> k;
  // cout << n << k << endl;

  vector<int> d(N), temp(n);
  vector<vector<int>> a(k, vector<int>(N));

  rep(i, k) {
    cin >> d.at(i);
    // cout << d.at(i) << endl;

    rep(j, d.at(i)) {
      cin >> a.at(i).at(j);
      temp.at(a.at(i).at(j) - 1) += 1;
      // cout << a.at(i).at(j);
    }
    // cout << endl;
  }

  rep(i, n) {
    if (temp.at(i) == 0)
      ans++;
  }

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

Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using p = pair<int, int>;
#define N 101

int main() {
  int n, k, ans = 0;
  cin >> n >> k;
  // cout << n << k << endl;

  vector<int> d(N), num(N);
  vector<vector<int>> a(k, vector<int>(k));

  rep(i, k) {
    cin >> d[i];
    // cout << d[i] << endl;

    rep(j, d[i]) {
      cin >> a[i][j];
      num[a[i][j] - 1] += 1;
      // cout << a[i][j];
    }
    // cout << endl;
  }

  rep(i, k) {
    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;
int main() {
  int N, K;
  int d;
  int e;
  int c;
  cin >> N >> K;
  vector<int> a(N);
  for (int j = 0; j < N; j++) {
    a.at(j) = 0;
  }
  for (int l = 0; l < K; l++) {
    cin >> d;
    for (int i = 0; i < d; i++) {
      cin >> e;
      a.at(e - 1) = 1;
    }
  }
  for (int m = 0; m < N; m++) {
    if (a.at(m) == 0)
      c++;
  }
  cout << c << endl;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  int d;
  int e;
  int c;
  cin >> N >> K;
  vector<int> a(N);
  for (int j = 0; j < K; j++) {
    a.at(j) = 0;
  }
  for (int l = 0; l < K; l++) {
    cin >> d;
    for (int i = 0; i < d; i++) {
      cin >> e;
      a.at(e - 1) = 1;
    }
  }
  for (int m = 0; m < N; m++) {
    if (a.at(m) == 0)
      c++;
  }
  cout << c << endl;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define FAST                                                                   \\
  ios_base ::sync_with_stdio(false);                                           \\
  cin.tie(NULL);

int main() {
  FAST;
  int N, K, d, A;
  cin >> N >> K;
  vector<int> X(N, 1);
  for (int i = 0; i < K; i++) {
    cin >> d;
    for (int i = 0; i < d; i++) {
      cin >> A;
      X.at(A - 1) = 0;
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += X.at(i);
  }
  cout << ans << endl;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define FAST                                                                   \\
  ios_base ::sync_with_stdio(false);                                           \\
  cin.tie(NULL);

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

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> d(K);
  vector<vector<int>> A(K, vector<int>(N));
  vector<bool> ans(N, true);
  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);
      ans.at(A.at(i).at(j) - 1) = false;
    }
  }
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (ans.at(i))
      count++;
  }
  cout << count << endl;
}


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


Fixed submission:

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

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

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

int main() {
  ll N, K, d, A, cnt = 0;
  cin >> N >> K;
  vector<bool> S(N, 0);
  for (ll i = 0; i < K; i++) {
    cin >> d;
    for (ll j = 0; j < d; j++) {
      cin >> A;
      S.at(A - 1) = 1;
    }
  }
  for (ll i = 0; i < N; i++) {
    if (S.at(i) == 0)
      cnt++;
  }
  cout << cnt << endl;
}

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


Fixed submission:

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

int main() {
  ll N, K, d, B, cnt = 0;
  cin >> N >> K;
  vector<bool> A(K, 0);
  for (ll i = 0; i < K; i++) {
    cin >> d;
    for (ll j = 0; j < d; j++) {
      cin >> B;
      A.at(B - 1) = 1;
    }
  }
  for (ll i = 0; i < K; i++) {
    if (A.at(i) == 0)
      cnt++;
  }
  cout << cnt << 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 arr[n];
  for (int i = 0; i < n; i++) {
    arr[i] = 0;
  }

  for (int i = 0; i < k; i++) {
    int n1;
    cin >> n1;

    for (int j = 0; j < n1; j++) {
      int x;
      cin >> x;
      arr[x - 1]++;
    }
  }

  int ans = 0;

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

  printf("%d\\n", ans);

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

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

  int arr[n];
  for (int i = 0; i < k; i++) {
    arr[i] = 0;
  }

  for (int i = 0; i < k; i++) {
    int n1;
    cin >> n1;

    for (int j = 0; j < n1; j++) {
      int x;
      cin >> x;
      arr[x - 1]++;
    }
  }

  int ans = 0;

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

  printf("%d\\n", ans);

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

#include <iostream>
#include <vector>
using namespace std;

int main(void) {

  int N, M;
  cin >> N >> M; // スヌケ君:N, お菓子の種類：M

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

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

    for (int j = 0; j < d; j++) {
      int x;
      cin >> x;
      sum[x - 1]++;
    }
  }

  int count = 0;

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

  cout << count << endl;

  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {
  int n, k;
  cin >> n >> k;
  int d[k], a[10][10];
  int lastGet[n], ans = 0;

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

  for (int i = 0; i < n; i++) {
    if (lastGet[i] == 0)
      ans++;
  }
  cout << ans;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
int n, k, d, t;
std::vector<int> vec;
int main() {
  std::cin >> n >> k;
  vec.assign(n, 0);
  for (int i = 0; i < k; i++) {
    std::cin >> d;
    for (int u = 0; u < d; u++) {
      std::cin >> t;
      vec[--t] = 1;
    }
  }
  std::cout << std::count(vec.begin(), vec.end(), 0) << std::endl;
}


Error: 0

Fixed submission:

#include <algorithm>
#include <iostream>
#include <vector>

int n, k, d;
std::vector<int> vec;

int main() {
  std::cin >> n >> k;
  vec.assign(n, 0);
  for (int i = 0; i < k; i++) {
    std::cin >> d;
    for (int u = 0; u < d; u++) {
      int t;
      std::cin >> t;
      vec[t] = 1;
    }
  }
  std::cout << std::count(vec.begin(), vec.end(), 1) << std::endl;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef float fl;
typedef long long ll;
int N, K;

int main() {
  cin >> N >> K;
  int snk[N];
  rep(i, N) snk[i] = 0;
  rep(i, K) {
    int d;
    cin >> d;
    rep(j, d) {
      int k;
      cin >> k;
      snk[--k] = 1;
    }
  }
  int ans = 0;
  rep(i, N) {
    if (snk[i] == 0)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef float fl;
typedef long long ll;
int N, K;

int main() {
  cin >> N >> K;
  int snk[K];
  rep(i, K) snk[i] = 0;
  rep(i, K) {
    int d;
    cin >> d;
    rep(j, d) {
      int k;
      cin >> k;
      snk[k] = 1;
    }
  }
  int ans = 0;
  rep(i, K) {
    if (snk[i] == 0)
      ans++;
  }
  cout << ans << endl;
  return 0;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
int MOD = 1000000007;
signed main() {
  int n, k;
  cin >> n >> k;
  vector<int> d(k);
  vector<vector<int>> a(100, vector<int>(100));

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

  vector<int> sunuke(n);

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

  int cnt = 0;
  rep(i, n) {
    if (sunuke.at(i) == 0) {
      cnt++;
    }
  }

  cout << cnt << endl;
}


Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
int MOD = 1000000007;
signed main() {
  int n, k;
  cin >> n >> k;
  vector<int> d(k + 2);
  vector<vector<int>> a(n + 1, vector<int>(n + 1));

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

  vector<int> sunuke(n + 2);

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

  int cnt = 0;
  rep(i, n) {
    if (sunuke.at(i) == 0) {
      cnt++;
    }
  }

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

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, K;
  cin >> N >> K;
  vector<int> d(K);
  map<int, int> mp;
  for (int i = 0; i < K; i++) {
    cin >> d[i];
    vector<int> A(d[i]);
    for (int j = 0; j < d[i]; j++) {
      cin >> A[j];
      mp[A[j]]++;
    }
  }
  cout << N - mp.size() << endl;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, K;
  cin >> N >> K;
  vector<int> d(K);
  vector<vector<int>> A(K, vector<int>(d));
  map<int, int> mp;
  for (int i = 0; i < K; i++) {
    cin >> d[i];
    for (int j = 0; j < d[i]; j++) {
      cin >> A[i][j];
      mp[A[i][j]]++;
    }
  }
  cout << N - mp.size() << endl;
}