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

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n + 1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int>> name((h), vector<int>(w));
#define myCeil(dividend, divisor) ceil((double)(dividend) / (double)(divisor))
#define myFloor(dividend, divisor) floor((double)(dividend) / (double)(divisor))
#define calcDigits(num) floor(log10(num)) + 1

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl;
#define dv(name, value) cerr << (name) << " is " << (value) << endl;
#define da(v)                                                                  \\
  cerr << "[";                                                                 \\
  REPI(itr, v) { cerr << *itr << (itr != --v.end() ? ", " : ""); }             \\
  cerr << "]" << endl;
#define dpa(v)                                                                 \\
  cerr << "[ " << endl;                                                        \\
  REPI(itr, v) {                                                               \\
    cerr << "  [" << (*itr).first << ", " << (*itr).second << ']'              \\
         << (itr != --v.end() ? "," : "") << endl;                             \\
  }                                                                            \\
  cerr << "]" << endl;

signed main() {
  int N, K;
  cin >> N >> K;
  vector<int> f(105);
  REP(x, K) {
    int d;
    cin >> d;
    REP(y, d) {
      int inp;
      cin >> inp;
      f.at(inp) = true;
    }
  }

  da(f);
  int cnt = 0;
  FOR1(x, N) {
    if (f.at(x) == false)
      cnt++;
  }
  cout << cnt << endl;
}


Error: 0
[0, 1, 0, 1]


Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n + 1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int>> name((h), vector<int>(w));
#define myCeil(dividend, divisor) ceil((double)(dividend) / (double)(divisor))
#define myFloor(dividend, divisor) floor((double)(dividend) / (double)(divisor))
#define calcDigits(num) floor(log10(num)) + 1

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl;
#define dv(name, value) cerr << (name) << " is " << (value) << endl;
#define da(v)                                                                  \\
  cerr << "[";                                                                 \\
  REPI(itr, v) { cerr << *itr << (itr != --v.end() ? ", " : ""); }             \\
  cerr << "]" << endl;
#define dpa(v)                                                                 \\
  cerr << "[ " << endl;                                                        \\
  REPI(itr, v) {                                                               \\
    cerr << "  [" << (*itr).first << ", " << (*itr).second << ']'              \\
         << (itr != --v.end() ? "," : "") << endl;                             \\
  }                                                                            \\
  cerr << "]" << endl;

signed main() {
  int N, K;
  cin >> N >> K;
  vector<int> f(N + 1);
  REP(x, K) {
    int d;
    cin >> d;
    REP(y, d) {
      int inp;
      cin >> inp;
      f.at(inp) = true;
    }
  }

  da(f);
  int cnt = 0;
  FOR1(x, K) {
    if (f.at(x) == false)
      cnt++;
  }
  cout << cnt << endl;
}