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

/**********************************************************/
/**            Bismillahir-rahmanir-rahim                **/
/**  In the name of Allah, the Beneficent, the Merciful. **/
/**********************************************************/
/****@author: Sayed Sohan, CSE 13th batch(2016), MBSTU*****/
/**********************************************************/

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

//              Templates
template <class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;

//              Basic-Defs
#define PB push_back
#define MP make_pair
#define SP " "
#define NL "\\n"
#define all(v) v.begin(), v.end()

//              DEBUG--SECTION
#define DE cout << "HERE\\n";
#define DE1(x) cout << x << "###\\n";
#define DE2(x, y) cout << x << "####" << y << "\\n";
#define Pause system("pause");

//              Functions
#define clr(arr, value) memset(arr, value, sizeof(arr))
#define __FAST_IO                                                              \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define NUM1(x) __builtin_popcount(x)
#define LCM(x, y) (x * y) / __gcd(x, y)

//              Sizes--Math     0123456789
#define MOD 1000000007 // 1e9+7
#define MAX 100050
#define INF 1e18
#define PI acos(-1)
#define eps 1e-6

//** your code goes from here

int main() {
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  __FAST_IO;

  ll i, j, k, n, m, T; // basic variables

  cin >> n >> k;

  ll arr[n + 5];
  clr(arr, 0);

  for (i = 0; i < k; i++) {
    ll d;
    cin >> d;
    for (j = 1; j <= d; j++) {
      ll x;
      cin >> x;
      arr[x] = 1;
    }
  }
  ll coun = 0;
  for (i = 1; i <= n; i++) {
    if (arr[i] != 1)
      coun++;
  }

  cout << coun << NL;

  /// Don't forget to set array size....
  return 0;
}


Error: 0

Fixed submission:

/**********************************************************/
/**            Bismillahir-rahmanir-rahim                **/
/**  In the name of Allah, the Beneficent, the Merciful. **/
/**********************************************************/
/****@author: Sayed Sohan, CSE 13th batch(2016), MBSTU*****/
/**********************************************************/

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

//              Templates
template <class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;

//              Basic-Defs
#define PB push_back
#define MP make_pair
#define SP " "
#define NL "\\n"
#define all(v) v.begin(), v.end()

//              DEBUG--SECTION
#define DE cout << "HERE\\n";
#define DE1(x) cout << x << "###\\n";
#define DE2(x, y) cout << x << "####" << y << "\\n";
#define Pause system("pause");

//              Functions
#define clr(arr, value) memset(arr, value, sizeof(arr))
#define __FAST_IO                                                              \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define NUM1(x) __builtin_popcount(x)
#define LCM(x, y) (x * y) / __gcd(x, y)

//              Sizes--Math     0123456789
#define MOD 1000000007 // 1e9+7
#define MAX 100050
#define INF 1e18
#define PI acos(-1)
#define eps 1e-6

//** your code goes from here

int main() {
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  __FAST_IO;

  ll i, j, k, n, m, T; // basic variables

  cin >> n >> k;

  ll arr[n + 1][k + 1];
  clr(arr, 0);

  for (i = 0; i < k; i++) {
    ll d;
    cin >> d;
    for (j = 1; j <= d; j++) {
      ll x;
      cin >> x;
      arr[x][j]++;
    }
  }
  ll coun = 0;
  for (i = 1; i <= n; i++) {
    ll sum = 0;
    for (j = 1; j <= k; j++) {
      sum += arr[i][j];
    }
    if (!sum) {
      coun++;
    }
  }

  cout << coun << NL;

  /// Don't forget to set array size....
  return 0;
}