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]){
    dfs(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);
  vb 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:67:24: error: template argument 4 is invalid
   67 |   vector<tuple<ll,ll,ll,>> edges;
      |                        ^
a.cc:67:25: error: template argument 1 is invalid
   67 |   vector<tuple<ll,ll,ll,>> edges;
      |                         ^~
a.cc:67:25: error: template argument 2 is invalid
a.cc:69:7: error: expected unqualified-id before ',' token
   69 |     ll,a,b,c;
      |       ^
a.cc:75:11: error: request for member 'emplace_back' in 'edges', which is of non-class type 'int'
   75 |     edges.emplace_back(a,b,c);
      |           ^~~~~~~~~~~~
a.cc:82:34: error: no match for 'operator=' (operand types are 'vb' {aka 'std::vector<bool>'} and 'int')
   82 |   rep(i,n) ok[i]=from1[i]&fromn[i];
      |                                  ^
In file included from /usr/include/c++/14/vector:67,
                 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_bvector.h:894:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(const std::vector<bool, _Alloc>&) [with _Alloc = std::allocator<bool>]'
  894 |       operator=(const vector& __x)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:894:31: note:   no known conversion for argument 1 from 'int' to 'const std::vector<bool>&'
  894 |       operator=(const vector& __x)
      |                 ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_bvector.h:926:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(std::vector<bool, _Alloc>&&) [with _Alloc = std::allocator<bool>]'
  926 |       operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:926:26: note:   no known conversion for argument 1 from 'int' to 'std::vector<bool>&&'
  926 |       operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_bvector.h:952:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(std::initializer_list<bool>) [with _Alloc = std::allocator<bool>]'
  952 |       operator=(initializer_list<bool> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:952:40: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<bool>'
  952 |       operator=(initializer_list<bool> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:91:23: error: invalid types 'int[long long int]' for array subscript
   91 |       tie(a,b,c)=edges[i];
      |                       ^
a.cc:92:10: error: no match for 'operator!' (operand type is 'vb' {aka 'std::vector<bool>'})
   92 |       if(!ok[a]||!ok[b]) continue;
      |          ^~~~~~
a.cc:92:10: note: candidate: 'operator!(bool)' (built-in)
a.cc:92:10: note:   no known conversion for argument 1 from 'vb' {aka 'std::vector<bool>'} to 'bool'
a.cc:92:18: error: no match for 'operator!' (operand type is 'vb' {aka 'std::vector<bool>'})
   92 |       if(!ok[a]||!ok[b]) continue;
      |                  ^~~~~~
a.cc:92:18: note: candidate: 'operator!(bool)' (built-in)
a.cc:92:18: note:   no known conversion for argument 1 from 'vb' {aka 'std::vector<bool>'} to 'bool'
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:
/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"
      |                        ^