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

#include<iostream>
#include<queue>
#include<vector>

#define MAX 100000
#define INF INT_MAX
#define NO 0
#define WENT 1

using namespace std;

void Dijkstra(void);

int V, E, r;
vector< vector<pair<int,int> > >  v;
vector<int> cost, visited;


int main() {
  int s, t, d;

  cin >> V >> E >> r;
  v.resize(V);

  for(int i=0; i<E; i++) {
    cin >> s >>t >> d;
    v[s].push_back(make_pair(t,d)); //s番目〜t番目のコストはd                                                                                                                                              \
                                                                                                                                                                                                            
  }

  //cout << 'a' << endl;                                                                                                                                                                                   \
                                                                                                                                                                                                            
  Dijkstra();

  //cout << "b" << endl;                                                                                                                                                                                   \
                                                                                                                                                                                                            

  for(int i=0; i<V; i++) {
    if(visited[i] == WENT) cout << cost[i] << endl;
    else cout << "INF" << endl;
  }

  return 0;
}




Compiler output:
/usr/bin/ld: /tmp/ccIQ2JRQ.o: in function `main':
a.cc:(.text+0xfd): undefined reference to `Dijkstra()'
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<queue>
#include<vector>

#define MAX 100000
#define INF INT_MAX
#define NO 0
#define WENT 1

using namespace std;


int V, E, r;
vector< vector<pair<int,int> > >  v;
vector<int> cost, visited;


int main() {
  int s, t, d;

  cin >> V >> E >> r;
  v.resize(V);

  for(int i=0; i<E; i++) {
    cin >> s >>t >> d;
    v[s].push_back(make_pair(t,d)); //s番目〜t番目のコストはd                                                                                                                                              \
                                                                                                                                                                                                            
  }

  //cout << 'a' << endl;                                                                                                                                                                                   \
                                                                                                                                                                                                            
  Dijkstra();

  //cout << "b" << endl;                                                                                                                                                                                   \
                                                                                                                                                                                                            

  for(int i=0; i<V; i++) {
    if(visited[i] == WENT) cout << cost[i] << endl;
    else cout << "INF" << endl;
  }

  return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:32:3: error: 'Dijkstra' was not declared in this scope
   32 |   Dijkstra();
      |   ^~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

#define Emax 500000
#define Vmax 100000
#define Dmax 10000

using namespace std;

static int edges[Vmax][Vmax];
static int d[Vmax];
static int Vnum, Enum, r;
static int prev_v[Vmax];

vector<int> connected_vertexes(int v) {
  vector<int> res = {};
  for (int i = 0; i < Vnum; i++) {
    if (edges[v][i] != -1) {
      res.push_back(i);
    }
  }
  return res;
}

int main(int ac, char **av) {
  vector<int> V;
  vector<int> Q;
  int tmp;

  fill_n(d, Vmax, Dmax);
  fill_n(prev_v, Vmax, -1);

  cin >> Vnum >> Enum >> r;

  for (int i = 0; i < Vnum; i++) {
    fill_n(edges[i], Vnum, -1);
  }

  for (int i = 0; i < Enum; i++) {
    int s, t, d;
    cin >> s >> t >> d;
    edges[s][t] = d;
  }

  d[r] = 0;
  prev_v[r] = 0;

  for (int i = 0; i < Vnum; i++) {
    Q.push_back(i);
  }

  while (!Q.empty()) {
    tmp = Q[0];
    for (int i : Q) {
      if (d[i] < d[tmp]) {
        tmp = i;
      }
    }
    int u = tmp;
    Q.erase(find(Q.begin(), Q.end(), u));
    for (int v : connected_vertexes(u)) {
      if (d[v] > d[u] + edges[u][v]) {
        d[v] = d[u] + edges[u][v];
        prev_v[v] = u;
      }
    }
  }
  for (int i = 0; i < Vnum; i++) {
    if (d[i] == Dmax) {
      cout << "INF" << endl;
    } else {
      cout << d[i] << endl;
    }
  }
  return 0;
}



Compiler output:
/tmp/ccCW6KZE.o: in function `connected_vertexes(int)':
a.cc:(.text+0x82): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/tmp/ccCW6KZE.o: in function `main':
a.cc:(.text+0xfa): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x11c): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x12b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x147): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x15c): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x17d): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x1ac): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x23b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x24a): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x25b): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

#define Emax 500000
#define Vmax 100000
#define Dmax 10000

using namespace std;

static int edges[Vmax][Vmax];
static int d[Vmax];
static int Vnum, Enum, r;
static int prev_v[Vmax];

vector<int> connected_vertexes(int v) {
  vector<int> res = {};
  for (int i = 0; i < Vnum; i++) {
    if (edges[v][i] != -1) {
      res.push_back(i);
    }
  }
  return res;
}

int main(int ac, char **av) {
  vector<int> V;
  vector<int> Q;
  int tmp;

  fill_n(d, Vmax, Dmax);
  fill_n(prev_v, Vmax, -1);

  cin >> Vnum >> Enum >> r;

  for (int i = 0; i < Vnum; i++) {
    fill_n(edges[i], Vnum, -1);
  }

  for (int i = 0; i < Enum; i++) {
    int s, t, d;
    cin >> s >> t >> d;
    edges[s][t] = d;
  }

  d[r] = 0;
  prev_v[r] = 0;

  for (int i = 0; i < Vnum; i++) {
    Q.push_back(i);
  }

  while (!Q.empty()) {
    tmp = Q[0];
    for (int i : Q) {
      if (d[i] < d[tmp]) {
        tmp = i;
      }
    }
    int u = tmp;
    Q.erase(find(Q.begin(), Q.end(), u));
    for (int v : connected_vertexes(u)) {
      if (d[v] > d[u] + edges[u][v]) {
        d[v] = d[u] + edges[u][v];
        prev_v[v] = u;
      }
    }
  }
  for (int i = 0; i < Vnum; i++) {
    if (d[i] == Dmax) {
      cout << "INF" << endl;
    } else {
      cout << d[i] << endl;
    }
  }
  return 0;
}



Compiler output:
/tmp/ccQKKJUL.o: in function `connected_vertexes(int)':
a.cc:(.text+0x82): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/tmp/ccQKKJUL.o: in function `main':
a.cc:(.text+0xfa): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x11c): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x12b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x147): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x15c): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x17d): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x1ac): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x23b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x24a): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x25b): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#define MAX_V 100000
#define MAX_E 500000
#define INF 1e9
using namespace std;

int V;//頂点の数
int E;//辺の数

struct edge {
	int from, to, cost;
};
edge es[MAX_E];
int d[MAX_V];


bool find_negative_loop(int s) {
	d[s] = 0;
	
	int count = 0;
	while (true) {
		bool update = false;
		count++;
		
		for (int i = 0; i < E; i++) {
			if (count == V) {
				return true;
			}
			if (d[es[i].from] != INF && d[es[i].to] > d[es[i].from] + es[i].cost) {
				d[es[i].to] = d[es[i].from] + es[i].cost;
				update = true;
			}
		}
		if (update == false) {
			return false;
		}
	}
}

int main() {
	int r;
	cin >> V >> E >> r;
	for (int i = 0; i < E; i++) {
		cin >> es[i].from >> es[i].to >> es[i].cost;
	}
	for (int i = 0; i <MV; i++) {
		d[i] = INF;
	}
	if (find_negative_loop(r)) {
		cout << "NEGATIVE CYCLE" << endl;
	}
	else {
		for (int i = 0; i < V; i++) {
			if (d[i] == INF) {
				cout << "INF" << endl;
			}
			else {
				cout << d[i] << endl;
			}
		}
	}
	return 0;
}









Compiler output:
a.cc: In function 'int main()':
a.cc:46:28: error: 'MV' was not declared in this scope; did you mean 'V'?
   46 |         for (int i = 0; i <MV; i++) {
      |                            ^~
      |                            V
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
struct Dijkstra {
  typedef pair<int, int> P;
  struct edge {
    int to;
    int cost;
  };
  int V;
  vector<vector<edge> > G;
  vector<int> d;
  Dijkstra (int V):V(V) {
    G.resize(V+1);
    d.resize(V+1,1e9);
  }
  void calc(int s){
    priority_queue<P, vector<P>, greater<P> > que;
    d[s]=0;
    que.push(P(0, s));
    while(!que.empty()){
      P p=que.top();que.pop();
      if(d[p.second]<p.first)continue;
      for(auto v : G[p.second]){
        if(d[v.to]>d[p.second]+v.cost){
          d[v.to]=d[p.second]+v.cost;
          que.push(P(d[v.to],v.to));
        }
      }
    }
  }
};

int main(){
    int V,E,r;
    cin>>V>>E>>r;
    Dijkstra dij(V+1);
    FOR(i,0,E){
        int s,t,d;
        cin>>s>>t>>d;
        gij.G[s].push_back({t, d});
    }
    calc(r);
    FOR(i,0,V){
        if(dij.d[i]==1e9)cout<<"INF"<<endl;
        else cout<<dij.d[i]<<endl;
    }
}




Compiler output:
a.cc: In function 'int main()':
a.cc:57:9: error: 'i' was not declared in this scope
   57 |     FOR(i,0,E){
      |         ^
a.cc:57:5: error: 'FOR' was not declared in this scope
   57 |     FOR(i,0,E){
      |     ^~~
a.cc:62:5: error: 'calc' was not declared in this scope
   62 |     calc(r);
      |     ^~~~
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
struct Dijkstra {
  typedef pair<int, int> P;
  struct edge {
    int to;
    int cost;
  };
  int V;
  vector<vector<edge> > G;
  vector<int> d;
  Dijkstra (int V):V(V) {
    G.resize(V+1);
    d.resize(V+1,1e9);
  }
  void calc(int s){
    priority_queue<P, vector<P>, greater<P> > que;
    d[s]=0;
    que.push(P(0, s));
    while(!que.empty()){
      P p=que.top();que.pop();
      if(d[p.second]<p.first)continue;
      for(auto v : G[p.second]){
        if(d[v.to]>d[p.second]+v.cost){
          d[v.to]=d[p.second]+v.cost;
          que.push(P(d[v.to],v.to));
        }
      }
    }
  }
};

int main(){
    int V,E,r;
    cin>>V>>E>>r;
    Dijkstra dij(V+1);
    FOR(i,0,E){
        int s,t,d;
        cin>>s>>t>>d;
        gij.G[s].push_back({t, d});
    }
    calc(r);
    FOR(i,0,V){
        if(dij.d[i]==1e9)cout<<"INF"<<endl;
        else cout<<dij.d[i]<<endl;
    }
}




Compiler output:
a.cc: In function 'int main()':
a.cc:61:9: error: 'gij' was not declared in this scope; did you mean 'dij'?
   61 |         gij.G[s].push_back({t, d});
      |         ^~~
      |         dij
a.cc:63:5: error: 'calc' was not declared in this scope
   63 |     calc(r);
      |     ^~~~
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
struct Dijkstra {
  typedef pair<int, int> P;
  struct edge {
    int to;
    int cost;
  };
  int V;
  vector<vector<edge> > G;
  vector<int> d;
  Dijkstra (int V):V(V) {
    G.resize(V+1);
    d.resize(V+1,1e9);
  }
  void calc(int s){
    priority_queue<P, vector<P>, greater<P> > que;
    d[s]=0;
    que.push(P(0, s));
    while(!que.empty()){
      P p=que.top();que.pop();
      if(d[p.second]<p.first)continue;
      for(auto v : G[p.second]){
        if(d[v.to]>d[p.second]+v.cost){
          d[v.to]=d[p.second]+v.cost;
          que.push(P(d[v.to],v.to));
        }
      }
    }
  }
};

int main(){
    int V,E,r;
    cin>>V>>E>>r;
    Dijkstra dij(V+1);
    FOR(i,0,E){
        int s,t,d;
        cin>>s>>t>>d;
        dij.G[s].push_back({t, d});
    }
    calc(r);
    FOR(i,0,V){
        if(dij.d[i]==1e9)cout<<"INF"<<endl;
        else cout<<dij.d[i]<<endl;
    }
}




Compiler output:
a.cc: In function 'int main()':
a.cc:63:5: error: 'calc' was not declared in this scope
   63 |     calc(r);
      |     ^~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

struct edge {
    int to, cost;
};

int V;
vector<edge> G[1000000];
ll d[1000000];

void dijkstra(int s) {
    priority_queue<pii, vector<pii>, greater<pii> > que;
    fill(d, d + V + 10, llmax);
    d[s] = 0;
    que.push(pii(0, s));

    while (!que.empty()) {
        pii p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) {
            continue;
        }
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(pii(d[e.to], e.to));
            }
        }
    }
}

int main() {
    int E, r;
    cin >> V >> E >> r;
    for (int i = 0; i < E; i++) {
        int s, t, d;
        cin >> s >> t >> d;
        edge e;
        e.to = t;
        e.cost = d;
        G[s].push_back(e);
    }
    bellmanFord(r);
    for (int i = 0; i < V; i++) {
        if (d[i] == llmax) {
            cout << "INF" << endl;
        } else {
            cout << d[i] << endl;
        }
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:72:5: error: 'bellmanFord' was not declared in this scope
   72 |     bellmanFord(r);
      |     ^~~~~~~~~~~
Language: C++

#include "kika.hpp"
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
using namespace std;
#define MK make_pair
#define F first
#define S second
const int MX=-1*(1e9+7);


int main(){
    int v,e,s;
    int dis[110000];
    fill(dis,&dis[110000],MX);
    vector<vector<pair<int,int>>> E(110000); //to,dis
    cin>>v>>e>>s;
    
    dis[s]=0;
    for(int i=0;i<e;i++){
        int h,t,d;
        cin>>h>>t>>d;
        E[h].push_back(MK(t,d));
    }
    priority_queue<pair<int,int>> q; //-1*dis,to
    bool done[110000]={};
    q.push(MK(0,s));
    while(!q.empty()){
        pair<int,int> a=q.top();
        q.pop();
        if(done[a.S]){continue;}
        done[a.S]=true;
        for(int i=0;i<E[a.S].size();i++){
            pair<int,int> b=E[a.S][i];
            if(dis[b.F]<dis[a.S]-b.S){
                dis[b.F]=dis[a.S]-b.S;
                q.push({dis[b.F],b.F});
            }
        }
    }
    for(int i=0;i<v;i++){
        if(dis[i]!=MX){
            cout<<-1*dis[i]<<endl;
        }
        else{
            cout<<"INF"<<endl;
        }
    }
    
    return 0;
}


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

#include <iostream>
#include <vector>
#include <queue>
#include <functional>
#include <cmath>

using namespace std;
#define MAX INT_MAX/2-100

typedef pair<int, int> Q;
typedef pair<int, Q> P;

int main() {
	int v, e, r;
	int s, t, d;
	cin >> v >> e >> r;
	vector< vector<int> > ligyo(v, vector<int> (v));
	vector<int> MIN(v, MAX);
	vector<bool> MIN2(v, false);
	for (int i = 0; i < e; i++) {
		cin >> s >> t >> d; 
		ligyo[s][t] = d;
	}

	MIN[r] = 0;
	MIN2[r] = true;

	priority_queue<P, vector<P>, greater<P> > pq;

	/*for (int i = 0; i < v; i++) {
		for (int j = 0; j < v; j++) {
			cout << ligyo[i][j] << " ";
		}
		cout << endl;
	}*/

	for (int i = 0; i < v; i++) {
		if (ligyo[r][i] != 0) {
			//cout << i << endl;
			pq.push(P(ligyo[r][i], Q(r, i)));
		}
	}

	while (!pq.empty()) {
		P p = pq.top();
		pq.pop();
		/*for (int i = 0; i < v; i++) {
			cout << MIN[i] << " " ;
		}
		cout << endl;
		cout << (p.second).first << " " << (p.second).second << " " << MIN[(p.second).second] << " " << MIN[(p.second).first] + p.first << endl;*/
		if (MIN2[(p.second).second] == true) {
			continue;
		}
		MIN[(p.second).second] = min(MIN[(p.second).second], MIN[(p.second).first] + p.first);
		MIN2[(p.second).second] = true;
		for (int j = 0; j < v; j++) {
			if (MIN2[j] == false && ligyo[(p.second).second][j] != 0) {
				pq.push(P(ligyo[(p.second).second][j], Q((p.second).second, j)));
			}
		}
	}

	for (int i = 0; i < v; i++) {
		if (MIN[i] >= MAX) {
			cout << "INF" << endl;
		} else {
			cout << MIN[i] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'INT_MAX' was not declared in this scope
    8 | #define MAX INT_MAX/2-100
      |             ^~~~~~~
a.cc:18:28: note: in expansion of macro 'MAX'
   18 |         vector<int> MIN(v, MAX);
      |                            ^~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <cmath>
  +++ |+#include <climits>
    6 |
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

#define INF 10000000/2-100;

typedef pair<int, int> P;

int main() {
	int v, e, r;
	int s, t, d;
	cin >> v >> e >> r;
	vector<P> rlist(v);
	vector<int> cost(v, INF);
	for (int i = 0; i < e; i++) {
		cin >> s >> t >> d;
		rlist[s].push_back(P(d, t));
	}
	priolity_queue<P, vector<P>, greater<P> > pq;
	pq.push(0, r);
	while (!pq.empty()) {
		P ten = pq.top();
		pq.pop();
		if (cost[ten.second] < ten.first) {
			continue;
		} 
		cost[ten.second] = ten.first;
		for (int i = 0; i < rlist[ten.second].size(); i++) {
			pq.push(P(rlist[i].first + cost[ten.second], rlist[i].second));
		}
	}
	for (int i = 0; i < v; i++) {
		if (cost[i] == INF) {
			cout << "INF" << endl;
		} else {
			cout << cost[i] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:27: error: expected ')' before ';' token
    8 | #define INF 10000000/2-100;
      |                           ^
a.cc:17:29: note: in expansion of macro 'INF'
   17 |         vector<int> cost(v, INF);
      |                             ^~~
a.cc:17:25: note: to match this '('
   17 |         vector<int> cost(v, INF);
      |                         ^
a.cc:17:32: error: expected primary-expression before ')' token
   17 |         vector<int> cost(v, INF);
      |                                ^
a.cc:20:26: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   20 |                 rlist[s].push_back(P(d, t));
      |                          ^~~~~~~~~
a.cc:22:9: error: 'priolity_queue' was not declared in this scope
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |         ^~~~~~~~~~~~~~
a.cc:22:25: error: expected primary-expression before ',' token
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                         ^
a.cc:22:36: error: expected primary-expression before ',' token
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                                    ^
a.cc:22:49: error: expected primary-expression before '>' token
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                                                 ^
a.cc:22:51: error: 'pq' was not declared in this scope
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                                                   ^~
a.cc:31:55: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'size'
   31 |                 for (int i = 0; i < rlist[ten.second].size(); i++) {
      |                                                       ^~~~
a.cc:36:35: error: expected primary-expression before ')' token
   36 |                 if (cost[i] == INF) {
      |                                   ^
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

#define MAX 10000000/2-100;

typedef pair<int, int> P;

int main() {
	int v, e, r;
	int s, t, d;
	cin >> v >> e >> r;
	vector<P> rlist(v);
	vector<int> cost(v, MAX);
	for (int i = 0; i < e; i++) {
		cin >> s >> t >> d;
		rlist[s].push_back(P(d, t));
	}
	priolity_queue<P, vector<P>, greater<P> > pq;
	pq.push(0, r);
	while (!pq.empty()) {
		P ten = pq.top();
		pq.pop();
		if (cost[ten.second] < ten.first) {
			continue;
		} 
		cost[ten.second] = ten.first;
		for (int i = 0; i < rlist[ten.second].size(); i++) {
			pq.push(P(rlist[i].first + cost[ten.second], rlist[i].second));
		}
	}
	for (int i = 0; i < v; i++) {
		if (cost[i] == INF) {
			cout << "INF" << endl;
		} else {
			cout << cost[i] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:27: error: expected ')' before ';' token
    8 | #define MAX 10000000/2-100;
      |                           ^
a.cc:17:29: note: in expansion of macro 'MAX'
   17 |         vector<int> cost(v, MAX);
      |                             ^~~
a.cc:17:25: note: to match this '('
   17 |         vector<int> cost(v, MAX);
      |                         ^
a.cc:17:32: error: expected primary-expression before ')' token
   17 |         vector<int> cost(v, MAX);
      |                                ^
a.cc:20:26: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   20 |                 rlist[s].push_back(P(d, t));
      |                          ^~~~~~~~~
a.cc:22:9: error: 'priolity_queue' was not declared in this scope
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |         ^~~~~~~~~~~~~~
a.cc:22:25: error: expected primary-expression before ',' token
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                         ^
a.cc:22:36: error: expected primary-expression before ',' token
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                                    ^
a.cc:22:49: error: expected primary-expression before '>' token
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                                                 ^
a.cc:22:51: error: 'pq' was not declared in this scope
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                                                   ^~
a.cc:31:55: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'size'
   31 |                 for (int i = 0; i < rlist[ten.second].size(); i++) {
      |                                                       ^~~~
a.cc:36:32: error: 'INF' was not declared in this scope
   36 |                 if (cost[i] == INF) {
      |                                ^~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

#define MAX 10000000/2-100

typedef pair<int, int> P;

int main() {
	int v, e, r;
	int s, t, d;
	cin >> v >> e >> r;
	vector<P> rlist(v);
	vector<int> cost(v, MAX);
	for (int i = 0; i < e; i++) {
		cin >> s >> t >> d;
		rlist[s].push_back(P(d, t));
	}
	priolity_queue<P, vector<P>, greater<P> > pq;
	pq.push(0, r);
	while (!pq.empty()) {
		P ten = pq.top();
		pq.pop();
		if (cost[ten.second] < ten.first) {
			continue;
		} 
		cost[ten.second] = ten.first;
		for (int i = 0; i < rlist[ten.second].size(); i++) {
			pq.push(P(rlist[i].first + cost[ten.second], rlist[i].second));
		}
	}
	for (int i = 0; i < v; i++) {
		if (cost[i] == INF) {
			cout << "INF" << endl;
		} else {
			cout << cost[i] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:26: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   20 |                 rlist[s].push_back(P(d, t));
      |                          ^~~~~~~~~
a.cc:22:9: error: 'priolity_queue' was not declared in this scope
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |         ^~~~~~~~~~~~~~
a.cc:22:25: error: expected primary-expression before ',' token
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                         ^
a.cc:22:36: error: expected primary-expression before ',' token
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                                    ^
a.cc:22:49: error: expected primary-expression before '>' token
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                                                 ^
a.cc:22:51: error: 'pq' was not declared in this scope
   22 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                                                   ^~
a.cc:31:55: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'size'
   31 |                 for (int i = 0; i < rlist[ten.second].size(); i++) {
      |                                                       ^~~~
a.cc:36:32: error: 'INF' was not declared in this scope
   36 |                 if (cost[i] == INF) {
      |                                ^~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <functional>
#include <utility>

using namespace std;

#define MAX 10000000/2-100

typedef pair<int, int> P;

int main() {
	int v, e, r;
	int s, t, d;
	cin >> v >> e >> r;
	vector<P> rlist(v);
	vector<int> cost(v, MAX);
	for (int i = 0; i < e; i++) {
		cin >> s >> t >> d;
		rlist[s].push_back(P(d, t));
	}
	priolity_queue<P, vector<P>, greater<P> > pq;
	pq.push(0, r);
	while (!pq.empty()) {
		P ten = pq.top();
		pq.pop();
		if (cost[ten.second] < ten.first) {
			continue;
		} 
		cost[ten.second] = ten.first;
		for (int i = 0; i < rlist[ten.second].size(); i++) {
			pq.push(P(rlist[i].first + cost[ten.second], rlist[i].second));
		}
	}
	for (int i = 0; i < v; i++) {
		if (cost[i] == INF) {
			cout << "INF" << endl;
		} else {
			cout << cost[i] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   21 |                 rlist[s].push_back(P(d, t));
      |                          ^~~~~~~~~
a.cc:23:9: error: 'priolity_queue' was not declared in this scope
   23 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |         ^~~~~~~~~~~~~~
a.cc:23:25: error: expected primary-expression before ',' token
   23 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                         ^
a.cc:23:36: error: expected primary-expression before ',' token
   23 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                                    ^
a.cc:23:49: error: expected primary-expression before '>' token
   23 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                                                 ^
a.cc:23:51: error: 'pq' was not declared in this scope
   23 |         priolity_queue<P, vector<P>, greater<P> > pq;
      |                                                   ^~
a.cc:32:55: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'size'
   32 |                 for (int i = 0; i < rlist[ten.second].size(); i++) {
      |                                                       ^~~~
a.cc:37:32: error: 'INF' was not declared in this scope
   37 |                 if (cost[i] == INF) {
      |                                ^~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

#define MAX 10000000/2-100

typedef pair<int, int> P;

int main() {
	int v, e, r;
	int s, t, d;
	cin >> v >> e >> r;
	vector<P> rlist(v);
	vector<int> cost(v, MAX);
	for (int i = 0; i < e; i++) {
		cin >> s >> t >> d;
		rlist[s].push_back(P(d, t));
	}
	priority_queue<P, vector<P>, greater<P> > pq;
	pq.push(0, r);
	while (!pq.empty()) {
		P ten = pq.top();
		pq.pop();
		if (cost[ten.second] < ten.first) {
			continue;
		} 
		cost[ten.second] = ten.first;
		for (int i = 0; i < rlist[ten.second].size(); i++) {
			pq.push(P(rlist[i].first + cost[ten.second], rlist[i].second));
		}
	}
	for (int i = 0; i < v; i++) {
		if (cost[i] == INF) {
			cout << "INF" << endl;
		} else {
			cout << cost[i] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:26: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   20 |                 rlist[s].push_back(P(d, t));
      |                          ^~~~~~~~~
a.cc:23:16: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(int, int&)'
   23 |         pq.push(0, r);
      |         ~~~~~~~^~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; value_type = std::pair<int, int>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; value_type = std::pair<int, int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note:   candidate expects 1 argument, 2 provided
a.cc:31:55: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'size'
   31 |                 for (int i = 0; i < rlist[ten.second].size(); i++) {
      |                                                       ^~~~
a.cc:36:32: error: 'INF' was not declared in this scope
   36 |                 if (cost[i] == INF) {
      |                                ^~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

#define MAX 10000000/2-100

typedef pair<int, int> P;

int main() {
	int v, e, r;
	int s, t, d;
	cin >> v >> e >> r;
	vector<P> rlist(v);
	vector<int> cost(v, MAX);
	for (int i = 0; i < e; i++) {
		cin >> s >> t >> d;
		(rlist[s]).push_back(P(d, t));
	}
	priority_queue<P, vector<P>, greater<P> > pq;
	pq.push(0, r);
	while (!pq.empty()) {
		P ten = pq.top();
		pq.pop();
		if (cost[ten.second] < ten.first) {
			continue;
		} 
		cost[ten.second] = ten.first;
		for (int i = 0; i < rlist[ten.second].size(); i++) {
			pq.push(P(rlist[i].first + cost[ten.second], rlist[i].second));
		}
	}
	for (int i = 0; i < v; i++) {
		if (cost[i] == MAX) {
			cout << "INF" << endl;
		} else {
			cout << cost[i] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:28: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   20 |                 (rlist[s]).push_back(P(d, t));
      |                            ^~~~~~~~~
a.cc:23:16: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(int, int&)'
   23 |         pq.push(0, r);
      |         ~~~~~~~^~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; value_type = std::pair<int, int>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; value_type = std::pair<int, int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note:   candidate expects 1 argument, 2 provided
a.cc:31:55: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'size'
   31 |                 for (int i = 0; i < rlist[ten.second].size(); i++) {
      |                                                       ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

#define MAX 10000000/2-100

typedef pair<int, int> P;

int main() {
	int v, e, r;
	int s, t, d;
	cin >> v >> e >> r;
	vector<P> rlist(v);
	vector<int> cost(v, MAX);
	for (int i = 0; i < e; i++) {
		cin >> s >> t >> d;
		P p = {d, t};
		rlist[s].push_back(p);
	}
	priority_queue<P, vector<P>, greater<P> > pq;
	pq.push(P(0, r));
	while (!pq.empty()) {
		P ten = pq.top();
		pq.pop();
		if (cost[ten.second] < ten.first) {
			continue;
		} 
		cost[ten.second] = ten.first;
		for (int i = 0; i < rlist[ten.second].size(); i++) {
			pq.push(P(rlist[i].first + cost[ten.second], rlist[i].second));
		}
	}
	for (int i = 0; i < v; i++) {
		if (cost[i] == MAX) {
			cout << "INF" << endl;
		} else {
			cout << cost[i] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   21 |                 rlist[s].push_back(p);
      |                          ^~~~~~~~~
a.cc:32:55: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'size'
   32 |                 for (int i = 0; i < rlist[ten.second].size(); i++) {
      |                                                       ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

#define MAX 10000000/2-100

typedef pair<int, int> P;

int main() {
	int v, e, r;
	int s, t, d;
	cin >> v >> e >> r;
	vector<P> rlist(v);
	vector<int> cost(v, MAX);
	for (int i = 0; i < e; i++) {
		cin >> s >> t >> d;
		P p;
		p.first = d;
		p.second = t;
		rlist[s].push_back(p);
	}
	priority_queue<P, vector<P>, greater<P> > pq;
	pq.push(P(0, r));
	while (!pq.empty()) {
		P ten = pq.top();
		pq.pop();
		if (cost[ten.second] < ten.first) {
			continue;
		} 
		cost[ten.second] = ten.first;
		for (int i = 0; i < rlist[ten.second].size(); i++) {
			pq.push(P(rlist[i].first + cost[ten.second], rlist[i].second));
		}
	}
	for (int i = 0; i < v; i++) {
		if (cost[i] == MAX) {
			cout << "INF" << endl;
		} else {
			cout << cost[i] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:26: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   23 |                 rlist[s].push_back(p);
      |                          ^~~~~~~~~
a.cc:34:55: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'size'
   34 |                 for (int i = 0; i < rlist[ten.second].size(); i++) {
      |                                                       ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

#define MAX 10000000/2-100

typedef pair<int, int> P;

int main() {
	int v, e, r;
	int s, t, d;
	cin >> v >> e >> r;
	vector<P> rlist[100000];
	vector<int> cost(v, MAX);
	for (int i = 0; i < e; i++) {
		cin >> s >> t >> d;
		rlist[s].push_back(P(d, t));
	}
	priority_queue<P, vector<P>, greater<P> > pq;
	pq.push(P(0, r));
	while (!pq.empty()) {
		P ten = pq.top();
		pq.pop();
		if (cost[ten.second] < ten.first) {
			continue;
		} 
		cost[ten.second] = ten.first;
		for (int i = 0; i < rlist[ten.second].size(); i++) {
			pq.push(P(rlist[i].first + cost[ten.second], rlist[i].second));
		}
	}
	for (int i = 0; i < v; i++) {
		if (cost[i] == MAX) {
			cout << "INF" << endl;
		} else {
			cout << cost[i] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:44: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
   32 |                         pq.push(P(rlist[i].first + cost[ten.second], rlist[i].second));
      |                                            ^~~~~
a.cc:32:79: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   32 |                         pq.push(P(rlist[i].first + cost[ten.second], rlist[i].second));
      |                                                                               ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <functional>
#include <cstdlib>

using namespace std;

#define MAX 10000000/2-100

typedef pair<int, int> P;

int main() {
	int v, e, r;
	int s, t, d;
	cin >> v >> e >> r;
	vector< vector<P> > rlist(v, vector<P>);
	vector<int> cost(v, MAX);
	for (int i = 0; i < e; i++) {
		cin >> s >> t >> d;
		rlist[s].push_back(P(d, t));
	}
	priority_queue<P, vector<P>, greater<P> > pq;
	pq.push(P(0, r));
	while (!pq.empty()) {
		P ten = pq.top();
		pq.pop();
		if (cost[ten.second] < ten.first) {
			continue;
		} 
		cost[ten.second] = ten.first;
		for (int i = 0; i < rlist[ten.second].size(); i++) {
			pq.push(P(rlist[ten.second][i].first + cost[ten.second], rlist[ten.second][i].second));
		}
	}
	for (int i = 0; i < v; i++) {
		if (cost[i] == MAX) {
			cout << "INF" << endl;
		} else {
			cout << cost[i] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:47: error: expected primary-expression before ')' token
   17 |         vector< vector<P> > rlist(v, vector<P>);
      |                                               ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
 
class Main {
    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String[] line1 = br.readLine().split(" ");
        int V = Integer.valueOf(line1[0]);
        int E = Integer.valueOf(line1[1]);
        int r = Integer.valueOf(line1[2]);
        ArrayList<Edge>[] list = new ArrayList<Edge>[V];
        for (int i = 0; i < V; i++) {
            list[i] = new ArrayList<Edge>();
        }
 
        for (int i = 0; i < E; i++) {
            String[] line = br.readLine().split(" ");
            int s = Integer.valueOf(line[0]);
            int t = Integer.valueOf(line[1]);
            int d = Integer.valueOf(line[2]);
            Edge edge = new Edge(t, d);
            list[s].add(edge);
        }
 
        int[] dist = new int[V];
        Arrays.fill(dist, 20000000);
        dist[r] = 0;
        for (int i = 0; i < V - 1; i++) {
            for (int j = 0; j < V; j++) {
                if (dist[j] != 20000000) {
                    for (int k = 0; k < list[j].size(); k++) {
                        Edge edge = (Edge) (list[j].get(k));
                        dist[edge.to] = Math.min(dist[edge.to], dist[j] + edge.dist);
                    }
                }
 
            }
        }
        //最後
        for (int j = 0; j < V; j++) {
            if (dist[j] != 20000000) {
                for (int k = 0; k < list[j].size(); k++) {
                    Edge edge = (Edge) (list[j].get(k));
                    if (dist[edge.to] > dist[j] + edge.dist) {
                        System.out.println("NEGATIVE CYCLE");
                        return;
                    }
                }
            }
        }
        for (int i = 0; i < V; i++) {
            if (dist[i] == 20000000) {
                System.out.println("INF");
            } else {
                System.out.println(dist[i]);
            }
        }
    }
 
}
 
class Edge {
 
    int to, dist;
 
    public Edge(int to, int dist) {
        this.to = to;
        this.dist = dist;
    }
}

Compiler output:
Main.java:14: error: generic array creation
        ArrayList<Edge>[] list = new ArrayList<Edge>[V];
                                 ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
 
class Main {
    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String[] line1 = br.readLine().split(" ");
        int V = Integer.valueOf(line1[0]);
        int E = Integer.valueOf(line1[1]);
        int r = Integer.valueOf(line1[2]);
        List<Edge>[] list = new ArrayList<Edge>[V];
        for (int i = 0; i < V; i++) {
            list[i] = new ArrayList<Edge>();
        }
 
        for (int i = 0; i < E; i++) {
            String[] line = br.readLine().split(" ");
            int s = Integer.valueOf(line[0]);
            int t = Integer.valueOf(line[1]);
            int d = Integer.valueOf(line[2]);
            Edge edge = new Edge(t, d);
            list[s].add(edge);
        }
 
        int[] dist = new int[V];
        Arrays.fill(dist, 20000000);
        dist[r] = 0;
        for (int i = 0; i < V - 1; i++) {
            for (int j = 0; j < V; j++) {
                if (dist[j] != 20000000) {
                    for (int k = 0; k < list[j].size(); k++) {
                        Edge edge = (Edge) (list[j].get(k));
                        dist[edge.to] = Math.min(dist[edge.to], dist[j] + edge.dist);
                    }
                }
 
            }
        }
        //最後
        for (int j = 0; j < V; j++) {
            if (dist[j] != 20000000) {
                for (int k = 0; k < list[j].size(); k++) {
                    Edge edge = (Edge) (list[j].get(k));
                    if (dist[edge.to] > dist[j] + edge.dist) {
                        System.out.println("NEGATIVE CYCLE");
                        return;
                    }
                }
            }
        }
        for (int i = 0; i < V; i++) {
            if (dist[i] == 20000000) {
                System.out.println("INF");
            } else {
                System.out.println(dist[i]);
            }
        }
    }
 
}
 
class Edge {
 
    int to, dist;
 
    public Edge(int to, int dist) {
        this.to = to;
        this.dist = dist;
    }
}

Compiler output:
Main.java:14: error: generic array creation
        List<Edge>[] list = new ArrayList<Edge>[V];
                            ^
1 error
Language: Java

import java.io.*;
import java.util.Arrays;
   
class Main{
   
static final int INF=Integer.MAX_VALUE/2;
static final PrintWriter out=new PrintWriter(System.out);
   
   
static class Edge{
int from;
int to;
int cost;
Edge(int from,int to,int cost){
this.from=from; this.to=to; this.cost=cost;
}
}
   
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int v=Integer.parseInt(line.split(" ")[0]);
int e=Integer.parseInt(line.split(" ")[1]);
int r=Integer.parseInt(line.split(" ")[2]);
Edge[] es=new Edge[e];
int[] d=new int[v];
for(int i=0;i<e;i++){
line=br.readLine();
int s=Integer.parseInt(line.split(" ")[0]);
int t=Integer.parseInt(line.split(" ")[1]);
int c=Integer.parseInt(line.split(" ")[2]);
es[i]=new Edge(s,t,c);
}
BellmanFord(v,e,r,neg,es,d);
if(neg){
out.println("NEGATIVE CYCLE");
}
else{
for(int i=0;i<v;i++){
if(d[i]==INF){
out.println("INF");
}
else{
out.println(d[i]);
}
}
}
out.flush();
}
}
   
private static void BellmanFord(int v,int ee,int r,boolean neg,Edge[] es,int[] d){
Arrays.fill(d,INF);
d[r]=0;
for(int i=0;i<v;i++){
boolean update=false;
for(int j=0;j<ee;j++){
Edge e=es[j];
if(d[e.to]>d[e.from]+e.cost){
d[e.to]=d[e.from]+e.cost;
update=true;
}
}
if(!update){
break;
}
if(i==v-1){
neg=true;
break;
}
}
}
}

Compiler output:
Main.java:35: error: cannot find symbol
BellmanFord(v,e,r,neg,es,d);
                  ^
  symbol:   variable neg
  location: class Main
Main.java:36: error: cannot find symbol
if(neg){
   ^
  symbol:   variable neg
  location: class Main
2 errors