Language: C++

#include <bits/stdc++.h>
#define sc(x) scanf("%d", &x)
#define pr(x) printf("%d\n", x)
#define lowbit(x) (x & -x)
#define ll long long
#define N 1000010
#define memset(x) memset(x, 0, sizeof(x))
using namespace std;
int tot = 0, head[N], ans, n, m, l, q;
struct Xiao
{
	int next, to, w;
}f[N * 2];
void add(int x, int y, int z)
{
	f[++tot].to = y;
	f[tot].next = head[x];
	f[tot].w = z;
	head[x] = tot;
}
void dfs(int x, int fa, int ed, ll k, ll now)
{
	if (k >= ans) return;
	if (x == ed)
	{
		ans = min(ans, k);
		return;
	}
	for (int i = head[x]; i; i = f[i].next)
	{
		int y = f[i].to;
		if (y == fa) continue;
		if (now < f[i].w) dfs(y, x, ed, k + 1, l - f[i].w);
		else 
		{
			dfs(y, x, ed, k, now - f[i].w);
			dfs(y, x, ed, k + 1, l - f[i].w);
		}
	}	
}
int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	sc(n);
	sc(m);
	sc(l);
	for (int i = 1; i <= m; i++)
	{
		int x, y, z;
		sc(x);
		sc(y);
		sc(z);
		add(x, y, z);
		add(y, x, z);
	}
	sc(q);
	while (q--)
	{
		int s, t;
		ans = 500;
		sc(s);
		sc(t);
		dfs(s, 0, t, 0, l);
		if (ans != 500) printf("%d\n", ans);
		else printf("-1\n");
	}
	return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int, int, long long int, long long int)':
a.cc:26:26: error: no matching function for call to 'min(int&, long long int&)'
   26 |                 ans = min(ans, k);
      |                       ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/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:26:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   26 |                 ans = min(ans, k);
      |                       ~~~^~~~~~~~
/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:
/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:26:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   26 |                 ans = min(ans, k);
      |                       ~~~^~~~~~~~