Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define forr(i,p,n) for(ll i=p;i<n;i++)
#define tam 5010
#define offset 50000
using namespace std;
typedef long long  ll;
typedef pair<ll,ll> ii;
typedef pair<ll,ii> iii;
const ll MOD=1e9+7;
vector<ii> grafo[tam];
vector<ll> grafoinv[tam];
bool vis[tam];
deque<ll> orden;
void dfs0( ll num)
{
    ll hijo;
    vis[num]=1;
    forr(i,0,grafo[num].size())
    {
        hijo=grafo[num][i].fi;
        if (vis[hijo]==false)
            dfs0(hijo);
    }
    orden.push_front(num);
}
vector<ll> comp;
bool vis1[tam];
void dfs1( ll num)
{
    ll hijo;
    comp.pb(num);
    vis1[num]=1;
    forr(i,0,grafoinv[num].size())
    {
        hijo=grafoinv[num][i];
        if (vis1[hijo]==false)
            dfs1(hijo);
    }

}

bool dijvis[tam];
ll dijpes[tam];
const ll INF=1e12;
bool marcado[tam];
bool dijks(ll num)
{   
    priority_queue<ii,vector<ii>,greater<ii> > cola;
    cola.push(ii(0,num));
    ll auxpes,auxnod;
    while(!cola.empty())
    {
        auxpes=cola.top().fi;
        auxnod=cola.top().se;
        cola.pop();
        //cout<<auxpes<<" "<<auxnod<<endl;
        if (dijpes[auxnod]!=INF && auxpes<dijpes[auxnod])
            {
                ////cout<<"dammdaniel\n";
                forr(i,0,2501)
                dijpes[i]=INF;
                return true;
            }

        dijpes[auxnod]=auxpes;
        ll hijo;
        forr(i,0,grafo[auxnod].size())
        {
            hijo=grafo[auxnod][i].fi;
            ////cout<<"hijo "<<hijo<<' ';
            if (dijvis[hijo]==1)
            {
                if (dijpes[hijo]>auxpes+grafo[auxnod][i].se)
                {
                    cola.push(ii(auxpes+grafo[auxnod][i].se,hijo));
                }
            }
        }
        ////cout<<endl;
    }

    return false;
}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    ll n,m,p;
    cin>>n>>m>>p;
    ll iz,der,valp;
    map<ii,ll> mapa;
    forr(i,0,m)
    {
        cin>>iz>>der>>valp;
        iz--,der--;
        mapa[ii(iz,der)]=max(mapa[ii(iz,der)],valp);
    }
    for(map<ii,ll>::iterator ite=mapa.begin();ite!=mapa.end();ite++)
    {
        iz=ite->fi.fi;
        der=ite->fi.se;
        valp=ite->se;
        grafo[iz].pb(ii(der,p-valp));
        grafoinv[der].pb(iz);
    }
    dfs0(0);
    memset(vis,0,sizeof vis);
    memset(vis1,0,sizeof vis1);
    forr(i,0,orden.size())
    {
        iz=orden[i];
        if (vis[iz]==false){
            comp.clear();
            dfs1(iz);
            memset(dijvis,0,sizeof dijvis);
            //componentes
            //cout<<"aca\n";
            forr(j,0,comp.size()){
              //  cout<<comp[j]<<' ';
                vis[comp[j]]=1;
            }
            //cout<<endl;
            //continue;
            forr(j,0,comp.size()){
                vis[comp[j]]=1;
                dijvis[comp[j]]=1;
                dijpes[comp[j]]=INF;
            }
            bool marca=dijks(iz);
            //cout<<marca<<" marcado?\n";
            forr(j,0,comp.size())
            {
                marcado[comp[j]]=marca;
            }
        }
    }
    // check poll
    comp.clear();
    memset(vis,0,sizeof vis);
    orden.clear();
        dfs0(0);
    vector<ll> vtry;
    forr(i,0,orden.size())
    {
        iz=orden[i];
        if (marcado[iz])
        {
            vtry.pb(iz);
        }
    }
    memset(vis,0,sizeof vis);
////    cout<<"try ";
    forr(i,0,vtry.size())
    {
        iz=vtry[i];
        //cout<<iz<<' ';
        if (vis[iz]==0)
            dfs0(iz);
    }
  ////  cout<<"\n";
    //end check
    if (vis[n-1]==1)
        cout<<-1<<endl;
    else
    {
        ////cout<<"entramos\n";
        forr(i,0,n)
        {
            if (marcado[i])
                dijvis[i]=false;
            else
                dijvis[i]=1;
            dijpes[i]=INF;
            //cout<<dijvis[i];
        }
        //cout<<endl;
        dijks(0);

        if (dijpes[n-1]==INF)
            cout<<-1<<endl;
        else
            cout<<max(0,-dijpes[n-1]);
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:185:22: error: no matching function for call to 'max(int, ll)'
  185 |             cout<<max(0,-dijpes[n-1]);
      |                   ~~~^~~~~~~~~~~~~~~~
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:185:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  185 |             cout<<max(0,-dijpes[n-1]);
      |                   ~~~^~~~~~~~~~~~~~~~
/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:185:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  185 |             cout<<max(0,-dijpes[n-1]);
      |                   ~~~^~~~~~~~~~~~~~~~