Language: C++

//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define int long long
#define N 1000005
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<22,stdin),p1 == p2)?EOF:*p1++)
using namespace std ;
//char buf[(1 << 22)] , *p1 = buf , *p2 = buf ;
inline int read ()
{
    char c = getchar () ; int x = 0 , f = 1 ;
    while (c < '0' || c > '9') { if (c == '-') f = -1 ; c = getchar () ; }
    while (c >= '0' && c <= '9'){ x = x * 10 + c - '0' ; c = getchar () ; }
    return x * f ;
}
int n , m , l , a , b , c , f[3005][3005] , ver[N << 1] , link[N << 1] , nxt[N << 1] , hed[N << 1] , tot , dis[N] , vis[N] ;
priority_queue <pair <int , int> > q ;
void add (int x , int y , int z) { ver[++ tot] = y ; link[tot] = z ; nxt[tot] = hed[x] ; hed[x] = tot ; }
void dijkstra (int s)
{
	for (int i = 0 ; i < N ; i ++) dis[i] = 1e9 , vis[i] = 0 ;
	while (! q.empty ()) q.pop () ;
	dis[s] = 0 ;
	q.push (make_pair (0 , s)) ; 
	while (! q.empty ())
	{
		int x = q.top ().second ;
		q.pop () ;
		if (vis[x]) continue ;
        vis[x] = 1 ;
		for (int i = hed[x] ; i ; i = nxt[i])
		{
			int y = ver[i] ;
			if (dis[y] > dis[x] + link[i] && dis[x] + link[i] <= l)
			{
				dis[y] = dis[x] + link[i] ;
				f[s][y] = 0 ;
				q.push (make_pair (-dis[y] , y)) ;
			}
		}
	}
}
int main ()
{
//    freopen (".in" , "r" , stdin) ; freopen (".out" , "w" , stdout) ;
	cin >> n >> m >> l ;
	for (int i = 1 , a , b , c ; i <= m ; i ++)
	{
		a = read () , b = read () , c = read () ;
		add (a , b , c) ;
		add (b , a , c) ;
	}
	for (int i = 0 ; i < 3000 ; i ++) for (int j = 0 ; j < 3000 ; j ++) f[i][j] = 1e9 ;
	for (int i = 1 ; i <= n ; i ++) dijkstra (i) ;
	for (int k = 1 ; k <= n ; k ++)
		for (int i = 1 ; i <= n ; i ++)
			for (int j = 1 ; j <= n ; j ++)
				f[i][j] = min (f[i][j] , f[i][k] + f[k][j] + 1) ;
	int q = read () ;
	while (q --> 0)
	{
		int s = read () , t = read () ;
		printf ("%d\n" , f[s][t] == 1e9 ? -1 : f[s][t]) ; 
	}
}

Compiler output:
a.cc:16:70: error: 'long long int link [2000010]' redeclared as different kind of entity
   16 | int n , m , l , a , b , c , f[3005][3005] , ver[N << 1] , link[N << 1] , nxt[N << 1] , hed[N << 1] , tot , dis[N] , vis[N] ;
      |                                                                      ^
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:3:
/usr/include/unistd.h:819:12: note: previous declaration 'int link(const char*, const char*)'
  819 | extern int link (const char *__from, const char *__to)
      |            ^~~~
a.cc: In function 'void add(long long int, long long int, long long int)':
a.cc:18:62: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   18 | void add (int x , int y , int z) { ver[++ tot] = y ; link[tot] = z ; nxt[tot] = hed[x] ; hed[x] = tot ; }
      |                                                              ^
a.cc:18:64: error: assignment of read-only location '*(link + ((sizetype)tot))'
   18 | void add (int x , int y , int z) { ver[++ tot] = y ; link[tot] = z ; nxt[tot] = hed[x] ; hed[x] = tot ; }
      |                                                      ~~~~~~~~~~^~~
a.cc: In function 'void dijkstra(long long int)':
a.cc:34:53: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                         if (dis[y] > dis[x] + link[i] && dis[x] + link[i] <= l)
      |                                                     ^
a.cc:34:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                         if (dis[y] > dis[x] + link[i] && dis[x] + link[i] <= l)
      |                                      ~~~~~~~^~~~~~~~~
a.cc:34:36: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |                         if (dis[y] > dis[x] + link[i] && dis[x] + link[i] <= l)
      |                             ~~~~~~~^~~~~~~~~~~~~~~~~~
a.cc:34:73: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                         if (dis[y] > dis[x] + link[i] && dis[x] + link[i] <= l)
      |                                                                         ^
a.cc:34:65: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                         if (dis[y] > dis[x] + link[i] && dis[x] + link[i] <= l)
      |                                                          ~~~~~~~^~~~~~~~~
a.cc:34:75: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |                         if (dis[y] > dis[x] + link[i] && dis[x] + link[i] <= l)
      |                                                          ~~~~~~~~~~~~~~~~~^~~~
a.cc:36:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   36 |                                 dis[y] = dis[x] + link[i] ;
      |                                                         ^
a.cc:36:49: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   36 |                                 dis[y] = dis[x] + link[i] ;
      |                                          ~~~~~~~^~~~~~~~~
a.cc:36:49: error: invalid conversion from 'int (*)(const char*, const char*) noexcept' to 'long long int' [-fpermissive]
   36 |                                 dis[y] = dis[x] + link[i] ;
      |                                          ~~~~~~~^~~~~~~~~
      |                                                 |
      |                                                 int (*)(const char*, const char*) noexcept
At global scope:
cc1plus: error: '::main' must return 'int'