Language: C++

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
#include <queue>
#define INF LONG_MAX
typedef long long ll;
struct edge{ll to, cost;};
typedef pair<ll,pair<ll,ll> >P;
ll L;
struct graph{
  ll V;
  vector<vector<edge> > G;

  VVI d2;
  graph(ll n){
    init(n);
  }

  void init(ll n){
    V = n;
    G.resize(V);
    d2.resize(V,VLL(400,1e9 + 10));
  }

  void add_edge(ll s, ll t, ll cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }

  void dijkstra(ll s){
    VI border(V,400);
    for(int i = 0; i < V; i++){
      rep(j,400)
      d2[i][j] = -1;
    }
    d2[s][0] = L;
    priority_queue<P,vector<P>> que;
    que.push(P(L,{0,s}));
    while(!que.empty()){
      P p = que.top(); que.pop();
      int times = p.second.first;
      int v = p.second.second;
      if(d2[v][times] > p.first) continue;
      if(border[v] < times) continue;
      for(auto e : G[v]){
        if(d2[v][times] - e.cost >= 0){
          if(d2[e.to][times] < d2[v][times] - e.cost){
            d2[e.to][times] = d2[v][times]-e.cost;
            que.push(P(d2[e.to][times],{times,e.to}));
            border[e.to] = min<ll>(times+1,border[e.to]);
          }
        }

        if( d2[e.to][times+1] < (L - e.cost) ){
          d2[e.to][times + 1] = L - e.cost;
          que.push(P(d2[e.to][times+1],{times+1,e.to}));
          border[e.to] = min<ll>(times+1,border[e.to]);
        }
      }
    }
  }
};


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,m;
  cin >> n >> m >> L;
  VLL a(m),b(m),c(m);
  graph g(n);
  rep(i,m){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--,b[i]--;
    if(c[i] > L){
      continue;
    }
    g.add_edge(a[i],b[i],c[i]);
    g.add_edge(b[i],a[i],c[i]);
  }
  int ans[n][n];
  rep(i,n)rep(j,n) ans[i][j]= -1;
  g.dijkstra(0);
  rep(i,n){
    g.dijkstra(i);
    rep(j,n){
      rep(k,400){
        if(g.d2[j][k] >= 0){
          ans[i][j] = k;
          break;
        }
      }
    }
  }
  int q;
  cin >> q;
  rep(i,q){
    int s,t;
    cin >> s >> t;
    s--,t--;
    cout << ans[s][t] << "\n";
  }
  return 0;
}


Compiler output:
a.cc: In member function 'void graph::init(ll)':
a.cc:48:14: error: no matching function for call to 'std::vector<std::vector<int> >::resize(ll&, VLL)'
   48 |     d2.resize(V,VLL(400,1e9 + 10));
      |     ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
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:1013:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(size_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int]'
 1013 |       resize(size_type __new_size)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1013:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1034:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(size_type, const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>]'
 1034 |       resize(size_type __new_size, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1034:54: note:   no known conversion for argument 2 from 'VLL' {aka 'std::vector<long long int>'} to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
 1034 |       resize(size_type __new_size, const value_type& __x)
      |                                    ~~~~~~~~~~~~~~~~~~^~~