Language: C++

#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll dist[333][333];
ll dist2[333][333];
ll n,m,l;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m>>l;
  fill_n(dist,333*333,llINF);
  fill_n(dist2,333*333,llINF);
  for(int i=0;i<m;i++){
    ll f,t,c;
    cin>>f>>t>>c;
    f--;t--;
    dist[f][t]=c;
    dist[t][f]=c;
  }
  for(int k=0;k<n;k++)
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)
	dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      if(dist[i][j]<=l)
	dist2[i][j]=1;
  for(int k=0;k<n;k++)
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)
	dist2[i][j]=min(dist2[i][j],dist2[i][k]+dist2[k][j]);
  ll q;cin>>q;
  for(int i=0;i<q;i++){
    ll from,to;cin>>from>>to;
    from--;to--;
    cout<<dist2[from][to]<<endl;
  }
  return 0;
}


Compiler output:
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: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int (*)[333]; _Tp = double; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:998:21:   required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long long int (*)[333]; _Tp = double]'
  998 |     { std::__fill_a1(__first, __last, __value); }
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1154:20:   required from '_OutputIterator std::__fill_n_a(_OutputIterator, _Size, const _Tp&, random_access_iterator_tag) [with _OutputIterator = long long int (*)[333]; _Size = int; _Tp = double]'
 1154 |       std::__fill_a(__first, __first + __n, __value);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1183:29:   required from '_OI std::fill_n(_OI, _Size, const _Tp&) [with _OI = long long int (*)[333]; _Size = int; _Tp = double]'
 1183 |       return std::__fill_n_a(__first, std::__size_to_integer(__n), __value,
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1184 |                                std::__iterator_category(__first));
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:27:9:   required from here
   27 |   fill_n(dist,333*333,llINF);
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:18: error: incompatible types in assignment of 'const double' to 'long long int [333]'
  952 |         *__first = __tmp;
      |         ~~~~~~~~~^~~~~~~