Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

inline ll read(){
    ll Hashimoto=0;
	bool Kanna=1;
    char I_Love=getchar();
    while(I_Love<'0'||I_Love>'9'){
        if(I_Love=='-')Kanna=0;
        I_Love=getchar();
    }
    while(I_Love>='0'&&I_Love<='9'){
        Hashimoto=Hashimoto*10+I_Love-'0';
        I_Love=getchar();
    }
    return (Kanna?Hashimoto:-Hashimoto);
}
template<typename T1,typename T2> inline void Umax(T1 &a,T2 b){
	if(a<b)a=b;
}
template<typename T1,typename T2> inline void Umin(T1 &a,T2 b){
	if(a>b)a=b;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<(Kanna);++I_Love)cout<<Hashimoto[I_Love]<<(I_Love==(Kanna)-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<(Kanna);++I_Love)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define UNIQUE(Kanna) Kanna.erase(unique(Kanna.begin(),Kanna.end()),Kanna.end());
#define inf (1000000000)
#define linf (1000000000000000000ll)
#define mod (1000000007)

int n,m,p;
vpii g[2555];
bool able[2555][2555];
void mark(int x,int f){
	able[f][x]=1;
	FOR(i,0,g[x].size()){
		int to=g[x][i].second;
		if(able[f][to])continue ;
		mark(to,f);
	}
}
int gg[2555][2555];
int dfn[2555],low[2555],index=0;
bool insta[2555];
int sta[2555],stasz=0;

void tarjan(int x) {
	dfn[x]=low[x]=index++;
	sta[stasz++]=x;insta[x]=1;
	FOR(i,0,g[x].size()) {
		int to=g[x][i].second;
		if(dfn[to]==-1) {
			tarjan(to);
			low[x]=min(low[x],low[to]);
		} else if(insta[to]) {
			low[x]=min(low[x],dfn[to]);
		}
	}
	if(dfn[x]==low[x]) {
		int lst=x;
		int cur=0;
		while(1) {
			int u=sta[--stasz];
			insta[u]=0;
			//MINE STARTS HERE
			cur+=gg[u][lst];
			lst=u;
			//MINE ENDS
			if(u==x)break;
		}
	}
}

priority_queue<pii>q;
void bfs(){
	int dis[2555];
	FOR(i,0,n)dis[i]=-inf;
	dis[0]=0;
	q.push(MP(0,0));
	while(!q.empty()){
		int d=q.top().first;
		int x=q.top().second;
		q.pop();
		if(d<dis[x])continue;
		FOR(i,0,g[x].size()){
			int to=g[x][i].second;
			if(!able[to][n-1])continue;
			int nd=g[x][i].first+d;
			if(nd>dis[to]){
				dis[to]=nd;
				q.push(MP(nd,to));
			}
		}
	}
	cout<<max(0,dis[n-1])<<endl;
	
}
int I_Love_Hashimoto_Kanna() {
	//完全想清楚了再开始写。
	//写不顺、不知道怎么写、很乱的时候，停下来好好想想。
	//做得慢总比做不出好。
	fastio;
	memset(dfn,-1,sizeof(dfn));
	memset(low,-1,sizeof(low));
	n=read();m=read();p=read();
	FOR(i,0,m){
		int a=read()-1,b=read()-1,c=read();
		gg[a][b]=c-p;
		g[a].push_back(MP(c-p,b));
	}
	FOR(i,0,n)mark(i,i);
	FOR(i,0,n){
		if(!able[0][i])continue;
		if(!able[i][n-1])continue;
		FOR(j,0,g[i].size()){
			if(g[i][j].second==i&&g[i][j].first>0){
				cout<<-1<<endl;
				return 0;
			}
		}
	}
	tarjan(0);
	bfs();
	return 0;
}


Compiler output:
a.cc:81:25: error: 'int index' redeclared as different kind of entity
   81 | int dfn[2555],low[2555],index=0;
      |                         ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from a.cc:3:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'void tarjan(int)':
a.cc:86:28: error: no post-increment operator for type
   86 |         dfn[x]=low[x]=index++;
      |                            ^~