Language: C++

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
typedef long long ll;
class newdist{
public:
ll refills;
ll cur;

newdist(){};

bool operator < (const newdist b) const
{
	if(refills<b.refills)
		return 1;
	else if(refills == b.refills)
	{
		if(cur<b.cur)
			return 1;
		else
			return 0;
	}
	else
		return 0;

}

};

int main()
{
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	
	ll n,m,cap,u,v,c;
	cin>>n>>m>>cap;
	vector<ll> edge[n+1];
	ll weight[n+1][n+1]={};
	newdist src[n+1][n+1], vis[n+1]={};
	
	
	for(ll i=0 ; i<m ; i++)
	{
		cin>>u>>v>>c;
		if(c>cap)
			continue;
		edge[u].pb(v);
		edge[v].pb(u);
		weight[u][v] = c;
		weight[v][u] = c;
	}
	for(ll i = 1; i<=n ; i++)
	{
		for(ll j = 1; j<=n ; j++)
		{
			
			src[i][j].refills = 1e9;
			src[i][j].cur = 0;
		}
	}

	for(ll dij = 1; dij<=n ; dij++)
	{
		src[dij][dij].refills = 0;
		src[dij][dij].cur=cap;
		set <pair<newdist,ll>> prqueue;
		
		for(ll i=1; i<=n ; i++)
			{
				vis[i]=0;
				prqueue.insert(mp(src[dij][i],i));
			}
				

		while(!prqueue.empty())
		{
			pair<newdist,ll> lat = *(prqueue.begin());
			prqueue.erase(lat);
			vis[lat.ss]=1;
			for(auto e: edge[lat.ss])
			{
				if(vis[e])
					continue;
				if(weight[e][lat.ss] > lat.ff.cur && weight[e][lat.ss]<=cap)
				{
					newdist upd;
					upd.refills = lat.ff.refills+1;
					upd.cur = cap - weight[e][lat.ss];
					if(upd<src[dij][e])
						{
							prqueue.erase(mp(src[dij][e],e));
							src[dij][e] = upd;
							prqueue.insert(mp(src[dij][e],e));
							
						}	
				}
				else
				{
					newdist upd;
					upd.refills = lat.ff.refills;
					upd.cur = lat.ff.cur - weight[e][lat.ss];
					if(upd.cur<0)
						continue;
					if(upd<src[dij][e])
						{
							prqueue.erase(mp(src[dij][e],e));
							src[dij][e] = upd;
							prqueue.insert(mp(src[dij][e],e));
						}	
				}
			}

		}

	}

	ll q;
	cin>>q;
	while(q--)
	{
		ll s,t;
		cin>>s>>t;

	 ll ref=src[s][t].refills;
	 if(ref >=1e4)
	 	cout<<-1<<endl;
	 else
	 	cout<<ref<<endl;
	}





	

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:40: error: no match for 'operator=' (operand types are 'newdist' and 'int')
   73 |                                 vis[i]=0;
      |                                        ^
a.cc:8:7: note: candidate: 'constexpr newdist& newdist::operator=(const newdist&)'
    8 | class newdist{
      |       ^~~~~~~
a.cc:8:7: note:   no known conversion for argument 1 from 'int' to 'const newdist&'
a.cc:8:7: note: candidate: 'constexpr newdist& newdist::operator=(newdist&&)'
a.cc:8:7: note:   no known conversion for argument 1 from 'int' to 'newdist&&'
a.cc:82:37: error: no match for 'operator=' (operand types are 'newdist' and 'int')
   82 |                         vis[lat.ss]=1;
      |                                     ^
a.cc:8:7: note: candidate: 'constexpr newdist& newdist::operator=(const newdist&)'
    8 | class newdist{
      |       ^~~~~~~
a.cc:8:7: note:   no known conversion for argument 1 from 'int' to 'const newdist&'
a.cc:8:7: note: candidate: 'constexpr newdist& newdist::operator=(newdist&&)'
a.cc:8:7: note:   no known conversion for argument 1 from 'int' to 'newdist&&'
a.cc:85:41: error: could not convert 'vis[e]' from 'newdist' to 'bool'
   85 |                                 if(vis[e])
      |                                    ~~~~~^
      |                                         |
      |                                         newdist