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

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define IOS                                                                    \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define MOD 1000000007
#define MOD2 998244353
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(x) (ll) x.size()
#define F first
#define S second
#define FOR(i, a, b) for (ll i = a; i <= b; ++i)
#define ROF(i, a, b) for (ll i = a; i >= b; --i)
#define trace(x) cerr << #x << ": " << x << '\\n';
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
#define TEMP int
#define ordered_set                                                            \\
  tree<TEMP, null_type, less<TEMP>, rb_tree_tag,                               \\
       tree_order_statistics_node_update>
auto clk = clock();

ll mexp(ll a, ll b, ll m) {
  ll ans = 1;
  a %= m;
  while (b) {
    if (b & 1)
      ans = ans * a % m;
    b >>= 1;
    a = a * a % m;
  }
  return ans;
}

int d[2005];

int main() {
  IOS srand(chrono::high_resolution_clock::now().time_since_epoch().count());

  int n, x, y;
  cin >> n >> x >> y;
  FOR(i, 1, n) {
    FOR(j, i + 1, n) {
      d[min(abs(j - i),
            min(abs(x - i) + 1 + abs(j - y), abs(y - i) + 1 + abs(j - x)))]++;
    }
  }
  FOR(i, 1, n - 1) { cout << d[i] << endl; }

  cerr << endl
       << endl
       << "Time: " << fixed << setprecision(12)
       << (long double)(clock() - clk) / CLOCKS_PER_SEC << " ms" << endl
       << endl;

  return 0;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define IOS                                                                    \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define MOD 1000000007
#define MOD2 998244353
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(x) (ll) x.size()
#define F first
#define S second
#define FOR(i, a, b) for (ll i = a; i <= b; ++i)
#define ROF(i, a, b) for (ll i = a; i >= b; --i)
#define trace(x) cerr << #x << ": " << x << '\\n';
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
#define TEMP int
#define ordered_set                                                            \\
  tree<TEMP, null_type, less<TEMP>, rb_tree_tag,                               \\
       tree_order_statistics_node_update>
auto clk = clock();

ll mexp(ll a, ll b, ll m) {
  ll ans = 1;
  a %= m;
  while (b) {
    if (b & 1)
      ans = ans * a % m;
    b >>= 1;
    a = a * a % m;
  }
  return ans;
}

int d[2005];

int main() {
  IOS srand(chrono::high_resolution_clock::now().time_since_epoch().count());
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  int n, x, y;
  cin >> n >> x >> y;
  FOR(i, 1, n) {
    FOR(j, i + 1, n) {
      d[min(abs(j - i),
            min(abs(x - i) + 1 + abs(j - y), abs(y - i) + 1 + abs(j - x)))]++;
    }
  }
  FOR(i, 1, n - 1) { cout << d[i] << endl; }

  cerr << endl
       << endl
       << "Time: " << fixed << setprecision(12)
       << (long double)(clock() - clk) / CLOCKS_PER_SEC << " ms" << endl
       << endl;

  return 0;
}