Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

#define P pair<ll, ll>
const int N_MAX = 100010;
vector<vector<int>> adj[N_MAX], radj[N_MAX];
double d[N_MAX], par[N_MAX];
ll N, M;

void dijkstra(ll s) {
  priority_queue<P, vector<P>, greater<P>> q;
  fill_n(par, N, 0); par[s] = -1;
  fill_n(d, N, 0); q.push(P(0, s));
  while (!q.empty()) {
    P p = q.top(); q.pop();
    ll v = p.second;
    for (auto e: adj[v]) {
      if (d[e] <= d[v]) {
        d[e] = d[v]+1;
        par[e] = v;
        q.push(P(d[e], e));
      }
    }
  }
}

int main() {
  cin >> N >> M;
  // adj.resize(N); radj.resize(N);
  rep(i,N-1+M) {
    int A, B; cin >> A >> B; A--; B--;
    adj[A].push_back(B);
    radj[B].push_back(A);
  }
  int root = 0;
  rep(i,N) if (radj[i].empty()) root = i;
  dijkstra(root);
  // rep(i,N) cout << d[i] << " "; cout << endl;
  rep(i,N) cout << par[i]+1 << " "; cout << endl;
  return 0;
}

Compiler output:
a.cc: In function 'void dijkstra(ll)':
a.cc:25:12: error: no match for 'operator[]' (operand types are 'double [100010]' and 'std::vector<int>')
   25 |       if (d[e] <= d[v]) {
      |            ^
a.cc:26:10: error: no match for 'operator[]' (operand types are 'double [100010]' and 'std::vector<int>')
   26 |         d[e] = d[v]+1;
      |          ^
a.cc:27:12: error: no match for 'operator[]' (operand types are 'double [100010]' and 'std::vector<int>')
   27 |         par[e] = v;
      |            ^
a.cc:28:19: error: no match for 'operator[]' (operand types are 'double [100010]' and 'std::vector<int>')
   28 |         q.push(P(d[e], e));
      |                   ^
a.cc: In function 'int main()':
a.cc:39:21: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
   39 |     adj[A].push_back(B);
      |     ~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:40:22: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
   40 |     radj[B].push_back(A);
      |     ~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~