criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
#include<vector>
#include<queue>
using namespace std;

pair<int, int> prev_seen_neighbour(int node, vector<pair<int, int>> &nei, vector<int> &seen, vector<int> &visited) {
  for (int i = 0; i < (int)nei.size(); i++)
    if ((seen[nei[i].first] == seen[node] - 1) && visited[nei[i].first] == 0)
      return nei[i];
  return {-1, -1};
}

int main() {
  int n, m, l; cin >> n >> m >> l;

  vector<vector <pair<int, int>>> nei(n, vector<pair <int, int>>());
  vector<vector <int>> a(m, vector<int>(3));

  for (int i = 0; i < m; i++) {
    cin >> a[i][0] >> a[i][1] >> a[i][2];
    nei[a[i][0] - 1].push_back({a[i][1] - 1, a[i][2]});
    nei[a[i][1] - 1].push_back({a[i][0] - 1, a[i][2]});
  }

  for(int i = 0; i < n; i++) {
    sort(nei[i].begin(), nei[i].end(), [](pair<int, int> &left, pair<int, int> &right) {
        return left.second < right.second;
    });
  }

  int q; cin >> q;
  vector<pair <int, int>> query(q, pair<int, int>());
  for (int i = 0; i < q; i++) {
    cin >> query[i].first >> query[i].second;
    vector<int> seen(n, 0);
    queue<int> bfs;
    int start = query[i].first - 1;

    bfs.push(start);
    seen[start] = 1;
    int finish = -1;
    while (finish == -1 && !bfs.empty()) {
      int current_node = bfs.front();
      bfs.pop();
      for (int j = 0; j < (int)nei[current_node].size(); j++) {
        int neighbour = nei[current_node][j].first;
        if (seen[neighbour] == 0) {
          bfs.push(neighbour);
          seen[neighbour] = seen[current_node] + 1;
          if (neighbour == query[i].second - 1) {
            finish = query[i].second - 1;
            break;
          }
        }
      }
    }

    if (bfs.empty()) {
      cout << "-1 \n";
    } else {
      vector<int> visited(n + 1, 0);
      vector<pair <int, int>> retrace;

      retrace.push_back({finish, 0});
      visited[finish] = 1;
      int current_node = finish;

      bool done = false;
      while (prev_seen_neighbour(current_node, nei[current_node], seen, visited).first != -1 && !done) {
        pair<int, int> neighbour = prev_seen_neighbour(current_node, nei[current_node], seen, visited);
        retrace.push_back(neighbour);
        visited[neighbour.first] = 1;
        current_node = neighbour.first;
        if (current_node == start)
          done = true;
      }

      int cap = l, count = 0;
      bool can = true;
      for (int j = retrace.size() - 1; j > 0; j--) {
        if (l < retrace[j].second) {
          can = false;
          break;
        } else {
          if (cap < retrace[j].second) {
            count++;
            cap = l;
          }
          cap -= retrace[j].second;
        }
      }
      if (can)
        cout << count << "\n";
      else
        cout << "-1 \n";
    }

  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   26 |     sort(nei[i].begin(), nei[i].end(), [](pair<int, int> &left, pair<int, int> &right) {
      |     ^~~~
      |     short
Language: C++

#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5LL << 33, MOD = 1e9 + 7;

int N, M, L;

const int MXV = 305;
int d[305][305];
int wd[305][305];
int Q;
vector<pii> vq;

void input() {
  cin >> N >> M >> L;
  int a, b, c;
  rep(i, 0, 304) {
    rep(j, 0, 304) {
      d[i][j] = wd[i][j] = INF;
      if (i == j) d[i][j] = wd[i][j] = 0;
    }
  }
  rep(i, 1, M) {
    cin >> a >> b >> c;
    if (c > L) {
      continue;
    }
    d[a][b] = c;
    d[b][a] = c;
    wd[a][b] = c;
    wd[b][a] = c;
  }

  //=
  cin >> Q;
  vq.resize(Q);
  rep(i, 0, Q - 1) { cin >> vq[i].first >> vq[i].second; }
}

int nxtg[MXV][MXV];
void solve() {
  rep(k, 1, N) {
    rep(i, 1, N) {
      rep(j, 1, N) {
        if (d[i][k] == INF || d[k][j] == INF) continue;  // 道がない場合
        wd[i][j] = min(wd[i][j], wd[i][k] + wd[k][j]);
      }
    }
  }

  rep(i, 1, N) {
    rep(j, 1, N) {
      if (i == j) {
        nxtg[i][j] = 0;
      } else {
        nxtg[i][j] = INF;
      }
    }
  }
  rep(i, 1, N) {
    rep(j, 1, N) {
      if (wd[i][j] <= L) {
        nxtg[i][j] = 1;
      }
    }
  }
  rep(k, 1, N) {
    rep(i, 1, N) {
      rep(j, 1, N) {
        if (nxtg[i][k] == INF || nxtg[k][j] == INF) continue;
        nxtg[i][j] = min(nxtg[i][j], nxtg[i][k] + nxtg[k][j]);
      }
    }
  }

  for (auto query : vq) {
    int asa = nxtg[query.first][query.second];
    if (asa < INF) {
      cout << asa - 1 << endl;
      else {
        cout << -1 << endl;
      }
    }
  }
  signed main() {
    input();
    solve();
    return 0;
  }

Compiler output:
a.cc: In function 'void solve()':
a.cc:91:7: error: expected '}' before 'else'
   91 |       else {
      |       ^~~~
a.cc:89:20: note: to match this '{'
   89 |     if (asa < INF) {
      |                    ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

const uint64_t Undedined = static_cast<uint64_t>(-1);

// ワーシャル・フロイド法
vector<vector<uint64_t>> warshall_floyd(uint64_t N, std::vector<std::map<uint64_t, uint64_t>> &edges)
{
  vector<vector<uint64_t>> d(N, vector<uint64_t>(N, Undedined));
  
  for (uint64_t i = 0; i < N; ++i) {
    for (uint64_t j = 0; j < N; ++j) {
      if (i == j) {
        d[i][j] = 0;
      } else if (edges[i].find(j) != edges[i].end()) {
        vector<uint64_t> route = {{ i, j }};
        d[i][j] = edges[i][j];
      }
    }
  }
  
  for (uint64_t i = 0; i < N; ++i) {
    for (uint64_t j = 0; j < N; ++j) {
      for (uint64_t k = 0; k < N; ++k) {
        if (d[i][k] == Undedined || d[k][j] == Undedined) {
          continue;
        }
        
        if (d[i][j] > d[i][k] + d[k][j]) {
          d[i][j] = d[i][k] + d[k][j];
        }
      }
    }
  }
  
  return d;
}

int main()
{
  uint64_t N, M, L;
  cin >> N >> M >> L;
  
  std::vector<std::map<uint64_t, uint64_t>> edges(N);
  for (uint64_t m = 0; m < M; ++m) {
    uint64_t A, B, C;
    cin >> A >> B >> C;
    
    // タンクの容量を超える道はそもそも通れない
    if (C <= L) {
      edges[A - 1].emplace(B - 1, C);
      edges[B - 1].emplace(A - 1, C);
    }
  }
  
  // ワーシャル・フロイド法
  vector<vector<uint64_t>> d1 = warshall_floyd(N, edges);
  debug(d1);
  
  std::vector<std::map<uint64_t, uint64_t>> refueling_edges(N);
  for (uint64_t i = 0; i < N; ++i) {
    for (uint64_t j = 0; j < N; ++j) {
      if (d1[i][j] != Undedined && d1[i][j] <= L) {
        refueling_edges[i][j] = 1;
      }
    }
  }
  
  // ワーシャル・フロイド法
  vector<vector<uint64_t>> d2 = warshall_floyd(N, refueling_edges);
  debug(d2);
  
  uint64_t Q;
  cin >> Q;
  
  for (uint64_t q = 0; q < Q; ++q) {
    uint64_t s, t;
    cin >> s >> t;
    --s; --t;
    
    if (d2[s][t] == Undedined) {
      cout << -1 << endl;
    } else {
      cout << (d2[s][t] - 1) << endl;
    }
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:3: error: 'debug' was not declared in this scope
   59 |   debug(d1);
      |   ^~~~~
Language: C++

#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main(int argc, char const *argv[])
{
    const ll INF = (1ll << 60);
    int n, m;
    ll l;
    cin >> n >> m >> l;
    int a[m], b[m];
    ll c[m];
    ll dist[n][n];
    rep(i, n) rep(j, n)
    {
        if (i == j)
            dist[i][j] = 0;
        else
            dist[i][j] = INF;
    }

    rep(i, m)
    {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;
        b[i]--;
        dist[a[i]][b[i]] = c[i];
        dist[b[i]][a[i]] = c[i];
    }
    pair<ll, ll> dp[n][n];
    rep(i, n) rep(j, n)
    {
        if (i == j)
        {
            dp[i][j] = {0, l};
        }
        else
        {
            dp[i][j] = {INF, -1};
        }
    }
    rep(i, m)
    {
        if (c[i] <= l)
        {
            dp[a[i]][b[i]] = {0, l - c[i]};
            dp[b[i]][a[i]] = {0, l - c[i]};
        }
    }
    bool flag;
    do
    {
        flag = false;
        rep(k, n) rep(i, n) rep(j, n)
        {
            if (dp[i][k].first == INF || dp[k][j].first == INF)
                continue;
            if (dist[k][j] > l)
                continue;
            int pena = (dp[i][k].second >= dist[k][j]) ? 0 : 1;
            int newFill = dp[i][k].first + dp[k][j].first + pena;
            int newRem = (pena == 1) ? l - dist[k][j] : dp[i][k].second - dist[k][j];
            if (dp[i][j].first > newFill || (dp[i][j].first == newFill && dp[i][j].second < newRem))
            {
                dp[i][j] = {newFill, newRem};
                cerr << newFill << " " << newRem << endl;
                //dp[j][i] = dp[i][j];
                flag = true;
            }
        }
        count++;
    } while (flag);
    int q;
    cin >> q;
    rep(i, q)
    {
        int s, t;
        cin >> s >> t;
        s--;
        t--;
        if (dp[s][t].first == INF)
            cout << -1 << endl;
        else
            cout << dp[s][t].first << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:86:14: error: no post-increment operator for type
   86 |         count++;
      |              ^~
Language: C++

#include <bits/stdc++.h> 
using namespace std;

const int N = 330, inf = 1e9;
typedef long long ll;

ll dist[N][N];

int main()  
{
	int n, m, l;
	cin >> n >> m >> l;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
		{
			dist[i][j] = inf;
			if(i == j)
				dist[i][j] = 0;
		}
	for (int i = 0; i < m; i++)
	{
		int v, u, w;
		cin >> v >> u >> w;
		v--, u--;
		dist[v][u] = min(dist[v][u], w * 1LL);
		dist[u][v] = dist[v][u];
	}
	for (int k = 0; k < n; k++)
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
	int q;
	cin >> q;
	while(q--)
	{
		int v, u;
		cin >> v >> u;
		v--, u--;
		if(dist[v][u] == inf)
		{
			cout << -1 << endl;
			continue;
		}
		cout << max(0, dist[v][u] / l + (bool) (dist[v][u] % l) - 1) << endl;
	}
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:44:28: error: no matching function for call to 'max(int, ll)'
   44 |                 cout << max(0, dist[v][u] / l + (bool) (dist[v][u] % l) - 1) << endl;
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   44 |                 cout << max(0, dist[v][u] / l + (bool) (dist[v][u] % l) - 1) << endl;
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   44 |                 cout << max(0, dist[v][u] / l + (bool) (dist[v][u] % l) - 1) << endl;
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int main(){
    long long N, M, L;
    cin >> N >> M >> L;
    vector<vector<long long>> road(N, vector<long long>(N,MOD*MOD));
    for(int i=0; i<M; i++){
        int A,B,C;
        cin >> A >> B >> C;
        A--;B--;
        road[A][B]=road[B][A]=C;
    }

    priority_queue<pair<long long, pair<long long, long long>>> p_que;
    vector<vector<long long>> map_(N,vector<long long>(N, MOD*MOD));

    for(int i=0; i<N; i++){
        p_que.push(make_pair(0, make_pair(L, i)));
        map_[i][i]=0;
        while((int) p_que.size()>0){
            pair<long long, pair<long long, long long>> tmp=p_que.top();
            p_que.pop();
            long long cost = tmp.first;
            long long fuel = tmp.second.first;
            long long place = tmp.second.second;
            for(int j=0; j<N; j++){
                long long next_cost=road[place][j];
                if(next_cost==MOD*MOD)continue;
                if(fuel<next_cost){
                    fuel=L;
                    cost--;
                }else{
                    fuel-=next_cost;
                }
                if(-cost < map_[i][j]){
                    map_[i][j]=-cost;
                }else{
                    continue;
                }
                p_que.push(make_pair(cost, make_pair(fuel, j)));
            }
        }
    }

    int Q;
    cin >> Q;
    for(int i=0; i<Q; i++){
        int s, t;
        cin >> s >> t;
        s--;t--;
        if(map_[s][t]==MOD*MOD){
            cout << -1 << endl;
        }else{
        cout <<  << endl;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:18: error: expected primary-expression before '<<' token
   68 |         cout <<  << endl;
      |                  ^~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
int main() {
    int n = 0, m = 0, l = 0;
    cin >> n >> m >> l;
    vector<vector<ll>> g(n + 1, vector<ll>(n + 1, INT_MAX));
    for(int i = 0; i < m; ++i) {
        int a = 0, b = 0, c = 0;
        cin >> a >> b >> c;
        g[a][b] = g[b][a] = c;
    }
    vector<vector<ll>> r(n + 1, vector<ll>(n + 1, INT_MAX));
    for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= n; ++j) {
            if(g[i][j] <= l) {
                r[i][j] = 1;
            }
        }
    }
    for(int k = 1; k <= n; ++k) {
        for(int i = 1; i <= n; ++i) {
            for(int j = 1; j <= n; ++j) {
                if(r[i][j] > r[i][k] + r[k][j]) {
                    r[i][j] = r[i][k] + r[k][j];
                }
            }
        }
    }
    int q = 0;
    cin >> q;
    vector<int> vs;
    vector<int> vt;
    for(int i = 0; i < q; ++i) {
        int s = 0, t = 0;
        cin >> s >> t;
        cout << (r[s][t] == INT_MAX ? -1 : (r[s][t] - 1)) << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:51: error: 'INT_MAX' was not declared in this scope
    9 |     vector<vector<ll>> g(n + 1, vector<ll>(n + 1, INT_MAX));
      |                                                   ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 | typedef long long ll;
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e12;

void warshall_floyd(vector<vector<long long>> &_Date){
    for(int k = 0; k < _Date.size(); k++){        //経由頂点
        for(int i = 0; i < _Date.size(); i++){    //始点
            for(int j = 0; j < _Date.size(); j++){//終点
                _Date[i][j] = min(_Date[i][j], _Date[i][k] + _Date[k][j]);
            }
        }
    }
}

struct UnionFind {
    vector<int> data;
    int sz;
    UnionFind(int _sz) : data(_sz, -1), sz(_sz) { }
    bool unionSet(int x, int y) {
        if ((x = root(x)) == (y = root(y))) return false;
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y]; data[y] = x; sz--;
        return true;
    }
    bool findSet(int x, int y) { return root(x) == root(y); }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
    int size(int x) { return -data[root(x)]; }
    int size() { return sz; }
};


int main(){
    int N, M;
    long long L;
    cin >> N >> M >> L;
    UnionFind uf(N);
    vector<vector<int>> G(N, vector<int>());
    vector<vector<long long>> dist(N, vector<long long>(N, INF));
    for(int i = 0; i < M; i++){
        int a, b;
        long long c;
        cin >> a >> b >> c;
        a--;
        b--;
        uf.unionSet(a, b);
        G[a].push_back(b);
        G[b].push_back(a);
        dist[a][b] = c;
        dist[b][a] = c;
    }
    
    warshall_floyd(dist);
    
    int Q;
    cin >> Q;
    for(int i = 0; i < Q; i++){
        int s, g;
        cin >> s >> g;
        s--;
        g--;
        long long ans = -1;
        if(uf.findSet(s, g)){
            vector<bool> seen(N, false);
            stack<pair<int, pair<long long, long long>>> sta;
            sta.push(make_pair(s, make_pair(0, L)));
            
            while(!sta.empty()){
                pair<int, pair<long long, long long>>> p;
                p = sta.top();
                sta.pop();
                int now = p.first;
                long long cnt = p.second.first;
                long long tank = p.second.second;
                seen[now] = true;
                if(now == g){
                    ans = cnt;
                    break;
                }
                for(auto v : G[now]){
                    if(seen[v])continue;
                    long long next = tank - dist[now][v];
                    if(next < 0){
                        sta.push(make_pair(v, make_pair(cnt + 1, L)));
                    }else{
                        sta.push(make_pair(v, make_pair(cnt, next)));
                    }
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:54: error: expected unqualified-id before '>' token
   68 |                 pair<int, pair<long long, long long>>> p;
      |                                                      ^
a.cc:69:17: error: 'p' was not declared in this scope
   69 |                 p = sta.top();
      |                 ^
Language: C++

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define souatari rep1(i,n-1)rep(j,i)
#define souatari1 for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;


pii e[330][330];


int main(){ 

  int n,m,l;
  cin >> n >> m >> l;

  
  rep(i,330)rep(j,330) e[i][j] = mp(500,0);

  rep(i,m){
    int a,b,c;
    cin >> a >> b >> c;
    if(c <= l){
      e[a-1][b-1]=mp(0,c);
      e[b-1][a-1]=mp(0,c);
    }
  }
  rep(i,330) e[i][i] = mp(0,0);

  int q;
  cin >> q;
  pii stlist[100000];
  rep(i,q) {
    int s,t;
    cin >> s >> t;
    stlist[i] = mp(s-1,t-1);
  }

  rep(itr,q){
    pii tmpans[330];
    rep(i,330) tmpans[i] = mp(500,0);

    pii question = stlist[itr];
    
    tmpans[question.F] = mp(0,0);
    rep(i,n)rep(j,n) {
      pii tmp = mp(500,500);
      ll nf,ns;
      nf = tmpans[i].F+e[i][j].F;
      ns = tmpans[i].S+e[i][j].S;
      if(ns > l){
        ns-=l;
        nf++;
      }
      tmp = mp(nf,ns);
      if(tmp < tmpans[j]) tmpans[j] = tmp;
    }

    int ans = tmpans[stlist[q].S].F;
    if(ans > 301){
      prints(-1);
    }
    else{
      prints(ans);
    }
  }



      
  }

  









  return 0;

}


Compiler output:
a.cc:141:3: error: expected unqualified-id before 'return'
  141 |   return 0;
      |   ^~~~~~
a.cc:143:1: error: expected declaration before '}' token
  143 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long
using namespace std;
using vl=vector<ll>;
int n,m;
vector<vl> g,d;
ll mx=(ll)1e18+11;
void solve(){
  g=vector<vl>(n+1,vl(n+1,mx));
  for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++){
      d[i][j]=g[i][j];
    }
  for(int k=1;k<=n;k++){
    for(int i=1;i<=n;i++){
      for(int j=1;j<=n;j++){
        if((d[i][k]+d[k][j])<d[i][j])
          d[i][j]=(d[i][k]+d[k][j]);
      }
    }
  }
}
  
int main(){
  fast;
  int a,b,q,l;
  cin>>n>>m>>l;
  g=vector<vl>(n+1,vl(n+1,mx));
  for(int i=0;i<m;i++){
    cin>>a>>b>>c;
    g[a][b]=g[b][a]=c;
  }
  solve();
  cin>>q;
  for(int i=0;i<q;i++){
    ll s,t;
    cin>>s>>t;
    cout<<(ceil(d[s][t]/l))<<"\n";
  }
}
    
    
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:31:16: error: 'c' was not declared in this scope
   31 |     cin>>a>>b>>c;
      |                ^
a.cc: At global scope:
a.cc:44:1: error: expected declaration before '}' token
   44 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,b,n) for(ll i=(ll)(b);i<(ll)(n);++i)
#define rep(i,n) REP(i,0,n)
 
struct G{
    struct E{ ll t, c; };
    ll n;
    vector<vector<E>> g;
    G(ll n) : n(n), g(n){}
    void add_undirected_edge(ll s, ll t, ll c){
        g[s].emplace_back(E{t, c});
        g[t].emplace_back(E{s, c});
    }
    // undirected なのだけ. (そうでなくしたければ, 逆グラフを作る)
    ll dijk(ll s, ll t){
        vector<priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>> pq(2);
        vector<vector<ll>> d(2, vector<ll>(n, numeric_limits<ll>::max() / 2));
        pq[0].emplace(d[0][s] = 0, s);
        pq[1].emplace(d[1][t] = 0, t);
        vector<ll> fin(n);
        for(bool cont = true; cont and !pq[0].empty() and !pq[1].empty(); ){
            for(ll i = 0; i < 2; ++i){
                if(pq[i].empty()) continue;
                ll u, c; tie(c, u) = pq[i].top(); pq[i].pop();
                if(c > d[i][u]) continue;
                if(++fin[u] == 2){
                    cont = false;
                    break;
                }
                for(auto &e : g[u]) if(d[i][e.t] > c + e.c)
                    pq[i].emplace(d[i][e.t] = c + e.c, e.t);
            }
        }
        ll res = numeric_limits<ll>::max();
        for(ll u = 0; u < n; ++u) res = min(res, d[0][u] + d[1][u]);
        return res;
    }
};

int main(){
    ll n, m,l; cin >> n >> m >> l;
    G g(n);
    rep(_, m){
        ll u, v, c; cin >> u >> v >> c;
        if(c > l) continue;
        g.add_undirected_edge(--u, --v, c);
    }
    ll q; cin >> q;

    rep(i,q){
        ll s,t; cin >> s >> t; s--; t--;
        ans = ceil(g.dijk(s,t) / l)-1;
        cout << ans << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   54 |         ans = ceil(g.dijk(s,t) / l)-1;
      |         ^~~
      |         abs
Language: C++

#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
long long INF;
using namespace std;
long long n,m,l,q,s,t;
long long dis[305][305];
int main()
{
    IOS;l
    cin>>n>>m>>l;
    memset(dis,0x3f,sizeof dis);
    INF = dis[0][0];
    for(int i = 1; i <= n; i++)
    {
        dis[i][i] = 0;
    }
    for(int i = 1; i <= m; i++)//输入边a,b两点的权值是x
    {
        int a, b, x;
        scanf("%d%d%d", &a, &b, &x);
        if(x>l)
        {
            continue;
        }
        if(dis[a][b] > x)
            dis[a][b] = dis[b][a] = x;
    }
    for(int k = 1; k <= n; k++)
        for(int i = 1; i <= n; i++)
            for(int j = 1; j <= n; j++)
            {
                if(dis[i][k] < INF && dis[k][j] < INF)
                    dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
            }
    cin>>q;
    while(q--)
    {
        scanf("%d%d", &s, &t);
        if(dis[s][t] != INF)//可以求任意两点间最短路
        {
             cout<<dis[s][t]/l<<endl;
        }
        else
            printf("-1\n");
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: expected ';' before 'cin'
   14 |     IOS;l
      |          ^
      |          ;
   15 |     cin>>n>>m>>l;
      |     ~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;
#define INFS (1LL<<28)
#define INF (1LL<<60)
#define DEKAI 1000000007
#define MOD 998244353
#define lp(i,n) for(int i=0;i<n;i++)
#define double long double
#define all(c) begin(c), end(c)

#define int long long 
#define qhoge pair<pair<int,int>,int>
int dp[1000][1000];
signed main(){

	cin.tie(0); ios::sync_with_stdio(false);
	int n,m,l;
	cin>>n>>m>>l;
	vector<pair<int,int>> v[5000];
	lp(i,m){
		int a,b,c;
		cin>>a>>b>>c;
		//if(c>l)continue;
		v[a].push_back({b,c});
		v[b].push_back({a,c});
	}
	lp(i,1000){
		lp(j,1000)dp[i][j]=INF;
	}
	lp(z,n+1){
		if(z==0)continue;
		int s=z;
		lp(i,n){
			dp[z][i+1]=INF;
		}
		priority_queue<qhoge,vector<qhoge>,greater<qhoge>> q;
		q.push({{0,-1*(l)},s});
		dp[z][s]=0;
		while(!q.empty()){
			int now=q.top().second;
			int rem=q.top().first.second;
			rem*=-1;
			int cnt=q.top().first.first;
			if(dp[now]>cnt)dp[now]=cnt;
			//cout<<now<<" "<<rem<<" "<<cnt<<endl;
			q.pop();
			lp(i,v[now].size()){
				int next=v[now][i].first;
				int cost=v[now][i].second;
				//cout<<" "<<next<<" "<<cost<<endl;
				int nexttank=rem-cost;
				if(nexttank<0){
					if(dp[z][next]<=cnt+1)continue;
					dp[z][next]=cnt+1;
					q.push({{cnt+1,-1*(l-cost)},next});
				}
				else{
					if(dp[z][next]<=cnt)continue;
					q.push({{cnt+1,-1*(l-cost)},next});
					dp[z][next]=cnt;
					q.push({{cnt,-1*(nexttank)},next});
				}
			}
		}
	}
	int qs;
	cin>>qs;
	lp(i,qs){
		int s,t;
		cin>>s>>t;
		if(dp[s][t]==INF)cout<<-1<<endl;
		else cout<<dp[s][t]<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   45 |                         if(dp[now]>cnt)dp[now]=cnt;
      |                            ~~~~~~~^~~~
a.cc:45:47: error: incompatible types in assignment of 'long long int' to 'long long int [1000]'
   45 |                         if(dp[now]>cnt)dp[now]=cnt;
      |                                        ~~~~~~~^~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

vector<vector<int>> next1;

void warshallFloyd(int N,vector<vector<ll>> &dist){
	rep(k,N)rep(i,N){
		if(dist[i][k] == LINF) continue;
		rep(j,N){
			if(dist[k][j] == LINF) continue;
            if(dist[i][j] > dist[i][k]+dist[k][j]){
                dist[i][j] = dist[i][k] + dist[k][j];
                next1[i][j] = next1[i][k];
            }
		}
	}
}

vector<int> get_path(int s,int t){
    vector<int> path;
    for(int i = s; i != t; i = next1[i][t]){
        path.push_back(i);
    }
    path.push_back(t);
    return path;
}

int main(){
    int N,M,L; cin >> N >> M >> L;
    next1.resize(N,vector<int>(N));
    rep(i,N)rep(j,N) next1[i][j] = j;
    vector<vector<ll>> dist(N,vector<ll>(N,LINF));
    rep(i,N)rep(j,N) if(i == j) dist[i][j] = 0;
    rep(i,M){
        int A,B; cin >> A >> B;
        A--; B--;
        ll C; cin >> C;
        if(C <= L) dist[A][B] = C;
        if(C <= L) dist[B][A] = C;
    }

    warshallFloyd(N,dist);
    int Q; cin >> Q;
    rep(i,Q){
        int s,t; cin >> s >> t;
        s--; t--;
        if(dist[s][t] == LINF){
            cout << -1 << endl;
            continue;
        }
        vector<int> path = get_path(s,t);
        int ans = 0;
        int now = dist[s][path[0]];
        
        repr(j,1,path.size()){
            if(now + dist[path[j-1]][path[j]] > L){
                ans++;
                now = 0;
            }
            now += dist[path[j-1][path[j]];
        }
        cout << ans << endl;

    }
}
   


Compiler output:
a.cc: In function 'int main()':
a.cc:86:34: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   86 |             now += dist[path[j-1][path[j]];
      |                                  ^
a.cc:86:43: error: expected ']' before ';' token
   86 |             now += dist[path[j-1][path[j]];
      |                                           ^
      |                                           ]
Language: C++

#include<bits/stdc++.h>

using namespace std;
#define INFS (1LL<<28)
#define INF (1LL<<60)
#define DEKAI 1000000007
#define MOD 998244353
#define lp(i,n) for(int i=0;i<n;i++)
#define double long double
#define all(c) begin(c), end(c)

#define int long long 
#define qhoge pair<pair<int,int>,int>
int dp[1000][1000];
signed main(){

	cin.tie(0); ios::sync_with_stdio(false);
	int n,m,l;
	cin>>n>>m>>l;
	vector<pair<int,int>> v[5000];
	lp(i,m){
		int a,b,c;
		cin>>a>>b>>c;
		//if(c>l)continue;
		uf.unite(a-1,b-1);
		v[a].push_back({b,c});
		v[b].push_back({a,c});
	}
	lp(i,500){
		lp(j,500)dp[i][j]=INF;
	}
	lp(z,n+1){
		if(z==0)continue;
		int s=z;
		lp(i,n){
			dp[z][i+1]=INF;
		}
		priority_queue<qhoge,vector<qhoge>,greater<qhoge>> q;
		q.push({{0,-1*(l)},s});
		dp[z][s]=0;
		while(!q.empty()){
			int now=q.top().second;
			int rem=q.top().first.second;
			rem*=-1;
			int cnt=q.top().first.first;
			//cout<<now<<" "<<rem<<" "<<cnt<<endl;
			q.pop();
			lp(i,v[now].size()){
				int next=v[now][i].first;
				int cost=v[now][i].second;
				//cout<<" "<<next<<" "<<cost<<endl;
				int nexttank=rem-cost;
				if(nexttank<0){
					if(dp[z][next]<=cnt+1)continue;
					dp[z][next]=cnt+1;
					q.push({{cnt+1,-1*(l-cost)},next});
				}
				else{
					if(dp[z][next]<=cnt)continue;
					dp[z][next]=cnt;
					q.push({{cnt,-1*(nexttank)},next});
				}
			}
		}
	}
	int qs;
	cin>>qs;
	lp(i,qs){
		int s,t;
		cin>>s>>t;
		if(dp[s][t]==INF)cout<<-1<<endl;
		else cout<<dp[s][t]<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: 'uf' was not declared in this scope
   25 |                 uf.unite(a-1,b-1);
      |                 ^~
Language: C++

#include<bits/stdc++.h>

using namespace std;
#define INFS (1LL<<28)
#define INF (1LL<<60)
#define DEKAI 1000000007
#define MOD 998244353
#define lp(i,n) for(int i=0;i<n;i++)
#define double long double
#define all(c) begin(c), end(c)

#define int long long 
#define qhoge pair<pair<int,int>,int>
int dp[1000][1000];
signed main(){

	cin.tie(0); ios::sync_with_stdio(false);
	int n,m,l;
	cin>>n>>m>>l;
	UnionFind uf(n);
	vector<pair<int,int>> v[5000];
	lp(i,m){
		int a,b,c;
		cin>>a>>b>>c;
		//if(c>l)continue;
		uf.unite(a-1,b-1);
		v[a].push_back({b,c});
		v[b].push_back({a,c});
	}
	lp(i,500){
		lp(j,500)dp[i][j]=INF;
	}
	lp(z,n+1){
		if(z==0)continue;
		int s=z;
		lp(i,n){
			dp[z][i+1]=INF;
		}
		priority_queue<qhoge,vector<qhoge>,greater<qhoge>> q;
		q.push({{0,-1*(l)},s});
		dp[z][s]=0;
		while(!q.empty()){
			int now=q.top().second;
			int rem=q.top().first.second;
			rem*=-1;
			int cnt=q.top().first.first;
			//cout<<now<<" "<<rem<<" "<<cnt<<endl;
			q.pop();
			lp(i,v[now].size()){
				int next=v[now][i].first;
				int cost=v[now][i].second;
				//cout<<" "<<next<<" "<<cost<<endl;
				int nexttank=rem-cost;
				if(nexttank<0){
					if(dp[z][next]<=cnt+1)continue;
					dp[z][next]=cnt+1;
					q.push({{cnt+1,-1*(l-cost)},next});
				}
				else{
					if(dp[z][next]<=cnt)continue;
					dp[z][next]=cnt;
					q.push({{cnt,-1*(nexttank)},next});
				}
			}
		}
	}
	int qs;
	cin>>qs;
	lp(i,qs){
		int s,t;
		cin>>s>>t;
		if(dp[s][t]==INF)cout<<-1<<endl;
		else cout<<dp[s][t]<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'UnionFind' was not declared in this scope
   20 |         UnionFind uf(n);
      |         ^~~~~~~~~
a.cc:26:17: error: 'uf' was not declared in this scope
   26 |                 uf.unite(a-1,b-1);
      |                 ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SMALLPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
ll inf=1000000007;
const int mod=1000000007;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}
int main(){
  int n,m,l;cin>>n>>m>>l;
  vector<vector<tuple<int,int,int>>> v(n,vector<tuple<int,int,int>>(n,make_tuple(inf,0,0)));
  rep(i,m){
    int a,b,c;cin>>a>>b>>c;
    if(l<c)continue;
    a--;b--;
    get<0>(v[a][b])=0;
    get<2>(v[a][b])=c;
    get<1>(v[a][b])=c;
    get<0>(v[b][a])=0;
    get<2>(v[b][a])=c;
    get<1>(v[b][a])=c;
  }
  rep(i,n){
    get<0>(v[i][i])=0;
    get<1>(v[i][i])=0;
    get<2>(v[i][i])=0;
  }
  rep(k,n){
    rep(i,n){
      rep(j,n){
        int p=get<2>(v[i][k]),q=get<1>(v[k][j]),a=0;
        bool b=true;
        if(p+q>l){
          a=1;
          b=false;
        }
        if(get<0>(v[i][j])<=get<0>(v[i][k])+get<0>(v[k][j])+a){
          get<0>(v[i][j])=get<0>(v[i][k])+get<0>(v[k][j]);
          get<1>(v[i][j])=get<1>(v[i][k]);
          get<2>(v[i][j])=
}

Compiler output:
a.cc:19:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   19 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |            ^~~~
a.cc:19:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   19 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |                    ^~~~
a.cc:20:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   20 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |            ^~~~
a.cc:20:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   20 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |                    ^~~~
a.cc: In function 'int main()':
a.cc:53:1: error: expected primary-expression before '}' token
   53 | }
      | ^
a.cc:53:2: error: expected '}' at end of input
   53 | }
      |  ^
a.cc:42:15: note: to match this '{'
   42 |       rep(j,n){
      |               ^
a.cc:53:2: error: expected '}' at end of input
   53 | }
      |  ^
a.cc:41:13: note: to match this '{'
   41 |     rep(i,n){
      |             ^
a.cc:53:2: error: expected '}' at end of input
   53 | }
      |  ^
a.cc:40:11: note: to match this '{'
   40 |   rep(k,n){
      |           ^
a.cc:53:2: error: expected '}' at end of input
   53 | }
      |  ^
a.cc:21:11: note: to match this '{'
   21 | int main(){
      |           ^
Language: C++

#include <stdio.h>
#include <queue>

#define fti(i, x, y) for(int i = (x), _y = (y); i <= _y; ++ i)
#define ftd(i, x, y) for(int i = (x), _y = (y); i >= _y; -- i)
#define pb push_back

using namespace std;

const int oo = 1e9, N = 302;
typedef pair <int, int> ii;
typedef pair <ii, int> iii;
vector <ii> a[N];
int n, m, L, res[N][N];
ii d[N];
priority_queue <iii, vector<iii>, greater<iii> > pq;

void inp()
{
    int p, q, m, w;
    scanf("%d %d %d", &n, &m, &L);
    fti(i, 1, m) {
        scanf("%d %d %d", &p, &q, &w);
        a[p].pb(ii(w, q));
        a[q].pb(ii(w, p));
    }
}
//#include <iostream>

void dijkstra(int s)
{
    int u, v, du1, du2, uv;
    fti(i, 1, n) d[i] = ii(oo, 0);
    d[s] = ii(0, L);
    pq.push(iii(ii(0, 0), s));
    while (!pq.empty()) {
        u = pq.top().second;
        du1 = pq.top().first.first;
        du2 = pq.top().first.second;
        cout << u << " " << du1 << " " << L - du2 << "\n";
        pq.pop();
        if (du1 != d[u].first || du2 != L - d[u].second) continue;
        fti(i, 0, int(a[u].size() - 1)) {
            uv = a[u][i].first;
            v = a[u][i].second;
            if(uv > L) continue;

            int tg = 0, tg2 = L - du2 - uv;
            if(tg2 < 0) tg = 1, tg2 = L - uv;

            if(d[v].first == du1 + tg)
                if(d[v].second < tg2) d[v].second = tg2, pq.push(iii(ii(d[v].first, L - d[v].second), v));
            if(d[v].first > du1 + tg) d[v] = ii(du1 + tg, tg2), pq.push(iii(ii(d[v].first, L - d[v].second), v));
        }
    }
}
void proc()
{
    fti(i, 1, n) {
        dijkstra(i);
        fti(j, 1, n) {
            if(d[j].first == oo) res[i][j] = -1;
            else res[i][j] = d[j].first;
            //cout << res[i][j] << " ";
        }
        //cout << "\n";
    }
    int q, x, y;
    scanf("%d", &q);
    while(q -- ) {
        scanf("%d %d", &x, &y);
        printf("%d\n", res[x][y]);
    }
}

int main()
{
    inp();
    proc();
    return 0;
}


Compiler output:
a.cc: In function 'void dijkstra(int)':
a.cc:40:9: error: 'cout' was not declared in this scope
   40 |         cout << u << " " << du1 << " " << L - du2 << "\n";
      |         ^~~~
a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <queue>
  +++ |+#include <iostream>
    3 |
Language: C++

#include<Header.hpp>

const int MAXN=500;

typedef long long ll;

vector<pair<int,ll>> G[MAXN];

ll dist[MAXN][MAXN],step[MAXN][MAXN],l;

void dij(int p)
{
    typedef tuple<ll,ll,ll,int> Node;
    priority_queue<Node,vector<Node>,greater<Node>> pq;
    while(!pq.empty()) pq.pop();
    pq.push({0ll,0ll,0ll,p});
    dist[p][p]=0;
    step[p][p]=0;
    while(!pq.empty())
    {
        ll x,y;
        int u;
        tie(ignore,ignore,y,u) = pq.top();
        pq.pop();
        for (auto it:G[u])
        {
            ll c=it.second,ty=y;
            int v=it.first;
            if (dist[p][v]>dist[p][u]+c)
            {
                dist[p][v]=dist[p][u]+c;
                step[p][v]=((ty+c)>l)+step[p][u];
                //if (p==0) cout << "?" << ty+c <<" "<< u << " "<< v << endl;
                pq.push({dist[p][v],step[p][v],c,v});
            }else if(dist[p][v]==dist[p][u]+c&&step[p][v]>((ty+c)>l)+step[p][u])
            {
                step[p][v]=((ty+c)>l)+step[p][u];
                pq.push({dist[p][v],step[p][v],c,v});
            }
        }
    }
    return ;
}

int main()
{
    int n,m;
    io >> n >> m >> l;
    for (int i=0;i<m;i++)
    {
        int x,y,z;
        cin >> x >> y >> z;
        --x,--y;
        if (z>l) continue;
        G[x].push_back({y,z});
        G[y].push_back({x,z});
    }
    memset(dist,INFC,sizeof(dist));
    memset(step,INFC,sizeof(step));
    for (int i=0;i<n;i++)
    {
        dij(i);
    }
    //io.WA(dist,n,n);
    //io.WA(step,n,n);
    int q;
    io >> q;
    while(q--)
    {
        int x,y;
        io >> x >> y;
        --x,--y;
        if (step[x][y]>=INFL/2) io.WL(-1);
        else io.WL(step[x][y]);
    }
    return 0;
}

Compiler output:
a.cc:1:9: fatal error: Header.hpp: No such file or directory
    1 | #include<Header.hpp>
      |         ^~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
#define ff first
#define ss second

long long X[305][305][305], N, M, L;
vector<pii> edge[305];

int f(int s, int t, int x) {
	if (s == t) return L;
	int &ret = X[s][t][x];
	if (ret != -1) return ret;
	if (x && f(s, t, x - 1) >= 0) return ret = L;
	ret = -1e9;
	for (auto i : edge[t])
		ret = max(ret, f(s, i.ss, x) - i.ff);
	if (ret < 0) ret = -1e9;
	return ret;
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> N >> M >> L;
	for (int i = 0; i < M; ++i) {
		int a, b, c; cin >> a >> b >> c;
		edge[a].emplace_back(c, b);
		edge[b].emplace_back(c, a);
	}
	memset(X, -1, sizeof(X));
	int Q; cin >> Q;
	for (int i = 0; i < Q; ++i) {
		int s, t; cin >> s >> t;
		int j = N; 
		if (f(s, t, N) < 0) {
			puts("-1");
			continue;
		}
		while (j >= 0 && f(s, t, j) >= 0) j--;
		printf("%d\n",j + 1);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int f(int, int, int)':
a.cc:12:29: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int'
   12 |         int &ret = X[s][t][x];
      |                    ~~~~~~~~~^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0,1,0,-1 };
const ll dy[4] = { -1, 0, 1,0 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////
int n, m, l;
vector<pii>G[310];
ll ans[310][310];
void def(int a, int b) {

}
int main() {
	cin >> n >> m >> l;
	for (int i = 0; i < m; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		if (c > l)continue;
		G[a].push_back({ b,c });
		G[b].push_back({ a,c });
	}
	int q; cin >> q;
	REP(i, q) {
		int s, t;
		cin >> s >> t;
		if (def(s, t) == INF)cout << -1 << endl;

	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:31: error: invalid operands of types 'void' and 'const int' to binary 'operator=='
   69 |                 if (def(s, t) == INF)cout << -1 << endl;
      |                     ~~~~~~~~~ ^~ ~~~
      |                        |         |
      |                        void      const int
Language: C++

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll_loops")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
typedef long long ll;
using namespace std;

struct edge {
	int to, dist;
};

int N, M, L, Q;
int dist[300][300];
vector<edge>v[300];

int main() {
	scanf("%d%d%d", &N, &M, &L);
	for (int i = 0; i < M; i++) {
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		if (c > L)continue;
		a--;
		b--;
		v[a].push_back({ b,c });
		v[b].push_back({ a,c });
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			dist[i][j] = -1;
		}
	}
	for (int i = 0; i < N; i++) {
		priority_queue<pair<pair<int, int>, int>, vector<pair<pair<int, int>, int>>, greater<pair<pair<int, int>, int>>>pq;
		pq.push({ {0,0},i });
		while (!pq.empty()) {
			int x = pq.top().second;
			int f = pq.top().first.first;
			ll d = pq.top().first.second;
			pq.pop();
			if (dist[i][x] == -1) {
				dist[i][x] = f;
				for (edge e : v[x]) {
					if (dist[i][e.to] == -1) {
						if (d + e.dist > L) {
							pq.push({ {f + 1,e.dist},e.to });
						}
						else {
							pq.push({ {f,d + e.dist}, e.to });
						}
					}
				}
			}
		}
	}
	scanf("%d", &Q);
	while (Q--) {
		int s, t;
		scanf("%d%d", &s, &t);
		s--;
		t--;
		printf("%d\n", dist[s][t]);
	}
}

Compiler output:
a.cc:3:37: warning: bad option '-funroll_loops' to pragma 'optimize' [-Wpragmas]
    3 | #pragma GCC optimize ("unroll_loops")
      |                                     ^
a.cc:22:10: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
   22 | int main() {
      |          ^
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:5:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<edge, std::allocator<edge> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = edge]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~