Language: C++

#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<set>
#include<tuple>
using namespace std;
#define INF 11000000000
#define MAX 5100
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)


//計算量はO(V*E)
struct edge{
  int from,to,cost;
};

edge es[110000]; //辺

ll d[110000]; //最短距離

int V,E; //Vは頂点数，Eは辺数
bool ans[2600];

//s番目の頂点から各頂点への最短距離を求める
void shortest_path(int s){
  for(int i=0;i<V;i++) d[i]=INF;
  d[s]=0;
  int count=0;
  while(true){
    bool update=false;
    for(int i=0;i<E;i++){

      edge e=es[i];
        //cout<<e.from<<endl;

      if(count>=2*V && ans[e.from]) ans[e.to]=true; 
      if(d[e.from]!=INF && d[e.to]>d[e.from]+e.cost){
          if(count>=2*V){
              ans[e.to]=true;
          }
        d[e.to]=d[e.from]+e.cost;
        update=true;
      }
    }
    if(!update) break;
    if(count>=3*V+2) break;
    count++;
  }

}


int main(){
    for(int i=0;i<2600;i++) ans[i]=false;
    int c;
    cin>>V>>E>>c;
    for(int i=0;i<E;i++){
        int A,B,C;
        cin>>A>>B>>C;
        A--; B--;

        es[i].from=A;
        es[i].to=B;
        es[i].cost=(C-c)*(-1);
    }
    shortest_path(0);
    if(ans[V-1]) cout<<-1<<endl;
    else cout<<max(d[V-1]*(-1),0)<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:81:19: error: no matching function for call to 'max(ll, int)'
   81 |     else cout<<max(d[V-1]*(-1),0)<<endl;
      |                ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:3:
/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:81:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   81 |     else cout<<max(d[V-1]*(-1),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:
/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:81:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   81 |     else cout<<max(d[V-1]*(-1),0)<<endl;
      |                ~~~^~~~~~~~~~~~~~~