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];
ll g[1100][1100];
int n,m;
ll a,b,c;
ll dist[1100];
const ll INF=-200000000000000000;
 
int main(){
	//O(VE)辺に着目して距離を更新
	cin>>n>>m;
	rep(i,n)dist[i]=INF;
 	rep(i,n)rep(j,n)g[i][j]=INF;

	rep(i,m){
		cin>>a>>b>>c;
		a--;
		b--;
		//G[a].push_back(mp(b,c));
		//G[b].push_back(mp(a,c));
		g[a][b]=max(g[a][b],c);
	}	
	rep(i,n){
		rep(j,n)if(g[i][j]!=INF)G[i].push_back(mp(j,g[i][j]));
	}
	dist[0]=0;
 
	rep(i,n){
		bool update=false;
			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){
					update=true;
					dist[to]=dist[from]+cost;
				}
			}
			}
		if(!update)break;
	}

 	bool ok=1;
	ll d[1100];
	rep(i,n)d[i]=0;

	rep(i,n){

			rep(j,n){
			rep(k,G[j].size()){
				int from=j,to=G[j][k].first,cost=G[j][k].second;
				if(d[to]<d[from]+cost){
					d[to]=d[from]+cost;
							if(i==n-1)ok=0;
				}
			}
			}

	}
	

	if(ok)
	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:21:1: note: in expansion of macro 'll'
   21 | ll g[1100][1100];
      | ^~
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 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:24:1: note: in expansion of macro 'll'
   24 | 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:25:7: note: in expansion of macro 'll'
   25 | const ll INF=-200000000000000000;
      |       ^~
a.cc: In function 'int main()':
a.cc:30:17: error: 'dist' was not declared in this scope
   30 |         rep(i,n)dist[i]=INF;
      |                 ^~~~
a.cc:30:25: error: 'INF' was not declared in this scope
   30 |         rep(i,n)dist[i]=INF;
      |                         ^~~
a.cc:31:25: error: 'g' was not declared in this scope
   31 |         rep(i,n)rep(j,n)g[i][j]=INF;
      |                         ^
a.cc:31:33: error: 'INF' was not declared in this scope
   31 |         rep(i,n)rep(j,n)g[i][j]=INF;
      |                                 ^~~
a.cc:34:22: error: 'a' was not declared in this scope
   34 |                 cin>>a>>b>>c;
      |                      ^
a.cc:34:25: error: 'b' was not declared in this scope
   34 |                 cin>>a>>b>>c;
      |                         ^
a.cc:34:28: error: 'c' was not declared in this scope
   34 |                 cin>>a>>b>>c;
      |                            ^
a.cc:39:17: error: 'g' was not declared in this scope
   39 |                 g[a][b]=max(g[a][b],c);
      |                 ^
a.cc:42:28: error: 'g' was not declared in this scope
   42 |                 rep(j,n)if(g[i][j]!=INF)G[i].push_back(mp(j,g[i][j]));
      |                            ^
a.cc:42:37: error: 'INF' was not declared in this scope
   42 |                 rep(j,n)if(g[i][j]!=INF)G[i].push_back(mp(j,g[i][j]));
      |                                     ^~~
a.cc:42:46: error: request for member 'push_back' in 'G[i]', which is of non-class type 'int'
   42 |                 rep(j,n)if(g[i][j]!=INF)G[i].push_back(mp(j,g[i][j]));
      |                                              ^~~~~~~~~
a.cc:44:9: error: 'dist' was not declared in this scope
   44 |         dist[0]=0;
      |         ^~~~
a.cc:49:36: error: request for member 'size' in 'G[j]', which is of non-class type 'int'
   49 |                         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:50:51: error: invalid types 'int[int]' for array subscript
   50 |                                 int from=j,to=G[j][k].first,cost=G[j][k].second;
      |                                                   ^
a.cc:51:56: error: 'cost' was not declared in this scope; did you mean 'const'?
   51 |                                 if(dist[to]<dist[from]+cost){
      |                                                        ^~~~
      |                                                        const
a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:61:9: note: in expansion of macro 'll'
   61 |         ll d[1100];
      |         ^~
a.cc:62:17: error: 'd' was not declared in this scope
   62 |         rep(i,n)d[i]=0;
      |                 ^
a.cc:67:36: error: request for member 'size' in 'G[j]', which is of non-class type 'int'
   67 |                         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:68:51: error: invalid types 'int[int]' for array subscript
   68 |                                 int from=j,to=G[j][k].first,cost=G[j][k].second;
      |                                                   ^
a.cc:69:36: error: 'd' was not declared in this scope
   69 |                                 if(d[to]<d[from]+cost){
      |                                    ^
a.cc:69:50: error: 'cost' was not declared in this scope; did you mean 'const'?
   69 |                                 if(d[to]<d[from]+cost){
      |                                                  ^~~~
      |                                                  const