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

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

// #define int long long
#define DBG 0
#define dump(o)                                                                \\
  if (DBG) {                                                                   \\
    cerr << #o << " " << o << endl;                                            \\
  }
#define dumpc(o)                                                               \\
  if (DBG) {                                                                   \\
    cerr << #o;                                                                \\
    for (auto &e : (o))                                                        \\
      cerr << " " << e;                                                        \\
    cerr << endl;                                                              \\
  }
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define each(it, c) for (auto it = (c).begin(); it != (c).end(); it++)
#define all(c) c.begin(), c.end()
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
  int N, W, H;
  cin >> N >> W >> H;
  vector<int> w(W + 1, 0);
  vector<int> h(H + 1, 0);
  rep(i, 0, N) {
    int x, y, k;
    cin >> x >> y >> k;
    w[max(0, x - k)]++;
    w[min(W, x + k)]--;
    h[max(0, y - k)]++;
    h[min(H, y + k)]--;
  }
  dumpc(h);
  dumpc(w);
  rep(i, 1, W + 1) { w[i] += w[i - 1]; }
  rep(i, 1, H + 1) { h[i] += h[i - 1]; }
  dumpc(h);
  dumpc(w);
  int a = max(*min_element(w.begin(), w.end() - 1),
              *min_element(h.begin(), h.end() - 1));
  if (a == 0)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}

Error: 0
h 1 0 0 1 -1 0 1 -1 0 -1
w 1 0 0 1 -1 0 1 -1 0 -1
h 1 1 1 2 1 1 2 1 1 0
w 1 1 1 2 1 1 2 1 1 0


Fixed submission:

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

// #define int long long
#define DBG 1
#define dump(o)                                                                \\
  if (DBG) {                                                                   \\
    cerr << #o << " " << o << endl;                                            \\
  }
#define dumpc(o)                                                               \\
  if (DBG) {                                                                   \\
    cerr << #o;                                                                \\
    for (auto &e : (o))                                                        \\
      cerr << " " << e;                                                        \\
    cerr << endl;                                                              \\
  }
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define each(it, c) for (auto it = (c).begin(); it != (c).end(); it++)
#define all(c) c.begin(), c.end()
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
  int N, W, H;
  cin >> N >> W >> H;
  vector<int> w(W + 1, 0);
  vector<int> h(H + 1, 0);
  rep(i, 0, N) {
    int x, y, k;
    cin >> x >> y >> k;
    w[max(0, x - k)]++;
    w[min(W, x + k)]--;
    h[max(0, y - k)]++;
    h[min(H, y + k)]--;
  }
  dumpc(h);
  dumpc(w);
  rep(i, 1, W + 1) { w[i] += w[i - 1]; }
  rep(i, 1, H + 1) { h[i] += h[i - 1]; }
  dumpc(h);
  dumpc(w);
  int a = max(*min_element(w.begin(), w.end() - 1),
              *min_element(h.begin(), h.end() - 1));
  if (a == 0)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}