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

#include <iostream>

using namespace std;

int main() {
  int N, K;
  int d[101]; // インデックス番号に対応したお菓子が何個あるかを格納する
  int kosu[101]; // iが持ってるお菓子の管理
  int dare[101][101];
  int ans = 0;

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

    for (int j = 1; j <= d[i]; j++) {
      cin >> dare[i][j];
      kosu[dare[i][j]] = 1;
    }
  }

  for (int k = 1; k <= N; k++) {
    if (kosu[k] == 0) {
      ans++;
    }
  }

  cout << ans;
}

Error: WA

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int N, K;
  int d[100]; // インデックス番号に対応したお菓子が何個あるかを格納する
  int kosu[100]; // iが持ってるお菓子の管理
  int dare[100][100];
  int ans = 0;

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

    for (int j = 1; j <= d[i]; j++) {
      cin >> dare[i][j];
      kosu[dare[i][j]] = 1;
    }
  }

  for (int i = 1; i <= N; i++) {
    if (kosu[i] == 0) {
      ans++;
    }
  }

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

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

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

  for (int i = 0; i < k; i++) {
    int num;
    cin >> num;
    for (int j = 0; j < num; j++) {
      int a;
      cin >> a;
      data.at(a - 1)++;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (data.at(i) == 0)
      ans++;
  }
  cout << ans << endl;
}


Error: 0

Fixed submission:

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

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

  for (int i = 0; i < k; i++) {
    cin >> num[i];
    for (int j = 0; j < num[i]; j++) {
      cin >> a.at(j);
      data.at(a.at(j) - 1)++;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (data.at(i) == 0)
      ans++;
  }
  cout << ans << 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;
  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;
}

Error: 0

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 < K; i++) {
    if (sunuke.at(i) == 0) {
      count++;
    }
  }
  cout << count << endl;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int a, b, c, d;
  cin >> a >> b;
  vector<int> ans(a, 0);
  int sum;
  for (int i = 0; i < b; i++) {
    cin >> c;
    for (int j = 0; j < c; j++) {
      cin >> d;
      ans.at(d - 1)++;
    }
  }
  for (int i = 0; i < a; i++) {
    if (ans.at(i) == 0)
      sum++;
  }
  cout << sum;
}


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 a, b;
  cin >> a >> b;
  vector<int> vec;
  int c = 0;
  for (int i = 0; a > i; i++) {
    int d;
    cin >> d;
    for (int j = 0; d > j; j++) {
      cin >> vec.at(c);
      c++;
    }
  }
  sort(vec.begin(), vec.end());
  int f = 0;
  for (int k = 1; k < c; k++) {
    if (vec.at(k) == vec.at(k - 1))
      f++;
  }
  cout << f << 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> d(k);
  vector<int> t(n, 0);
  for (int i = 0; i < k; ++i) {
    cin >> d[i];
    d[i]--;
    for (int j = 0; j <= d[i]; ++j) {
      int a;
      cin >> a;
      a--;
      t[a]++;
    }
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    if (t[i] == 0) {
      res++;
    }
  }
  cout << res << endl;
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)

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

  int res = n;
  rep(i, k) {
    int sum = 0;
    rep(j, k) { sum += A[j][i]; }
    if (sum) {
      res--;
    }
  }
  cout << res << endl;
  return 0;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  // / vector<int> a[n+1];
  set<int> s;
  for (int i = 0; i < k; ++i) {
    int x;
    cin >> x;
    // s.insert(x);
    for (int j = 0; j < x; ++j) {
      int y;
      cin >> y;
      // a[x].push_back(y);
      s.insert(y);
    }
  }
  cout << n - (int)s.size() << "\\n";
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<int> a[k];
  set<int> s;
  for (int i = 0; i < k; ++i) {
    int x;
    cin >> x;
    s.insert(x);
    for (int i = 0; i < x; ++i) {
      int y;
      cin >> y;
      a[i].push_back(y);
    }
  }
  cout << n - (int)s.size() << "\\n";
  return 0;
}
Problem p02688 (C++) — buggy submission, verdict: 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[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;
}


Error: 0

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

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  // Your code here!
  int N, K, count, ans;
  cin >> N >> K;
  int d[K];
  ans = 0;
  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];
    }
  }
  for (int h = 1; h <= N; h++) {
    count = 0;
    for (int i = 0; i < K; i++) {
      for (int j = 0; j < d[i]; j++) {
        if (h == A[i][j]) {
          count++;
        }
      }
    }
    if (count == 0) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  // Your code here!
  int N, K, count, ans;
  cin >> N >> K;
  ans = 0;
  int A[N + 1][K + 1];
  int d[K + 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 <= N; i++) {
    count = 0;
    for (int j = 1; j <= K; j++) {
      for (int k = 1; k <= d[k]; k++) {
        if (i == A[j][k]) {
          count++;
        }
      }
    }
    if (count == 0) {
      ans++;
    }
  }
  cout << ans << endl;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
#define INF 1000000000
#define PI 3.14159265359

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

  int n, k;
  cin >> n >> k;
  vi cnt(n);
  for (int i = 0; i < k; i++) {

    int d = 0;

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

    for (int j = 0; j < d; j++) {
      cnt.at(ls.at(j) - 1) += 1;
    }
  }
  int ans = 0;

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

  cout << ans << endl;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
#define INF 1000000000
#define PI 3.14159265359

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

  int n, k;
  cin >> n >> k;
  vi cnt(n);
  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int x;
      cin >> x;
      cnt.at(x - 1) += 1;
    }
  }
  int ans = 0;

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

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

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

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


Error: 0

Fixed submission:

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

int main() {
  int N, K, count = 0, c = 0;
  cin >> N >> K;
  vector<int> d(K);
  vector<vector<int>> A(K, vector<int>(K));
  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 = 1; i <= N; i++) {
    for (int j = 0; j < K; j++) {
      for (int l = 0; l < K; l++) {
        if (i == A.at(j).at(l)) {
          c = 1;
          break;
        }
      }
      if (c == 1)
        break;
    }
    if (c == 0)
      count++;
    c = 0;
  }
  cout << count << endl;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  int n = 0, k = 0, d[100], a[100], l = 0, i = 0, j = 0, m = 0, res = 0;
  for (i = 0; i < 100; i++)
    a[i] = d[i] = 0;
  i = j = 0;
  cin >> n >> k;
  for (i = 0; i < k; i++) {
    cin >> d[i];
    for (j = 0; j < d[i]; j++) {
      cin >> l;
      for (m = 1; m <= n; m++) {
        if (l == m)
          a[m - 1]++;
      }
    }
  }
  for (i = 0; i < n; i++) {
    if (a[i] == 0)
      res++;
  }
  cout << res << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  int d[n];
  cin >> d[0];
  int a[d[0]];
  int l, i = 0;
  while (cin >> l) {
    a[i] = l;
    i++;
    if (i > d[0])
      break;
  }
  i = 1;
  while (i < k) {
    cin >> d[i];
    i++;
  }
  printf("%d\\n", n - d[0]);
  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> 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;
}

Error: 0

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 < K; i++) {
    if (vec1.at(i) == 0) {
      count++;
    }
  }

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

#include <iostream>
using namespace std;
int main() {
  int n, k, d, a, b[999], i, j;
  for (i = 0; i < 999; i++) {
    b[i] = 0;
  }
  cin >> n;
  cin >> k;
  for (i = 0; i < k; i++) {
    cin >> d;
    for (j = 0; j < d; j++) {
      cin >> a;
      if (b[a] == 0) {
        b[a] = 1;
        n--;
      }
    }
  }
  cout << n;
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, k, d[99], a[99][99], b[99], i, j;
  cin >> n;
  cin >> k;
  for (i = 0; i < k; i++) {
    cin >> d[i];
    for (j = 0; j < d[i]; j++) {
      cin >> a[i][j];
      if (b[a[i][j]] == 0) {
        b[a[i][j]] = 1;
        n--;
      }
    }
  }
  cout << "%d" << n;
  return 0;
}
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;
// using ll = long long;
// using P = pair<int,int>;

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.at(a - 1) = 1;
    }
  }
  int ans = 0;
  rep(i, n) if (d.at(i) == 0) ans++;
  cout << ans << endl;
}

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


Fixed submission:

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

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.at(j - 1) = 1;
    }
  }
  int ans = 0;
  rep(i, k) if (d.at(i) == 0) ans++;
  cout << ans << endl;
}
Problem p02688 (C++) — buggy submission, verdict: Runtime Error

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


Error: 0

Fixed submission:

#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;
}
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(void) {
  int N, K;
  cin >> N >> K;
  std::vector<int> A(N, 0);
  rep(i, K) {
    int d;
    cin >> d;
    rep(j, d) {
      int AA;
      cin >> AA;
      A.at(AA - 1)++;
    }
  }
  int ans = 0;
  rep(i, N) {
    if (A.at(i) == 0)
      ans++;
  }
  cout << ans << endl;
}


Error: 0

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;
    for (int j = 0; j < d; j++) {
      int AA;
      cin >> AA;
      A.at(AA - 1)++;
    }
  }

  int ans = 0;
  for (int i = 0; i < K; i++) {
    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;
  vector<int> A(N, 0);
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int AA;
      cin >> AA;
      A.at(AA - 1)++;
    }
  }

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

  cout << ans << endl;
}


Error: 0

Fixed submission:

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

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

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

  int count = 0;
  for (int k = 0; k < K; k++) {
    if (S.at(k) == 0)
      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> A(N, 0);
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int AA;
      cin >> AA;
      A.at(AA - 1)++;
    }
  }

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

  cout << ans << endl;
}


Error: 0

Fixed submission:

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

int main(void) {
  int N, K, d, A, count = 0;
  cin >> N >> K;
  vector<int> S(N, 0);

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

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

  cout << count << endl;

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

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

#define FOR(i, a, b) for (ll i = a; (i) < (b); ++(i))
#define RFOR(i, a, b) for (ll i = a; (i) >= (b); --(i))
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define UNIQ(v)                                                                \\
  sort(ALL(v));                                                                \\
  v.erase(unique(ALL(v)), v.end())
#define BIT(n) (1LL << (n))
#define DEBUG(a) cout << #a << " = " << a << endl

const ll inf = 1e15;
const ll mod = 1e9 + 7;

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

int N, K;
int d, A;

int main() {
  cin >> N >> K;
  vector<int> okashi(N, 0);
  // cout << "size" << okashi.size() << endl;
  FOR(i, 0, K) {
    cin >> d;
    FOR(j, 0, d) {
      cin >> A;
      okashi[A - 1]++;
    }
  }
  auto count =
      count_if(okashi.begin(), okashi.end(), [](int x) { return x == 0; });
  cout << count << endl;
}


Error: 0

Fixed submission:

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

#define FOR(i, a, b) for (ll i = a; (i) < (b); ++(i))
#define RFOR(i, a, b) for (ll i = a; (i) >= (b); --(i))
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define UNIQ(v)                                                                \\
  sort(ALL(v));                                                                \\
  v.erase(unique(ALL(v)), v.end())
#define BIT(n) (1LL << (n))
#define DEBUG(a) cout << #a << " = " << a << endl

const ll inf = 1e15;
const ll mod = 1e9 + 7;

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

int N, K;
int d, A;

int main() {
  cin >> N >> K;
  vector<int> okashi(K - 1, 0);
  FOR(i, 0, K) {
    cin >> d;
    FOR(j, 0, d) {
      cin >> A;
      okashi[A]++;
    }
  }
  auto count =
      count_if(okashi.begin(), okashi.end(), [](int x) { return x == 0; });
  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> 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;
}

Error: WA

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

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

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

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

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

  int d[K], A[K];

  int cnt = 0;

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

  for (int i = 0; i <= N; ++i) {
    if (num[i])
      ++cnt;
  }
  cout << N - cnt;

  return 0;
}

Error: WA

Fixed submission:

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

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

  int d[N], A[K];

  int cnt = 0;

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

  for (int i = 0; i <= 1000; ++i) {
    if (num[i])
      ++cnt;
  }
  cout << N - cnt;

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

Error: 0

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 < k; i++) {
    ans += ansv.at(i);
  }

  cout << ans << endl;
}