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

#include<stdio.h>
#define INF -1000000000000000000
#define ll long long

int main() {
  int n, m, f;
  int i, j;
  ll score[1010] = {};
  scanf("%d %d", &n, &m);
  ll a[2010] = {};
  ll b[2010] = {};
  ll c[2010] = {};
  for (i = 1; i < m+1; i++) {
    scanf("%lld %lld %lld", &a[i], &b[i], &c[i]);
  }
  for (i = 2; i < n+1; i++) {
    score[i] = INF;
  }
  for (i = 1; i < n+1; i++) {
    f = 0;
    for (j = 1; j < m+1; j++) {
      int from = a[j];
      int to = b[j];
      /*基本的に、修正が入ったらf=1
       */
      if (score[to] < score[from] + c[j]) {
	score[to] = score[from] + c[j];
	f = 1;
	}
      }
    }
    /*修正が入らなくなれば(f==0)そこで終わり*/
    if (f == 0) {
      break;
    }
    /*修正が入り続け、最後も修正が起こればinf*/
    if (i == n) {
      printf("inf\n");
      return 0;
    }
  } 
  printf("%lld\n", score[n]);
  return 0;
}
  
  
      


Compiler output:
main.c: In function 'main':
main.c:34:7: error: break statement not within loop or switch
   34 |       break;
      |       ^~~~~
main.c: At top level:
main.c:42:10: error: expected declaration specifiers or '...' before string constant
   42 |   printf("%lld\n", score[n]);
      |          ^~~~~~~~
main.c:42:20: error: unknown type name 'score'
   42 |   printf("%lld\n", score[n]);
      |                    ^~~~~
main.c:43:3: error: expected identifier or '(' before 'return'
   43 |   return 0;
      |   ^~~~~~
main.c:44:1: error: expected identifier or '(' before '}' token
   44 | }
      | ^
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>
using namespace std;
int to[2010],len[2010],findnext[2010],head[1010],num,Numpath,Numdot,Inqueue[1010];
long long Shortpath[1010];
void add(int from,int go,int length)
{
	to[++num]=go;
	len[num]=length;
	findnext[num]=head[from];
	head[from]=num;
}
int checked[1010],times[1010];
int Checkspfa(int source)
{
	memset(Shortpath,0xf7,sizeof(Shortpath));
	memset(Inqueue,0,sizeof(Inqueue));
	queue<int>unwork;
	unwork.push(source),Inqueue[source]=1,Shortpath[source]=0,checked[source]=1;
	while(unwork.size())
	{
		int first,substitute;
		first=unwork.front(),unwork.pop(),Inqueue[first]=0;
		for(int i=head[first];i;i=findnext[i])
		{
			substitute=to[i];
			checked[substitute]=1;
			if(Shortpath[substitute]<Shortpath[first]+len[i])
			{
				Shortpath[substitute]=Shortpath[first]+len[i];
				times[substitute]++;
				unwork.push(substitute);
				if(times[substitute]>Numdot)
					return 0;
			}
		}
	}
	return 1;
}
void Workspfa(int source)
{
	memset(Shortpath,0xf7,sizeof(Shortpath));
	memset(Inqueue,0,sizeof(Inqueue));
	queue<int >unwork;
	unwork.push(source),Inqueue[source]=1,Shortpath[source]=0;
	while(unwork.size())
	{
		int first;
		first=unwork.front(),unwork.pop(),Inqueue[first]=0;
		for(int i=head[first];i;i=findnext[i])
			if(Shortpath[to[i]]<Shortpath[first]+len[i])
			{
				Shortpath[to[i]]=Shortpath[first]+len[i];
				if(Inqueue[to[i]]==0)
					Inqueue[to[i]]=1,unwork.push(to[i]);
			}
	}
}
int main()
{
	cin>>Numdot>>Numpath;
	for(int i=1;i<=Numpath;i++)
	{
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		add(a,b,c);
	}
	if(Checkspfa(1)==0)
	{
		cout<<"inf";
		return 0;
	}
	Workspfa(1);
	while(1)
	{
		long long q++;
	}
	//printf("%lld\n",Shortpath[Numdot]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:28: error: expected initializer before '++' token
   79 |                 long long q++;
      |                            ^~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pair<ll, ll> > vp;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define out(n) cout << (n) << endl;

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

vector<vp> a(1001);
vi ma(1001, -1e10);
ll n, m, ans = -1e10;
bool inf;

int tansaku(ll score, int node, vp load, bool kinf) {
  if(inf) return 0;
  if(node == n) {
    if(ans > score) return 0;
    ans = score;
  }

  rep(i, 0, a[node].size()) {
    ll x = a[node][i].first;
    if(load[x].first >= 2) return 0;
    if(load[x].first && load[x].second < score) kinf = true;
    if(kinf && x == n) {
      inf = true;
      return 0;
    }
    if(kinf || ma[x] < score) {
      if(!kinf)ma[x] = load[x].second = score;
      load[x].first++;
      tansaku(score + a[node][i].second, x, load, kinf);
    }
  }
}

int main() {
  cin >> n >> m;
  ll na, nb, nc;
  vp load(1001);
  load[1].second = true;

  rep(i, 0, m) {
    cin >> na >> nb >> nc;
    a[na].pb(make_pair(nb, nc));
  }

  if(a[1].first != 0) {
    while(1) {
      
    }
  }

  tansaku(0, 1, load, false);

  if(inf) out("inf")
  else out(ans)
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:11: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<long long int, long long int> > >, std::vector<std::pair<long long int, long long int> > >::value_type' {aka 'class std::vector<std::pair<long long int, long long int> >'} has no member named 'first'
   60 |   if(a[1].first != 0) {
      |           ^~~~~
a.cc: In function 'int tansaku(ll, int, vp, bool)':
a.cc:47:1: warning: control reaches end of non-void function [-Wreturn-type]
   47 | }
      | ^
Language: C++

// ProgramingExcerciseA.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
using namespace std;

typedef long long LL;
/*
	Edge class
*/
struct Edge {
	int to;
	LL cost;
	Edge(int to, LL cost) : to(to), cost(cost) {}
};

// node and edge
/*
	data structure
	graph[0], graph[1], graph[2], ...... => initial vertex
	 |_ Edge(t0,c0)
	 |_ Edge(t1,c1)	=> terminal vertex and consumed cost
	 |_ Edge(t2,c2)
	 |
	 :
*/
typedef vector<vector<Edge> > AdjList;
AdjList graph;

// limitataion of cost
const LL INF = -99999999999;

// the minimum path
vector<LL> dist;

void debug_log(int n) {
	cout << "progress..." << endl;
	for (int i = 0; i < n; i++)
	{
		if (dist[i] != INF)
			cout << dist[i] << " -> ";
		else
			cout << "INF -> ";
	}
	cout << endl;
}

/*
	Bellman-Ford Algortithm.
	argument n is number of vertex, and s is index of initial vertex.
*/
bool bellman_ford(int n, int s) {
	dist = vector<LL>(n, INF); //  n node are initialize with int value - INF 
	dist[s] = 0; // first node (default - 0)
	for (int i = 0; i<n; i++) {
		for (int v = 0; v<n; v++) {
			for (int k = 0; k<graph[v].size(); k++) {
				Edge e = graph[v][k]; // a edge
				if (dist[v] != INF && dist[e.to]<(dist[v] + e.cost)) {
					dist[e.to] = dist[v] + e.cost;
					//debug_log(n);
					if (i == (n - 1))
						return true;
				}
			}
		}
	}
	return false;
}

int main(int argc, char const *argv[]) {
	// n is number of vertex, m is number of edge
	int n, m;
	bool loop_flag;
	cin >> n >> m;
	// create graph where n vertex are puted
	graph = AdjList(n);

	for (int i = 0; i<m; i++) {
		int from, to;
		LL cost;
		cin >> from >> to >> cost;
		graph[from - 1].push_back(Edge(to - 1, cost));
	}

	// start Bellman-Ford algorithm
	loop_flag = bellman_ford(n, 0);

	// output result
	if (loop_flag) {
		cout << "inf" << endl;
	}
	else
	{
		cout << dist[n - 1] << endl;
	}
	return 0;
}


Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <stdio.h>
#include <map>
#include <vector>
struct edge {long long from,long long to,long long cost;};

edge es[20000];
long long d[1100];
int over[1252];
int n,m;

using namespace std;
int main(){
  scanf("%d%d",&n,&m);
  for(int i=0;i<m;i++){
    long long a,b,c;
    scanf("%ld%ld%ld", &a,&b,&c);
    es[i].from = a-1;
    es[i].to = b-1;
    es[i].cost =  c;
  }
  for(int i = 0; i < n; i++)d[i] = -1000000000;
  d[0] = 0;
  for(int k=0;k<=2*n;k++){
    for(int i=0;i<m;i++){
      if(d[es[i].from] != -1000000000 && d[es[i].to] < d[es[i].from] + es[i].cost){
        d[es[i].to] = d[es[i].from] + es[i].cost;
        if(k == 2*n){
          over[es[i].to] = 1;
        }
      }
    }
  }
  if(over[n-1])printf("inf\n");
  else printf("%ld", d[n-1]);
}


Compiler output:
a.cc:4:29: error: expected unqualified-id before 'long'
    4 | struct edge {long long from,long long to,long long cost;};
      |                             ^~~~
a.cc: In function 'int main()':
a.cc:18:11: error: 'struct edge' has no member named 'to'
   18 |     es[i].to = b-1;
      |           ^~
a.cc:19:11: error: 'struct edge' has no member named 'cost'
   19 |     es[i].cost =  c;
      |           ^~~~
a.cc:25:50: error: 'struct edge' has no member named 'to'
   25 |       if(d[es[i].from] != -1000000000 && d[es[i].to] < d[es[i].from] + es[i].cost){
      |                                                  ^~
a.cc:25:78: error: 'struct edge' has no member named 'cost'
   25 |       if(d[es[i].from] != -1000000000 && d[es[i].to] < d[es[i].from] + es[i].cost){
      |                                                                              ^~~~
a.cc:26:17: error: 'struct edge' has no member named 'to'
   26 |         d[es[i].to] = d[es[i].from] + es[i].cost;
      |                 ^~
a.cc:26:45: error: 'struct edge' has no member named 'cost'
   26 |         d[es[i].to] = d[es[i].from] + es[i].cost;
      |                                             ^~~~
a.cc:28:22: error: 'struct edge' has no member named 'to'
   28 |           over[es[i].to] = 1;
      |                      ^~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int> > vp;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define out(n) cout << (n) << endl;

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

vector<vp> a(1001);
vi ma(1001, -1e10);
ll n, m, ans = -1e10;
bool inf;

int tansaku(ll score, int node, vi load, ll flag, ll kinf) {
  if(inf) return 0;
  if(node == n) {
    ans = max(ans, score);
    ma[n] = ans;
  }

  rep(i, 0, a[node].size()) {
    ll x = a[node][i].first;
    if(load[n] && kinf) inf = true;
    if(flag || ma[x] < score && !load[x]) {
      if(x == flag) {
        if(score <= 0) flag = false;
        else kinf = true;
        return 0;
      }
      if(!flag) ma[x] = score, load[x] = true;
      tansaku(score + a[node][i].second, a[node][i].first, load, flag, kinf);
    }else if(load[x]) {
      flag = x;
      score = 0;
      tansaku(score + a[node][i].second, a[node][i].first, load, flag, kinf);
      return 0;
    }
  }
}

int main() {
  cin >> n >> m;
  ll na, nb, nc;
  vi load(1001);
  load[1] = true;

  rep(i, 0, m) {
    cin >> na >> nb >> nc;
    a[na].pb(make_pair(nb, nc));
  }

  tansaku(0, 1, load, false);

  if(inf) out("inf")
  else out(ans)
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:10: error: too few arguments to function 'int tansaku(ll, int, vi, ll, ll)'
   64 |   tansaku(0, 1, load, false);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~
a.cc:26:5: note: declared here
   26 | int tansaku(ll score, int node, vi load, ll flag, ll kinf) {
      |     ^~~~~~~
a.cc: In function 'int tansaku(ll, int, vi, ll, ll)':
a.cc:51:1: warning: control reaches end of non-void function [-Wreturn-type]
   51 | }
      | ^
Language: C

#include <stdio.h>
#define INF 2300000000000000000L
long long dist[1001][1001];
int main(){
	int V,E,i,j;long long k;
	scanf("%d%d",&V,&E);
	for(i=0;i<V;i++){
		for(j=0;j<i;j++)dist[i][j]=INF;
		dist[i][j++]=0;
		for(;j<V;j++)dist[i][j]=INF;
	}
	for(;E--;)scanf("%d%d%lld",&i,&j,&k),dist[i-1][j-1]=-k;
	for(k=0;k<V;k++)for(i=0;i<V;i++)for(j=0;j<V;j++)
		if(dist[i][k]<INF && dist[k][j]<INF && dist[i][j]>dist[i]k]+dist[k][j])
				dist[i][j]=dist[i][k]+dist[k][j];
	for(i=0;i<V;i++)if(dist[i][i]<0){puts("inf");return 0;}
	printf("%lld",-dist[0][V-1]);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:66: warning: comparison between pointer and integer
   14 |                 if(dist[i][k]<INF && dist[k][j]<INF && dist[i][j]>dist[i]k]+dist[k][j])
      |                                                                  ^
main.c:14:74: error: expected ')' before 'k'
   14 |                 if(dist[i][k]<INF && dist[k][j]<INF && dist[i][j]>dist[i]k]+dist[k][j])
      |                   ~                                                      ^
      |                                                                          )
main.c:14:75: error: expected statement before ']' token
   14 |                 if(dist[i][k]<INF && dist[k][j]<INF && dist[i][j]>dist[i]k]+dist[k][j])
      |                                                                           ^
main.c:14:87: error: expected ';' before ')' token
   14 |                 if(dist[i][k]<INF && dist[k][j]<INF && dist[i][j]>dist[i]k]+dist[k][j])
      |                                                                                       ^
      |                                                                                       ;
main.c:14:87: error: expected statement before ')' token
Language: C

#include <stdio.h>
#define INF 2100000000
int dist[1001][1001];
int main(){
    int V,E,i,j,k;
    scanf("%d%d",&V,&E);
    for(i=0;i<V;i++){
        for(j=0;j<i;j++)dist[i][j]=INF;
        dist[i][j++]=0;
        for(;j<V;j++)dist[i][j]=INF;
    }
    for(;E--;)scanf("%d%d%d",&i,&j,&k),dist[i-1][j-1]=k;
    for(k=0;k<V;k++)for(i=0;i<V;i++)for(j=0;j<V;j++)
        if(dist[i][k]<INF && dist[k][j]<INF && dist[i][j]>dist[i][k]+dist[k][j])
            dist[i][j]=dist[i][k]+dist[k][j];
    for(i=0;i<V;i++)if(dist[i][i]<0){puts("inf");return 0;}
    printf("%d",dist[0][n-1]);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:25: error: 'n' undeclared (first use in this function)
   17 |     printf("%d",dist[0][n-1]);
      |                         ^
main.c:17:25: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

void DFS(vector<vector<int>> &graph, vector<bool> visited, int k, long long sum, long long &ret)
{
	if (ret == -1) return;
	int N = visited.size();
	if (k == N - 1)
	{
		ret = max(sum, ret);
	}
	for (int i = 0; i < N; ++i)
	{
		if (graph[k][i] != 0)
		{
			if (visited[i])
			{
				ret = -1; return;
			}
			else {
				visited[i] = true;
				DFS(graph, visited, i, sum + graph[k][i], ret);
				visited[i] = false;
			}
		}
	}
}

int main()
{
	int N, M;
	cin >> N >> M;
	vector<vector<int>> graph(N, vector<int>(N, 0));
	for (int i = 0; i < M; ++i)
	{
		int a, b, c;
		cin >> a >> b >> c;
		graph[a - 1][b - 1] = c;
	}
	vector<bool> visited(N, false);
	long long ret = LLONG_MIN;
	DFS(graph, visited, 0, 0, ret);
	if (ret == -1)
	{
		cout << "inf" << endl;
	}
	else {
		cout << ret << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:25: error: 'LLONG_MIN' was not declared in this scope
   44 |         long long ret = LLONG_MIN;
      |                         ^~~~~~~~~
a.cc:5:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <algorithm>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

public class Main{

	public static void main(String[] args) {
		java.util.Scanner scanner = new java.util.Scanner (System.in);
		int N=scanner.nextInt() ;
		int K=scanner.nextInt() ;
		
		int a[]=new int[N+1];
		int b[]=new int[N+1];
		
		for(int i=1;i<=N;i++){
			a[i]=scanner.nextInt();
			b[i]=scanner.nextInt();
		}
		int array[]=new int[100000+1];
		for(int i=0;i<=100000;i++){
			array[i]=0;
		}
		for(int i=1;i<=N;i++){
			array[a[i]]+=b[i];
		}
		int count=0;
		for(int i=1;i<=N;i++){
			count+=array[i];
			if(count>=K){
				System.out.println(a[i]);
				break;
			}
		}
		
	}

}

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'public'
    1 | public class Main{
      | ^~~~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<string.h>
#define int long long
using namespace std;

int mincost[1000][1000];
signed main() {
	int a, b; scanf("%lld%lld", &a, &b);
	for (int c = 0; c < a; c++) {
		for (int d = 0; d < a; d++) {
			mincost[c][d] = LLONG_MAX;
		}
		mincost[c][c] = 0;
	}
	for (int c = 0; c < b; c++) {
		int d, e, f; scanf("%lld%lld%lld", &d, &e, &f);
		mincost[d - 1][e - 1] = -f;
	}
	for (int x = 0; x < a; x++) {
		for (int y = 0; y < a; y++) {
			for (int z = 0; z < a; z++) {
				if (mincost[y][x] != LLONG_MAX&& mincost[x][z] != LLONG_MAX) {
					mincost[y][z] = min(mincost[y][z], mincost[y][x] + mincost[x][z]);
				}
			}
		}
	}
	if (mincost[a - 1][a - 1] < 0) { puts("inf"); }
	else {
		printf("%lld\n", -mincost[0][a - 1]);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:41: error: 'LLONG_MAX' was not declared in this scope
   16 |                         mincost[c][d] = LLONG_MAX;
      |                                         ^~~~~~~~~
a.cc:8:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include<string.h>
  +++ |+#include <climits>
    8 | #define int long long
a.cc:27:54: error: 'LLONG_MAX' was not declared in this scope
   27 |                                 if (mincost[y][x] != LLONG_MAX&& mincost[x][z] != LLONG_MAX) {
      |                                                      ^~~~~~~~~
a.cc:27:54: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#define int long long
using namespace std;

int mincost[1000][1000];
signed main() {
	int a, b; scanf("%lld%lld", &a, &b);
	for (int c = 0; c < a; c++) {
		for (int d = 0; d < a; d++) {
			mincost[c][d] = LLONG_MAX;
		}
		mincost[c][c] = 0;
	}
	for (int c = 0; c < b; c++) {
		int d, e, f; scanf("%lld%lld%lld", &d, &e, &f);
		mincost[d - 1][e - 1] = -f;
	}
	for (int x = 0; x < a; x++) {
		for (int y = 0; y < a; y++) {
			for (int z = 0; z < a; z++) {
				if (mincost[y][x] != LLONG_MAX&& mincost[x][z] != LLONG_MAX) {
					mincost[y][z] = min(mincost[y][z], mincost[y][x] + mincost[x][z]);
				}
			}
		}
	}
	if (mincost[a - 1][a - 1] < 0) { puts("inf"); }
	else {
		printf("%lld\n", -mincost[0][a - 1]);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:41: error: 'LLONG_MAX' was not declared in this scope
   15 |                         mincost[c][d] = LLONG_MAX;
      |                                         ^~~~~~~~~
a.cc:7:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include<map>
  +++ |+#include <climits>
    7 | #define int long long
a.cc:26:54: error: 'LLONG_MAX' was not declared in this scope
   26 |                                 if (mincost[y][x] != LLONG_MAX&& mincost[x][z] != LLONG_MAX) {
      |                                                      ^~~~~~~~~
a.cc:26:54: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
using namespace std;
#define MAX_E 2010 // max M
#define MAX_V 1010 // max N
// #define INF 9223372036854775800
#define INF (1LL << 59)

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

edge es[MAX_E];
long long d[MAX_V];
bool negative[MAX_V];
int V, E;

int main() {
  cin >> V >> E;
  for (int i = 1; i < MAX_V; i++) d[i] = INF;
  for (int i = 1; i < MAX_V; i++) negative[i] = false;

  for (int i = 1; i <= E; i++) {
    int a, b;
    long long c;
    cin >> a >> b >> c;
    es[i].from = a;
    es[i].to = b;
    es[i].cost = c * -1;
  }

  d[1] = 0;
  for (int i = 0; i < V - 1; i++) {
    for (int j = 1; 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;
      }
    }
  }
  long long ans = d[N] * -1;

  for (int i = 0; i < V; i++) {
    for (int j = 1; 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;
        negative[i] = true;
      }
    }
  }

  if (negative[V]) {
    cout << "inf" << endl;
  } else {
    cout << ans << endl;
  }


  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:21: error: 'N' was not declared in this scope
   42 |   long long ans = d[N] * -1;
      |                     ^
Language: C++

#include <iostream>
using namespace std;
#define MAX_E 2010 // max M
#define MAX_V 1010 // max N
// #define INF 9223372036854775800
#define INF (1LL << 59)

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

edge es[MAX_E];
long long d[MAX_V];
bool negative[MAX_V];
int V, E;

int main() {
  cin >> V >> E;
  for (int i = 1; i < MAX_V; i++) d[i] = INF;
  for (int i = 1; i < MAX_V; i++) negative[i] = false;

  for (int i = 1; i <= E; i++) {
    int a, b;
    long long c;
    cin >> a >> b >> c;
    es[i].from = a;
    es[i].to = b;
    es[i].cost = c * -1;
  }

  d[1] = 0;
  for (int i = 0; i < V - 1; i++) {
    for (int j = 1; 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;
      }
    }
  }

  for (int i = 0; i < V; i++) {
    for (int j = 1; 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;
        negative[i] = true;
      }
    }
  }

  if (negative[N]) {
    cout << "inf" << endl;
  } else {
    cout << d[V] * -1 << endl;
  }


  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:16: error: 'N' was not declared in this scope
   53 |   if (negative[N]) {
      |                ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int N, M;
bool heiro;
struct edge{
  int to;
  ll cost;
  edge(int t, ll c) : to(t), cost(c) {}
};

vector<edge> G[1001];
typedef long long ll;
ll dist[1001];
const ll INF = 1e12;

int main() {
  cin >> N >> M;

  for(int i = 0; i < M; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    G[a].push_back(edge(b,-c));
  }
  
  fill(dist,dist+N,INF);
  dist[0] = 0;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      for(int k = 0; k < G[j].size(); k++) {
	edge u = G[j][k];
	if(dist[u.to] > dist[j] + u.cost) {
	  dist[u.to] = dist[j] + u.cost;
	  if(i == N-1) heiro = true;
	}
      }
    }
    
  }

  if(heiro) {
    cout << "inf" <<endl;
    return 0;
  }

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


Compiler output:
a.cc:9:3: error: 'll' does not name a type
    9 |   ll cost;
      |   ^~
a.cc:10:15: error: 'll' has not been declared
   10 |   edge(int t, ll c) : to(t), cost(c) {}
      |               ^~
a.cc: In constructor 'edge::edge(int, int)':
a.cc:10:30: error: class 'edge' does not have any field named 'cost'
   10 |   edge(int t, ll c) : to(t), cost(c) {}
      |                              ^~~~
a.cc: In function 'int main()':
a.cc:34:37: error: 'struct edge' has no member named 'cost'
   34 |         if(dist[u.to] > dist[j] + u.cost) {
      |                                     ^~~~
a.cc:35:36: error: 'struct edge' has no member named 'cost'
   35 |           dist[u.to] = dist[j] + u.cost;
      |                                    ^~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)
#define F first
#define S second

using namespace std;

const long long INF = 1LL<<50;

int N,M;
long long a[2010], b[2010], c[2010];

int main() {
  cin>>N>>M;

  REP(i,0,M){
    cin>>a[i]>>b[i]>>c[i];
    c[i] = (-1)*c[i];
  }

  //BF
  long long d[1010];
  REP(i,0,N) d[i] = INF;
  d[0] = 0;

  REP(i,0,N-1){
    REP(j,0,M){
      if(d[a[j]-1]==INF) continue; /*0から到達不可能な起点は除外*/
      long long t;
      if(d[a[j]-1]+c[j] <= (-1)*INF) t = (-1)*INF;
      else t = d[a[j]-1]+c[j];
      d[b[j]-1] = min(d[b[j]-1], t);
    }
  }
  long long ans = d[N-1];

  REP(i,0,N) negative[i] = false;
  REP(i,0,2*N){
    REP(j,0,M){
      if(d[a[j]-1]==INF) continue;
      long long t;
      if(d[a[j]-1]+c[j] <= (-1)*INF) t = (-1)*INF;
      else t = d[a[j]-1]+c[j];
      d[b[j]-1] = min(d[b[j]-1], t);
    }
  }

  /*d[N-1]が更新される => 0->N-1 の経路のどっかで正の閉路が存在する
  (２回めの更新はN回回すだけでいいのか？)*/
  if(ans != d[N-1]) cout<<"inf"<<endl;
  else cout<<(-1)*ans<<endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:14: error: 'negative' was not declared in this scope
   51 |   REP(i,0,N) negative[i] = false;
      |              ^~~~~~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <vector>

using namespace std;

struct edge {
	int from;
	int to;
	long long cost;
};
edge es[2000];
long long d[1000];
int num[1000];
int N,M;

long long INF = 1LL << 50;

bool est_path(int s);
//bool find_n_loop();

int main(){

	scanf("%d %d",&N,&M);

	for(int i=0;i<M;i++){
		int a,b;
		long long c;
		scanf("%d %d %lld",&a,&b,&c);
		struct edge e;
		e.from = a-1;
		e.to = b-1;
		e.cost = -1*c;
		es[i] = e;
	}


	if(largest_path(0)){
		printf("inf\n");
	}else{
		//printf("%d\n",num[N-1]);

		printf("%lld\n",-d[N-1]);
	}
	/*
	for(int i=0;i<N;i++){
		printf("%lld\n",d[i]);
	}
	*/

	return 0;
}

//
bool largest_path(int s){
	for(int i=0;i<N;i++) d[i] = INF;
	d[s] = 0;
	for(int j=0;j<N-1;j++){
		//bool update = false;
		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(!update) break;
	}
	bool negative[MAX_N];
	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 && 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;
//			}
        }
    }
    return negative[N - 1];
}
//
/*
bool find_n_loop(){
	//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) return true;
			}
		}
	}
	return false;
}
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:38:12: error: 'largest_path' was not declared in this scope; did you mean 'est_path'?
   38 |         if(largest_path(0)){
      |            ^~~~~~~~~~~~
      |            est_path
a.cc: In function 'bool largest_path(int)':
a.cc:69:23: error: 'MAX_N' was not declared in this scope
   69 |         bool negative[MAX_N];
      |                       ^~~~~
a.cc:71:17: error: 'negative' was not declared in this scope
   71 |                 negative[i] = false;
      |                 ^~~~~~~~
a.cc:78:33: error: 'negative' was not declared in this scope
   78 |                                 negative[e.to] = true;
      |                                 ^~~~~~~~
a.cc:85:12: error: 'negative' was not declared in this scope
   85 |     return negative[N - 1];
      |            ^~~~~~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <vector>

using namespace std;

struct edge {
	int from;
	int to;
	long long cost;
};
edge es[2000];
long long d[1000];
int num[1000];
int N,M;

long long INF = 1LL << 50;

bool largest_path(int s);
//bool find_n_loop();

int main(){

	scanf("%d %d",&N,&M);

	for(int i=0;i<M;i++){
		int a,b;
		long long c;
		scanf("%d %d %lld",&a,&b,&c);
		struct edge e;
		e.from = a-1;
		e.to = b-1;
		e.cost = -1*c;
		es[i] = e;
	}


	if(largest_path(0)){
		printf("inf\n");
	}else{
		//printf("%d\n",num[N-1]);

		printf("%lld\n",-d[N-1]);
	}
	/*
	for(int i=0;i<N;i++){
		printf("%lld\n",d[i]);
	}
	*/

	return 0;
}

//
bool largest_path(int s){
	for(int i=0;i<N;i++) d[i] = INF;
	d[s] = 0;
	for(int j=0;j<N-1;j++){
		//bool update = false;
		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(!update) break;
	}
	bool negative[MAX_N];
	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 && 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;
//			}
        }
    }
    return negative[N - 1];
}
//
/*
bool find_n_loop(){
	//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) return true;
			}
		}
	}
	return false;
}
*/


Compiler output:
a.cc: In function 'bool largest_path(int)':
a.cc:69:23: error: 'MAX_N' was not declared in this scope
   69 |         bool negative[MAX_N];
      |                       ^~~~~
a.cc:71:17: error: 'negative' was not declared in this scope
   71 |                 negative[i] = false;
      |                 ^~~~~~~~
a.cc:78:33: error: 'negative' was not declared in this scope
   78 |                                 negative[e.to] = true;
      |                                 ^~~~~~~~
a.cc:85:12: error: 'negative' was not declared in this scope
   85 |     return negative[N - 1];
      |            ^~~~~~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <vector>

using namespace std;

struct edge {
	int from;
	int to;
	long long cost;
};
edge es[2000];
long long d[1000];
int num[1000];
int N,M;

long long INF = 1LL << 50;

bool largest_path(int s);
//bool find_n_loop();

int main(){

	scanf("%d %d",&N,&M);

	for(int i=0;i<M;i++){
		int a,b;
		long long c;
		scanf("%d %d %lld",&a,&b,&c);
		struct edge e;
		e.from = a-1;
		e.to = b-1;
		e.cost = -1*c;
		es[i] = e;
	}

	largest_path(0);
	if(find_n_loop()){
		printf("inf\n");
	}else{
		//printf("%d\n",num[N-1]);

		printf("%lld\n",-d[N-1]);
	}
	/*
	for(int i=0;i<N;i++){
		printf("%lld\n",d[i]);
	}
	*/

	return 0;
}

//
bool largest_path(int s){
	for(int i=0;i<N;i++) d[i] = INF;
	d[s] = 0;
	for(int j=0;j<N-1;j++){
		//bool update = false;
		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(!update) break;
	}
	bool negative[MAX_N];
	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 && 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;
//			}
        }
    }
    return negative[N - 1];
}
//
/*
bool find_n_loop(){
	//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) return true;
			}
		}
	}
	return false;
}
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:38:12: error: 'find_n_loop' was not declared in this scope
   38 |         if(find_n_loop()){
      |            ^~~~~~~~~~~
a.cc: In function 'bool largest_path(int)':
a.cc:69:23: error: 'MAX_N' was not declared in this scope
   69 |         bool negative[MAX_N];
      |                       ^~~~~
a.cc:71:17: error: 'negative' was not declared in this scope
   71 |                 negative[i] = false;
      |                 ^~~~~~~~
a.cc:78:33: error: 'negative' was not declared in this scope
   78 |                                 negative[e.to] = true;
      |                                 ^~~~~~~~
a.cc:85:12: error: 'negative' was not declared in this scope
   85 |     return negative[N - 1];
      |            ^~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;
using ll = long long;

const ll INF = -(1LL << 50);
int n, m;
int a[2000], b[2000];
ll c[2000];
ll d[1001];


int main() {
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		cin >> a[i] >> b[i] >> c[i];
	}
	fill(d, d + 1001, INF);

	for (int i = 0; i < n; ++i) {
		if (a[i] == 1) {
			d[b[i]] = c[i];
		}
	}
	for (int i = 0; i < m; ++i) {
		for (int j = 0; j < m; ++i) {
			if (d[a[j]] == INF) continue;
			ll d1 = d[b[j]]; 
			ll d2 = d[a[j]] + c[j];
			if (d1 < d2 ) {
				d[b[j]] = d2;
			}
		}
	}
	ll ans = d[n];
	for (int j = 0; j < m; ++i) {
		if (d[a[j]] == INF) continue;
		ll d1 = d[b[j]]; 
		ll d2 = d[a[j]] + c[j];
		if (d1 < d2 ) {
			d[b[j]] = d2;
		}
	}
	if (ans < d[n]) {
		cout << "inf" << endl;
	}else {
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:34: error: 'i' was not declared in this scope
   37 |         for (int j = 0; j < m; ++i) {
      |                                  ^
Language: C++

#include <iostream>

using namespace std;
using ll = long long;

const int MAX_N = 1000;
const int MAX_M = 2000;
const ll WEIGHT_MAX = 1000000000;

// 頂点fromから頂点toへのコストcostの辺
struct edge {
    int from, to;
    ll cost;
};

edge es[MAX_M];     // 辺

ll d[MAX_N];       // 始点から各頂点への最大距離
int N, M;

// s番目の頂点から各頂点への最短距離を求める
bool shortest_path(int s) {
    for (int i = 0; i < N; ++i) {
        d[i] = LLONG_MAX / 2;
    }
    d[s] = 0;
    for (int loop = 0; loop < N - 1; ++loop) {
        for (int i = 0; i < M; ++i) {
            edge e = es[i];
            if ((d[e.from] != LLONG_MAX / 2 && d[e.to] > d[e.from] + e.cost)) {
                d[e.to] = d[e.from] + e.cost;
            }
        }
    }
    bool negative[MAX_N];
    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] != LLONG_MAX / 2 && 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;
//            }
        }
    }
    return negative[N - 1];
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; ++i) {
        int from, to;
        ll cost;
        cin >> from >> to >> cost;
        es[i].from = from - 1;
        es[i].to = to - 1;
        es[i].cost = -cost;
    }
    if (shortest_path(0)) {
        cout << "inf" << endl;
    } else {
        cout << -d[N - 1] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'bool shortest_path(int)':
a.cc:24:16: error: 'LLONG_MAX' was not declared in this scope
   24 |         d[i] = LLONG_MAX / 2;
      |                ^~~~~~~~~
a.cc:2:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | 
a.cc:30:31: error: 'LLONG_MAX' was not declared in this scope
   30 |             if ((d[e.from] != LLONG_MAX / 2 && d[e.to] > d[e.from] + e.cost)) {
      |                               ^~~~~~~~~
a.cc:30:31: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:42:31: error: 'LLONG_MAX' was not declared in this scope
   42 |             if ((d[e.from] != LLONG_MAX / 2 && d[e.to] > d[e.from] + e.cost)) {
      |                               ^~~~~~~~~
a.cc:42:31: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: Java

import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
		int M = sc.nextInt();

		int[] a = new int[M];
		int[] b = new int[M];
		int[] c = new int[M];

		int[][] to = new int[N+1][M];
		int[] cnt = new int[N+1];
		for(int i=1; i<=N; i++){
			cnt[i] = 0;
		}

		for(int i=0; i<M; i++){
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			c[i] = sc.nextInt();
			to[a[i]][cnt[a[i]]++] = i;
		}

		long[] score = new long[N+1];
		score[1] = 0;
		for(int i=2; i<=N; i++){
			score[i] = Long.MIN_VALUE;
		}

		boolean[] check = new boolean[N+1]
		for(int i=2; i<=N; i++){
			check[i] = false;
		}

		int now = 1;
		int next;
		int time = 0;
		boolean inf = false;
		while(true){
			for(int j=0; j<cnt[now]; j++){
				next = to[now][j];
				Long x = score[b[next]];
				Long y = score[now] + c[next];
				if(x.compareTo(y)==-1){
					score[b[next]] = score[now] + c[next];
					if(cnt[b[next]]>0 && check[b[next]==false){
						stock[stock_cnt++] = b[next];
						check[b[next]] = true;
					}
				}
			}
			if(stock_cnt!=0){
				now = stock[stock_cnt-1];
				stock_cnt--;
				check[now] = false;
			}else{
				break;
			}
			time++;
			if(time>=M*M){
				inf = true;
				break;
			}
		}

		if(inf==true){
			System.out.print("inf");
		}else{
			System.out.print(score[N]);
		}


	}

}


Compiler output:
Main.java:33: error: ';' expected
		boolean[] check = new boolean[N+1]
		                                  ^
Main.java:49: error: ']' expected
					if(cnt[b[next]]>0 && check[b[next]==false){
					                                         ^
2 errors
Language: C++

#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
const ll mod = LLONG_MAX;

print("inf")
return 0;

Compiler output:
a.cc:4:18: error: 'cout' does not name a type
    4 | #define print(x) cout<<x<<endl;
      |                  ^~~~
a.cc:9:1: note: in expansion of macro 'print'
    9 | print("inf")
      | ^~~~~
a.cc:10:1: error: expected unqualified-id before 'return'
   10 | return 0;
      | ^~~~~~
Language: C++

// ConsoleApplication1.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<queue>
typedef long long  i64;
using namespace std;
int n;
int m;
int a[2000];
int b[2000];
i64 c[2000];
struct Edge {
	int src, dst;
	i64 cost;
public:
	Edge(int src, int dst, i64 cost) {
		this->src = src;
		this->dst = dst;
		this->cost = cost;
	}
};
struct State {
	int cur;
	i64 cost;
public:State(int cur, i64 cost) {
	this->cur = cur;
	this->cost = cost;
}
};
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; ++i) {
		scanf("%d%d%lld", a + i, b + i, c + i);
		--a[i];
		--b[i];
		c[i] *= -1;
	}
	vector<vector<Edge>> g;
	vector<vector<int>> rev;
	g.resize(n);
	rev.resize(n);
	for (int i = 0; i < m; ++i) {
		Edge e = { a[i],b[i],c[i] };
		g[a[i]].push_back(Edge(a[i], b[i], c[i]));
		rev[b[i]].push_back(a[i]);
	}

	i64 d[1000];
	for (int i = 0; i < n; ++i) {
		d[i] = 1LL << 60;
	}

	d[0] = 0;
	vector<queue<State>> pend;
	pend.resize(n + 2);
	pend[0].push(State(0, 0));
	for (int i = 0; i < n; ++i) {
		while (!pend[i].empty()) {
			State s = pend[i].front();
			pend[i].pop();
			if (d[s.cur] < s.cost)
				continue;
			for (Edge e : g[s.cur]) {
				if (d[e.dst] > d[s.cur] + e.cost) {
					d[e.dst] = d[s.cur] + e.cost;
					State ns = { e.dst, d[e.dst] };
					pend[i + 1].push(ns);
				}
			}
		}
	}
	bool reach[1000];
	queue<int> q;
	q.push(n - 1);
	reach[n - 1] = true;
	while (q.size() > 0) {
		int v = q.front();
		q.pop();
		for (int dst : rev[v]) {
			if (!reach[dst]) {
				reach[dst] = true;
				q.push(dst);
			}
		}
	}
	bool f = false;
	while (!pend[n].empty()) {
		State s = pend[n].front();
		pend[n].pop();
		f |= reach[s.cur];
	}
	if (!f) {
		printf("%lld\n", -d[n - 1]);
	}
	else {
		printf("inf\n");
	}


	return 0;
}

Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>

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++

// ConsoleApplication1.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<queue>
typedef long long  i64;
using namespace std;
int n;
int m;
int a[2000];
int b[2000];
i64 c[2000];
struct Edge {
	int src, dst;
	i64 cost;
public:
	Edge(int src, int dst, i64 cost) {
		this->src = src;
		this->dst = dst;
		this->cost = cost;
	}
};
struct State {
	int cur;
	i64 cost;
public:State(int cur, i64 cost) {
	this->cur = cur;
	this->cost = cost;
}
};
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; ++i) {
		scanf("%d%d%lld", a + i, b + i, c + i);
		--a[i];
		--b[i];
		c[i] *= -1;
	}
	vector<vector<Edge>> g;
	vector<vector<int>> rev;
	g.resize(n);
	rev.resize(n);
	for (int i = 0; i < m; ++i) {
		Edge e = { a[i],b[i],c[i] };
		g[a[i]].push_back(Edge(a[i], b[i], c[i]));
		rev[b[i]].push_back(a[i]);
	}

	i64 d[1000];
	for (int i = 0; i < n; ++i) {
		d[i] = 1LL << 60;
	}

	d[0] = 0;
	vector<queue<State>> pend;
	pend.resize(n + 2);
	pend[0].push(State(0, 0));
	for (int i = 0; i < n; ++i) {
		while (pend[i].size() > 0) {
			//while (!pend[i].empty()) {
			State s = pend[i].front();
			pend[i].pop();
			if (d[s.cur] < s.cost)
				continue;
			for (Edge e : g[s.cur]) {
				if (d[e.dst] > d[s.cur] + e.cost) {
					d[e.dst] = d[s.cur] + e.cost;
					State ns = { e.dst, d[e.dst] };
					pend[i + 1].push(ns);
				}
			}
		}
	}
	bool reach[1000];
	queue<int> q;
	q.push(n - 1);
	reach[n - 1] = true;
	while (q.size() > 0) {
		int v = q.front();
		q.pop();
		for (int dst : rev[v]) {
			if (!reach[dst]) {
				reach[dst] = true;
				q.push(dst);
			}
		}
	}
	bool f = false;
	while (pend[n].size() > 0) {
		State s = pend[n].front();
		pend[n].pop();
		f |= reach[s.cur];
	}
	if (!f) {
		printf("%lld\n", -d[n - 1]);
	}
	else {
		printf("inf\n");
	}


	return 0;
}

Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e18+1

using ll = long long;
const ll mod = LLONG_MAX;


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

edge es[2010];
int d[1010];//最短距離　入力を負にしてヒックリカセス
int V,E;
void shrtest_path(int s){
  rep(i,V)d[i]=INF;

  d[s]=0;
  rep(cnt,V+1){
    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(cnt>=V){

          cout<<"inf"<<endl;


        }
      }


    }
    if(!update)break;
  }
}

bool find(){
  rep(i,V)d[i]=0;
  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;
}



signed main(){
  cin>>V>>E;
  rep(i,E){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    es[i].from=a;
    es[i].to=b;
    //入力　負
    es[i].cost=-c;
  }

  bool changed[1000000];
  rep(i,N){
    dist[i] = INF;
    changed[2*i]=false;
    changed[2*i+1]=false;
}

  int xc=2*V;
  rep(i,xc){
      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( e.to== V-1 )
                  changed[i]=true;
          }
      }
  }

  if(changed[2*V-1]){
    cout<<"inf"<<endl;
  }else{
    shrtest_path(0);
    cout<<-d[V-1]<<endl;
  }

  return 0;



}


Compiler output:
a.cc: In function 'int main()':
a.cc:75:9: error: 'N' was not declared in this scope
   75 |   rep(i,N){
      |         ^
a.cc:4:34: note: in definition of macro 'FOR'
    4 | #define FOR(i,a,b) for(int i=a;i<b;i++)
      |                                  ^
a.cc:75:3: note: in expansion of macro 'rep'
   75 |   rep(i,N){
      |   ^~~
a.cc:76:5: error: 'dist' was not declared in this scope
   76 |     dist[i] = INF;
      |     ^~~~
Language: C++

// ConsoleApplication1.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<queue>
typedef long long  i64;
using namespace std;
int n;
int m;
int a[1000];
int b[1000];
i64 c[1000];
struct Edge {
	int src, dst;
	i64 cost;
public:
	Edge(int src, int dst, i64 cost) {
		this->src = src;
		this->dst = dst;
		this->cost = cost;
	}
};
struct State {
	int cur;
	i64 cost;
public:State(int cur, i64 cost) {
	this->cur = cur;
	this->cost = cost;
}
};
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; ++i) {
		scanf("%d%d%lld", a + i, b + i, c + i);
		--a[i];
		--b[i];
		c[i] *= -1;
	}
	vector<vector<Edge>> g;
	vector<vector<int>> rev;
	g.resize(n);
	rev.resize(n);
	for (int i = 0; i < m; ++i) {
		Edge e = { a[i],b[i],c[i] };
		g[a[i]].push_back(Edge(a[i], b[i], c[i]));
		rev[b[i]].push_back(a[i]);
	}

	i64 d[1000];
	for (int i = 0; i < n; ++i) {
		d[i] = 1LL << 60;
	}

	d[0] = 0;
	vector<queue<State>> pend;
	pend.resize(n + 2);
	pend[0].push(State(0, 0));
	for (int i = 0; i < n; ++i) {
		while (pend[i].size() > 0) {
			//while (!pend[i].empty()) {
			State s = pend[i].front();
			pend[i].pop();
			if (d[s.cur] < s.cost)
				continue;
			for (Edge e : g[s.cur]) {
				if (d[e.dst] > d[s.cur] + e.cost) {
					d[e.dst] = d[s.cur] + e.cost;
					State ns = { e.dst, d[e.dst] };
					pend[i + 1].push(ns);
				}
			}
		}
	}
	bool reach[1000];
	queue<int> q;
	q.push(n - 1);
	reach[n - 1] = true;
	while (q.size() > 0) {
		int v = q.front();
		q.pop();
		for (int dst : rev[v]) {
			if (!reach[dst]) {
				reach[dst] = true;
				q.push(dst);
			}
		}
	}
	bool f = false;
	while (pend[n].size() > 0) {
		State s = pend[n].front();
		pend[n].pop();
		f = f || reach[s.cur];
	}
	if (!f) {
		printf("%lld\n", -d[n - 1]);
	}
	else {
		printf("inf\n");
	}


	return 0;
}

Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

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

int main()
{
  long long int N,M;
  cin >> N >> M;
  vector<struct edge>es(M);
  for(int i=0; i < M; i++){
    long long int a,b,c;
    cin >> a >> b >> c;
    a--;
    b--;
    es[i].from = a;
    es[i].to = b;
    es[i].score = c;
  }

  long long int inf = 10000000000;
  vector<long long int>s(N);
  for(int i=0; i < N; i++)
    s[i] = -inf;
  s[0] = 0;
  bool inf = false;
  for(int j=0; j < N-1; j++){
    bool update = false;
    for(int i=0; i < M; i++){
      struct edge e = es[i];
      if(s[e.from] != -inf && s[e.to] < s[e.from] + e.score){
	s[e.to] = s[e.from] + e.score;
	update = true;
      }
    }
    if(!update)
      break;
  }
  vector<bool>ne(N);
  for(int i=0; i < N; i++)
    ne[i] = false;
  for(int i=0; i < N; i++){
    for(int j=0; j < M; j++){
      struct edge e = es[j];
      if(s[e.from] != -inf && s[e.to] < s[e.from] + e.score){
	s[e.to] = s[e.from] + e.score;
	ne[e.to] = true;
	ne[e.from] = true;
      }
    }
  }

  if(ne[N-1])
    cout << "inf" << endl;
  else
    cout << s[N-1] << endl;


  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:8: error: conflicting declaration 'bool inf'
   36 |   bool inf = false;
      |        ^~~
a.cc:31:17: note: previous declaration as 'long long int inf'
   31 |   long long int inf = 10000000000;
      |                 ^~~