Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n, m, l; cin >> n >> m >> l;
	vector<vector<pair<int, int>>> e(n, vector<pair<int, int>>());
	rep(i, 0, m - 1)
	{
		int a, b, c; cin >> a >> b >> c;
		--a, --b;
		e[a].push_back({ b,c });
		e[b].push_back({ a,c });
	}
	int inf = 1000;
	vector<vector<pair<int, int>>> res(n, vector<pair<int, int>>(n, { inf, 0 }));
	rep(i, 0, n - 1)res[i][i] = { 0,0 };
	rep(i, 0, n - 1)
	{
		priority_queue < pair<pair<int, int>, int>, vector<pair<pair<int, int>, int>>, greater<pair<pair<int, int>, int>>> q;;
		q.push({ i, {0,0} });
		while (!q.empty())
		{
			pair<int,int> p = q.top().first;
			int now = q.top().second;
			int cnt = p.first;
			int used = p.second;
			q.pop();
			for (pair<int, int> x : e[now])
			{
				int next = x.first;
				int cost = x.second;
				if (l < cost)continue;

				pair<int, int> current;
				if (l < used + cost)
				{
					current = { cnt + 1,cost };
				}
				else
				{
					current = { cnt,used + cost };
				}

				if (current < res[i][next])
				{
					q.push({ next,current });
					res[i][next] = current;
				}
			}
		}
	}
	int Q; cin >> Q;
	rep(i, 1, Q)
	{
		int s, t; cin >> s >> t;
		--s, --t;
		if (res[s][t].first == inf)cout << -1 << endl;
		else cout << res[s][t].first << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:23: error: no matching function for call to 'std::priority_queue<std::pair<std::pair<int, int>, int>, std::vector<std::pair<std::pair<int, int>, int> >, std::greater<std::pair<std::pair<int, int>, int> > >::push(<brace-enclosed initializer list>)'
   36 |                 q.push({ i, {0,0} });
      |                 ~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<std::pair<int, int>, int>; _Sequence = std::vector<std::pair<std::pair<int, int>, int> >; _Compare = std::greater<std::pair<std::pair<int, int>, int> >; value_type = std::pair<std::pair<int, int>, int>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<std::pair<std::pair<int, int>, int>, std::vector<std::pair<std::pair<int, int>, int> >, std::greater<std::pair<std::pair<int, int>, int> > >::value_type&' {aka 'const std::pair<std::pair<int, int>, int>&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<std::pair<int, int>, int>; _Sequence = std::vector<std::pair<std::pair<int, int>, int> >; _Compare = std::greater<std::pair<std::pair<int, int>, int> >; value_type = std::pair<std::pair<int, int>, int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<std::pair<int, int>, int>, std::vector<std::pair<std::pair<int, int>, int> >, std::greater<std::pair<std::pair<int, int>, int> > >::value_type&&' {aka 'std::pair<std::pair<int, int>, int>&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
a.cc:62:47: error: no matching function for call to 'std::priority_queue<std::pair<std::pair<int, int>, int>, std::vector<std::pair<std::pair<int, int>, int> >, std::greater<std::pair<std::pair<int, int>, int> > >::push(<brace-enclosed initializer list>)'
   62 |                                         q.push({ next,current });
      |                                         ~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<std::pair<int, int>, int>; _Sequence = std::vector<std::pair<std::pair<int, int>, int> >; _Compare = std::greater<std::pair<std::pair<int, int>, int> >; value_type = std::pair<std::pair<int, int>, int>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<std::pair<std::pair<int, int>, int>, std::vector<std::pair<std::pair<int, int>, int> >, std::greater<std::pair<std::pair<int, int>, int> > >::value_type&' {aka 'const std::pair<std::pair<int, int>, int>&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<std::pair<int, int>, int>; _Sequence = std::vector<std::pair<std::pair<int, int>, int> >; _Compare = std::greater<std::pair<std::pair<int, int>, int> >; value_type = std::pair<std::pair<int, int>, int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<std::pair<int, int>, int>, std::vector<std::pair<std::pair<int, int>, int> >, std::greater<std::pair<std::pair<int, int>, int> > >::value_type&&' {aka 'std::pair<std::pair<int, int>, int>&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~