Problem p02688 (C++) — buggy submission, verdict: Runtime Error

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

void __print(int x) { cout << x; }
void __print(long x) { cout << x; }
void __print(long long x) { cout << x; }
void __print(unsigned x) { cout << x; }
void __print(unsigned long x) { cout << x; }
void __print(unsigned long long x) { cout << x; }
void __print(float x) { cout << x; }
void __print(double x) { cout << x; }
void __print(long double x) { cout << x; }
void __print(char x) { cout << '\\'' << x << '\\''; }
void __print(const char *x) { cout << '\\"' << x << '\\"'; }
void __print(const string &x) { cout << '\\"' << x << '\\"'; }
void __print(bool x) { cout << (x ? "true" : "false"); }

template <typename T, typename V> void __print(const pair<T, V> &x) {
  cout << '{';
  __print(x.first);
  cout << ',';
  __print(x.second);
  cout << '}';
}
template <typename T> void __print(const T &x) {
  int f = 0;
  cout << '{';
  for (auto &i : x)
    cout << (f++ ? "," : ""), __print(i);
  cout << "}";
}
void _print() { cout << "]\\n"; }
template <typename T, typename... V> void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v))
    cout << ", ";
  _print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...)                                                            \\
  cout << "[" << #x << "] = [";                                                \\
  _print(x)
#else
#define debug(x...)
#endif

#define int long long int
#define fi first
#define se second
#define FIO                                                                    \\
  {                                                                            \\
    ios::sync_with_stdio(0);                                                   \\
    cin.tie(nullptr);                                                          \\
    cout.tie(nullptr);                                                         \\
  }
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define pow10(n) stoll("1" + string(n, '0'))
// fill(all(arr),1)
// if(map.count(key)){}
// bitset<20>(n);
// int mini=min({a,b,c,d,e});

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;

int32_t main() {
  FIO int n, k, d, b;
  cin >> n >> k;
  int have[n];
  memset(have, 0, sizeof(have));
  forn(i, k) {
    cin >> d;
    forn(j, d) {
      cin >> b;
      have[b - 1] = 1;
    }
  }
  int cnt = 0;
  forn(i, n) {
    //  cout<<have[i];
    if (have[i] != 1) {
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}

Error: WA

Fixed submission:

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

void __print(int x) { cout << x; }
void __print(long x) { cout << x; }
void __print(long long x) { cout << x; }
void __print(unsigned x) { cout << x; }
void __print(unsigned long x) { cout << x; }
void __print(unsigned long long x) { cout << x; }
void __print(float x) { cout << x; }
void __print(double x) { cout << x; }
void __print(long double x) { cout << x; }
void __print(char x) { cout << '\\'' << x << '\\''; }
void __print(const char *x) { cout << '\\"' << x << '\\"'; }
void __print(const string &x) { cout << '\\"' << x << '\\"'; }
void __print(bool x) { cout << (x ? "true" : "false"); }

template <typename T, typename V> void __print(const pair<T, V> &x) {
  cout << '{';
  __print(x.first);
  cout << ',';
  __print(x.second);
  cout << '}';
}
template <typename T> void __print(const T &x) {
  int f = 0;
  cout << '{';
  for (auto &i : x)
    cout << (f++ ? "," : ""), __print(i);
  cout << "}";
}
void _print() { cout << "]\\n"; }
template <typename T, typename... V> void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v))
    cout << ", ";
  _print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...)                                                            \\
  cout << "[" << #x << "] = [";                                                \\
  _print(x)
#else
#define debug(x...)
#endif

#define int long long int
#define fi first
#define se second
#define FIO                                                                    \\
  {                                                                            \\
    ios::sync_with_stdio(0);                                                   \\
    cin.tie(nullptr);                                                          \\
    cout.tie(nullptr);                                                         \\
  }
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define pow10(n) stoll("1" + string(n, '0'))
// fill(all(arr),1)
// if(map.count(key)){}
// bitset<20>(n);
// int mini=min({a,b,c,d,e});

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;

int32_t main() {
  FIO int n, k, d, b;
  cin >> n >> k;
  int have[k];
  forn(i, n) {
    cin >> d;
    forn(j, d) {
      cin >> b;
      have[b - 1] = 1;
    }
  }
  int cnt = 0;
  forn(i, n) {
    if (have[i] != 1) {
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}