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

#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
map<int, int> ct;
map<int, int> ct2;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 998244353LL
#define EPS 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (int i = (a); i <= (signed)(b); i++)
#define AFOR(i, a) for (int i = 0; i < (signed)(a); i++)
#define RFOR(i, a, b) for (int i = (a); i >= b; i--)

#define MN 100005
int n, m, l;
int a, b, c;
string s[MN];
string str;
string ans;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

/*
int N;
cin >> N;
vi vect(N);
FOR(i,N) cin >> vec.at(i);*/
// sort(vec.begin(),vec.end());
// vvi data(N,vi(4));

/*	int bfs(int x, int y,vvi &A,vvi flag) {
                queue<pii> que;
                que.push(pii(x, y));
                while (que.size()) {
                        pii p = que.front(); que.pop();
                        AFOR(i, 4) {
                                int nx = p.first + dx[i]; int ny = p.second +
   dy[i]; if (0 <= nx && nx < N && 0 <= ny && ny < N) { if
   (A.at(p.first).at(p.second) + flag.at(p.first).at(p.second) <
   A.at(nx).at(ny)) { A.at(nx).at(ny) = A.at(p.first).at(p.second) +
   flag.at(p.first).at(p.second); que.push(pii(nx, ny));
                                        }
                                }
                        }
                }
                return 0;
        }
        */
/*int gcd(int p, int q){
        while(q != 0){
        int r = p % q;
        p = q;
        q = r;
        }
return p;
}*/
int N;
int A[200100];
int L[200100];
int main() {
  int X, Y;
  cin >> N >> X >> Y;
  int m;
  AFOR(i, N + 1) { A[i] = 0; }
  FOR(i, 1, N - 1) {
    FOR(j, i + 1, N) { A[min(abs(i - j), abs(X - i) + 1 + abs(Y - j))]++; }
  }

  FOR(i, 1, N - 1) { cout << A[i] << endl; }

  return 0;
}

Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 1) >= this->size() (which is 1)


Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
map<int, int> ct;
map<int, int> ct2;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 998244353LL
#define EPS 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (int i = (a); i <= (signed)(b); i++)
#define AFOR(i, a) for (int i = 0; i < (signed)(a); i++)
#define RFOR(i, a, b) for (int i = (a); i >= b; i--)

#define MN 100005
int n, m, l;
int a, b, c;
string s[MN];
string str;
string ans;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

/*
int N;
cin >> N;
vi vect(N);
FOR(i,N) cin >> vec.at(i);*/
// sort(vec.begin(),vec.end());
// vvi data(N,vi(4));

/*	int bfs(int x, int y,vvi &A,vvi flag) {
                queue<pii> que;
                que.push(pii(x, y));
                while (que.size()) {
                        pii p = que.front(); que.pop();
                        AFOR(i, 4) {
                                int nx = p.first + dx[i]; int ny = p.second +
   dy[i]; if (0 <= nx && nx < N && 0 <= ny && ny < N) { if
   (A.at(p.first).at(p.second) + flag.at(p.first).at(p.second) <
   A.at(nx).at(ny)) { A.at(nx).at(ny) = A.at(p.first).at(p.second) +
   flag.at(p.first).at(p.second); que.push(pii(nx, ny));
                                        }
                                }
                        }
                }
                return 0;
        }
        */
/*int gcd(int p, int q){
        while(q != 0){
        int r = p % q;
        p = q;
        q = r;
        }
return p;
}*/
int N;
int A[200100];
int L[200100];
int main() {
  int X, Y;
  vi ans(N + 1);
  cin >> N >> X >> Y;
  int m;
  FOR(i, 1, N - 1) {
    FOR(j, i + 1, N) { ans.at(min(abs(i - j), abs(X - i) + 1 + abs(Y - j)))++; }
  }

  AFOR(i, N - 1) { cout << ans.at(i) << endl; }

  return 0;
}