Language: C++

//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef vector<ll> vi;
typedef vector<long long> vl;
typedef pair<ll, ll> pi;
typedef vector<pair<ll, ll>> vpi;

//const long long INF = 1LL << 55;

#define itn ll
#define endl '\n'
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

inline void ain(vector<ll>& a,ll n){
   for(ll i = 0;i < n;i++)scanf("%d",&a[i]);
}
inline void ainl(vector<ll>&a,ll n){
   for(ll i = 0;i < n;i++)scanf("%lld",&a[i]);
}
template<class T>inline void aout(vector<T> a){
   ll sz = a.size();
   cout << "[ ";
   for(ll i = 0;i < sz;i++){
      if(i != sz-1)cout << a[i] << ", ";
      else cout << a[i];
   }
   cout << " ]" << endl;
}
ll n,m,l;
ll cost[400][400];
ll cost2[400][400];
int main(void){
   ioboost;
   rep(i, 400) rep(j, 400) cost[i][j] = cost2[i][j] = (ll)1e17;
   cin >> n >> m >> l;
   rep(i,m){
      ll a,b,c;cin >> a >> b >> c;
      a--,b--;
      cost[a][b] = c;
      cost[b][a] = c;
   }
   rep(i,n)cost[i][i] = cost2[i][i] = 0;
   rep(i,n)rep(j,n)rep(k,n){
      cost[i][j] = min(cost[i][j],cost[i][k] + cost[k][j]);
   }

   rep(i,n)rep(j,n){
      if(cost[i][j] <= l)mins(cost2[i][j],1);
      else cost2[i][j] = 1e17;
   }
   rep(i,n)rep(j,n)rep(k,n){
      cost2[i][j] = min(cost2[i][j],cost2[i][k] + cost2[k][j]);
   }
   ll q;cin >> q;
   rep(i,q){
      ll s,t;cin >> s >> t;
      s--,t--;
      if(cost2[s][t] >= (ll)1e17)cout << -1 << endl;
      else cout << --cost2[s][t] << endl;
   }
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:26: error: no matching function for call to 'min(ll&, int)'
   34 | #define mins(x,y) x = min(x,y)
      |                       ~~~^~~~~
a.cc:84:26: note: in expansion of macro 'mins'
   84 |       if(cost[i][j] <= l)mins(cost2[i][j],1);
      |                          ^~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:34:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 | #define mins(x,y) x = min(x,y)
      |                       ~~~^~~~~
a.cc:84:26: note: in expansion of macro 'mins'
   84 |       if(cost[i][j] <= l)mins(cost2[i][j],1);
      |                          ^~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:11:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:34:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 | #define mins(x,y) x = min(x,y)
      |                       ~~~^~~~~
a.cc:84:26: note: in expansion of macro 'mins'
   84 |       if(cost[i][j] <= l)mins(cost2[i][j],1);
      |                          ^~~~