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)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#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 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 dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
vll to[2505];
vll rto[2505];
bool from1[2505];
bool fromn[2505];
void dfs(ll v){
  if(from1[v]) return ;
  from1[v]=true;
  for(auto p:to[v]){
    dfs(p);
  }
}
void rdfs(ll v){
  if(fromn[v]) return ;
  fromn[v]=true;
  for(auto p:rto[v]){
    rdfs(p);
  }
}
int main(){
  ll n,m,p;
  cin>>n>>m>>p;
  vector<tuple<ll,ll,ll>> edges;
  rep(i,m){
    ll a,b,c;
    cin>>a>>b>>c;
    a--;
    b--;
    c-=p;
    c*=-1;
    edges.emplace_back(a,b,c);
    to[a].pb(b);
    rto[b].pb(a);
  }
  dfs(0);
  rdfs(n-1);
  bool ok[2505];
  rep(i,n) ok[i]=from1[i]&fromn[i];
  vll d(n,INF);
  d[0]=0;
  bool udt=true;
  ll cu=0;
  while(udt){
    udt=false;
    rep(i,m){
      ll a,b,c;
      tie(a,b,c)=edges[i];
      if(!ok[a]||!ok[b]) continue;
      if(d[a]+c<d[b]){
        d[b]=d[a]+c;
        udt=true;
      }
    }
    cu++;
    if(cu>n){
      COUT(-1);
      return 0;
    }
  }
  COUT(max(-d[n-1],0));
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:104:11: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)'
  104 |   COUT(max(-d[n-1],0));
      |        ~~~^~~~~~~~~~~
a.cc:20:24: note: in definition of macro 'COUT'
   20 | #define COUT(x) cout<<(x)<<"\n"
      |                        ^
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:104:11: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
  104 |   COUT(max(-d[n-1],0));
      |        ~~~^~~~~~~~~~~
a.cc:20:24: note: in definition of macro 'COUT'
   20 | #define COUT(x) cout<<(x)<<"\n"
      |                        ^
/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:104:11: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  104 |   COUT(max(-d[n-1],0));
      |        ~~~^~~~~~~~~~~
a.cc:20:24: note: in definition of macro 'COUT'
   20 | #define COUT(x) cout<<(x)<<"\n"
      |                        ^