Language: C++

#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
void WF(ll &d[][310],ll n){
    rep(i,n){
        rep(j,n){
            rep(k,n){
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
}
int main{
    ll n,m,l;
    cin>>n>>m>>l;
    ll d[310][310];
    rep(i,n)rep(j,n)d[i][j]=inf;
    rep(i,m){
        ll a,b,c;cin>>a>>b>>c;
        a--;b--;
        d[a][b]=c;
        d[b][a]=c;
    }
    WF(d,n);
    ll dd[310][310];
    rep(i,n)rep(j,n){
        if(d[i][j]<=l)dd[i][j]=1;
        dd[i][j]=inf;
    }
    WF(dd,n);
    ll q;cin>>q;
    while(q){
        q--;
        ll s,t;cin>>s>>t;
        s--;t--;
        if(dd[s][t]>300)cout<<-1<<endl;
        else cout<<dd[i][j]-1<<endl;
    }
}

Compiler output:
a.cc:10:13: error: declaration of 'd' as array of references
   10 | void WF(ll &d[][310],ll n){
      |             ^
a.cc:10:21: error: expected ')' before ',' token
   10 | void WF(ll &d[][310],ll n){
      |        ~            ^
      |                     )
a.cc:10:25: error: expected initializer before 'n'
   10 | void WF(ll &d[][310],ll n){
      |                         ^
a.cc:19:5: error: cannot declare '::main' to be a global variable
   19 | int main{
      |     ^~~~
a.cc:20:8: error: expected primary-expression before 'n'
   20 |     ll n,m,l;
      |        ^
a.cc:20:8: error: expected '}' before 'n'
a.cc:19:9: note: to match this '{'
   19 | int main{
      |         ^
a.cc:21:5: error: 'cin' does not name a type
   21 |     cin>>n>>m>>l;
      |     ^~~
a.cc:3:20: error: expected unqualified-id before 'for'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                    ^~~
a.cc:4:18: note: in expansion of macro 'REP'
    4 | #define rep(i,n) REP(i,0,n)
      |                  ^~~
a.cc:23:5: note: in expansion of macro 'rep'
   23 |     rep(i,n)rep(j,n)d[i][j]=inf;
      |     ^~~
a.cc:23:9: error: 'i' does not name a type
   23 |     rep(i,n)rep(j,n)d[i][j]=inf;
      |         ^
a.cc:3:34: note: in definition of macro 'REP'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                                  ^
a.cc:23:5: note: in expansion of macro 'rep'
   23 |     rep(i,n)rep(j,n)d[i][j]=inf;
      |     ^~~
a.cc:23:9: error: 'i' does not name a type
   23 |     rep(i,n)rep(j,n)d[i][j]=inf;
      |         ^
a.cc:3:40: note: in definition of macro 'REP'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                                        ^
a.cc:23:5: note: in expansion of macro 'rep'
   23 |     rep(i,n)rep(j,n)d[i][j]=inf;
      |     ^~~
a.cc:23:17: error: 'j' does not name a type
   23 |     rep(i,n)rep(j,n)d[i][j]=inf;
      |                 ^
a.cc:3:34: note: in definition of macro 'REP'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                                  ^
a.cc:23:13: note: in expansion of macro 'rep'
   23 |     rep(i,n)rep(j,n)d[i][j]=inf;
      |             ^~~
a.cc:23:17: error: 'j' does not name a type
   23 |     rep(i,n)rep(j,n)d[i][j]=inf;
      |                 ^
a.cc:3:40: note: in definition of macro 'REP'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                                        ^
a.cc:23:13: note: in expansion of macro 'rep'
   23 |     rep(i,n)rep(j,n)d[i][j]=inf;
      |             ^~~
a.cc:3:20: error: expected unqualified-id before 'for'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                    ^~~
a.cc:4:18: note: in expansion of macro 'REP'
    4 | #define rep(i,n) REP(i,0,n)
      |                  ^~~
a.cc:24:5: note: in expansion of macro 'rep'
   24 |     rep(i,m){
      |     ^~~
a.cc:24:9: error: 'i' does not name a type
   24 |     rep(i,m){
      |         ^
a.cc:3:34: note: in definition of macro 'REP'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                                  ^
a.cc:24:5: note: in expansion of macro 'rep'
   24 |     rep(i,m){
      |     ^~~
a.cc:24:9: error: 'i' does not name a type
   24 |     rep(i,m){
      |         ^
a.cc:3:40: note: in definition of macro 'REP'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                                        ^
a.cc:24:5: note: in expansion of macro 'rep'
   24 |     rep(i,m){
      |     ^~~
a.cc:30:7: error: expected constructor, destructor, or type conversion before '(' token
   30 |     WF(d,n);
      |       ^
a.cc:3:20: error: expected unqualified-id before 'for'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                    ^~~
a.cc:4:18: note: in expansion of macro 'REP'
    4 | #define rep(i,n) REP(i,0,n)
      |                  ^~~
a.cc:32:5: note: in expansion of macro 'rep'
   32 |     rep(i,n)rep(j,n){
      |     ^~~
a.cc:32:9: error: 'i' does not name a type
   32 |     rep(i,n)rep(j,n){
      |         ^
a.cc:3:34: note: in definition of macro 'REP'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                                  ^
a.cc:32:5: note: in expansion of macro 'rep'
   32 |     rep(i,n)rep(j,n){
      |     ^~~
a.cc:32:9: error: 'i' does not name a type
   32 |     rep(i,n)rep(j,n){
      |         ^
a.cc:3:40: note: in definition of macro 'REP'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                                        ^
a.cc:32:5: note: in expansion of macro 'rep'
   32 |     rep(i,n)rep(j,n){
      |     ^~~
a.cc:32:17: error: 'j' does not name a type
   32 |     rep(i,n)rep(j,n){
      |                 ^
a.cc:3:34: note: in definition of macro 'REP'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                                  ^
a.cc:32:13: note: in expansion of macro 'rep'
   32 |     rep(i,n)rep(j,n){
      |             ^~~
a.cc:32:17: error: 'j' does not name a type
   32 |     rep(i,n)rep(j,n){
      |                 ^
a.cc:3:40: note: in definition of macro 'REP'
    3 | #define REP(i,m,n) for(int i=(m);i<(n);i++)
      |                                        ^
a.cc:32:13: note: in expansion of macro 'rep'
   32 |     rep(i,n)rep(j,n){
      |             ^~~
a.cc:36:7: error: expected constructor, destructor, or type conversion before '(' token
   36 |     WF(dd,n);
      |       ^
a.cc:37:10: error: 'cin' does not name a type
   37 |     ll q;cin>>q;
      |          ^~~
a.cc:38:5: error: expected unqualified-id before 'while'
   38 |     while(q){
      |     ^~~~~
a.cc:45:1: error: expected declaration before '}' token
   45 | }
      | ^