Language: C++

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
//#define ll long long
#define P pair<ll,ll>

vector<P>G[1100];
int n,m;
ll a,b,c;
ll dist[1100];
bool heiro[11000];
bool used[11000];
const ll INF=-20000000000000000;

bool che(int now){
	queue<int>bfs;
	bfs.push(now);
	
	while(!bfs.empty()){
		int next=bfs.front();
		bfs.pop();
		if(used[next])continue;
		if(heiro[next])return 0;
		rep(i,G[next].size()){
			bfs.push(G[next][i].first);
		}
	}
	
	return 1;
}
int main(){
	//O(VE)辺に着目して距離を更新
	cin>>n>>m;
	rep(i,n)dist[i]=INF;

	rep(i,m){
		cin>>a>>b>>c;
		a--;
		b--;
		G[a].push_back(mp(b,c));
		//G[b].push_back(mp(a,c));
	}	
	dist[0]=0;

	rep(i,3*n){
			rep(j,n){
			rep(k,G[j].size()){
				int from=j,to=G[j][k].first,cost=G[j][k].second;
				if(dist[to]<dist[from]+cost){
					dist[to]=dist[from]+cost;
					if(i>n)heiro[to]=heiro[from]=1;
				}
			}
			}
		if(i>=3*n-1){
			break;
		}
	}

	if(che(0))
	cout<<dist[n-1]<<endl;
	else cout<<"inf"<<endl;
	return 0;
}


Compiler output:
a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:18:16: note: in expansion of macro 'll'
   18 | #define P pair<ll,ll>
      |                ^~
a.cc:20:8: note: in expansion of macro 'P'
   20 | vector<P>G[1100];
      |        ^
a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:18:19: note: in expansion of macro 'll'
   18 | #define P pair<ll,ll>
      |                   ^~
a.cc:20:8: note: in expansion of macro 'P'
   20 | vector<P>G[1100];
      |        ^
a.cc:18:21: error: template argument 1 is invalid
   18 | #define P pair<ll,ll>
      |                     ^
a.cc:20:8: note: in expansion of macro 'P'
   20 | vector<P>G[1100];
      |        ^
a.cc:18:21: error: template argument 2 is invalid
   18 | #define P pair<ll,ll>
      |                     ^
a.cc:20:8: note: in expansion of macro 'P'
   20 | vector<P>G[1100];
      |        ^
a.cc:20:9: error: template argument 1 is invalid
   20 | vector<P>G[1100];
      |         ^
a.cc:20:9: error: template argument 2 is invalid
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:22:1: note: in expansion of macro 'll'
   22 | ll a,b,c;
      | ^~
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:23:1: note: in expansion of macro 'll'
   23 | ll dist[1100];
      | ^~
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:26:7: note: in expansion of macro 'll'
   26 | const ll INF=-20000000000000000;
      |       ^~
a.cc: In function 'bool che(int)':
a.cc:37:31: error: request for member 'size' in 'G[next]', which is of non-class type 'int'
   37 |                 rep(i,G[next].size()){
      |                               ^~~~
a.cc:13:32: note: in definition of macro 'rep'
   13 | #define rep(i,a) for(int i=0;i<a;i++)
      |                                ^
a.cc:38:41: error: invalid types 'int[int]' for array subscript
   38 |                         bfs.push(G[next][i].first);
      |                                         ^
a.cc: In function 'int main()':
a.cc:47:17: error: 'dist' was not declared in this scope
   47 |         rep(i,n)dist[i]=INF;
      |                 ^~~~
a.cc:47:25: error: 'INF' was not declared in this scope
   47 |         rep(i,n)dist[i]=INF;
      |                         ^~~
a.cc:50:22: error: 'a' was not declared in this scope
   50 |                 cin>>a>>b>>c;
      |                      ^
a.cc:50:25: error: 'b' was not declared in this scope
   50 |                 cin>>a>>b>>c;
      |                         ^
a.cc:50:28: error: 'c' was not declared in this scope
   50 |                 cin>>a>>b>>c;
      |                            ^
a.cc:56:9: error: 'dist' was not declared in this scope
   56 |         dist[0]=0;
      |         ^~~~
a.cc:60:36: error: request for member 'size' in 'G[j]', which is of non-class type 'int'
   60 |                         rep(k,G[j].size()){
      |                                    ^~~~
a.cc:13:32: note: in definition of macro 'rep'
   13 | #define rep(i,a) for(int i=0;i<a;i++)
      |                                ^
a.cc:61:51: error: invalid types 'int[int]' for array subscript
   61 |                                 int from=j,to=G[j][k].first,cost=G[j][k].second;
      |                                                   ^
a.cc:62:56: error: 'cost' was not declared in this scope; did you mean 'const'?
   62 |                                 if(dist[to]<dist[from]+cost){
      |                                                        ^~~~
      |                                                        const