criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;

struct edge {
    int to, cost;
};

vector<edge> G[1000];

int N;
vector<bool> used(1000);
bool dfs(int v, long long depth, vector<long long> &dist) {
    if (used.at(v) && dist.at(v) >= 0) return true;
    else if (used.at(v) && dist.at(v) == -1) return false;
    
    used.at(v) = true;
    
    if (v == N) {
        dist.at(v) = depth;
        return true;
    }

    bool ret = false;
    for (int i = 0; i < (int)G[v].size(); i++) {
        ret |= dfs(G[v].at(i).to, depth + 1, dist);
    }
    if (ret) dist.at(v) = depth;
    else dist.at(v) = -1;
    return ret;
}

int main() {
    int n, m;
    cin >> n >> m;
    N = n - 1;
    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        G[a].push_back(edge{b, c});
    }

    vector<long long> dist(n, 0);
    dfs(0, 0, dist);

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < (int)G[i].size(); j++) {
            if (dist.at(i) == -1 || dist.at(G[i].at(j).to) == -1) G[i].at(j).to = -1;
        }
    }

    vector<long long> x(n);
    x.at(0) = 0;
    for (int i = 1; i < n; i++) {
        x.at(i) = -LLONG_MAX;    
    }

    for (int l = 0; l < n; l++){
        for (int i = 0; i < n; i++) {
            if (dist.at(i) == -1) continue;

            for (int j = 0; j < (int)G[i].size(); j++) {
                if (G[i].at(j).to == -1) continue;

                x.at(G[i].at(j).to) = max(x.at(G[i].at(j).to), x.at(i) + G[i].at(j).cost);
                
                if (x.at(G[i].at(j).to)) > 10'000'000'000'000) {
                    cout << "inf" << endl;
                    return 0;
                }
            }
        }
    }

    long long maximum = x.at(n - 1);
    for (int i = 0; i < n; i++) {
        if (dist.at(i) == -1) continue;

        for (int j = 0; j < (int)G[i].size(); j++) {
            if (G[i].at(j).to == -1) continue;

            x.at(G[i].at(j).to) = max(x.at(G[i].at(j).to), x.at(i) + G[i].at(j).cost);
            
            if (x.at(G[i].at(j).to)) > 10'000'000'000'000) {
                cout << "inf" << endl;
                return 0;
            }
        }
    }
    
    if (maximum < x.at(n - 1)) cout << "inf" << endl;
    else cout << maximum << endl;
}   

Compiler output:
a.cc: In function 'int main()':
a.cc:67:42: error: expected primary-expression before '>' token
   67 |                 if (x.at(G[i].at(j).to)) > 10'000'000'000'000) {
      |                                          ^
a.cc:84:38: error: expected primary-expression before '>' token
   84 |             if (x.at(G[i].at(j).to)) > 10'000'000'000'000) {
      |                                      ^
Language: C++

INF = float('inf')
#vは頂点数、eは辺数
#s番目の頂点から各頂点への最短距離を求める
def Bellmanford(n, e, s):
  d = [INF]*n
  d[s] = 0
  for i in range(n):
    print(i)
    for e_from, e_to, e_cost in e:
      if d[e_from] != INF and d[e_to] > d[e_from] + e_cost:
        print("aaa")
        d[e_to] = d[e_from] + e_cost
        if i == n-1:
          return 'inf'
  return -d[n-1]

n,m = (int(x) for x in input().split())
edges = [None] * m

for i in range(m):
    ai, bi, ci = map(int, input().split())
    edges[i] = (ai-1, bi-1, -ci)
    
ans = Bellmanford(n, edges, 0)
print(ans)

    
  


Compiler output:
a.cc:1:13: warning: multi-character character constant [-Wmultichar]
    1 | INF = float('inf')
      |             ^~~~~
a.cc:2:2: error: extended character 、 is not valid in an identifier
    2 | #vは頂点数、eは辺数
      |  ^
a.cc:2:2: error: invalid preprocessing directive #v\U0000306f\U00009802\U000070b9\U00006570\U00003001e\U0000306f\U00008fba\U00006570
    2 | #vは頂点数、eは辺数
      |  ^~~~~~~~~~~~~~~~~~
a.cc:3:2: error: invalid preprocessing directive #s\U0000756a\U000076ee\U0000306e\U00009802\U000070b9\U0000304b\U00003089\U00005404\U00009802\U000070b9\U00003078\U0000306e\U00006700\U000077ed\U00008ddd\U000096e2\U00003092\U00006c42\U00003081\U0000308b
    3 | #s番目の頂点から各頂点への最短距離を求める
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:18: warning: multi-character character constant [-Wmultichar]
   14 |           return 'inf'
      |                  ^~~~~
a.cc:1:1: error: 'INF' does not name a type
    1 | INF = float('inf')
      | ^~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <string.h>
#include <limits.h>
using namespace std;
typedef long long ll;

ll INF=1e18;
struct edge { ll from, to, cost; };

edge es[2005];
ll d[1005];
ll v, e;
bool neg = false;

void shortest_path(int s) {
    for (int i = 0; i < v; i++) d[i] = INF;
    d[s] = 0;
    int l;
    for (int i = 0; i < v; i++) {
        bool update = false;
        for (int j = 0; j < e; j++) {
            edge e = es[j];
            if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
                d[e.to] = d[e.from] + e.cost;
                update = true;
                if (i == v - 1 && d[v - 1] != l;) {
                    neg = true;
                }
            }
        }
        if (!update) break;
        l = d[v - 1];
    }
}

int main(void){
    cin >> v >> e;
    for (int i = 0; i < e; i++) {
        ll pt;
        cin >> es[i].from >> es[i].to >> pt;
        es[i].from--;  es[i].to--;
        es[i].cost = -pt;
    }
    
    shortest_path(0);
    if (neg) cout << "inf" << endl;
    else {
        cout << -d[v - 1] << endl;
    }
    
}

Compiler output:
a.cc: In function 'void shortest_path(int)':
a.cc:28:49: error: expected primary-expression before ')' token
   28 |                 if (i == v - 1 && d[v - 1] != l;) {
      |                                                 ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define mk make_pair

typedef long long LL;
typedef pair<int,int> Interval;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

const int maxn = 1005;
LL INF = 1e18;

struct Edge{
    int from,to,w;
    Edge(int u = 0,int v = 0,int w = 0):from(u),to(v),w(w){;}
};

int inq[maxn];
int cnt[maxn];
LL d[maxn];
int N,M;

vector<int> G[maxn];
vector<Edge> edges;

bool bellman_ford(int s){
    queue<int> Q;
    memset(inq,0,sizeof(inq));
    memset(cnt,0,sizeof(cnt));
    _rep(i,0,N) d[i] = INF;
    d[s] = 0;
    inq[s] = true;
    Q.push(s);

    while(!Q.empty()){
        int u = Q.front();Q.pop();
        inq[u] = false;
        for(int i = 0;i < G[u].size();i++){
            Edge &e = edges[G[u][i]];
            if(d[u] < INF && d[e.to] > d[u] + e.w){
                d[e.to] = d[u] + e.w;
            }
            if(!inq[e.to]){
                Q.push(e.to);
                inq[e.to] = true;
                if(++cnt[e.to] > N) return false;
            }
        }
    }

    return true;
}




Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;

long long INF = - 1'000'000'000'000'000'000;

int main(){
    int n, m;
    cin >> n >> m;

    struct edge {
        long long from, to, cost;
    };

    vector<edge> es(m);
    for (int i = 0; i < m; i++){
        cin >> es[i].from >> es[i].to >> es[i].cost;
    }

    vector<long long> distance(n, INF);
    distance[0] = 0;
    int cnt = 0;

    while (1){
        bool flag = false;
        for (int i = 0; i < m; i++){
            bool up = false;
            edge e = es[i];
            if (distance[e.from - 1] != INF && distance[e.to - 1] < distance[e.from - 1] + e.cost){
                distance[e.to - 1] = distance[e.from - 1] + e.cost;
                flag = true;
                if (cnt >= n - 1){
                    cout << "inf" << endl;
                    exit(0);
                }
            }
        }
        cnt++;
        if (flag == false) break;
    }

    if (distance[i - 1] == INF) cout << distance[100000000] << endl;
    cout << distance[n - 1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:18: error: 'i' was not declared in this scope
   41 |     if (distance[i - 1] == INF) cout << distance[100000000] << endl;
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

long long INF = - 1'000'000'000'000'000'000;

int main(){
    int n, m;
    cin >> n >> m;

    struct edge {
        long long from, to, cost;
    };

    vector<edge> es(m);
    for (int i = 0; i < m; i++){
        cin >> es[i].from >> es[i].to >> es[i].cost;
    }

    vector<long long> distance(n, INF);
    distance[0] = 0;
    int cnt = 0;

    while (1){
        bool flag = false;
        for (int i = 0; i < m; i++){
            bool up = false;
            edge e = es[i];
            if (distance[e.from - 1] != INF && distance[e.to - 1] < distance[e.from - 1] + e.cost){
                distance[e.to - 1] = distance[e.from - 1] + e.cost;
                flag = true;
                if (cnt >= n - 1){
                    cout << "inf" << endl;
                    exit(0);
                }
            }
        }
        cnt++;
        if (flag == false) break;
    }

    if (distance[i - 1] == INF) cout << distance[INF] << endl;
    cout << distance[n - 1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:18: error: 'i' was not declared in this scope
   41 |     if (distance[i - 1] == INF) cout << distance[INF] << endl;
      |                  ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
// http://drken1215.hatenablog.com/entry/2019/02/16/075900
using Edge = pair<int, long long>;
int N, M;
vector<vector<Edge>> G;

int main() {
    int N, M;
    cin >> N >> M;
    G.resize(N);
    REP(i, M) {
        int a, b;
        long long w;
        cin >> a >> b >> w;
        a--;
        b--;
        G[a].push_back(Edge(b, -w));
    }
    vector<long long> dist(N, INF);
    bool negative = false;
    dist[0] = 0;
    for(int iter = 0; iter <= N * 2; iter++) {
        for(int v = 0; v < N; v++) {
            // vertex
            if(dist[v] >= INF / 2) {
                continue;
            } //なんで
            for(auto e : G[v]) {
                if(chmin(dist[e.first], dist[v] + e.second)) {
                    if(e.first == N - 1 and iter == N * 2) {
                        negation = true; //壊れてる
                    }
                }
            }
        }
    }
    if(!negative) {
        cout << -dist[N - 1] << endl;
    } else {
        cout << "inf" << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:34: error: expected unqualified-id before '=' token
   60 |                         negation = true; //壊れてる
      |                                  ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100010;
const int MOD=1000000007;
const int inf=1000000007;
const long long INF=1000000000000000007;
using ll=long long;


int main(){
	ll n,m,a,b,c;
	ll,dp[1010][1010]={};
	cin>>n>>m;
	rep(i,1,n+1)rep(j,1,n+1){
		if(i!=j)dp[i][j]=-INF;
	}
	rep(i,0,m)cin>>a>>b>>c,dp[a][b]=c;
	rep(k,1,n+1)rep(i,1,n+1){
		if(dp[i][k]==-INF)continue;
		rep(j,1,n+1)if(dp[i][k]+dp[k][j]>dp[i][j])
			dp[i][j]=dp[i][k]+dp[k][j];
	}
	dp[1][1]>0?print("inf"):print(dp[1][n]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:11: error: expected unqualified-id before ',' token
   20 |         ll,dp[1010][1010]={};
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
ll ans = 0;

int main()
{
ll n,m;
cin >> n>>m;
vector<pair<ll,ll> > G[n+1];
ll maxa=0;
rep(i, m)
{
    ll a,b,c;
    cin >> a>>b>>c;
    G[a].push_back(pair<ll,ll>(b, c));
    maxa+=c
}
ll cost[n+1];
rep(i,n+1){
    cost[i]=INF;
}

queue<ll> qq;
qq.push(1);
cost[1]=0;
ll cou=0;
while(!qq.empty()){
    ll p = qq.front();
    qq.pop();
    rep(i,G[p].size()){
        if(cost[G[p][i].first]==INF){
            cost[G[p][i].first]=G[p][i].second+cost[p];
            qq.push(G[p][i].first);
        }
        else{
            if(G[p][i].second+cost[p]>cost[G[p][i].first]){
            cost[G[p][i].first]=G[p][i].second+cost[p];
            if(cost[G[p][i].first]<maxa)qq.push(G[p][i].first);
            if(G[p][i].first==n)cou++;
            }
            if(n<cou){
                cout << "inf" << endl;
                return 0;
            }
        }
    }
}
cout << cost[n] << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:12: error: expected ';' before '}' token
   21 |     maxa+=c
      |            ^
      |            ;
   22 | }
      | ~
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100010;
const int MOD=1000000007;
const int INF=1000000007;
using ll=long long;

bool used[1010]={};
ll dist[1010];
int n,m,a,b,c;
vvl g(1010,vl(1010));
ll ans=0;

void dfs(int cur){
	used[cur]=true;
	rep(i,1,n+1){
		if(g[cur][i]){
			if(!used[i]){
				dist[i]=dist[cur]+g[cur][i];
				used[i]=true;
				dfs(i);
			}else{
//				if(dist[cur]+g[cur][i]>dist[i]){
					dist[n]=-1;
					return;
				}
			}
		}
	}
}

int main(){
	cin>>n>>m;
	rep(i,0,m){
		cin>>a>>b>>c;
		g[a][b]=c;
	}
	rep(i,1,n+1)dist[i]=INF;
	dist[1]=0;
	dfs(1);
	if(dist[n]==-1)print("inf");
	else print(dist[n]);
}

Compiler output:
a.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long INF=1e12;
struct edge{int from,to,cost;};
edge es[2000];
long long d[1000];
int V,E;
void shortest_path(int s){
	for(int i=0;i<V;i++)
		d[i]=INF;
	d[s]=0;
	for(int i=0;i<V;i++)
		for(int j=0;j<E;j++){
			edge e=es[j];
			if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost)
				d[e.to]=d[e.from]+e.cost;
		}
	}
}
bool find_negative_loop(){
	memset(d,0,sizeof(d));
	for(int i=0;i<2*V;i++){
		for(int j=0;j<E;j++){
			edge e=es[i];
			if(d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				if(i>=V-1&&e.to==V-1)
					return true;
			}
		}
	}
	return false;
}
int main(){
	cin>>V>>E;
	int a,b,c;
	for(int i=0;i<E;i++){
		cin>>a>>b>>c;
		es[i]=(edge){a-1,b-1,-c};
	}
	if(find_negative_loop()){
		cout<<"inf"<<endl;
		return 0;
	}
	shortest_path(0);
	cout<<-d[V-1]<<endl;
}


Compiler output:
a.cc:19:1: error: expected declaration before '}' token
   19 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long INF=1e12;
struct edge{long long from,to,cost;};
edge es[2000];
long long d[1000];
long long V,E;
void shortest_path(long long s){
	for(long long i=0;i<V;i++)
		d[i]=INF;
	d[s]=0;
	while(true){
		bool update=false;
		for(long long i=0;i<E;i++){
			edge e=es[i];
			if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				update=true;
			}
		}
		if(!update)
			break;
	}
}
bool find_negative_loop(){
	memset(d,0,sizeof(d));
	for(long long i=0;i<2*V;i++){
		for(long long j=0;j<E;j++){
			edge e=es[i];
			if(d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				if(i=>V-1&&e.to==V-1)
					return true;
			}
		}
	}
	return false;
}
int main(){
	cin>>V>>E;
	long long a,b,c;
	for(long long i=0;i<E;i++){
		cin>>a>>b>>c;
		es[i]=(edge){a-1,b-1,-c};
	}
	if(find_negative_loop()){
		cout<<"inf"<<endl;
		return 0;
	}
	shortest_path(0);
	cout<<-d[V-1]<<endl;
}


Compiler output:
a.cc: In function 'bool find_negative_loop()':
a.cc:32:38: error: expected primary-expression before '>' token
   32 |                                 if(i=>V-1&&e.to==V-1)
      |                                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long INF=1e12;
struct edge{long long from,to,cost;};
edge es[2000];
long long d[1000];
long long V,E;
void shortest_path(long long s){
	for(long long i=0;i<V;i++)
		d[i]=INF;
	d[s]=0;
	while(true){
		bool update=false;
		for(long long i=0;i<E;i++){
			edge e=es[i];
			if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				update=true;
			}
		}
		if(!update)
			break;
	}
}
bool find_negative_loop(){
	memset(d,0,sizeof(d));
	for(long long i=0;i<V;i++){
		for(long long j=0;j<E;j++){
			edge e=es[i];
			if(d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				if(i==V-1)
					return true;
			}
		}
	}
	return false;
}
long long main(){
	cin>>V>>E;
	long long a,b,c;
	for(long long i=0;i<E;i++){
		cin>>a>>b>>c;
		es[i]=(edge){a-1,b-1,-c};
	}
	if(find_negative_loop()){
		cout<<"inf"<<endl;
		return 0;
	}
	shortest_path(0);
	cout<<-d[V-1]<<endl;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <iostream>
#include <numeric>
#include <vector>
using namespace std;

using Weight = long long;

class Edge {
public:
  int src, dst;
  Weight w;
  Edge(): src(0), dst(0), w(0) {}
  Edge(int src, int dst, Weight w): src(src), dst(dst), w(w) {}
};

using Edges = vector < Edge >;
using Graph = vector < Edges >;

void addArc(Graph &g, int a, int b, Weight w = 1) {
  g[a].emplace_back(a, b, w);
}


void BellmanFord(const Graph&g, int s) {
  const Weight INF = numeric_limits<Weight>::max() / 4;
  Edges edges;
  for (auto& es: g) for (auto& e: es) edges.emplace_back(e);
  vector < Weight > dist(g.size(), -INF);
  dist[s] = 0;
    
  for (int i = 0; i <= 2 * g.size(); ++i) {
    for (auto& e: edges) {
      if (dist[e.src] != INF && dist[e.dst] < dist[e.src] + e.w) {
        if (i > g.size() && e.dst == g.size() - 1) {
          cout << "inf" << endl;
          return;
        }
        dist[e.dst] = dist[e.src] + e.w;
      }
    }
  }
  cout << dist[g.size() - 1] << endl;
}

int main() {
  int n, m;
  cin >> n >> m;
  Graph g(n);

  for (int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    addArc(g, a, b, c);
  }
  BellmanFord(g, 0);
  return 0;
}


Compiler output:
a.cc: In function 'void BellmanFord(const Graph&, int)':
a.cc:25:22: error: 'numeric_limits' was not declared in this scope
   25 |   const Weight INF = numeric_limits<Weight>::max() / 4;
      |                      ^~~~~~~~~~~~~~
a.cc:25:43: error: expected primary-expression before '>' token
   25 |   const Weight INF = numeric_limits<Weight>::max() / 4;
      |                                           ^
a.cc:25:49: error: no matching function for call to 'max()'
   25 |   const Weight INF = numeric_limits<Weight>::max() / 4;
      |                                            ~~~~~^~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:   candidate expects 2 arguments, 0 provided
/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, 0 provided
Language: C++

#include "/Users/daikikodama/Desktop/stdc++.h"
//#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 10000000000000000
#define endl '\n'
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int N,M;
int dist[1010];
bool negative[1010];
struct edge{int from,to,cost;};
edge G[2010];

signed main(void){
    
    cin>>N>>M;
    rep(i,M){
        edge e;
        cin>>e.from>>e.to>>e.cost;
        e.from--; e.to--; e.cost=-e.cost;
        G[i]=e;
    }
    
    fill(dist,dist+N,INF);
    dist[0]=0;
    rep(i,N-1){
        rep(j,M){
            if(dist[G[j].from]==INF)continue;
            if(dist[G[j].to]>dist[G[j].from]+G[j].cost){
                dist[G[j].to]=dist[G[j].from]+G[j].cost;
            }
        }
    }
    
    rep(i,N){
        rep(j,M){
            if(dist[G[j].from]==INF)continue;
            if(dist[G[j].to]>dist[G[j].from]+G[j].cost){
                dist[G[j].to]=dist[G[j].from]+G[j].cost;
                negative[G[j].to]=true;
            }
            if(negative[G[j].from])negative[G[j].from]=true;
        }
    }
    
    int ans=-dist[N-1];
    if(negative[N-1])cout<<"inf\n";
    else cout<<ans<<endl;
    
}

Compiler output:
a.cc:1:10: fatal error: /Users/daikikodama/Desktop/stdc++.h: No such file or directory
    1 | #include "/Users/daikikodama/Desktop/stdc++.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int N, M;
struct edge {
  ll from, to, cost;
};
static const ll INF = 1000000000000;
edge es[2000];
ll d[1000];

bool find_negative_loop(int s){
    int cnt = 0;
    for(int i = 0; i < N; i++){
        d[i] = INF;
    }
    
    d[s] = 0;
    while(true){
        bool update = false;
        cnt++;
        for(int i = 0; i < M; i++){
            edge e = es[i];
            if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                update = true;
                if(cnt == N && e.to = N - 1){
                    return true;
                } else if(cnt == N){
                    return false;
                }
                
            }
        }
        if(!update){
            break;
        }
    }
    
    return false;
}

int main(void){
    // Your code here!
    cin >> N >> M;
    ll a, b, c;
    for(int i = 0; i < M; i++){
        cin >> a >> b >> c;
        es[i].from = a - 1;
        es[i].to = b - 1;
        es[i].cost  = -c;
    }
    
    if(find_negative_loop(0)){
        cout << "inf" << endl;
    } else {
        cout << -d[N-1] << endl;
    }
    
}


Compiler output:
a.cc: In function 'bool find_negative_loop(int)':
a.cc:29:29: error: lvalue required as left operand of assignment
   29 |                 if(cnt == N && e.to = N - 1){
      |                    ~~~~~~~~~^~~~~~~
Language: C++

#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;

#define N 11000
#define INF 111111111111111111ll

typedef long long ll;

ll n, m;
ll d[N], u[N], v[N];

bool inf(){
    for (int i = 1; i <= n; ++i) d[i] = INF;
    d[n] = 0;
    for (int k = 0; k < n; ++k) {
        for (int i = 0; i < m; ++i) {
            int x = u[i], y = v[i];
            if (d[y] > d[x] + w[i]) {
                //printf("%lld %lld %lld\n", e.from, e.to, e.cost);
                d[y] = d[x] + w[i];
                if (k == n - 1) return true;
            }
        }
    }
    return false;
}

int main() {
    while (scanf("%lld%lld", &n, &m) != EOF) {
        for (int i = 0; i < m; ++i) {
            scanf("%lld%lld%lld", &u[i], &v[i], &w[i]);
            w[i] = -w[i];
        }
        if (inf()) puts("inf"); else printf("%lld\n", -d[1]);
    }
    return 0;
}
//#include <stdio.h>
//#include <string.h>
//#include <algorithm>
//#include <vector>
//
//
//#define N 220
//#define N 102000
//
//struct Edge {
//    int from, to, dis;
//};
//
//int pa[N];
//Edge edges[N];
//vector<int> G[N];
//
//int findset(int x) {
//    return pa[x] == x ? pa[x] = findset(pa[x]);
//}
//
//int main() {
//
//    return 0;
//}


Compiler output:
a.cc: In function 'bool inf()':
a.cc:21:31: error: 'w' was not declared in this scope
   21 |             if (d[y] > d[x] + w[i]) {
      |                               ^
a.cc: In function 'int main()':
a.cc:34:50: error: 'w' was not declared in this scope
   34 |             scanf("%lld%lld%lld", &u[i], &v[i], &w[i]);
      |                                                  ^
Language: C++

#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;

#define N 11000
#define INF 111111111111111111ll

typedef long long ll;

ll n, m;
ll d[N], u[N], v[N];

bool inf(){
    for (int i = 1; i <= n; ++i) d[i] = INF;
    d[1] = 0;
    for (int k = 0; k < n; ++k) {
        for (int i = 0; i < m; ++i) {
            int x = u[i], y = v[i];
            if (d[y] > d[x] + w[i]) {
                //printf("%lld %lld %lld\n", e.from, e.to, e.cost);
                d[y] = d[x] + w[i];
                if (k == n - 1) return true;
            }
        }
    }
    return false;
}

int main() {
    while (scanf("%lld%lld", &n, &m) != EOF) {
        for (int i = 0; i < m; ++i) {
            scanf("%lld%lld%lld", &u[i], &v[i], &w[i]);
            w[i] = -w[i];
        }
        if (inf()) puts("inf"); else printf("%lld\n", -d[n]);
    }
    return 0;
}
//#include <stdio.h>
//#include <string.h>
//#include <algorithm>
//#include <vector>
//
//
//#define N 220
//#define N 102000
//
//struct Edge {
//    int from, to, dis;
//};
//
//int pa[N];
//Edge edges[N];
//vector<int> G[N];
//
//int findset(int x) {
//    return pa[x] == x ? pa[x] = findset(pa[x]);
//}
//
//int main() {
//
//    return 0;
//}


Compiler output:
a.cc: In function 'bool inf()':
a.cc:21:31: error: 'w' was not declared in this scope
   21 |             if (d[y] > d[x] + w[i]) {
      |                               ^
a.cc: In function 'int main()':
a.cc:34:50: error: 'w' was not declared in this scope
   34 |             scanf("%lld%lld%lld", &u[i], &v[i], &w[i]);
      |                                                  ^
Language: C++

#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;

#define N 11000
#define INF 111111111111111111ll

typedef long long ll;

int n, m;
ll d[N], u[N], v[N];

bool inf(){
    for (int i = 1; i <= n; ++i) d[i] = INF;
    d[1] = 0;
    for (int k = 0; k < n; ++k) {
        for (int i = 0; i < m; ++i) {
            int x = u[i], y = v[i];
            if (d[y] > d[x] + w[i]) {
                //printf("%lld %lld %lld\n", e.from, e.to, e.cost);
                d[y] = d[x] + w[i];
                if (k == n - 1) return true;
            }
        }
    }
    return false;
}

int main() {
    while (scanf("%d%d", &n, &m) != EOF) {
        for (int i = 0; i < m; ++i) {
            scanf("%lld%lld%lld", &u[i], &v[i], &w[i]);
            w[i] = -w[i];
        }
        if (inf()) puts("inf"); else printf("%lld\n", -d[n]);
    }
    return 0;
}
//#include <stdio.h>
//#include <string.h>
//#include <algorithm>
//#include <vector>
//
//
//#define N 220
//#define N 102000
//
//struct Edge {
//    int from, to, dis;
//};
//
//int pa[N];
//Edge edges[N];
//vector<int> G[N];
//
//int findset(int x) {
//    return pa[x] == x ? pa[x] = findset(pa[x]);
//}
//
//int main() {
//
//    return 0;
//}


Compiler output:
a.cc: In function 'bool inf()':
a.cc:21:31: error: 'w' was not declared in this scope
   21 |             if (d[y] > d[x] + w[i]) {
      |                               ^
a.cc: In function 'int main()':
a.cc:34:50: error: 'w' was not declared in this scope
   34 |             scanf("%lld%lld%lld", &u[i], &v[i], &w[i]);
      |                                                  ^
Language: C++

#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;

#define N 11000
#define INF 111111111111111111ll

typedef long long ll;

int n, m;
ll d[N], u[N], v[N];

bool inf(){
    for (int i = 1; i <= n; ++i) d[i] = INF;
    d[1] = 0;
    for (int k = 0; k < n; ++k) {
        for (int i = 0; i < m; ++i) {
            int x = u[i], y = v[i];
            if (d[y] >= d[x] + w[i]) {
                //printf("%lld %lld %lld\n", e.from, e.to, e.cost);
                d[y] = d[x] + w[i];
                if (k == n - 1) return true;
            }
        }
    }
    return false;
}

int main() {
    while (scanf("%d%d", &n, &m) != EOF) {
        for (int i = 0; i < m; ++i) {
            scanf("%lld%lld%lld", &u[i], &v[i], &w[i]);
            w[i] = -w[i];
        }
        if (inf()) puts("inf"); else printf("%lld\n", -d[n]);
    }
    return 0;
}
//#include <stdio.h>
//#include <string.h>
//#include <algorithm>
//#include <vector>
//
//
//#define N 220
//#define N 102000
//
//struct Edge {
//    int from, to, dis;
//};
//
//int pa[N];
//Edge edges[N];
//vector<int> G[N];
//
//int findset(int x) {
//    return pa[x] == x ? pa[x] = findset(pa[x]);
//}
//
//int main() {
//
//    return 0;
//}


Compiler output:
a.cc: In function 'bool inf()':
a.cc:21:32: error: 'w' was not declared in this scope
   21 |             if (d[y] >= d[x] + w[i]) {
      |                                ^
a.cc: In function 'int main()':
a.cc:34:50: error: 'w' was not declared in this scope
   34 |             scanf("%lld%lld%lld", &u[i], &v[i], &w[i]);
      |                                                  ^
Language: C++

#include <iostream>
#define INF 10000000000000
using namespace std;

struct edge
{
	int from;
	int to;
	long long int cost;
};

edge es[2005];

long long int d[1005];
int V, E;
bool negative[1005];


void shortest_path(int s)
{
	for (int i = 0; i <= V; i++)
		d[i] = INF;
	d[s] = 0;
	for (int j = 0; j <= V; j++)
	{
		bool update = false;
		for (int i = 0; i < E; i++)
		{
			edge e = es[i];

			if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost)
			{
				d[e.to] = d[e.from] + e.cost;
				update = true;
			}
		}
		if (!update)
			break;
	}
}

bool find_negative_loop()
{
	memset(negative, false, 1005);

	for (int j = 0; j <= V; j++)
	{
		for (int i = 0; i < E; i++)
		{
			edge e = es[i];

			if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost)
			{
				d[e.to] = d[e.from] + e.cost;
				if (i == V - 1)
					return true;
			}
		}
	}
	return false;
}

int main()
{
	cin >> V >> E;
	for (int i = 0; i < E; i++)
	{
		cin >> es[i].from >> es[i].to >> es[i].cost;
		es[i].cost *= -1;
	}

	shortest_path(1);

	if (!find_negative_loop())
		cout << -d[V] << endl;
	else
		cout << "inf" << endl;


	return 0;
}

Compiler output:
a.cc: In function 'bool find_negative_loop()':
a.cc:44:9: error: 'memset' was not declared in this scope
   44 |         memset(negative, false, 1005);
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #define INF 10000000000000
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const int inf = 1e+7;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

struct edge { ll from, to, cost; };

edge es[2020];

ll d[1010];
ll N, M;

void bellman_ford(int s) {
    rep(i, N) d[i] = inf;
    d[s] = 0;
    while(true) {
        bool update = false;
        rep(i, M) {
            edge e = es[i];
            if (d[e.from] != inf && d[e.to] > d[e.from] + e.cost ) {
                d[e.to] = d[e.from] + e.cost;
                update = true;
            }
        }
        if (!update) break;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N >> M;

    rep(i, M) {
        ll a, b, c; cin >> a >> b >> c;
        a--; b--;c *= -1;
        es[i] = {a, b, c};
    }

    bellman_ford(0);
    int ans = d[N - 1];

    bool negative_loop[1010];
    rep(i , N) negative_loop[i] = false;

    rep(i, N) {
        rep(j, M) {
            edge e = es[j];
            if (d[e.to] > d[e.from] + e.cost ) {
                d[e.to] = d[e.from] + e.cost;

                if (i == N - 1) {
                    negative_loop[e.to] = true;
                    negative_loop[e.from] = true;
            }
        }
    }

    if (negative_loop[N - 1] == true) cout << "inf" << endl;
    else cout << ans * (-1) << endl;


 

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:103:2: error: expected '}' at end of input
  103 | }
      |  ^
a.cc:65:12: note: to match this '{'
   65 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <unordered_map>

#define BIG 998244353

using namespace std;

typedef struct Node{
    vector<long> weight;
    vector<int> connected;
} node;

long maxscore = LONG_MIN;


void search(const vector<node>& graph,unordered_map<int,long> history,int last,long score){
    if(maxscore == LONG_MAX)return;
    node n = graph[last];
    for(int i = 0;i < n.connected.size();++i){
        if(history.find(n.connected[i]) != history.end()){
            if(history[n.connected[i]] <= score + n.weight[i])maxscore = LONG_MAX;
            return;
        }
        else{
            long nscore = score + n.weight[i];
            if(n.connected[i] == graph.size() - 1 && nscore > maxscore)maxscore = nscore;
            unordered_map<int,long> nhis(history);
            nhis[n.connected[i]] = nscore;
            search(graph,nhis,n.connected[i],nscore);
        }
    }
}

int main() {
    int n,m;
    cin >> n >> m;
    vector<node> graph(n,{vector<long>(),vector<int>()});
    for(int i = 0;i < m;++i){
        int a,b,c;
        cin >> a >> b >> c;
        --a;
        --b;
        graph[a].connected.push_back(b);
        graph[a].weight.push_back(c);
    }
    search(graph,unordered_map<int,long>(),0,0);
    cout << maxscore << endl;

}

Compiler output:
a.cc:17:17: error: 'LONG_MIN' was not declared in this scope
   17 | long maxscore = LONG_MIN;
      |                 ^~~~~~~~
a.cc:7:1: note: 'LONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <unordered_map>
  +++ |+#include <climits>
    7 | 
a.cc: In function 'void search(const std::vector<Node>&, std::unordered_map<int, long int>, int, long int)':
a.cc:21:20: error: 'LONG_MAX' was not declared in this scope
   21 |     if(maxscore == LONG_MAX)return;
      |                    ^~~~~~~~
a.cc:21:20: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:25:74: error: 'LONG_MAX' was not declared in this scope
   25 |             if(history[n.connected[i]] <= score + n.weight[i])maxscore = LONG_MAX;
      |                                                                          ^~~~~~~~
a.cc:25:74: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;
const ll INF = 1LL<<60;
const ll mod = 1e9 + 7;
const int MAX_N = 5e5 + 5;
int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 };
vector<ll> prime;

ll inv[MAX_N], fac[MAX_N];

template <class T = ll> T in() { T x; cin >> x; return (x); }
inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; }
inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
inline ll POW(ll a, ll b) { ll c = 1; while (b > 0) { if (b & 1) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; }
inline void _nCr() { fac[0] = 1; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } }
inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; }
inline void PRI(ll n) { bool a[n + 1]; for (int i = 0; i < n + 1; i++) { a[i] = 1; }for (int i = 2; i < n + 1; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } }

vector<vector<pair<int,int>>> Edge;
vector<int> node;

bool bellman_ford(int n,int s) {
	node = vector<int>(node.size(),INF);
	node[s] = 0;
	REP (i,n) {
		REP (j,Edge.size()) {
			REP (k,Edge[j].size()) {
				int from = j,to = Edge[j][k].F;
				int cost = Edge[j][k].S;
				if (node[from] != INF && node[to] > node[from] + cost) {
					node[to] = node[from] + cost;
					if (i == n - 1) return true;
				}
			}
		}
	}
	return false;
}

signed main() {
	int n,m;
	cin >> n >> m;
	cost = vector<int>(m);
	Edge = vector<vector<pair<int,int>>>(m);
	REP (i,m) {
		int x,y,z;
		cin >> x >> y >> z;
		Edge[x-1].push_back({y-1,-z});
	}
	if (bellman_ford(0,n)) {
		cout << "inf" << endl;
	} else {
		cout << -node[n-1] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:9: error: 'cost' was not declared in this scope; did you mean 'cosl'?
   56 |         cost = vector<int>(m);
      |         ^~~~
      |         cosl
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;
const ll INF = 1LL<<60;
const ll mod = 1e9 + 7;
const int MAX_N = 5e5 + 5;
int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 };
vector<ll> prime;

ll inv[MAX_N], fac[MAX_N];

template <class T = ll> T in() { T x; cin >> x; return (x); }
inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; }
inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
inline ll POW(ll a, ll b) { ll c = 1; while (b > 0) { if (b & 1) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; }
inline void _nCr() { fac[0] = 1; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } }
inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; }
inline void PRI(ll n) { bool a[n + 1]; for (int i = 0; i < n + 1; i++) { a[i] = 1; }for (int i = 2; i < n + 1; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } }

vector<vector<pair<int,int>>> Edge;
vector<int> node;

bool bellman_ford(int n,int s) {
	node = vector<int>(node.size(),INF);
	node[s] = 0;
	REP (i,n) {
		REP (j,Edge.size()) {
			REP (k,Edge[j].size()) {
				int from = j,to = Edge[j][k].F;
				int cost = Edge[j][k].S;
				if (node[from] != INF && node[to] > node[from] + cost) {
					node[to] = node[from] + cost;
					if (i == n - 1) return true;
				}
			}
		}
	}
	return false;
}

signed main() {
	int n,m;
	cin >> n >> m;
	cost = vector<int>(m);
	Edge = vector<vector<pair<int,int>>>(m);
	REP (i,m) {
		int x,y,z;
		cin >> x >> y >> z;
		Edge[x-1].push_back{y-1,-z};
	}
	if (bellman_ford(0,n)) {
		cout << "inf" << endl;
	} else {
		cout << -node[n-1] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:9: error: 'cost' was not declared in this scope; did you mean 'cosl'?
   56 |         cost = vector<int>(m);
      |         ^~~~
      |         cosl
a.cc:61:36: error: expected ';' before '{' token
   61 |                 Edge[x-1].push_back{y-1,-z};
      |                                    ^
      |                                    ;
a.cc:61:27: error: statement cannot resolve address of overloaded function
   61 |                 Edge[x-1].push_back{y-1,-z};
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;
const ll INF = 1LL<<60;
const ll mod = 1e9 + 7;
const int MAX_N = 5e5 + 5;
int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 };
vector<ll> prime;

ll inv[MAX_N], fac[MAX_N];

template <class T = ll> T in() { T x; cin >> x; return (x); }
inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; }
inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
inline ll POW(ll a, ll b) { ll c = 1; while (b > 0) { if (b & 1) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; }
inline void _nCr() { fac[0] = 1; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } }
inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; }
inline void PRI(ll n) { bool a[n + 1]; for (int i = 0; i < n + 1; i++) { a[i] = 1; }for (int i = 2; i < n + 1; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } }

vector<int> cost;
vector<pair<int,int>> Edge;
vector<int> node;

bool bellman_ford(int n,int s) {
	node = vector<int>(node.size(),INF);
	node[s] = 0;
	REP (i,n) {
		REP (j,Edge.size()) {
			int from = Edge[j],to = Edge[j];
			if (node[from] != INF && node[to] > node[from] + cost[j]) {
				node[to] = node[from] + cost[j];
				if (i == n - 1) return true;
			}
		}
	}
	return false;
}

signed main() {
	int n,m;
	cin >> n >> m;
	node = vector<int>(n);
	cost = vector<int>(m);
	Edge = vector<pair<int,int>>(m);
	REP (i,m) {
		cin >> Edge[i].F >> Edge[i].S >> cost[i];
		Edge[i].F--;Edge[i].S--;
		Edge[i].F *= (-1);Edge[i].S *= (-1);
	}
	if (bellman_ford(0,n)) {
		cout << "inf" << endl;
	} else {
		cout << -cost[n-1] << endl;
	}
}

Compiler output:
a.cc: In function 'bool bellman_ford(long long int, long long int)':
a.cc:41:42: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'long long int' in initialization
   41 |                         int from = Edge[j],to = Edge[j];
      |                                          ^
a.cc:41:55: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'long long int' in initialization
   41 |                         int from = Edge[j],to = Edge[j];
      |                                                       ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<50; 
const int MOD = 1e9 + 7;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    vector<edge> G[n];
    vector<ll> a(m), b(m), c(m);
    for(int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--, b[i]--;
        c[i] = -c[i];
    }
    vector<ll> dist(n, INF);
    dist[0] = 0;
    for(int i = 0; i < n - 1; i++)
    {
        for(int j = 0; j < m; j++)
        {
            if(dist[a[j]] == INF) continue;
            dist[b[j]] = min(dist[b[j]], dist[a[j]] + c[j]);
        }
    }
    bool negative = false;
    for(int j = 0; j < m; j++)
    {
        if(dist[a[j]] == INF) continue;
        if(dist[a[j]] + c[j] < dist[b[j]]) negative = true;
    }
    if(negative) cout << "inf" << endl;
    else cout << -dist[n - 1] << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:12: error: 'edge' was not declared in this scope
   21 |     vector<edge> G[n];
      |            ^~~~
a.cc:21:16: error: template argument 1 is invalid
   21 |     vector<edge> G[n];
      |                ^
a.cc:21:16: error: template argument 2 is invalid
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define lPair pair<ll,ll>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define debug(a) cout << a << endl;
const ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
ll N,M;
ll a,b,c;
struct edge{ll from,to,cost;};
vector<edge> es;
ll d[1000];
ll V,E;
//頂点sからの最大距離
bool bellmanford(ll s){
    for(int i = 0; i < V; i++) d[i] = -INF;
    d[s] = 0;
    for(int i = 0; i < V-1; i++){ //**
        for(int j = 0; j < E; j++){
            edge e = es[j];
            if(d[e.from] != -INF && d[e.to] < d[e.from]+e.cost){
                d[e.to] = d[e.from] + e.cost;
            }
        }
    }
    ll dv = d[V-1];
    for(int i = 0; i < V; i++){ //**
        for(int j = 0; j < E; j++){
            edge e = es[j];
            if(d[e.to] != -INF && d[e.to] < d[e.from]+e.cost){
                d[e.to] = d[e.from]+e.cost;
            }
        }
    }
    if(d[V-1] > dv) return 0;
    else return 1;

}

int main(){
    cin >> V >> E;
    for(int i = 0; i < E; i++){
        ll a,b,c;
        cin >> a >> b >> c;
        a--; b--;
        es.push_back({a,b,c});
    }
    if(BellmanFord(0)) cout << d[V-1] << endl;
    else cout << "inf" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:8: error: 'BellmanFord' was not declared in this scope; did you mean 'bellmanford'?
   57 |     if(BellmanFord(0)) cout << d[V-1] << endl;
      |        ^~~~~~~~~~~
      |        bellmanford