Language: C++

#include <cstdio>
#include <random>
#include <cassert>
#include <algorithm>    
#include <iostream>
#include <chrono>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define int long long


using namespace std;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef tuple<int, int, int> tiii;
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const long long INF = 1e18;
const int M = 1e9 + 7;

const int maxn = 5000;
int d[maxn];
int u[maxn], v[maxn], c[maxn];
bool vis[maxn];
signed main()
{
#ifndef ONLINE_JUDGE
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#endif
    int n, m, p;
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n >> m >> p;
    for(int i = 0; i < m; ++i) {
        cin >> u[i] >> v[i] >> c[i];
        c[i] -= p;
        c[i] = -c[i];
        // cout << c[i] << ' ';
    }
    // cout << endl;
    bool ok = 1;
    int cnt = 0;
    for(int i = 1; i <= n; ++i) {
        d[i] = INF;
    }
    d[1] = 0;
    int f = 0;
    while(ok) {
        ok = 0;
        for(int i = 0; i < m; ++i) {
            int x = u[i], y = v[i];
            if(d[x] < INF && d[x] + c[i] < d[y]) {
                d[y] = d[x] + c[i];
                ok = 1;
                // cout << x << ' ' << d[x] << ' ' << y << ' ' << d[y] << endl;
                if(y == n) {
                    ++f;
                    if(f > m) {
                        cout << -1 << endl;
                        return 0;
                    }
                    // cout << x << ' ' << d[x] << ' ' << y << ' ' << d[y] << endl;
                }
            }
        }
        if(ok) {
            ++cnt;
        }
        if(cnt > 5 * m) {
            break;
        }
    }
    // cout << f << endl;
    if(f > m || d[n] == INF) {
        cout << -1 << endl;
    }
    else cout << max(-d[n], 0) << endl;



    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:92:21: error: no matching function for call to 'max(long long int, int)'
   92 |     else cout << max(-d[n], 0) << endl;
      |                  ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from /usr/include/c++/14/random:40,
                 from a.cc:2:
/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:92:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   92 |     else cout << max(-d[n], 0) << 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,
                 from a.cc:4:
/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:92:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   92 |     else cout << max(-d[n], 0) << endl;
      |                  ~~~^~~~~~~~~~