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

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

int a[2003];
int main(){
	int n;scanf("%d",&n);	
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	int ans = 0;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			ans += max(lower_bound(a+1,a+1+n,a[i]+a[j]) - a - 1 - j , 0ll);
	printf("%d\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:35: error: no matching function for call to 'max(long int, long long int)'
   12 |                         ans += max(lower_bound(a+1,a+1+n,a[i]+a[j]) - a - 1 - j , 0ll);
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:12:35: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   12 |                         ans += max(lower_bound(a+1,a+1+n,a[i]+a[j]) - a - 1 - j , 0ll);
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:12:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   12 |                         ans += max(lower_bound(a+1,a+1+n,a[i]+a[j]) - a - 1 - j , 0ll);
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

/*
https://t.me/unstoppabIesoIvemachinechannel
*/
#pragma ARCENIY_KIRILLOV_POVELITEL_KROKODILOV
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC pop_options
//#pragma GCC target("popcnt")
//#pragma GCC target("sse4")
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rng(a) a.begin(),a.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i > -1; i--)
#define rer(i, x, n) for (int i = x; i < n; i++)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef long double ld;















signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0;i<n;i++) cin >> a[i];
    sort(a.begin(), a.end());
    int ans = 0;
    for (int i = 0; i < n; i++){
        for (int j = i + 1; j < n; j++){
            int k = int(lower_bound(rng(a), a[i] + a[j]) - a.begin());
          //  cout << i << ' ' << j << ' ' << k << endl;
          //  cout << a[i] << ' ' << a[j] << ' ' << a[k] << endl;
            int f = (n - k);
            ans += (f);
        }
    }
    cout << n * (n - 1) * (n - 2) / 6 - ans;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:13: error: expected primary-expression before 'long'
   24 | #define int long long
      |             ^~~~
a.cc:56:21: note: in expansion of macro 'int'
   56 |             int k = int(lower_bound(rng(a), a[i] + a[j]) - a.begin());
      |                     ^~~
Language: C++

// C++ program to count number of triangles that can be 
// formed from given array 
#include <bits/stdc++.h> 
using namespace std; 

/* Following function is needed for library function 
qsort(). Refer 
http://www.cplusplus.com/reference/clibrary/cstdlib/qsort/ */
int comp(const void* a, const void* b) 
{ return *(int*)a > *(int*)b ; } 

// Function to count all possible triangles with arr[] 
// elements 
int findNumberOfTriangles(int arr[], int n) 
{ 
	// Sort the array elements in non-decreasing order 
	qsort(arr, n, sizeof( arr[0] ), comp); 

	// Initialize count of triangles 
	int count = 0; 

	// Fix the first element. We need to run till n-3 
	// as the other two elements are selected from 
	// arr[i+1...n-1] 
	for (int i = 0; i < n - 2; ++i) 
	{ 
		// Initialize index of the rightmost third 
		// element 
		int k = i + 2; 

		// Fix the second element 
		for (int j = i + 1; j < n; ++j) 
		{ 
			// Find the rightmost element which is 
			// smaller than the sum of two fixed elements 
			// The important thing to note here is, we 
			// use the previous value of k. If value of 
			// arr[i] + arr[j-1] was greater than arr[k], 
			// then arr[i] + arr[j] must be greater than k, 
			// because the array is sorted. 
			while (k < n && arr[i] + arr[j] > arr[k]) 
			++k; 

			// Total number of possible triangles that can 
			// be formed with the two fixed elements is 
			// k - j - 1. The two fixed elements are arr[i] 
			// and arr[j]. All elements between arr[j+1]/ to 
			// arr[k-1] can form a triangle with arr[i] and arr[j]. 
			// One is subtracted from k because k is incremented 
			// one extra in above while loop. 
			// k will always be greater than j. If j becomes equal 
			// to k, then above loop will increment k, because arr[k] 
			// + arr[i] is always greater than arr[k] 
			if(k > j) 
			count += k - j - 1; 
		} 
	} 

	return count; 
} 

// Driver code 
int main() 
{ 
	 
  ll n;
  cin>>n;
  ll arr(n);
  for(ll i=0;i<n;i++)
    cin>>arr[i];

	cout<<findNumberOfTriangles( arr, n ); 

	return 0; 
} 

// This code is contributed by rathbhupendra 


Compiler output:
a.cc: In function 'int main()':
a.cc:66:3: error: 'll' was not declared in this scope
   66 |   ll n;
      |   ^~
a.cc:67:8: error: 'n' was not declared in this scope; did you mean 'yn'?
   67 |   cin>>n;
      |        ^
      |        yn
a.cc:68:5: error: expected ';' before 'arr'
   68 |   ll arr(n);
      |     ^~~~
      |     ;
a.cc:69:9: error: expected ';' before 'i'
   69 |   for(ll i=0;i<n;i++)
      |         ^~
      |         ;
a.cc:69:14: error: 'i' was not declared in this scope
   69 |   for(ll i=0;i<n;i++)
      |              ^
a.cc:70:10: error: 'arr' was not declared in this scope
   70 |     cin>>arr[i];
      |          ^~~
a.cc:72:38: error: 'arr' was not declared in this scope
   72 |         cout<<findNumberOfTriangles( arr, n );
      |                                      ^~~
Language: C++

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

int main() {
  int N;
  cin>>N;
  vector<int>L(N);
  for(int i=0;i<N;i++) cin>>L[i];
  sort(L.begin(),L.end);
  int ans=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      for(int k=j+1;k<N;k++){
        if(L[i]+L[j]>L[k]) ans++;
      }
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: no matching function for call to 'sort(std::vector<int>::iterator, <unresolved overloaded function type>)'
    9 |   sort(L.begin(),L.end);
      |   ~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:63: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<int*, std::vector<int> >'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |                                         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <bits/stdc++.h>
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define eb emplace_back
#define uqv(v) v.erase(unique(all(v)), v.end());
#define INF 1e9
#define LINF 1e18

using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

int arr[2020];

int main() {
	ios::sync_with_stdio(false); cin.tie(0);

	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> arr[i];
	}
	sort(arr+1, arr+n+1);

	long long ans = 0;
	for(int i = 3; i <= n; i++) {
		for(int j = 2; j < i; j++) {
			ans += max(0, (arr + j - upper_bound(arr+1, arr+n+1, arr[i] - arr[j])));
		}
	}
	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:35: error: no matching function for call to 'max(int, long int)'
   30 |                         ans += max(0, (arr + j - upper_bound(arr+1, arr+n+1, arr[i] - arr[j])));
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:30:35: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   30 |                         ans += max(0, (arr + j - upper_bound(arr+1, arr+n+1, arr[i] - arr[j])));
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:30:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   30 |                         ans += max(0, (arr + j - upper_bound(arr+1, arr+n+1, arr[i] - arr[j])));
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
int main()
{
  int N;
  int stick[2500]={};
  int i,j,k;
  int count;
  
  sacnf("%d",&N);
  for(i=0;i<N;i++)
    scanf("%d",stick[i]);
  
  for(i=0;i<N;i++)
    for(j=i+1;j<N;j++)
      for(k=j+1;k<N;k++)
      	if(
          stick[i]<stick[j]+stick[k]&&
          stick[j]<stick[k]+stick[i]&&
          stick[k]<stick[i]+stick[j]
          )
          count++;
  
  printf("%d",count);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'sacnf' was not declared in this scope; did you mean 'scanf'?
    9 |   sacnf("%d",&N);
      |   ^~~~~
      |   scanf
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long

int main() {
	int N;
	cin >> N;
	vector<int> L(N);
	for (int i = 0;i < N;i++) {
		cin >> L[i];
	}
	sort(all(L));

	ll ans = 0;
	for (int i = 0;i < N;i++) {
		for (int j = i + 1;j < N;j++) {
			auto it1 = L.begin() + j + 1;
			auto it2 = upper_bound(it1, L.end(), abs(L[i] - L[j]));
			auto it3 = lower_bound(it1, L.end(), L[i] + L[j]);
			ans += (ll)max(it3 - it2, 0);
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:39: error: no matching function for call to 'max(__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type, int)'
   21 |                         ans += (ll)max(it3 - it2, 0);
      |                                    ~~~^~~~~~~~~~~~~~
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:21:39: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   21 |                         ans += (ll)max(it3 - it2, 0);
      |                                    ~~~^~~~~~~~~~~~~~
/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:21:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   21 |                         ans += (ll)max(it3 - it2, 0);
      |                                    ~~~^~~~~~~~~~~~~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  int l[n];
  for ( int i = 0; i < n; i++ ) { cin >> l[i]; }
  int ans = 0;
  for ( int i = 0; i < n; i++ ) {
    for ( int j = i+1; j < n; j++ ) {
      for ( int k = j+1; k < n; k++ ) {
        ans += ( l[i] < l[j]+k[k] && l[j] < l[i]+k[k] && l[k] < l[i]+k[j] ) ? 1 : 0;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:31: error: invalid types 'int[int]' for array subscript
   13 |         ans += ( l[i] < l[j]+k[k] && l[j] < l[i]+k[k] && l[k] < l[i]+k[j] ) ? 1 : 0;
      |                               ^
a.cc:13:51: error: invalid types 'int[int]' for array subscript
   13 |         ans += ( l[i] < l[j]+k[k] && l[j] < l[i]+k[k] && l[k] < l[i]+k[j] ) ? 1 : 0;
      |                                                   ^
a.cc:13:71: error: invalid types 'int[int]' for array subscript
   13 |         ans += ( l[i] < l[j]+k[k] && l[j] < l[i]+k[k] && l[k] < l[i]+k[j] ) ? 1 : 0;
      |                                                                       ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define chmin(x,y) x = min(x,y)
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;

int main() {
    int n, m, l;
    cin >> n >> m >> l;
    vector<vector<int>> dist(n, vector<int> (n, INF));
    rep(i, n) dist[i][i] = 0;
    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        dist[a][b] = dist[b][a] = c;
    }
    rep(k,n)rep(i,n)rep(j,n) chmin(dist[i][j], dist[i][k]+dist[k][j]);
    vector<vector<int>> dist2(n, vector<int>(n,INF));
    rep(i, n) rep(j, n) {
        if (dist[i][j] <= l) dist2[i][j] = 1;
    }
    #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define chmin(x,y) x = min(x,y)
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;

int main() {
    int n, m, l;
    cin >> n >> m >> l;
    vector<vector<int>> dist(n, vector<int> (n, INF));
    rep(i, n) dist[i][i] = 0;
    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        dist[a][b] = dist[b][a] = c;
    }
    rep(k,n)rep(i,n)rep(j,n) chmin(dist[i][j], dist[i][k]+dist[k][j]);
    vector<vector<int>> dist2(n, vector<int>(n,INF));
    rep(i, n) rep(j, n) {
        if (dist[i][j] <= l) dist2[i][j] = 1;
    }
    rep(k,n)rep(i,n)rep(j,n) chmin(dist2[i][j], dist2[i][k]+dist2[k][j]);
    int Q;
    cin >> Q;
    rep(i, Q) {
        int s, t;
        cin >> s >> t;
        --s; --t;
        if (dist2[s][t] == INF) puts("-1");
        else cout << dist2[s][t] - 1 << '\n';
    }
    return 0;
}

    int Q;
    cin >> Q;
    rep(i, Q) {
        int s, t;
        cin >> s >> t;
        --s; --t;
        if (dist2[s][t] == INF) puts("-1");
        else cout << dist2[s][t] - 1 << '\n';
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   39 | int main() {
      |         ^~
a.cc:39:9: note: remove parentheses to default-initialize a variable
   39 | int main() {
      |         ^~
      |         --
a.cc:39:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:39:12: error: a function-definition is not allowed here before '{' token
   39 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,m,l;
  cin>>n>>m>>l;
  vvll t(n,vll(n,INF));
  rep(i,m){
    ll a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    t[a][b]=c;
    t[b][a]=c;
  }
  rep(k,n)rep(i,n)rep(j,n){
    t[i][j]=min(t[i][j],t[i][k]+t[k][j]);
  }
  rep(i,n) t[i][i]=0;
  rep(i,n) rep(j,n){
    if(t[i][j]<=l)t[i][j]=1;
  }
  rep(k,n)rep(i,n)rep(j,n){
    t[i][j]=min(t[i][j],t[i][k]+t[k][j]);
  }
  ll q;
  cin>>q;
  rep(i,q){
    ll s,t;
    cin>>s>>t;
    s--;t--;
    COUT(t[s][t]-1);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:11: error: invalid types 'long long int[long long int]' for array subscript
   75 |     COUT(t[s][t]-1);
      |           ^
a.cc:20:24: note: in definition of macro 'COUT'
   20 | #define COUT(x) cout<<(x)<<endl
      |                        ^
Language: C++

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long
#define INF INT_MAX
#define mod 1000000007
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
vector<pair<int,int>>g[305];
int main()
{
	ll n,m,l;cin>>n>>m>>l;
	ll dp[n+1][n+1];
	for(ll i=0;i<=n;i++)
	{
		for(ll j=0;j<=n;j++)
		{
			if(i==j)dp[i][j]=0;
			else dp[i][j]=mod;
		}
	}
	for(ll i=0;i<m;i++)
	{
		ll u,v,wt;cin>>u>>v>>wt;
		dp[u][v]=wt;
		dp[v][u]=wt;
	}
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=n;j++)
		{
			for(ll k=1;k<=n;k++)
			{
				dp[j][k]=min(dp[j][k],dp[j][i]+dp[i][k]);
			}
		}
	}
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=n;j++)
		{
			if(i!=j&&dp[i][j]<=l)dp[i][j]=1;
		}
	}
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=n;j++)
		{
			for(ll k=1;k<=n;k++)
			{
				dp[j][k]=min(dp[j][k],dp[j][i]+dp[i][k]);
			}
		}
	}
	ll q;cin>>q;
	while(q--)
	{
		 uu,vv;cin>>uu>>vv;
		if(dp[uu][vv]==mod)cout<<-1<<endl;
		else cout<<dp[uu][vv]-1<<endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:18: error: 'uu' was not declared in this scope
   60 |                  uu,vv;cin>>uu>>vv;
      |                  ^~
a.cc:60:21: error: 'vv' was not declared in this scope
   60 |                  uu,vv;cin>>uu>>vv;
      |                     ^~
Language: C

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
ll m,n,l,yy[305][305],ans[305][305]; 
 
int main()
{
    std::ios::sync_with_stdio(0); std::cin.tie(0);
    cin>>m>>n>>l;
    ll a,b,c;
    for(int i=1;i<=m;++i)
     for(int j=1;j<=m;++j)
     yy[i][j]=1e15,ans[i][j]=1e15;
    for(int i=0;i<n;++i)
    {
    	cin>>a>>b>>c;
    	
    	yy[a][b]=yy[b][a]=c;
	}
	for(int i=1;i<=m;++i)
	 for(int j=1;j<=m;++j)
	  for(int k=1;k<=m;++k)
	  yy[i][j]=min(yy[i][j],yy[i][k]+yy[k][j]);
	  for(int i=1;i<=m;++i)
	 for(int j=1;j<=m;++j)
	  if(yy[i][j]<=l) ans[i][j]=1;
	  for(int i=1;i<=m;++i)
	 for(int j=1;j<=m;++j)
	  for(int k=1;k<=m;++k)
	  ans[i][j]=min(ans[i][j],ans[i][k]+ans[k][j]);
	ll q;
	cin>>q;
	while(q--)
	{
		cin>>a>>b;
		cout<<ans[a][b]-1<<'\n';
	}
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

// https://atcoder.jp/contests/abc143/tasks/abc143_e

#include <bits/stdc++.h>
using namespace std;
#define watch(x) cerr << (#x) << " is " << (x) << endl;
#define endl '\n' 
#define int long long
#define pii pair<int, int>
#define fi first
#define se second

struct Rel {
    int to, ref, left;

    Rel(int too, int reff, int leftt) {
        to = too;
        ref = reff;
        left = leftt;
    }
};

struct Cute {
    int refills;
    int tot;
    int dest;  

    Cute(int r, int t, int d) {
        refills = r;
        tot = t;
        dest = d;
    }
};

struct Compare {
    bool operator()(Rel &l, Rel &r) {
        // return pii(l.ref, l.left) < pii(r.ref, r.left);
        return l.ref < r.ref;
    }
};

const int maxn = 350;
int N, M, L, Q;

vector<pii> G[maxn];
pii dis[maxn][maxn];

signed main() {
    ios::sync_with_stdio(0);
    cin.sync_with_stdio(0);
    cin.tie(0);

    for(int i = 0; i < maxn; i++) {
        for(int j = 0; j < maxn; j++) {
            dis[i][j] = pii(LLONG_MAX-100, LLONG_MAX-100);
        }
    }

    cin >> N >> M >> L;

    for(int i = 1; i <= M; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        G[a].emplace_back(c, b);
        G[b].emplace_back(c, a);
    }

    // cerr << emp.left << " " << emp.ref << " " << emp.to << endl;

    for(int st = 1; st <= N; st++) {
        priority_queue<Rel, vector<Rel>, Compare> pq;

        pq.push(Rel(st, 0, 0));
        dis[st][st] = pii(0, 0);

        while(!pq.empty()) {
            Rel S = pq.top(); pq.pop();

            for(pii e: G[S.to]) {
                if(e.fi > L) continue;

                pii c = pii(S.ref, S.left);
                if(e.fi > S.left) {
                    c.fi++;
                    c.se = L;
                }
                c.se -= e.fi;

                if(c < dis[st][e.se]) {
                    dis[st][e.se] = c;
                    pq.push(Rel(e.se, c.fi, c.se));
                }
            }
        }
    }

    cin >> Q;
    while(Q--) {
        int s, t;
        cin >> s >> t;
        if(dis[s][t] == pii(LLONG_MAX-100, LLONG_MAX-100)) {
            cout << -1 << endl;
        } else {
            cout << dis[s][t].fi-1; << endl;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:103:37: error: expected primary-expression before '<<' token
  103 |             cout << dis[s][t].fi-1; << endl;
      |                                     ^~
Language: C

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

std::vector<std::vector<long long>> warshall_floyd(std::vector<std::vector<long long>> dist) {
  const long long LINF = 1000000000000000018LL;
  int n = (int)dist.size();
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      if (dist[i][k] == LINF) {
        continue;
      }
      for (int j = 0; j < n; j++) {
        if (dist[k][j] == LINF) {
          continue;
        }
        dist[i][j] = std::min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
  return dist;
}

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);

  const long long LINF = 1000000000000000018LL;

  int N, M, L;
  std::cin >> N >> M >> L;

  std::vector<std::vector<long long>> Graph(N, std::vector<long long>(N, LINF));
  for (int i = 0; i < M; i++) {
    int A, B, C;
    std::cin >> A >> B >> C;
    --A, --B;
    Graph[A][B] = C;
    Graph[B][A] = C;
  }

  auto d = warshall_floyd(Graph);

  std::vector<std::vector<long long>> Graph2(N, std::vector<long long>(N, LINF));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (d[i][j] <= L) {
        Graph2[i][j] = 1;
        Graph2[j][i] = 1;
      }
    }
  }

  auto d2 = warshall_floyd(Graph2);

  int Q;
  std::cin >> Q;

  while (Q--) {
    int s, t;
    std::cin >> s >> t;

    long long ans = d2[s - 1][t - 1];
    std::cout << (ans == LINF ? -1 : ans - 1) << "\n";
  }

  return 0;
}

Compiler output:
main.c:1:10: fatal error: algorithm: No such file or directory
    1 | #include <algorithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

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

#define REP(i,n) for(int i=0;i<n;i++)

using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using PLL = pair<LL,LL>;
using VPLL = vector<PLL>;

constexpr LL INF = 1LL << 60;

int MinDistance(VPLL &d, vector<bool> &inq) {
  int index = -1;
  REP(i, d.size()) {
    if (!inq[i]) continue;
    if (index == -1) {
      index = i;
    } else {
      if (d[index] > d[i]) index = i;
    }
  }
  return index;
}

void Dijkstra(int s, VVLL &g, VPLL &d, LL &l) {
  REP (i, d.size()) d[i] = {d.size(), INF};
  d[s] = {0, 0};
  vector<bool> inq(d.size(), true);
  REP (i, d.size()) {
    int index = MinDistance(d, inq);
    inq[index] = false;
    REP(j, d.size()) {
      if (g[index][j] == INF) continue;
      PLL tmp;
      tmp.first = d[index].first;
      tmp.second = d[index].second + g[index][j];
      if (tmp.second > l) {
        tmp.first++;
        tmp.second = g[index][j];
      }
      d[j] = min(d[j], tmp);
    }
  }
}

int main() {
  int n, m, l;
  cin >> n >> m >> l;
  int a, b, c;
  VVLL g(n, VLL(n, INF));
  REP (i, m) {
    cin >> a >> b >> c;
    a--;
    b--;
    g[a][b] = (LL)c;
    g[b][a] = (LL)c;
  }

  vector<VPLL> d(n,VPLL(n));
  REP (i, n) Dijkstra(i, g, d[i], (LL)l);

  int q, s, t;
  cin >> q;
  REP (i, q) {
    cin >> s >> t;
    s--;
    t--;
    if (d[s][t].first == n) cout << -1 << endl;
    else cout << d[s][t].first << endl;        
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:35: error: cannot bind non-const lvalue reference of type 'LL&' {aka 'long long int&'} to an rvalue of type 'LL' {aka 'long long int'}
   64 |   REP (i, n) Dijkstra(i, g, d[i], (LL)l);
      |                                   ^~~~~
a.cc:29:44: note:   initializing argument 4 of 'void Dijkstra(int, VVLL&, VPLL&, LL&)'
   29 | void Dijkstra(int s, VVLL &g, VPLL &d, LL &l) {
      |                                        ~~~~^
Language: C++

#include<bits/stdc++.h>
#define ff first
#define int long long
#define ss second
#define len(x) (int)(x.size())
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using ii = pair<int, int>;

#define MAXN 409
int dist[MAXN][MAXN];

int ceil(int a, int b){
	return(a+b-1)/b;
}
void floyd(int n){
    for(int k=1; k<=n; ++k){
        for(int u=1; u<=n; ++u){
            for(int v=1; v<=n; ++v){
                if(dist[u][v]>dist[u][k]+dist[k][v]){
                    dist[u][v] = dist[u][k] + dist[k][v];
                }
            }
        }
    }
}

const int inf = 1e11;
int32_t main(){
	ios::sync_with_stdio(0);
	int n, m, l;
	cin >> n >> m >> l;
	for(int u=1; u<=n; ++u)
		for(int v=1; v<=n; ++v) 
			dist[u][v] = inf;
	for(int u=1; u<=n; ++u)
		dist[u][u]=0;
	
	for(int i=0; i<m; ++i){
		int a, b, c;
		cin >> a >> b >> c;
		if(c>l) continue;
		dist[a][b] = c;
		dist[b][a] = c;
	}
	floyd(n);
	int q;
	cin >> q;
	while(q--){
		int a, b;
		cin >> a >> b;
		if(dist[a][b]>=inf)
			cout << -1 << endl; 
		else
			cout << ceil(dist[a][b]+1, k) << endl;
	}
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:56:52: error: 'k' was not declared in this scope
   56 |                         cout << ceil(dist[a][b]+1, k) << endl;
      |                                                    ^
Language: C++

#pragma GCC target("avx512")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const ll INF = 1e17;


int main()
{
    int n, m, l;
    cin >> n >> m >> l;
    vector<vector<pair<int,ll>>> hen(n);
    for(int i = 0; i < m; i++) {
        int a, b, c; cin >> a >> b >> c;
        if(c > l)continue;
        a--, b--;
        hen[a].push_back({b, c});
        hen[b].push_back({a, c});
    }

    vector<vector<pair<ll,ll>>> Dist;
    
    //頂点v出発
    for(int v = 0; v < n; v++) {
        vector<pair<ll,ll>> dist(n, {INF, INF}); //回数, あまり
        dist[v] = {0, 0};
        using T = pair<pair<ll,ll>,int>;
        priority_queue<T, vector<T>, greater<T>> que;
        que.push({{0, 0}, v});

        while(que.size()) {
            auto cur = que.top().first;
            int vert = que.top().second;
            que.pop();
            for(auto i : hen[vert]) {

                pair<ll,ll> nxt = (cur.second + i.second > l ? make_pair(cur.first + 1, i.second) : make_pair(cur.first, cur.second + i.second));
                if(dist[i.first] > nxt) {
                    dist[i.first] = nxt;
                    que.push({dist[i.first], i.first});
                }
            }
        }
        Dist.push_back(dist);
    }


    int que; cin >> que;
    vector<int> s(que), t(que);
    for(int i = 0; i < que; i++) {
        cin >> s[i] >> t[i];
        s[i]--, t[i]--;
    }

    for(int i = 0; i < que; i++) {
        cout << ( Dist[s[i]][t[i]].first >= INF ? -1 : Dist[s[i]][t[i]].first ) << endl;
    }
}

Compiler output:
cc1plus: error: attribute 'target' argument 'avx512' is unknown
cc1plus: error: attribute 'target' argument 'avx512' is unknown
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,l;cin>>n>>m>>l;
  vector<vector<int>>v;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i==j) v[i][j]=0;
      else v[i][j]=INT_MAX;
    }
  }
  for(int k=0;i<m;k++){
  	int a,b,c; cin>>a>>b>>c;
    v[a][b]=c;
   }
  for(int i=0;i<n;i++){
  	for(int j=0;j<n;j++){
  		for(int k=0;k<n;k++){
  		v[i][j]=min(v[i][j],v[i][k]+v[k][j]);
  		}
  	}
  }
  int q; cin>>q;
  for(int i=0;i<q;i++){
  	int s,t;cin>>s>>t;
    cout<<v[s][t]/l<<"\n";
  }
  

}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: 'i' was not declared in this scope
   12 |   for(int k=0;i<m;k++){
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,l;cin>>n>>m>>l;
  vector<vector<>>v;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i==j) v[i][j]=0;
      else v[i][j]=INT_MAX;
    }
  }
  for(int k=0;i<m;k++){
  	int a,b,c; cin>>a>>b>>c;
    v[a][b]=c;
   }
  for(int i=0;i<n;i++){
  	for(int j=0;j<n;j++){
  		for(int k=0;k<n;k++){
  		v[i][j]=min(v[i][j],v[i][k]+v[k][j]);
  		}
  	}
  }
  int q; cin>>q;
  for(int i=0;i<q;i++){
  	int s,t;cin>>s>>t;
    cout<<v[s][t]/l<<"\n";
  }
  

}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:16: error: wrong number of template arguments (0, should be at least 1)
    5 |   vector<vector<>>v;
      |                ^
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,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: provided for 'template<class _Tp, class _Alloc> class std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:5:17: error: template argument 1 is invalid
    5 |   vector<vector<>>v;
      |                 ^~
a.cc:5:17: error: template argument 2 is invalid
a.cc:8:17: error: invalid types 'int[int]' for array subscript
    8 |       if(i==j) v[i][j]=0;
      |                 ^
a.cc:9:13: error: invalid types 'int[int]' for array subscript
    9 |       else v[i][j]=INT_MAX;
      |             ^
a.cc:12:15: error: 'i' was not declared in this scope
   12 |   for(int k=0;i<m;k++){
      |               ^
a.cc:14:6: error: invalid types 'int[int]' for array subscript
   14 |     v[a][b]=c;
      |      ^
a.cc:19:18: error: invalid types 'int[int]' for array subscript
   19 |                 v[i][j]=min(v[i][j],v[i][k]+v[k][j]);
      |                  ^
a.cc:19:30: error: invalid types 'int[int]' for array subscript
   19 |                 v[i][j]=min(v[i][j],v[i][k]+v[k][j]);
      |                              ^
a.cc:19:38: error: invalid types 'int[int]' for array subscript
   19 |                 v[i][j]=min(v[i][j],v[i][k]+v[k][j]);
      |                                      ^
a.cc:19:46: error: invalid types 'int[int]' for array subscript
   19 |                 v[i][j]=min(v[i][j],v[i][k]+v[k][j]);
      |                                              ^
a.cc:26:12: error: invalid types 'int[int]' for array subscript
   26 |     cout<<v[s][t]/l<<"\n";
      |            ^
Language: C++

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

using Weight = long long;
using Vertex = int;
struct Edge {Vertex from, to; Weight weight, charge;};
using Graph = vector<vector<Edge>>;

int main() {
  int N, M, L;
  cin >> N >> M >> L;

  Graph G(N);
  for(auto i = 0; i < M; ++i) {
    int A, B, C;
    cin >> A >> B >> C;
    --A; --B;
    if(L < C) continue;
    G[A].push_back({A, B, C});
    G[B].push_back({B, A, C});
  }

  memo[300][300] = {};
  fill(memo[0], memo[300], -1);
  priority_queue<Edge, vector<Edge>, function<bool(Edge,Edge)>> q([](Edge lhs, Edge rhs){
    if(lhs.charge != rhs.charge) return lhs.charge > rhs.charge;
    return lhs.weight < rhs.weight;
  });
  for(auto s = 0; s < N; ++s) {
    auto& d = memo[s];
    q.push({s, s, L, 0});
    while(!q.empty()) {
      auto cur = q.top(); q.pop();
      if(d[cur.to] != -1) continue;
      d[cur.to] = cur.charge;
      for(const auto& nex: G[cur.to]) if(d[nex.to] == -1) {
        q.push({cur.to, nex.to, L - nex.weight, cur.charge + 1});
        if(nex.weight <= cur.weight) q.push({cur.to, nex.to, cur.weight - nex.weight, cur.charge});
      }
    }
  }

  int Q;
  cin >> Q;
  for(auto i = 0; i < Q; ++i) {
    int s, t;
    cin >> s >> t;
    --s, --t;
    cout << memo[s][t] << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:3: error: 'memo' was not declared in this scope
   23 |   memo[300][300] = {};
      |   ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<50)
signed main(){
  int N,M,L; cin>>N>>M>>L;
  if(M<=10000){
  vector<vector<pii>> A(N,vector<pii>(N,mp(INF,INF)));
  rep(i,0,M){
    int X,Y,Z; cin>>X>>Y>>Z;
    if(L>=Z){
      A[X-1][Y-1]=mp(0,Z);
      A[Y-1][X-1]=mp(0,Z);
    }
  }
  rep(i,0,N) A[i][i]=mp(0,0);
  rep(i,0,N){
    rep(j,0,N){
      rep(k,0,N){
        int X=A[j][i].first+A[i][k].first,Y=A[j][i].second+A[i][k].second;
        if(Y>L){
          Y-=L;
          X++;
        }
        A[j][k]=min(A[j][k],mp(X,Y));
      }
    }
  int Q; cin>>Q;
  rep(i,0,Q){
    int X,Y; cin>>X>>Y;
    int ans=A[X-1][Y-1].first;
    if(ans==INF) ans=-1;
    cout<<ans<<endl;
  }
  }
  else{
  vector<vector<pii>> A(N,vector<pii>(N,mp(INF,INF)));
  rep(i,0,M){
    int X,Y,Z; cin>>X>>Y>>Z;
    if(L>=Z){
      A[X-1][Y-1]=mp(0,Z);
      A[Y-1][X-1]=mp(0,Z);
    }
  }
  rep(i,0,N) A[i][i]=mp(0,0);
  rep(i,0,N){
    rep(j,0,N){
      rep(k,0,N){
        int X=A[j][i].first+A[i][k].first,Y=A[j][i].second+A[i][k].second;
        if(Y>L){
          Y-=L;
          X++;
        }
        A[j][k]=min(A[j][k],mp(X,Y));
      }
    }
  }
  int Q; cin>>Q;
  rep(i,0,Q){
    int X,Y; cin>>X>>Y;
    int ans=A[X-1][Y-1].first;
    if(ans==INF) ans=-1;
    cout<<ans<<endl;
  }
  }
  }




Compiler output:
a.cc: In function 'int main()':
a.cc:50:3: error: expected '}' before 'else'
   50 |   else{
      |   ^~~~
a.cc:21:15: note: to match this '{'
   21 |   if(M<=10000){
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<50)
signed main(){
  int N,M,L; cin>>N>>M>>L;
  if(M<=10000){
  vector<vector<pii>> A(N,vector<pii>(N,mp(INF,INF)));
  rep(i,0,M){
    int X,Y,Z; cin>>X>>Y>>Z;
    if(L>=Z){
      A[X-1][Y-1]=mp(0,Z);
      A[Y-1][X-1]=mp(0,Z);
    }
  }
  rep(i,0,N) A[i][i]=mp(0,0);
  rep(i,0,N){
    rep(j,0,N){
      rep(k,0,N){
        int X=A[j][i].first+A[i][k].first,Y=A[j][i].second+A[i][k].second;
        if(Y>L){
          Y-=L;
          X++;
        }
        A[j][k]=min(A[j][k],mp(X,Y));
      }
    }
  int Q; cin>>Q;
  rep(i,0,Q){
    int X,Y; cin>>X>>Y;
    int ans=A[X-1][Y-1].first;
    if(ans==INF) ans=-1;
    cout<<ans<<endl;
  }
  }else{
  vector<vector<pii>> A(N,vector<pii>(N,mp(INF,INF)));
  rep(i,0,M){
    int X,Y,Z; cin>>X>>Y>>Z;
    if(L>=Z){
      A[X-1][Y-1]=mp(0,Z);
      A[Y-1][X-1]=mp(0,Z);
    }
  }
  rep(i,0,N) A[i][i]=mp(0,0);
  rep(i,0,N){
    rep(j,0,N){
      rep(k,0,N){
        int X=A[j][i].first+A[i][k].first,Y=A[j][i].second+A[i][k].second;
        if(Y>L){
          Y-=L;
          X++;
        }
        A[j][k]=min(A[j][k],mp(X,Y));
      }
    }
  }
  int Q; cin>>Q;
  rep(i,0,Q){
    int X,Y; cin>>X>>Y;
    int ans=A[X-1][Y-1].first;
    if(ans==INF) ans=-1;
    cout<<ans<<endl;
  }
  }
  }




Compiler output:
a.cc: In function 'int main()':
a.cc:49:4: error: expected '}' before 'else'
   49 |   }else{
      |    ^~~~
a.cc:21:15: note: to match this '{'
   21 |   if(M<=10000){
      |               ^
Language: C++

#include <iostream>
using namespace std;

static constexpr int inf = INT_MAX / 2;
static_assert(inf > 1'000'000'000, "range of `int` is smaller than expected.");
static int dist[300][300];

template <class T> static void fill(T &dest, const T &value) { dest = value; }
template <class T, size_t N, class V> static void fill(T (&dest)[N], const V &value) {
    for (auto &elem : dest)
        fill(elem, value);
}

int main() {
    int cities, m, tank;
    cin >> cities >> m >> tank;
    fill(dist, inf);
    for (int i = 0; i < cities; i++)
        dist[i][i] = 0;

    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        if (c <= tank) {
            dist[a][b] = c;
            dist[b][a] = c;
        }
    }

    for (int k = 0; k < cities; k++) {
        for (int s = 0; s < cities; s++) {
            for (int g = 0; g < cities; g++) {
                if (dist[s][g] > dist[s][k] + dist[k][g])
                    dist[s][g] = dist[s][k] + dist[k][g];
            }
        }
    }

    for (int s = 0; s < cities; s++) {
        for (int g = 0; g < cities; g++) {
            if (dist[s][g] <= tank) {
                dist[s][g] = 1;
            } else {
                dist[s][g] = inf;
            }
        }
    }

    for (int k = 0; k < cities; k++) {
        for (int s = 0; s < cities; s++) {
            for (int g = 0; g < cities; g++) {
                if (dist[s][g] > dist[s][k] + dist[k][g])
                    dist[s][g] = dist[s][k] + dist[k][g];
            }
        }
    }

    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int s, t;
        cin >> s >> t;
        s--, t--;
        int d = dist[s][t];
        if (d < inf) {
            cout << (d - 1) << "\n";
        } else {
            cout << -1 << "\n";
        }
    }

    return 0;
}


Compiler output:
a.cc:4:28: error: 'INT_MAX' was not declared in this scope
    4 | static constexpr int inf = INT_MAX / 2;
      |                            ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
a.cc:5:19: error: non-constant condition for static assertion
    5 | static_assert(inf > 1'000'000'000, "range of `int` is smaller than expected.");
      |               ~~~~^~~~~~~~~~~~~~~
Language: C++

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//V,P(大文字)使用不可

const ll INF=1e18;

const ll max_V=305;//制約に注意

ll d[max_V][max_V];
ll N,M;
ll nex[max_V][max_V];//経路復元

//d[i][j]の入力の前にINFに初期化せよ!!!

void warshall_floyd(){
    for(ll i=0;i<N;i++){
        for(ll j=0;j<N;j++) nex[i][j]=j;
    }
    for(ll k=0;k<N;k++){
        for(ll i=0;i<N;i++){
            for(ll j=0;j<N;j++){
                if(d[i][j]>d[i][k]+d[k][j]){
                    d[i][j]=d[i][k]+d[k][j];
                    nex[i][j] = nex[i][k];
                }
            }
        }
    }
}

vector<ll> get_path(ll start,ll goal) {
    vector<ll> path;
    for (ll cur = start; cur != goal; cur = nex[cur][goal]){
        //printf("%d ", cur);
        path.push_back(cur);
    }
    path.push_back(goal);
    //printf("%d\n", goal);
    return path;
}

int main(){
    ll L;
    cin>>N>>M>>L;
    rep(i,N){
        rep(j,N) d[i][j]=INF;
    }
    rep(i,M){
        ll a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        d[a][b]=c;
        d[b][a]=c;
    }
    warshall_floyd();
    int Q;
    cin>>Q;
    while(Q--){
        int s,t;
        cin>>s>>t;
        s--;t--;
        vector<int> path=get_path(s,t);
        ll m=path.size();
        ll cnt=0;
        ll sum=L;
        ll ans=0;
        bool ok=1;
        for(int i=0;i<m-1;i++){
            ll len=d[path[i]][path[i+1]];
            if(sum<len){
                if(cnt==0){
                    ok=0;
                    break;
                }else{
                    if(L<len){
                        ok=0;
                        break;
                    }else{
                        sum=L-len;
                        ans++;
                    }
                }
            }else{
                sum-=len;
                cnt++;
            }
        }
        if(ok) cout<<ans<<endl;
        else cout<<-1<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:80:34: error: conversion from 'vector<long long int>' to non-scalar type 'vector<int>' requested
   80 |         vector<int> path=get_path(s,t);
      |                          ~~~~~~~~^~~~~