Language: C++

#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

ll adj[305][305], path[305][305];
ll n,m,u,v,d,l,q,ct,st,end1;
int flag;
ll MAX = 1e18;

int main(){
	cin>>n>>m>>l;

	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=n; j++){
			if(i == j)continue;
			adj[i][j] = MAX;
		}
	}

	for(ll i = 0; i<m; i++){
		cin>>u>>v>>d;
		if(d <= l){
			adj[u][v] = d;
			adj[v][u] = d;
			path[u][v] = u;
			path[v][u] = v;
		}
	}
	//cout<<1;

	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=n; j++){
			for(int k = 1; k<=n; k++){
				if(adj[j][k] > adj[j][i] + adj[i][k]){
					adj[j][k] = adj[j][i] + adj[i][k];
				}
			}
		}
	}
	
	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=n; j++){
			if(i == j) continue;
			adj[i][j] = (adj[i][j] <= l)? 1 : MAX; 
		}
	}

	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=n; j++){
			for(int k = 1; k<=n; k++){
				if(adj[j][k] > adj[j][i] + adj[i][k]){
					adj[j][k] = adj[j][i] + adj[i][k];
				}
			}
		}
	}

	cin>>q;
	for(int i = 1; i<=q; i++){
		cin>>u>>v;
		if(adj[u][v] == MAX)
			cout<<-1<<endl;
		else
			cout<<adj[u][v]-1<<endl;
	}
	
}#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

ll adj[305][305], path[305][305];
ll n,m,u,v,d,l,q,ct,st,end1;
int flag;
ll MAX = 1e18;

int main(){
	cin>>n>>m>>l;

	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=n; j++){
			if(i == j)continue;
			adj[i][j] = MAX;
		}
	}

	for(ll i = 0; i<m; i++){
		cin>>u>>v>>d;
		if(d <= l){
			adj[u][v] = d;
			adj[v][u] = d;
			path[u][v] = u;
			path[v][u] = v;
		}
	}
	//cout<<1;

	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=n; j++){
			for(int k = 1; k<=n; k++){
				if(adj[j][k] > adj[j][i] + adj[i][k]){
					adj[j][k] = adj[j][i] + adj[i][k];
				}
			}
		}
	}
	
	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=n; j++){
			if(i == j) continue;
			adj[i][j] = (adj[i][j] <= l)? 1 : MAX; 
		}
	}

	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=n; j++){
			for(int k = 1; k<=n; k++){
				if(adj[j][k] > adj[j][i] + adj[i][k]){
					adj[j][k] = adj[j][i] + adj[i][k];
				}
			}
		}
	}

	cin>>q;
	for(int i = 1; i<=q; i++){
		cin>>u>>v;
		if(adj[u][v] == MAX)
			cout<<-1<<endl;
		else
			cout<<adj[u][v]-1<<endl;
	}
	
}

Compiler output:
a.cc:67:2: error: stray '#' in program
   67 | }#include <bits/stdc++.h>
      |  ^
a.cc:67:3: error: 'include' does not name a type
   67 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:71:4: error: redefinition of 'll adj [305][305]'
   71 | ll adj[305][305], path[305][305];
      |    ^~~
a.cc:5:4: note: 'll adj [305][305]' previously declared here
    5 | ll adj[305][305], path[305][305];
      |    ^~~
a.cc:71:19: error: redefinition of 'll path [305][305]'
   71 | ll adj[305][305], path[305][305];
      |                   ^~~~
a.cc:5:19: note: 'll path [305][305]' previously declared here
    5 | ll adj[305][305], path[305][305];
      |                   ^~~~
a.cc:72:4: error: redefinition of 'll n'
   72 | ll n,m,u,v,d,l,q,ct,st,end1;
      |    ^
a.cc:6:4: note: 'll n' previously declared here
    6 | ll n,m,u,v,d,l,q,ct,st,end1;
      |    ^
a.cc:72:6: error: redefinition of 'll m'
   72 | ll n,m,u,v,d,l,q,ct,st,end1;
      |      ^
a.cc:6:6: note: 'll m' previously declared here
    6 | ll n,m,u,v,d,l,q,ct,st,end1;
      |      ^
a.cc:72:8: error: redefinition of 'll u'
   72 | ll n,m,u,v,d,l,q,ct,st,end1;
      |        ^
a.cc:6:8: note: 'll u' previously declared here
    6 | ll n,m,u,v,d,l,q,ct,st,end1;
      |        ^
a.cc:72:10: error: redefinition of 'll v'
   72 | ll n,m,u,v,d,l,q,ct,st,end1;
      |          ^
a.cc:6:10: note: 'll v' previously declared here
    6 | ll n,m,u,v,d,l,q,ct,st,end1;
      |          ^
a.cc:72:12: error: redefinition of 'll d'
   72 | ll n,m,u,v,d,l,q,ct,st,end1;
      |            ^
a.cc:6:12: note: 'll d' previously declared here
    6 | ll n,m,u,v,d,l,q,ct,st,end1;
      |            ^
a.cc:72:14: error: redefinition of 'll l'
   72 | ll n,m,u,v,d,l,q,ct,st,end1;
      |              ^
a.cc:6:14: note: 'll l' previously declared here
    6 | ll n,m,u,v,d,l,q,ct,st,end1;
      |              ^
a.cc:72:16: error: redefinition of 'll q'
   72 | ll n,m,u,v,d,l,q,ct,st,end1;
      |                ^
a.cc:6:16: note: 'll q' previously declared here
    6 | ll n,m,u,v,d,l,q,ct,st,end1;
      |                ^
a.cc:72:18: error: redefinition of 'll ct'
   72 | ll n,m,u,v,d,l,q,ct,st,end1;
      |                  ^~
a.cc:6:18: note: 'll ct' previously declared here
    6 | ll n,m,u,v,d,l,q,ct,st,end1;
      |                  ^~
a.cc:72:21: error: redefinition of 'll st'
   72 | ll n,m,u,v,d,l,q,ct,st,end1;
      |                     ^~
a.cc:6:21: note: 'll st' previously declared here
    6 | ll n,m,u,v,d,l,q,ct,st,end1;
      |                     ^~
a.cc:72:24: error: redefinition of 'll end1'
   72 | ll n,m,u,v,d,l,q,ct,st,end1;
      |                        ^~~~
a.cc:6:24: note: 'll end1' previously declared here
    6 | ll n,m,u,v,d,l,q,ct,st,end1;
      |                        ^~~~
a.cc:73:5: error: redefinition of 'int flag'
   73 | int flag;
      |     ^~~~
a.cc:7:5: note: 'int flag' previously declared here
    7 | int flag;
      |     ^~~~
a.cc:74:4: error: redefinition of 'll MAX'
   74 | ll MAX = 1e18;
      |    ^~~
a.cc:8:4: note: 'll MAX' previously defined here
    8 | ll MAX = 1e18;
      |    ^~~
a.cc:76:5: error: redefinition of 'int main()'
   76 | int main(){
      |     ^~~~
a.cc:10:5: note: 'int main()' previously defined here
   10 | int main(){
      |     ^~~~