Language: C++

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

vector<int> bfs(int &ver, vector<vector<int> > &Gragh) {
    vector<int> dist(Gragh.size(), -1);
    queue<int> list;
    dist.at(ver) = 0;
    list.push(ver);

    while (!list.empty()) {
        int v = list.front();
        list.pop();
        for (int i = 0; i < Gragh.at(v).size(); i++) {
            if (dist.at(Gragh.at(v).at(i)) != -1) {
                continue;
            }
            dist.at(Gragh.at(v).at(i)) = dist.at(v) + 1;
            list.push(Gragh.at(v).at(i));
        }
    }

    return dist;
}

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;
    vector<vector<int> > gragh(N);
    for (int i = 0; i < N; i++) {
        if (i - 1 >= 0) {
            gragh.at(i).push_back(i - 1);
        }
        if (i + 1 < N) {
            gragh.at(i).push_back(i + 1);
        }
    }
    gragh.at(X - 1).push_back(Y - 1);
    gragh.at(Y - 1).push_back(X - 1);

    vector<int> ans(N - 1, 0);
    for (int i = 0; i < N; i++) {
        for (int j = 1; j < N - 1; j++) {
            ans.at(j - 1) += (lower_bound(bfs(i, gragh).begin(), bfs(i, gragh).end())) - (lower_bound(bfs(i - 1, gragh).begin(), bfs(i - 1, gragh).end()));
        }
    }

    for (int i = 0; i < N - 1; i++) {
        cout << ans.at(i) / 2 << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:42: error: no matching function for call to 'lower_bound(std::vector<int>::iterator, std::vector<int>::iterator)'
   43 |             ans.at(j - 1) += (lower_bound(bfs(i, gragh).begin(), bfs(i, gragh).end())) - (lower_bound(bfs(i - 1, gragh).begin(), bfs(i - 1, gragh).end()));
      |                               ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note:   candidate expects 4 arguments, 2 provided
a.cc:43:109: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   43 |             ans.at(j - 1) += (lower_bound(bfs(i, gragh).begin(), bfs(i, gragh).end())) - (lower_bound(bfs(i - 1, gragh).begin(), bfs(i - 1, gragh).end()));
      |                                                                                                           ~~^~~
a.cc:4:22: note:   initializing argument 1 of 'std::vector<int> bfs(int&, std::vector<std::vector<int> >&)'
    4 | vector<int> bfs(int &ver, vector<vector<int> > &Gragh) {
      |                 ~~~~~^~~
a.cc:43:136: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   43 |             ans.at(j - 1) += (lower_bound(bfs(i, gragh).begin(), bfs(i, gragh).end())) - (lower_bound(bfs(i - 1, gragh).begin(), bfs(i - 1, gragh).end()));
      |                                                                                                                                      ~~^~~
a.cc:4:22: note:   initializing argument 1 of 'std::vector<int> bfs(int&, std::vector<std::vector<int> >&)'
    4 | vector<int> bfs(int &ver, vector<vector<int> > &Gragh) {
      |                 ~~~~~^~~