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

#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
long long int INF = 9223372036854775806/2;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
long long int i,j,k;
int n,m;
long long int x[1002][1002];
long long int a,b,c;


int main(){
	cin>>n>>m;
	if(n>=100){
		for(i=0;i<1000;i++){
			for(j=0;j<1000;j++){
				for(k=0;k<1000;k++){
					x[i][j] = min(i+j,i*j,k*k);
				}
			}
		}
	}
	cout<<"year"<<endl;

	return 0;
}

Compiler output:
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: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:31:19:   required from here
   31 |                                         x[i][j] = min(i+j,i*j,k*k);
      |                                                   ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

long long inf=100000000000007;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
typedef pair<int,int>  P;
string alph("abcdefghijklmnopqrstuvwxyz");
struct edge{int from,to,cost;};
vector<edge> G;
vector<int> O[10];
P sg[10];
int d[1005];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
pair<int,double> s[1005];
int c=0;
int fi[1005][1005];
int ans[1005][1005]={};
bool graph[55][55];
bool visited[55];
int a[55],b[55];
int n,m;
bool in=false;
void longest_path(){
    rep(i,n+5)d[i]=-inf;
    d[0]=0;
    bool update=true;
   rep(j,n){
        update=false;
        rep(i,m){
            edge e=G[i];
            if(d[e.from]!=-inf&&d[e.to]<d[e.from]+e.cost) {
                d[e.to]=d[e.from]+e.cost;
                if(e.from==n-1&&j==n-1)in=true;
                update=true;
                 }
        }
        if(!update)break;
    }
}
signed main(){
 cin>>n>>m;
    rep(i,m){
        int a,b,c;cin>>a>>b>>c;
        G.push_back(edge{a-1,b-1,c});
    }
    rep(i,n+5)d[i]=-inf;
    d[0]=0;
    rep(j,n){
        rep(i,m){
            edge e=G[i];
            if(d[e.from]!=-inf&&d[e.to]<d[e.from]+e.cost) {
                d[e.to]=d[e.from]+e.cost;
                if(e.from==n-1&&j==n-1)in=true;
            }
        }
    }

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


Compiler output:
a.cc:4:9: error: 'pair' does not name a type
    4 | typedef pair<int,int>  P;
      |         ^~~~
a.cc:5:1: error: 'string' does not name a type
    5 | string alph("abcdefghijklmnopqrstuvwxyz");
      | ^~~~~~
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<edge> G;
      | ^~~~~~
a.cc:8:1: error: 'vector' does not name a type
    8 | vector<int> O[10];
      | ^~~~~~
a.cc:9:1: error: 'P' does not name a type
    9 | P sg[10];
      | ^
a.cc:13:1: error: 'pair' does not name a type
   13 | pair<int,double> s[1005];
      | ^~~~
a.cc: In function 'void longest_path()':
a.cc:29:20: error: 'G' was not declared in this scope
   29 |             edge e=G[i];
      |                    ^
a.cc: In function 'int main()':
a.cc:40:2: error: 'cin' was not declared in this scope; did you mean 'in'?
   40 |  cin>>n>>m;
      |  ^~~
      |  in
a.cc:43:9: error: 'G' was not declared in this scope
   43 |         G.push_back(edge{a-1,b-1,c});
      |         ^
a.cc:49:20: error: 'G' was not declared in this scope
   49 |             edge e=G[i];
      |                    ^
a.cc:57:11: error: 'cout' was not declared in this scope
   57 |     if(in)cout<<"inf"<<endl;
      |           ^~~~
a.cc:57:24: error: 'endl' was not declared in this scope
   57 |     if(in)cout<<"inf"<<endl;
      |                        ^~~~
a.cc:58:14: error: 'cout' was not declared in this scope
   58 |         else cout<<d[n-1]<<endl;
      |              ^~~~
a.cc:58:28: error: 'endl' was not declared in this scope
   58 |         else cout<<d[n-1]<<endl;
      |                            ^~~~
Language: C++


#include <numeric>
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include<algorithm>
#include <sstream>
#include<string>
using namespace std;
long long inf=100000000000007;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
typedef pair<int,int>  P;
string alph("abcdefghijklmnopqrstuvwxyz");
struct edge{int from,to,cost;};
vector<edge> G;
vector<int> O[10];
P sg[10];
int d[1005];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
pair<int,double> s[1005];
int c=0;
int fi[1005][1005];
int ans[1005][1005]={};
bool graph[55][55];
bool visited[55];
int a[55],b[55];
int n,m;
bool in=false;
void longest_path(){
    rep(i,n+5)d[i]=inf*-1;
    d[0]=0;
    bool update=true;
    while(true){
        update=false;
        rep(i,m){
            edge e=G[i];
            if(d[e.from]!=inf*-1&&d[e.to]<d[e.from]+e.cost) {
                d[e.to]=d[e.from]+e.cost;
                update=true;
                 }
        }
        if(!update)break;
    }
}
int dn[1005];
bool find_nega(){
    memset(dn,0,sizeof(dn));
    rep(i,n){
        rep(j,m){
            edge e=G[j];
            if(d[e.to]<d[e.from]+e.cost){
                 d[e.to]=d[e.from]+e.cost;
                if(i==n-1)return true;
            }
        }
    }
    return false;
}

signed main(){
 cin>>n>>m;
    rep(i,m){
        int a,b,c;cin>>a>>b>>c;
        G.push_back(edge{a-1,b-1,c});
    }
    if(find_nega()){
        cout<<"inf"<<endl;
        return 0;
    }

    longest_path();
        cout<<d[n-1]<<endl;
        return 0;
}


Compiler output:
a.cc: In function 'bool find_nega()':
a.cc:52:5: error: 'memset' was not declared in this scope
   52 |     memset(dn,0,sizeof(dn));
      |     ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <sstream>
  +++ |+#include <cstring>
   11 | #include<string>
Language: C++

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define mset(a,x) memset(a,x,sizeof(a))
#define FASTIO cin.tie(0),ios::sync_with_stdio(0)

using pii = pair<int, int>;
using edge = pair<pii, int>;

const ll INF = 1LL << 60;
int n, m;
vector<edge> es;


ll dist(int s, union_find uf) {
    vector<ll> d(n, INF);
    d[s] = 0;
    bool updated = false;
    rep(k, n - 1) {
        for (auto&& e : es) {
            int src = e.first.first, dst = e.first.second;
            if (d[src] < INF && d[dst] > (d[src] + e.second)) {
                d[dst] = d[src] + e.second;
            }
        }
    }
    ll ret = d[n - 1];
    
    vector<int> neg(n, 0);
    rep(k, n) {
        for (auto&& e : es) {
            int src = e.first.first, dst = e.first.second;
            if (d[src] < INF && d[dst] > (d[src] + e.second)) {
                d[dst] = d[src] + e.second;
                neg[dst] = 1;
            }
            if (neg[src]) neg[dst] = 1;
        }
    }

    if (neg[n - 1]) return INF;
    return ret;
}

int main() {
    cin >> n >> m;
    union_find uf(n);
    rep(i, m) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        --a; --b;
        es.push_back(make_pair(make_pair(a, b), -c));
        uf.unite(a, b);
    }

    ll d = dist(0, uf);
    if (d == INF)
        cout << "inf" << endl;
    else
        cout << -d << endl;

    return 0;
}

Compiler output:
a.cc:22:16: error: 'union_find' has not been declared
   22 | ll dist(int s, union_find uf) {
      |                ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:54:5: error: 'union_find' was not declared in this scope
   54 |     union_find uf(n);
      |     ^~~~~~~~~~
a.cc:60:9: error: 'uf' was not declared in this scope
   60 |         uf.unite(a, b);
      |         ^~
a.cc:63:20: error: 'uf' was not declared in this scope
   63 |     ll d = dist(0, uf);
      |                    ^~
Language: C++

#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#define INF 2000000000

using namespace std;

typedef pair<ll,ll> P;
typedef long long ll;
typedef pair<P,ll> PP;


int n,m;
vector<PP> e;
ll d[1050];

bool bellman_ford(int s)
{
	fill(d,d+n,INF);
	d[s]=0;
	for(int k=0;k<n;k++){
		//bool update=false;
		for(int i=0;i<m;i++){
			int from=e[i].first.first;
			int to=e[i].first.second;
			ll cost=e[i].second;
			if(d[from]!=INF&&d[to]>d[from]+cost){
				d[to]=d[from]+cost;
				//update=true;
				if(k==n-1&&to==n-1)return true;
			}
		}
	}
	else return false;
}

/*
bool find_negative_loop()
{
	fill(d,d+n,0);
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			int from=e[j].first.first;
			int to=e[j].first.second;
			ll cost=e[j].second;
		
			if(d[to]>d[from]+cost){
				d[to]=d[from]+cost;
				if(i==n-1)return true;
			}
		}
	}
	return false;
}
*/

int main()
{
	cin>>n>>m;
	ll a,b;
	ll c;
	for(int i=0;i<m;i++){
		cin>>a>>b>>c;
		a--; b--; c*=-1;
		e.push_back(PP(P(a,b),c));
	}
	if(bellman_ford(0)){
		cout<<"inf"<<endl;
		return 0;
	}
	bellman_ford(0);
	cout<<d[n-1]*(-1)<<endl;

	return 0;	
}

Compiler output:
a.cc:11:14: error: 'll' was not declared in this scope
   11 | typedef pair<ll,ll> P;
      |              ^~
a.cc:11:17: error: 'll' was not declared in this scope
   11 | typedef pair<ll,ll> P;
      |                 ^~
a.cc:11:19: error: template argument 1 is invalid
   11 | typedef pair<ll,ll> P;
      |                   ^
a.cc:11:19: error: template argument 2 is invalid
a.cc: In function 'bool bellman_ford(int)':
a.cc:27:45: error: request for member 'first' in 'e.std::vector<std::pair<int, long long int> >::operator[](((std::vector<std::pair<int, long long int> >::size_type)i)).std::pair<int, long long int>::first', which is of non-class type 'int'
   27 |                         int from=e[i].first.first;
      |                                             ^~~~~
a.cc:28:43: error: request for member 'second' in 'e.std::vector<std::pair<int, long long int> >::operator[](((std::vector<std::pair<int, long long int> >::size_type)i)).std::pair<int, long long int>::first', which is of non-class type 'int'
   28 |                         int to=e[i].first.second;
      |                                           ^~~~~~
a.cc:37:9: error: 'else' without a previous 'if'
   37 |         else return false;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:68:37: error: expression list treated as compound expression in functional cast [-fpermissive]
   68 |                 e.push_back(PP(P(a,b),c));
      |                                     ^
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

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

edge es[2010];    //辺
ll d[1010];   //最短距離
int n,m,sum;


bool BF(int s,int V,int E){ //vは頂点数eは辺の数
	REP(i,V)d[i] = -10000000000000;d[s] = 0;
	int cou = 0;
	while(true){
		bool update = false;
		REP(i,E){
			edge e = es[i];
			if(d[e.from] != -10000000000000 && d[e.to] < d[e.from] + e.cost){
				d[e.to] = d[e.from] + e.cost;update = true;
				cou++;
			}
		}
		if(!update)break;
		if(d[n-1] > sum)return false;
	}
	else return true;
}


int main()
{
	cin >> n >> m;
	
	REP(i,m)
	{
		int a,b,c;
		cin >> a >> b >> c;
		es[i].from = a-1;es[i].to = b-1;es[i].cost = c;sum+=c;
	}
	
	if(BF(0,n,m))
	{
		cout << d[n-1] << endl;
	}
	else
	{
		cout << "inf" << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'bool BF(int, int, int)':
a.cc:59:9: error: 'else' without a previous 'if'
   59 |         else return true;
      |         ^~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;
using ll = long long;

const ll INF = 1LL << 60;

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

bool bellman_ford(const int v, const int s, vector<edge> es, vector<ll>& dist) {
    vector<ll> d(v, INF);
    d[s] = 0;
    bool neg_loop = false;
    for(int cnt=0; ;cnt++) {
        bool update = false;
        for(auto& e : es) {
            if(d[e.from] == INF) continue;
            if(d[e.to] > d[e.from] + e.cost) {
                d[e.to] = d[e.from] + e.cost;
                update = true;

                if(cnt >= v-1 && e.to == N-1) return true;
            }
        }

        if(!update) break;
        
        /*if(cnt >= v-1) {
            neg_loop = true;
            break;
        }*/
    }

    dist = std::move(d);
    return neg_loop;
}

int main(void){
    ll N, M;
    cin >> N >> M;
    vector<edge> es;
    for(int i=0;i<M;i++){
        ll a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        es.push_back(edge{a, b, -c});
    }

    vector<ll> dist;
    bool  loop = bellman_ford(N, 0, es, dist);

    if(loop) {
        cout << "inf" << endl;
    } else {
        cout << -dist[N-1] << endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'bool bellman_ford(int, int, std::vector<edge>, std::vector<long long int>&)':
a.cc:24:42: error: 'N' was not declared in this scope
   24 |                 if(cnt >= v-1 && e.to == N-1) return true;
      |                                          ^
Language: C++

#include <bits/stdc++.h>
#define INF 1234567890123LL
#define MN 1001

using namespace std;

typedef long long ll;
typedef pair<int, ll> arc;

ll dist[MN];
vector<arc> es[MN];
int prev[MN];

int main()
{
    int n, m;
    cin >> n >> m;
    for(int i=0; i<m; i++)
    {
        int a, b;
        ll c;
        cin >> a >> b >> c;
        es[a].push_back(arc(b, -c));
    }
    dist[1] = 0;
    for(int i=2; i<=n; i++) dist[i] = INF;
    
    for(int t=1; t<=n; t++)
    {
        for(int i=1; i<=n; i++)
        {
            for(vector<arc>::iterator itr=es[i].begin(); itr!=es[i].end(); itr++)
            {
                if(dist[itr->first] > dist[i] + itr->second)
                {
                    dist[itr->first] = dist[i] + itr->second;
                    prev[itr->first] = i;
                    if(t==n)
                    {
                        dist[itr->first] = -INF;
                    }
                }
            }
        }
    }
    
    if(dist[n]<=-INF)
    {
        cout << "inf" << endl;
    }
    else
    {
        cout << -dist[n] << endl;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:21: error: reference to 'prev' is ambiguous
   37 |                     prev[itr->first] = i;
      |                     ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:12:5: note:                 'int prev [1001]'
   12 | int prev[MN];
      |     ^~~~
Language: C++

#include<algorithm>
#define MM 20000000000000000
using namespace std;
int main(void)
{
	int n,m,flg[1001],a[2000],b[2000],c[2000],i,j;
	long long leng[1001];
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++)	{
		scanf("%d %d %d",&a[i],&b[i],&c[i]);
		c[i]=-c[i];
	}
	for(i=1;i<=n;i++)	leng[i]=2000000000000000000;
	leng[1]=0;
	for(i=0;i<n;i++)	{
		for(j=0;j<m;j++)	{
			leng[b[j]]=min(leng[b[j]],leng[a[j]]+c[j]);
		}
	}
	for(i=1;i<=n;i++)	flg[i]=0;
	for(i=0;i<m;i++)	{
		if(leng[b[i]]>leng[a[i]]+c[i])	{
			flg[b[i]]=1;
		}
		if(flg[a[i]]==1)	flg[b[i]]=1;	
	}
	if(flg[n]==1)	printf("inf\n");
	else printf("%lld\n",-leng[n]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'scanf' was not declared in this scope
    8 |         scanf("%d %d",&n,&m);
      |         ^~~~~
a.cc:27:25: error: 'printf' was not declared in this scope
   27 |         if(flg[n]==1)   printf("inf\n");
      |                         ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    1 | #include<algorithm>
  +++ |+#include <cstdio>
    2 | #define MM 20000000000000000
a.cc:28:14: error: 'printf' was not declared in this scope
   28 |         else printf("%lld\n",-leng[n]);
      |              ^~~~~~
a.cc:28:14: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MAX_M=20000;

ll N, M;
ll cost[1011][1011];

int main(){
        cin>>N>>M;
        for(int i=1;i<=N;i++){
                for(int j=1;j<=N;j++){
                        if(i==j){
                                cost[i][j]=0;
                        }
                        else{
                                cost[i][j]=-1000000000000000;
                        }
                }
        }
        for(int i=0;i<M;i++){
                ll from, to, cst;
                cin>>from>>to>>cst;
                cost[from][to]=cst;
        }

        for(ll k=1;k<=N;k++){
                for(ll i=1;i<=N;i++){
                        for(ll j=1;j<=N;j++){
                                cost[i][j]=max(cost[i][j], cost[i][k]+cost[k][j]);
                        }
                }
        }
        if(cost[1][1]>0){
                cout<<"inf"<<endl;
        }
        else{
                cout<<cost[1][N]<<endl;
        }
        return 0;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:13:9: error: 'cin' was not declared in this scope
   13 |         cin>>N>>M;
      |         ^~~
a.cc:33:44: error: 'max' was not declared in this scope
   33 |                                 cost[i][j]=max(cost[i][j], cost[i][k]+cost[k][j]);
      |                                            ^~~
a.cc:38:17: error: 'cout' was not declared in this scope; did you mean 'cost'?
   38 |                 cout<<"inf"<<endl;
      |                 ^~~~
      |                 cost
a.cc:38:30: error: 'endl' was not declared in this scope
   38 |                 cout<<"inf"<<endl;
      |                              ^~~~
a.cc:41:17: error: 'cout' was not declared in this scope; did you mean 'cost'?
   41 |                 cout<<cost[1][N]<<endl;
      |                 ^~~~
      |                 cost
a.cc:41:35: error: 'endl' was not declared in this scope
   41 |                 cout<<cost[1][N]<<endl;
      |                                   ^~~~
Language: Java

import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    final int NMAX = 1000;
    final int MMAX = 2000;
    final long INF = Long.MAX_VALUE;
    int[] a = new int[MMAX];
    int[] b = new int[MMAX];
    long[] c = new long[MMAX];

    for (int i = 0; i < M; i++) {
      a[i] = sc.nextInt();
      b[i] = sc.nextInt();
      c[i] = sc.nextLong();
      c[i] = -c[i]; //スコア逆
    }
    long ans = bellmanFord(a,b,c,N,M);

    if(ans == -INF) System.out.println("inf");
    else System.out.println(-ans);
  }

  public static long bellmanFord(int[] a, int[] b, long[]c, int N, int M){
    final long INF = Long.MAX_VALUE;

    long[] dist = new long[N];


    for (int i = 0; i < N; i++) {
      dist[i] = INF; //初期化
    }

    dist[0] = 0L;

    for(int loop = 0; loop < N - 1; loop++) {
      for (int i = 0; i < M; i++) {
        if(dist[a[i] - 1] == INF) continue;

        if(dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
          dist[b[i] - 1] = dist[a[i] - 1] + c[i];
        }
      }
    }

    long ans = dist[N - 1];

    boolean[] negative = new boolean[NMAX];

    for(int i = 0; i < N; i++) {
      negative[i] = false;
    }

    for (int loop = 0; loop < N; loop++) {
      for (int i = 0; i < M; i++) {
        if (dist[a[i] - 1] == INF) continue;

        if (dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
          dist[b[i] - 1] = dist[a[i] - 1] + c[i];
          negative[b[i] - 1] = true;
        }

        if (negative[a[i] - 1] == true) {
          negative[b[i] - 1] = true;
        }
      }
    }
    if (negative[N - 1]) return -INF;
    else return ans;
  }
}


Compiler output:
Main.java:50: error: cannot find symbol
    boolean[] negative = new boolean[NMAX];
                                     ^
  symbol:   variable NMAX
  location: class Main
1 error
Language: C++

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define all(c) begin(c),end(c)
const ll INF = 1e18;

struct edge { ll from, to, cost; };
edge es[2000];
ll d[1000];
bool flag = false;;
int V, E;	//頂点、辺数
//頂点sからの最短d
void bellmanford(int s) {
	int count = 0;
	rep(i, V)d[i] = INF;
	d[s] = 0;
	while (count<n) {
		bool update = false;
		rep(i, E) {
			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;
		count++;
	}
	if (count == V)flag = true;
}

//負の閉路->true
bool find_negative_loop() {
	memset(d, 0, sizeof(d));
	rep(i, V) {
		rep(j, E) {
			edge e = es[j];
			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;
}

int main() {
	cin.sync_with_stdio(false);
	cin >> V >> E;
	rep(i, E) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--; c = -c;
		es[i].from = a; es[i].to = b; es[i].cost = c;
	}
	bellmanford(0);
	if (flag) {
		cout << "inf" << endl;
		return 0;
	}
	bellmanford(0);
	cout << -d[V - 1] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'void bellmanford(int)':
a.cc:21:22: error: 'n' was not declared in this scope
   21 |         while (count<n) {
      |                      ^
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long
 
#define rep(i,x) for(int i=0;i<x;++i)
 
struct edge{
    int from, to, cost;
    edge(int from, int to, int cost) : from(from), to(to), cost(cost) {};
};
 
vector<edge> edges;
 
const int MAX_N = 100000;
 
int N, M;
int dist[MAX_N];
 
void bf(int s)
{
    rep(i, N) dist[i] = LLONG_MAX / 2;
    dist[s] = 0;
 
    rep(i, N) {
        for (edge& e : edges) {
            if (dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
            }
        }
    }
    for (edge& e : edges) {
        if (dist[e.to] > dist[e.from] + e.cost) {
          	dist[e.to] = dist[e.from] + e.cost
            if (e.to == N - 1) {
              cout << "inf" << endl; exit(0);
            }
        }
    }
}
 
signed main()
{
    cin >> N >> M;
 
    rep(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        edges.emplace_back(edge(a, b, -c));
    }
 
    bf(0);
 
    cout << -dist[N - 1] << endl;
}

Compiler output:
a.cc: In function 'void bf(long long int)':
a.cc:35:51: error: expected ';' before 'if'
   35 |                 dist[e.to] = dist[e.from] + e.cost
      |                                                   ^
      |                                                   ;
   36 |             if (e.to == N - 1) {
      |             ~~
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long
 
#define rep(i,x) for(int i=0;i<x;++i)
 
struct edge{
    int from, to, cost;
    edge(int from, int to, int cost) : from(from), to(to), cost(cost) {};
};
 
vector<edge> edges;
 
const int MAX_N = 100000;
 
int N, M;
int dist[MAX_N];
 
void bf(int s)
{
    rep(i, N) dist[i] = LLONG_MAX / 2;
    dist[s] = 0;
 
    rep(i, N) {
        for (edge& e : edges) {
            if (dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
            }
        }
    }
}
 
signed main()
{
    cin >> N >> M;
 
    rep(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        edges.emplace_back(edge(a, b, -c));
    }
 
    bf(0);
 
    for (edge &e : edges) {
        dist[e.to] = dist[e.from] + e.cost;
            if (e.to == n - 1) {
                cout << "inf" << endl;
            return 0;
        }
    }
 
    cout << -dist[N - 1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:25: error: 'n' was not declared in this scope
   50 |             if (e.to == n - 1) {
      |                         ^
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long
 
#define rep(i,x) for(int i=0;i<x;++i)
 
struct edge{
    int from, to, cost;
    edge(int from, int to, int cost) : from(from), to(to), cost(cost) {};
};
 
vector<edge> edges;
 
const int MAX_N = 100000;
 
int N, M;
int dist[MAX_N];
 
void bf(int s)
{
    rep(i, N) dist[i] = LLONG_MAX / 2;
    dist[s] = 0;
 
    rep(i, N - 1) {
        for (edge& e : edges) {
            if (dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
            }
        }
    }

    for (edge& e : edges) if (dist[e.to] > dist[e.from] + e.cost) {
        if (e.to == n - 1) { cout << "inf" << endl; exit(0); }
    }
}
 
signed main()
{
    cin >> N >> M;
 
    rep(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        edges.emplace_back(edge(a, b, -c));
    }
 
    bf(0);

    cout << -dist[N - 1] << endl;
}
 

Compiler output:
a.cc: In function 'void bf(long long int)':
a.cc:35:21: error: 'n' was not declared in this scope
   35 |         if (e.to == n - 1) { cout << "inf" << endl; exit(0); }
      |                     ^
Language: C++

#include<iostream>
#include<algorithm>
#include<functional>
#include <string>
#include<cstdio>
#include<math.h>
#include<stack>
#include<queue>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
#define MIN -93193111451418101
#define INF 931931114518101
using namespace std;
typedef long long int ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}

//------------------変数-----------------------//
ll n, m;
typedef pair<ll, ll> P;

ll dp[20][100000] = {};//vコメの頂点のとき、どの頂点に行ったか
ll maxa = 0, moto = 0;
queue <ll>q;
ll bitmax = 0;
//-------------------関数----------------------//

struct G {
	ll from;
	ll to;
	ll cost;
};
G g[10001];
ll weight[10001];
int main() {
	fill_all(weight,(ll) MIN);
	weight[0] = 0;
	cin >> n >> m;
	REP(i, m) {
		ll a, b, c; cin >> a >> b >> c; a--; b--;
		g[i].from = a; g[i].to = b; g[i].cost = c;
	}
	ll j = 0;
	while(true){
		j++;
		if (j == 103831) { cout << "inf" << endl; return 0; }
		bool flag = true;
		REP(i, m) {
			G a = g[i];
			if (weight[a.from] != MIN&&weight[a.to]<weight[a.from]+a.cost) {
				flag = false;
				weight[a.to] = weight[a.from] + a.cost;
			}
		}
		if (flag) { break; }
	}
	cout << weight[n - 1] << endl;
	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:69:18: error: expected '}' at end of input
   69 |         return 0;
      |                  ^
a.cc:46:12: note: to match this '{'
   46 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<algorithm>
#include<functional>
#include <string>
#include<cstdio>
#include<math.h>
#include<stack>
#include<queue>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
#define MIN -93193111451418101
#define INF 931931114518101
using namespace std;
typedef long long int ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}

//------------------変数-----------------------//
ll n, m;
typedef pair<ll, ll> P;

ll dp[20][100000] = {};//vコメの頂点のとき、どの頂点に行ったか
ll maxa = 0, moto = 0;
queue <ll>q;
ll bitmax = 0;
//-------------------関数----------------------//

struct G {
	ll from;
	ll to;
	ll cost;
};
G g[1001];
ll weight[1001];
int main() {
	fill_all(weight, MIN);
	weight[0] = 0;
	cin >> n >> m;
	REP(i, m) {
		ll a, b, c; cin >> a >> b >> c; a--; b--;
		g[i].from = a; g[i].to = b; g[i].cost = c;
	}
	ll j = 0;
	while(true){
		j++;
		if (j == 9319831) { cout << "inf" << endl; return 0; }
		bool flag = true;
		REP(i, m) {
			G a = g[i];
			if (weight[a.from] != MIN&&weight[a.to]<weight[a.from]+a.cost) {
				flag = false;
				weight[a.to] = weight[a.from] + a.cost;
			}
		}
		if (flag) { break; }
	}
	cout << weight[n - 1] << endl;
	return 0;
}

Compiler output:
a.cc: In instantiation of 'void fill_all(ARR&, const T&) [with T = long int; ARR = long long int]':
a.cc:26:32:   required from 'void fill_all(ARR&, const T&) [with T = long int; ARR = long long int [1001]]'
   26 |         for (auto& i : arr) { fill_all(i, v); }
      |                               ~~~~~~~~^~~~~~
a.cc:47:10:   required from here
   47 |         fill_all(weight, MIN);
      |         ~~~~~~~~^~~~~~~~~~~~~
a.cc:26:9: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   26 |         for (auto& i : arr) { fill_all(i, v); }
      |         ^~~
      |         std::begin
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:26:9: error: 'end' was not declared in this scope; did you mean 'std::end'?
   26 |         for (auto& i : arr) { fill_all(i, v); }
      |         ^~~
      |         std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
Language: C++

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

using lint = long long;

struct edge {
  int to, cost;
  edge() {}
  edge(int a, int b) :to(a), cost(b) {}
};

const lint inf = 1001001001001001001;
vector<vector<edge>> G;
vector<lint> d;

bool bellman_ford(int n, int s = 0) {
  d = vector<lint>(n, inf);
  d[s] = 0;

  for (int i = 0; i < n; ++i) {
    for (int v = 0; v < n; ++v) {
      for (int j = 0; j < G[v].size(); ++j) {
        edge e = G[v][j];
        if (d[e.to] > d[v] + e.cost) {
          d[e.to] = d[v] + e.cost;
          if (i == n - 1) return true;
        }
      }
    }
  }

  return false;
}

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

  G.resize(n);

  for (int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;

    G[a].push_back(edge(b, -c));
  }

  //if (bellman_ford(n)) puts("inf");
  bellman_ford(n);
  else cout << -d.back() << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:3: error: 'else' without a previous 'if'
   51 |   else cout << -d.back() << endl;
      |   ^~~~
Language: C++



#include <iostream>
#include <vector>

using namespace std;

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i = a ; i < (int)n ; i++)
#define pb push_back
#define N_MAX 1000
#define INF -1000000000000;

typedef long long ll;

struct Edge{
  int from, to;
  ll cost;
  Edge(int f, int t, ll c) : from(f), to(t), cost(c) {}
};

int n, m;
vector<Edge> edges;
ll d[N_MAX+1];

bool bellman_ford(){
  rep(i, N_MAX+1) d[i] =-INF;
  d[0] = 0;
  rep(i, 2*n+1){
    for(auto &edge:edges){
      if(d[edge.from] != INF && d[edge.to] < d[edge.from] + edge.cost){
        d[edge.to] = d[edge.from] + edge.cost;
        if(i == n-1) return true;
      }
    }
  }
  return false;
}

signed main(){
  int f, t;
  ll c;
  cin >> n >> m;

  rep(i, m){
    cin >> f >> t >> c;
    f--; t--;
    edges.emplace_back(f, t, c);    
  }

  if(bellman_ford()){
    cout << "inf" << endl;
  }else{
    cout << d[n-1] << endl;
  }
}


Compiler output:
a.cc: In function 'bool bellman_ford()':
a.cc:31:34: error: expected ')' before '[' token
   31 |       if(d[edge.from] != INF && d[edge.to] < d[edge.from] + edge.cost){
      |         ~                        ^
      |                                  )
a.cc:31:33: error: label 'd' used but not defined
   31 |       if(d[edge.from] != INF && d[edge.to] < d[edge.from] + edge.cost){
      |                                 ^
Language: C++

#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N, M, a[2123], b[2123], c[2123];
LL ans;

struct edge { LL from, to, cost; };
edge G[2123];
LL d[1123];
bool negative[1123];

// s 番目の頂点から各頂点への最短距離を求める
void bellman_ford(LL s)
{
	std::fill_n(d, N + 1, INF);
	d[s] = 0;
	rep(i, N - 1)
	{
		rep(j, M)
		{
			auto e = G[j];
			if (d[e.from] == INF) { continue; }
			d[e.to] = std::min(d[e.to], d[e.from] + e.cost); (d[e.from] != INF) {  }
		}
	}
}

// negative[N] == true なら負の閉路が存在する
void find_negative_loop()
{
	memset(negative, false, sizeof(false));
	rep(i, N)
	{
		rep(j, M)
		{
			auto e = G[j];
			if (d[e.from] == INF) { continue; }
			if (d[e.to] > d[e.from] + e.cost)
			{
				d[e.to] = d[e.from] + e.cost;
				negative[e.to] = true;
			}
			if (negative[e.from]) { negative[e.to] = true; }
		}
	}
}

int main()
{
	in >> N >> M;
	rep(i, M)
	{
		in >> a[i] >> b[i] >> c[i];
		G[i] = { a[i],b[i],-c[i] };
	}

	bellman_ford(1);
	ans = d[N];
	find_negative_loop();
	if (negative[N]) { out << "inf" << std::endl; }
	else { out << -ans << std::endl; }
	return 0;
}

Compiler output:
a.cc: In function 'void bellman_ford(LL)':
a.cc:28:92: error: expected ';' before '{' token
   28 |                         d[e.to] = std::min(d[e.to], d[e.from] + e.cost); (d[e.from] != INF) {  }
      |                                                                                            ^~
      |                                                                                            ;
Language: C++

#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <vector>
#include <queue>
#include <unordered_map> 
#include <iomanip>
#include <random>
#include <future>
#include <thread>
#include <utility>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF (INT_MAX/3)
#define INF_L (LLONG_MAX/3)
#define PSB push_back
#define PN 1000000007
typedef long long LL;
#define int long long


// booooooooooooost
// #include <boost/multiprecision/cpp_int.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// namespace mp = boost::multiprecision;	//多倍長整数(mp::cpp_int), 多倍長小数(mp::cpp_dec_float_100)


signed main() {

	int N, M;
	struct edge { int from, to, cost; };
	vector<edge> es;
	vector<int> d;

	cin >> N >> M;
	for (int i = 0; i < M; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		es.push_back(edge{ a - 1, b - 1, -c });
	}
	d.assign(N, INF_L);
	d[0] = 0;

	for (int v = 0; v < N; ++v) {
		/* // 負閉路検出
		if (v == N - 1) {
			d[N - 1] = -INF_L;
			break;
		} */

		bool update = false;
		for (int i = 0; i < M; ++i) {
			edge e = es[i];
			if (d[e.from] != INF_L && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				update = true;
			}
		}

		if (!update) break;
	}
	int ans = d[N - 1];


	/* bool negative[1000];
	for (int i = 0; i < N; ++i) {
		negative[i] = false;
	}
	for (int loop = 0; loop < N; ++loop) {
		for (int i = 0; i < M; ++i) {
			edge e = es[i];
			if (d[e.from] != INF_L && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				negative[e.to] = true;
			}
			if (negative[e.from] == true) {
				negative[e.to] = true;
			}
		}
	} */

	int ans = d[N - 1];
	bool negative = false;
	for (int i = 0; i < N; ++i) d[i] = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < M; ++j) {
			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 = true;
			}
		}
	}



	cout << (negative ? "inf" : to_string(-ans)) << endl;




	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:91:13: error: redeclaration of 'long long int ans'
   91 |         int ans = d[N - 1];
      |             ^~~
a.cc:71:13: note: 'long long int ans' previously declared here
   71 |         int ans = d[N - 1];
      |             ^~~
Language: C++

#include <stdlib.h>
#include <iostream>

using ll = long long;
const ll INF = 1ll << 50;

int main(void){
  int N, M;
  std::cin >> N >> M;

  const int NMAX = 1000;
  const int MMAX = 2000;
  int a[MMAX], b[MMAX];
  ll c[MMAX];

  for (int i = 0; i < M; ++ i){
    std::cin >> a[i] >> b[i] >> c[i];
    c[i] = -c[i];
  }
  //printf("%d \n", f);

  ll dist[NMAX];

  dist[0] = 0;

  for (int loop = 0; loop < N - 1; ++ loop) {
    for (int i = 0; i < M; ++ i) {
      if (dist[a[i] - 1] == INF) continue;
      if (dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
        dist[b[i] - 1] = dist[a[i] - 1] + c[i];
      }
    }
  }

  ll ans = dist[N - 1];

  bool negative[NMAX];

  for (int i = 0; i < N; ++ i) {
    negative[i] = false;
  }

  for (int loop = 0; loop < N; ++ loop) {
    for (int i = 0; i < M; ++ i) {
      if (dist[a[i] - 1] == INF) continue;
      if (dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
        dist[b[i] - 1] = dist[a[i] - 1] + c[i];
        negative[b[i] - 1] = true;
      }

      if (negative[a[i] - 1] == true) {
        negative[b[i] - 1] = true;
      }
    }
  }

  if (negative[N - 1])
    std::cout << "inf" << std::endl;
  else
    std::cout << -ans << std::endl;

  return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:62:12: error: expected '}' at end of input
   62 |   return 0;
      |            ^
a.cc:7:15: note: to match this '{'
    7 | int main(void){
      |               ^
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <limits>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

typedef long long ll;

int main(void) {

	ll N,M;
	cin >> N >> M;
	vector<ll> a(M), b(M), c(M);
	REP(i, M) {
		cin >> a[i] >> b[i] >> c[i];
	}

	ll d[1010];
	d[0] = 0;
	FOR(i, 1, 1010) d[i] = -LLONG_MAX;

	ll count = 0;
	ll temp;

	while (count < N*2+1) {

		if (count == N) {
			temp = d[N - 1];
		}

		FOR(i, 0, M){
			d[b[i]-1] = max(d[b[i]-1], d[a[i]-1]+c[i]);
		}

		if (count == (N*2)) {
			break;
		}
		count++;
	}

	if (d[N - 1] > temp) {
		cout << "inf" << endl;
	}
	else {
		cout << d[N - 1] << endl;
	}


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: error: 'LLONG_MAX' was not declared in this scope
   24 |         FOR(i, 1, 1010) d[i] = -LLONG_MAX;
      |                                 ^~~~~~~~~
a.cc:6:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <limits>
  +++ |+#include <climits>
    6 | using namespace std;
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <limits>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

typedef long long ll;

int main(void) {

	ll N,M;
	cin >> N >> M;
	vector<ll> a(M), b(M), c(M);
	REP(i, M) {
		cin >> a[i] >> b[i] >> c[i];
	}

	ll d[1010];
	d[0] = 0;
	FOR(i, 1, 1010) d[i] = -LLONG_MAX;

	ll count = 0;
	ll temp;

	while (count < N*3) {

		if (count == N) {
			temp = d[N - 1];
		}

		FOR(i, 0, M){
			d[b[i]-1] = max(d[b[i]-1], d[a[i]-1]+c[i]);
		}

		if (count == (N*2)) {
			break;
		}
		count++;
	}

	if (d[N - 1] > temp) {
		cout << "inf" << endl;
	}
	else {
		cout << d[N - 1] << endl;
	}


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: error: 'LLONG_MAX' was not declared in this scope
   24 |         FOR(i, 1, 1010) d[i] = -LLONG_MAX;
      |                                 ^~~~~~~~~
a.cc:6:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <limits>
  +++ |+#include <climits>
    6 | using namespace std;
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <limits>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

typedef long long ll;

int main(void) {

	int N,M;
	cin >> N >> M;

	vector<int> a(M), b(M), c(M);
	REP(i, M) {
		cin >> a[i] >> b[i] >> c[i];
	}

	ll d[1010];
	d[0] = 0;
	FOR(i, 1, 1010) d[i] = -LLONG_MAX;

	ll count = 0;
	ll temp;

	while (count < N*3) {

		if (count == N) {
			temp = d[N - 1];
		}

		FOR(i, 0, M){
			d[b[i]-1] = max(d[b[i]-1], d[a[i]-1]+c[i]);
		}

		if (count == (N*2)) {
			break;
		}
		count++;
	}

	if (d[N - 1] > temp) {
		cout << "inf" << endl;
	}
	else {
		cout << d[N - 1] << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:33: error: 'LLONG_MAX' was not declared in this scope
   25 |         FOR(i, 1, 1010) d[i] = -LLONG_MAX;
      |                                 ^~~~~~~~~
a.cc:6:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <limits>
  +++ |+#include <climits>
    6 | using namespace std;
Language: C++

#include <bits/stdc++.h>
#define MAXN 1000
std::vector < std::pair <int,int> > g[MAXN+1];
long long dist[MAXN+1];
int main(){
     int i,n,m,a,b,c,j;
     long long aux;
     cin >> n >> m;
     for(i=1;i<=m;i++){
           cin >> a >> b >> c;
           g[a].push_back(std::make_pair(b,c));
     }
    for(i=1;i<=n;i++)
           dist[i]=-(1LL<<62);
   long long aux=dist[n];
    for(i=0;i<n+1;i++){
          for(j=1;j<=n;j++)
               for(auto it:g[j])
                  if(dist[j]+it.second>dist[it.first])
                          dist[it.first]=dist[j]+it.second;
          if(dist[n]!=aux&&i==n){
                  cout << inf << "\n";
                 return 0;
          }
          aux=dist[n];
    }
   cout  << dist[n] << "\n"; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:6: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |      cin >> n >> m;
      |      ^~~
      |      std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:15:14: error: redeclaration of 'long long int aux'
   15 |    long long aux=dist[n];
      |              ^~~
a.cc:7:16: note: 'long long int aux' previously declared here
    7 |      long long aux;
      |                ^~~
a.cc:22:19: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   22 |                   cout << inf << "\n";
      |                   ^~~~
      |                   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:22:27: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   22 |                   cout << inf << "\n";
      |                           ^~~
      |                           ynf
a.cc:27:4: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |    cout  << dist[n] << "\n";
      |    ^~~~
      |    std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,start,lim) for(lld i=start;i<lim;i++)
#define repd(i,start,lim) for(lld i=start;i>=lim;i--)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld ",x)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define br printf("\n")
#define sz(a) lld((a).size())
#define YES printf("YES\n")
#define NO printf("NO\n")
#define all(c) (c).begin(),(c).end()
using namespace std;
#define INF         1011111111
#define LLINF       1000111000111000111LL
#define EPS         (double)1e-10
#define MOD         1000000007
#define PI          3.14159265358979323
using namespace std;
typedef long double ldb;
typedef long long lld;
lld powm(lld base,lld exp,lld mod=MOD) {lld ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
typedef vector<lld> vlld;
typedef pair<lld,lld> plld;
typedef map<lld,lld> mlld;
typedef set<lld> slld;
#define N 100005
lld a[N],b[N],c[N],dis[N],neg[N];
int main()
{
	lld n,m;
	cin>>n>>m,dis[1]=0;
	rep(i,2,n+1) dis[i]=LLINF,neg[i]=0;
	rep(i,1,m+1) cin>>a[i]>>b[i]>>c[i],c[i]*=-1;
	rep(i,1,n) rep(j,1,m+1) if(dis[a[j]]!=LLINF and dis[b[j]]>dis[a[j]]+c[j]) dis[b[j]]=dis[a[j]]+c[j]; 
	rep(j,1,m+1) if(dis[a[j]]!=LLINF and dis[b[j]]>dis[a[j]]+c[j]) neg[b[j]]=1; else if(neg[a[i]]) neg[b[i]]=1; 
	if(!neg[n]) print(-dis[n]);
	else printf("inf\n");
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:99: error: 'i' was not declared in this scope
   38 |         rep(j,1,m+1) if(dis[a[j]]!=LLINF and dis[b[j]]>dis[a[j]]+c[j]) neg[b[j]]=1; else if(neg[a[i]]) neg[b[i]]=1;
      |                                                                                                   ^