Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

LL n, m, l, q, INF = 500;
pair<LL, LL> d[300][300];

int main() {
	cin >> n >> m >> l;
	inc(i, n) {
	inc(j, n) {
		d[i][j] = (i == j ? { 0, 0 } : { INF, l });
	}
	}
	
	inc(i, m) {
		LL a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		if(c <= l) { d[a][b] = d[b][a] = { c / l, c % l }; }
	}
	
	inc(k, n) {
	inc(i, n) {
	inc(j, n) {
		LL c1 = d[i][k].FI;
		LL d1 = d[i][k].SE;
		LL c2 = d[k][j].FI;
		LL d2 = d[k][j].SE;
		
		pair<LL, LL> p;
		if(c1 + c2 == 0 && d1 + d2 <= l) {
			p = { 0, d1 + d2 };
		} else {
			p = { c1 + c2 + 1, d2 };
		}
		
		setmin(d[i][j], p);
	}
	}
	}
	
	inc(i, n) {
	inc(j, n) {
		if(d[i][j].FI >= INF) { d[i][j].FI = -1; }
		if(d[i][j].SE ==   0) { d[i][j].FI--; }
	}
	}
	
	cin >> q;
	inc(qq, q) {
		int s, t;
		cin >> s >> t;
		s--; t--;
		
		cout << d[s][t].FI << "\n";
	}
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:37: error: expected primary-expression before '{' token
   49 |                 d[i][j] = (i == j ? { 0, 0 } : { INF, l });
      |                                     ^
a.cc:49:36: error: expected ':' before '{' token
   49 |                 d[i][j] = (i == j ? { 0, 0 } : { INF, l });
      |                                    ^~
      |                                    :
a.cc:49:37: error: expected primary-expression before '{' token
   49 |                 d[i][j] = (i == j ? { 0, 0 } : { INF, l });
      |                                     ^
a.cc:49:36: error: expected ')' before '{' token
   49 |                 d[i][j] = (i == j ? { 0, 0 } : { INF, l });
      |                           ~        ^~
      |                                    )
a.cc:49:58: error: expected primary-expression before ')' token
   49 |                 d[i][j] = (i == j ? { 0, 0 } : { INF, l });
      |                                                          ^