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

public class Main {
	static class Pair implements Comparable<Pair> {
		int a, b;

		Pair(String[] tokens) {
			this.a = Integer.parseInt(tokens[0]);
			this.b = Integer.parseInt(tokens[1]);
		}

		@Override
		public int compareTo(Pair o) {
			int compB = Integer.compare(this.b, o.b);
			if (compB != 0) {
				return -1 * compB;
			}
			return -1 * Integer.compare(this.a, o.a);
		}
	}

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);

		String[] tokens = in.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int M = Integer.parseInt(tokens[1]);
		List<Pair> pairs = new ArrayList<>(N);
		for (int i = 0; i < N; ++i) {
			pairs.add(new Pair(in.readLine().split(" ")));
		}
		Collections.sort(pairs);
		Deque<Pair> queue = new ArrayDeque<>(N);
		queue.addAll(pairs);
		long result = 0;
		int day = 0;
		while (!queue.isEmpty()) {
			Pair pair = queue.pollFirst();
			if (pair.a + day <= M) {
				++day;
				result += (long) (pair.b);
			}
		}
		System.out.println(result);
	}
}


Compiler output:
Main.java:20: error: cannot find symbol
	public static void main(String[] args) throws IOException {
	                                              ^
  symbol:   class IOException
  location: class Main
Main.java:21: error: cannot find symbol
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		^
  symbol:   class InputStreamReader
  location: class Main
Main.java:21: error: cannot find symbol
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		                               ^
  symbol:   class InputStreamReader
  location: class Main
Main.java:21: error: cannot find symbol
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		                                                            ^
  symbol:   variable StandardCharsets
  location: class Main
Main.java:22: error: cannot find symbol
		BufferedReader in = new BufferedReader(reader);
		^
  symbol:   class BufferedReader
  location: class Main
Main.java:22: error: cannot find symbol
		BufferedReader in = new BufferedReader(reader);
		                        ^
  symbol:   class BufferedReader
  location: class Main
Main.java:27: error: cannot find symbol
		List<Pair> pairs = new ArrayList<>(N);
		^
  symbol:   class List
  location: class Main
Main.java:27: error: cannot find symbol
		List<Pair> pairs = new ArrayList<>(N);
		                       ^
  symbol:   class ArrayList
  location: class Main
Main.java:31: error: cannot find symbol
		Collections.sort(pairs);
		^
  symbol:   variable Collections
  location: class Main
Main.java:32: error: cannot find symbol
		Deque<Pair> queue = new ArrayDeque<>(N);
		^
  symbol:   class Deque
  location: class Main
Main.java:32: error: cannot find symbol
		Deque<Pair> queue = new ArrayDeque<>(N);
		                        ^
  symbol:   class ArrayDeque
  location: class Main
11 errors
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  
  int n,m;
  cin>>n>>m;
  long long a,b;
  vector<pair<long long,long long>> ba;
  REP(i,n){
    cin>>a>>b;
    ba.push_back(make_pair(b,a));
  }
  sort(ba.begin(),ba.end(),greater<pair<long long,long long>>());
  long long ans=0;
  day=0;
  REP(i,n){
    if(day>m)break;
    if(day+ba[i].second>m)continue;
    ans += ba[i].first;
    day++;
  }
  cout<<ans<<endl;
  return 0;
}


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

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  
  int n,m;
  cin>>n>>m;
  long long a,b;
  vector<pair<long,long>> ba;
  REP(i,n){
    cin>>a>>b;
    ba.push_back(make_pair(b,a));
  }
  sort(ba.begin(),ba.end(),greater<pair<long long>>());
  long long ans=0;
  day=0;
  REP(i,n){
    if(day>m)break;
    if(day+ba[i].second>m)continue;
    ans += ba[i].first;
    day++;
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:101:46: error: wrong number of template arguments (1, should be 2)
  101 |   sort(ba.begin(),ba.end(),greater<pair<long long>>());
      |                                              ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
   89 |     struct pair;
      |            ^~~~
a.cc:101:50: error: template argument 1 is invalid
  101 |   sort(ba.begin(),ba.end(),greater<pair<long long>>());
      |                                                  ^~
a.cc:103:3: error: 'day' was not declared in this scope
  103 |   day=0;
      |   ^~~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  
  int n,m;
  cin>>n>>m;
  long long a,b;
  vector<pair<long,long>> ba;
  REP(i,n){
    cin>>a>>b;
    ba.push_back(make_pair(b,a));
  }
  sort(ba.begin(),ba.end(),greater()<pair<long long>>);
  long long ans=0;
  day=0;
  REP(i,n){
    if(day>m)break;
    if(day+ba[i].second>m)continue;
    ans += ba[i].first;
    day++;
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:101:48: error: wrong number of template arguments (1, should be 2)
  101 |   sort(ba.begin(),ba.end(),greater()<pair<long long>>);
      |                                                ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
   89 |     struct pair;
      |            ^~~~
a.cc:101:54: error: expected primary-expression before ')' token
  101 |   sort(ba.begin(),ba.end(),greater()<pair<long long>>);
      |                                                      ^
a.cc:103:3: error: 'day' was not declared in this scope
  103 |   day=0;
      |   ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define srand() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l,r) uniform_int_distribution<int>(l,r)(rng)
typedef unsigned long long ull;
const int inf=1039074182;
using namespace std;
int n,k;
int time[100005];
int cost[100005];
int id[100005];
priority_queue <int> que;

bool compare(const int a,const int b)
{
	return time[a]<time[b];
}

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",time+i,cost+i);
		id[i]=i;
	}
	sort(id,id+n,compare);
	int res=0;
	int i=0;
	for(int day=k-1;day>=0;day--)
	{
		while(i<n && time[id[i]]+day<=k)
		{
			que.push(cost[id[i++]]);
		}
		if(!que.empty()) res+=que.top(),que.pop();
	}
	cout<<res<<endl;
	return 0;
}

Compiler output:
a.cc:27:16: error: 'int time [100005]' redeclared as different kind of entity
   27 | int time[100005];
      |                ^
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'bool compare(int, int)':
a.cc:34:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |         return time[a]<time[b];
      |                      ^
a.cc:34:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |         return time[a]<time[b];
      |                              ^
a.cc: In function 'int main()':
a.cc:43:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   43 |                 scanf("%d%d",time+i,cost+i);
      |                              ~~~~^~
a.cc:51:40: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   51 |                 while(i<n && time[id[i]]+day<=k)
      |                                        ^
a.cc:51:41: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   51 |                 while(i<n && time[id[i]]+day<=k)
      |                              ~~~~~~~~~~~^~~~
a.cc:51:45: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   51 |                 while(i<n && time[id[i]]+day<=k)
      |                              ~~~~~~~~~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

vector<int> G[2505];
vector<int> rG[2505];
bool reachable_0[2505];
bool reachable_N[2505];
bool reachable[2505];

void dfs_0(int v = 0){
  if(reachable_0[v]) return;
  reachable_0[v] = true;
  for(auto& nv: G[v]) dfs_0(nv);
  return;
}
void dfs_N(int v){
  if(reachable_N[v]) return;
  reachable_N[v] = true;
  for(auto& nv: rG[v]) dfs_N(nv);
  return;
}

struct edge{
  int src, dst;
  long long cost;
};

int main(){
  using namespace std;
  int n, m;
  long long p;
  cin>>n>>m>>p;
  int a[m], b[m];
  long long c[m];
  REP(i, m){
    cin>>a[i]>>b[i]>>c[i];
    a[i]--; b[i]--;
  }
  
  REP(i, m){
    G[a[i]].push_back(b[i]);
    rG[b[i]].push_back(a[i]);
  }
  dfs_0(); dfs_N(n - 1);
  REP(i, n) reachable[i] = reachable_0[i] && reachable_N[i];
  
  vector<edge> edges;
  REP(i, m){
    if(!reachable[a[i]] || !reachable[b[i]]) continue;
    edges.push_back({a[i], b[i], -(c[i] - p)});
  }
  
  vector<long long> dist(n, INF);
  dist[0] = 0;
  REP(_, n - 1){
    for(auto& e: edges){
      int src = e.src, dst = e.dst;
      if(dist[dst] > dist[src] + e.cost) dist[dst] = dist[src] + e.cost;
    }
  }
  for(auto& e: edges){
    int src = e.src, dst = e.dst;
    if(dist[dst] > dist[src] + e.cost){
      cout << -1 << endl;
      return 0;
    }
  }
  
  long long ans = max(0, -dst[n - 1]);
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:134:27: error: 'dst' was not declared in this scope; did you mean 'dist'?
  134 |   long long ans = max(0, -dst[n - 1]);
      |                           ^~~
      |                           dist
Language: C++

#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

//頂点fromから頂点toへのコストcostの辺
struct edge { ll from, to, cost; };
edge es[345678]; //辺
ll d[345678]; //最短距離
//Vは頂点数、Eは辺数
//s番目の頂点から各頂点への最短距離を求める
void Bellman_Ford(ll V, ll E, ll s) {
	for (int i = 0; i <= V; i++) d[i] = INF;
	d[s] = 0;
	for (int z = 0; z <= V; z++) {
		bool flag = false;
		for (int i = 0; i < E; i++) {
			edge e = es[i];
			if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				if (used1[e.to] == true && used2[e.to] == true) { flag = true; }
			}
			if (flag == false) { break; }
			if (z == V) {
				d[V] = INF;
			}
		}
	}
}


ll test[12345678], a[1234567], b[1234567], c[1234567];
bool used1[1 << 18], used2[1 << 18];
signed main() {
	ll n, m, ppp; cin >> n >> m >> ppp;
	rep(h, m) {
		cin >> a[h] >> b[h] >> c[h]; c[h] -= ppp;
		es[h] = { a[h], b[h], 0 - c[h] };
	}
	used1[1] = true;
	rep(h, n) {
		rep(i, m) {
			if (used1[a[i]] == true) { used1[b[i]] = true; }
		}
	}
	used2[n] = true;
	rep(h, n) {
		rep(i, m) {
			if (used2[b[i]] == true) { used2[a[i]] = true; }
		}
	}
	Bellman_Ford(n, m, 1);
	if (d[n] == INF) { cout << "-1\n"; }
	else { cout << max((ll)0, 0 - d[n]) << endl; }
	return 0;
}

Compiler output:
a.cc: In function 'void Bellman_Ford(ll, ll, ll)':
a.cc:26:37: error: 'used1' was not declared in this scope
   26 |                                 if (used1[e.to] == true && used2[e.to] == true) { flag = true; }
      |                                     ^~~~~
a.cc:26:60: error: 'used2' was not declared in this scope
   26 |                                 if (used1[e.to] == true && used2[e.to] == true) { flag = true; }
      |                                                            ^~~~~
Language: C++

#include<bits/stdc++.h>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
#define puts(x) cout << x << "\n"
constexpr int mod = 1000000007;
using namespace std;
int input() { int r; cin >> r; return r; }
int n, m, q, c;
int a[60000], b[60000], c[60000], p[60000];
bool b00l[60000];
signed main() {
	cin >> n >> m >> q;
	for1(i, m) { cin >> a[i] >> b[i] >> c; c[i] = c - q; }
	b00l[1] = 1;
	for1(valsqotch, 3 * n + 10) {
		for1(i, m) {
			if (b00l[a[i]]) {
				if (!b00l[b[i]]) {
					b00l[b[i]] = 1;
					p[b[i]] = p[a[i]] + c[i];
				}
				else {
					if (p[b[i]] < p[a[i]] + c[i]) {
						if (b[i] == n && valsqotch > 2 * n) {
							puts("inf"); return 0;
						}
						p[b[i]] = p[a[i]] + c[i];
					}
				}
			}
		}
	}
	puts(p[n]);
}

Compiler output:
a.cc:12:25: error: conflicting declaration 'long long int c [60000]'
   12 | int a[60000], b[60000], c[60000], p[60000];
      |                         ^
a.cc:11:14: note: previous declaration as 'long long int c'
   11 | int n, m, q, c;
      |              ^
a.cc: In function 'int main()':
a.cc:16:49: error: invalid types 'long long int[long long int]' for array subscript
   16 |         for1(i, m) { cin >> a[i] >> b[i] >> c; c[i] = c - q; }
      |                                                 ^
a.cc:23:62: error: invalid types 'long long int[long long int]' for array subscript
   23 |                                         p[b[i]] = p[a[i]] + c[i];
      |                                                              ^
a.cc:26:66: error: invalid types 'long long int[long long int]' for array subscript
   26 |                                         if (p[b[i]] < p[a[i]] + c[i]) {
      |                                                                  ^
a.cc:30:70: error: invalid types 'long long int[long long int]' for array subscript
   30 |                                                 p[b[i]] = p[a[i]] + c[i];
      |                                                                      ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;
//printf("%.10f\n", n);

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}

//頂点fromから頂点toへのコストcostの辺
struct edge { ll from, to, cost; };
edge es[345678]; //辺
ll d[345678]; //最短距離
//Vは頂点数、Eは辺数
//s番目の頂点から各頂点への最短距離を求める
void Bellman_Ford(ll V, ll E, ll s) {
	for (int i = 0; i <= V; i++) d[i] = INF;
	d[s] = 0; ll sum = 0;
	for (int z = 0; z < V; z++) {
		for (int i = 0; i < E; i++) {
			edge e = es[i];
			if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
			}
		}
	}
}
//trueなら負の経路が存在する
bool find_negative_loop(ll V, ll E) { //Vは頂点数、Eは辺数
	memset(d, 0, sizeof(d)); ll sum = 0;
	for (int i = 0; i < V; i++) {
		for (int j = 0; j < E; j++) {
			edge e = es[j];
			if (d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				//n回目にも更新があるなら負の経路が存在
				if (i == V - 1 && d[V] != sum)return true;
			}
		}
		if (i == V - 2) { sum = d[V]; }
	}
	return false;
}
ll test[12345678];
signed main() {
	ll n, m, p, a, b, c; cin >> n >> m >> p;
	for (int h = 0; h < m; h++) {
		cin >> a >> b >> c;
		es[h] = { a, b, 0 - c + p };
	}
	if (find_negative_loop(n, m)) { cout << "inf" << endl; return 0; }
	Bellman_Ford(n, m, 1);
	cout << 0 - d[n] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'bool find_negative_loop(ll, ll)':
a.cc:61:9: error: 'memset' was not declared in this scope
   61 |         memset(d, 0, sizeof(d)); ll sum = 0;
      |         ^~~~~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include<functional>
  +++ |+#include <cstring>
   15 | //#include<bits/stdc++.h>
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <tuple>
#include <bitset>
#include <random>
#define REP(i,n) for(int i=0;i<n;i++)
#define INF 100000000000007
using namespace std;
using pii=pair<int,int>;




vector<int64_t> dist;
vector<int> pre;


void Bellman_Ford(vector<vector<pii>> adj_list,int start){
    
    
    int n=adj_list.size();
    /*初期化*/
    dist=vector<int64_t>(n,INF);
    pre=vector<int>(n);/*最短経路におけるひとつ前の頂点*/
    
    dist.at(start)=0;
    REP(i,n-1){
        REP(u,n){
            for(auto vpair : adj_list.at(u)){
                int weight_u_to_v,v;
                tie(v,weight_u_to_v)=vpair;
                if(dist.at(u)!=INF && dist.at(v)>dist.at(u)+weight_u_to_v){
                  dist.at(v)=dist.at(u)+weight_u_to_v;
                  pre.at(v)=u;
                  
                }

            }
        }
    }

    REP(i,n){/*ここで更新があったら負閉路が存在*/
        REP(u,n){
            for(auto vpair : adj_list.at(u)){
                int weight_u_to_v,v;
                tie(v,weight_u_to_v)=vpair;
                if(dist.at(u)!=INF && dist.at(v)>dist.at(u)+weight_u_to_v){
                  dist.at(v)=-INF
                  
                }

            }
        }
    }

  
}
int main() {
  int V,E,p;
  cin>>V>>E>>p;
  vector<vector<pair<int,int>>> adj_list(V);
  
  REP(i,E){
    int s,t,d;
    cin>>s>>t>>d;
    s--;
    t--;/*添字の調整*/
    d-=p;
    adj_list.at(s).push_back(make_pair(t,-d));

  }
  

  Bellman_Ford(adj_list,0);

  if(dist.at(V-1)==-INF){
      cout<<-1<<endl;
      return 0;
  }
  
  
  int64_t score=0;
  if(-dist.at(V-1)>0){
      score=-dist.at(V-1);
  }
  cout<<score<<endl;




  return 0;
}

Compiler output:
a.cc: In function 'void Bellman_Ford(std::vector<std::vector<std::pair<int, int> > >, int)':
a.cc:58:17: error: expected ';' before '}' token
   58 |                 }
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using LL = long long;
using P = pair<int,int>;
const int Max_N=2510;
const LL INF=1e18;

struct edge{
	int to;
	LL coin;
	edge(int to, LL coin): to(to), coin(coin) {}
};

bool available[Max_N];
bool visited[Max_N];
vector<vector<edge>> G;

void dfs(int n){
	visited[n]=true;
	for(auto e:G[n]){
		if(visited[e.to]) continue;
		dfs(e.to);
	}
}

int main(){
	int N, M, P;
	cin >> N >> M >> P;
	rep(i,N) available[i]=true;
	G.resize(N);
	rep(i,M){
		int a, b;
		LL c;
		cin >> a >> b >> c;
		a--; b--; c-=P;
		edge e(b,-c);
		G[a].emplace_back(e);
	}
	rep(i,N){
		rep(j,N) visited[j]=false;
		dfs(i);
		if(visited[N-1]==false) available[i]=false;
	}
	vector<LL> dist(N,INF);
	dist[0]=0;
	rep(n,N){
		if(available[n]==false) continue;
		for(auto e:G[n]){
			if(e.to==n and e.cost<0){
				cout << -1 << endl;
				return 0;
			}
			if(available[e.to]==false) continue;
			if(dist[e.to]>dist[n]+e.coin){
				dist[e.to]=dist[n]+e.coin;
				if(n==N-1){
					cout << -1 << endl;
					return 0;
				}
			}
		}
	}
	if(dist[N-1]>0) cout << 0 << endl;
	else cout << -dist[N-1] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:42: error: 'struct edge' has no member named 'cost'
   51 |                         if(e.to==n and e.cost<0){
      |                                          ^~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int,int>
#define PP pair<P,P>
#define T tuple<int,int,int> 
using namespace std;
 
vector<vector<int> > preki,preki2;
vector<bool> visited,visited2;
 
void dfs(int now){
    if(visited[now]) return;
    visited[now]=true;
    for(auto x : preki[now]){
        dfs(x);
    }
}
 
void dfs2(int now){
    if(visited2[now]) return;
    visited2[now]=true;
    for(auto x : preki2[now]){
        dfs2(x);
    }
}
 
int main(){
    int n,m,p;
    cin >> n >> m >> p;
    map<P,int> cost;
    vector<vector<int> > prekiki(n);
    preki=preki2=prekiki;
 
    vector<bool> exx(n,false);
 
    visited=visited2=exx;
    
    vector<T> sidelist;
    rep(i,m){
        int a,b,c; cin >> a >> b >> c;
        a--; b--;
        c=-c+p;
        sidelist.emplace_back(a,b,c);
        preki[a].push_back(b);
        preki2[b].push_back(a);
        cost[P(a,b)]=-c+p;
    }
    dfs(0);
    dfs2(n-1);
 
    vector<P> ki;
    rep(i,n) visited[i]=visited[i]&visited2[i];
/*
    rep(i,m){
        int a=sidelist[i].first;
        int b=sidelist[i].second;
        //cout << visited[a] << visited[b] << visited2[a] << visited2[b] << endl;
        bool check=visited[a]&visited[b]&visited2[a]&visited2[b];
        //bool check2=visited2[a]&visited2[b];
        //check=check&check2;
        if(check) ki.push_back(P(a,b));
    }
*/
    vector<int> ans(n,INF);
    ans[0]=0;
 
    bool update=true;
    int times=0;
 
    while(update){
        times++;
        update=false;
        rep(i,m){
            int a,b,c;
            tie(a,b,c) = sidelist[i];
            int newcost=ans[a]+c;
            if(c!=cost[P(a,b)]){
                8/=0;
            }
            if(!visited[a]) continue;
            if(!visited[b]) continue;
            if(ans[b]>newcost){
                update=true;
                ans[b]=newcost;
            }
        }
        if(times>n){
            cout << -1 << endl;
            return 0;
        }
    }
 
    if(ans[n-1]>0) ans[n-1]=0;
    cout << -ans[n-1] << endl;
return 0;
}
 

Compiler output:
a.cc: In function 'int main()':
a.cc:83:18: warning: division by zero [-Wdiv-by-zero]
   83 |                 8/=0;
      |                 ~^~~
a.cc:83:20: error: lvalue required as left operand of assignment
   83 |                 8/=0;
      |                    ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int,int>
#define PP pair<P,P>
using namespace std;
 
int n,m,p;
vector<vector<int> > preki,preki2;
vector<bool> visited,visited2;
 
void dfs(int now){
    if(visited[now]) return;
    visited[now]=true;
    for(auto x : preki[now]){
        dfs(x);
    }
}
 
void dfs2(int now){
    if(visited2[now]) return;
    visited2[now]=true;
    for(auto x : preki2[now]){
        dfs2(x);
    }
}
 
int main(){
    cin >> n >> m >> p;
    map<P,int> cost;
    vector<vector<int> > prekiki(n);
    preki=preki2=prekiki;
 
    vector<bool> exx(n,false);
 
    visited=visited2=exx;
    
    vector<P> sidelist;
    rep(i,m){
        int a,b,c; cin >> a >> b >> c;
        a--; b--;
        sidelist.push_back(P(a,b));
        preki[a].push_back(b);
        preki2[b].push_back(a);
        cost[P(a,b)]=-c+p;
    }
    dfs(0);
    dfs2(n-1);
 
    vector<P> ki;
    rep(i,n) visited[i]=visited[i]&visited2[i];
/*
    rep(i,m){
        int a=sidelist[i].first;
        int b=sidelist[i].second;
        //cout << visited[a] << visited[b] << visited2[a] << visited2[b] << endl;
        bool check=visited[a]&visited[b]&visited2[a]&visited2[b];
        //bool check2=visited2[a]&visited2[b];
        //check=check&check2;
        if(check) ki.push_back(P(a,b));
    }
*/
    vector<int> ans(n,INF);
    ans[0]=0;
 
    bool update=true;
    int times=0;
 
    while(update){
        times++;
        update=false;
        rep(i,m){
            int res1=sidelist[i].first;
            int res2=sidelist[i].second;
            int newcost=ans[res1]+cost[P(res1,res2)]);
            if(!visited[res1]) continue;
            if(!visited[res2]) continue;
            if(ans[res2]>newcost){
                update=true;
                ans[res2]=newcost;
            }
        }
        if(times>n){
            cout << -1 << endl;
            return 0;
        }
    }
 
    if(ans[n-1]>0) ans[n-1]=0;
    cout << -ans[n-1] << endl;
return 0;
}
 

Compiler output:
a.cc: In function 'int main()':
a.cc:79:53: error: expected ',' or ';' before ')' token
   79 |             int newcost=ans[res1]+cost[P(res1,res2)]);
      |                                                     ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int,int>
#define PP pair<P,P>
using namespace std;

int n,m,p;
vector<vector<int> > preki,preki2;
vector<bool> visited,visited2;

void dfs(int now){
    if(visited[now]) return;
    visited[now]=true;
    for(auto x : preki[now]){
        dfs(x);
    }
}

void dfs2(int now){
    if(visited2[now]) return;
    visited2[now]=true;
    for(auto x : preki2[now]){
        dfs2(x);
    }
}

int main(){
    cin >> n >> m >> p;
    map<P,int> cost;
    vector<vector<int> > prekiki(n);
    preki=preki2=prekiki;

    vector<bool> exx(n,false);

    visited=visited2=exx;
    
    vector<P> sidelist;
    rep(i,m){
        int a,b,c; cin >> a >> b >> c;
        a--; b--;
        sidelist.push_back(P(a,b));
        preki[a].push_back(b);
        preki2[b].push_back(a);
        cost[P(a,b)]=-c+p;
    }
    dfs(0);
    visited=exx;
    dfs2(n-1);

    vector<P> ki;

    rep(i,m){
        int a=sidelist[i].first;
        int b=sidelist[i].second;
        bool check=visited[a]&visited[b]&visited2[a]&visited2[b];
        //bool check2=visited2[a]&visited2[b];
        //check=check&check2;
        if(check) ki.push_back(P(a,b));
    }

    vector<int> ans(n,INF);
    ans[0]=0;

    bool update=true;
    int times=0;

    while(update){
        times++;
        update=false;
        rep(i,ki.size()){
            int res1=ki[i].first;
            int res2=ki[i].second;
            int newcost=ans[res1]+cost[ki[i]];
            if(!check[res1]) continue;
            if(!check[res2]) continue;
            if(ans[res2]>newcost){
                update=true;
                ans[res2]=newcost;
            }
        }
        if(times>n){
            cout << -1 << endl;
            return 0;
        }
    }

    if(ans[n-1]>0) ans[n-1]=0;
    cout << -ans[n-1] << endl;
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:79:17: error: 'check' was not declared in this scope
   79 |             if(!check[res1]) continue;
      |                 ^~~~~
a.cc:80:17: error: 'check' was not declared in this scope
   80 |             if(!check[res2]) continue;
      |                 ^~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int,int>
#define PP pair<P,P>
using namespace std;

int n,m,p;
vector<vector<int> > preki,preki2;
vector<bool> visited,visited2;

void dfs(int now){
    if(visited[now]) return;
    visited[now]=true;
    for(auto x : preki[now]){
        dfs(x);
    }
}

void dfs2(int now){
    if(visited2[now]) return;
    visited2[now]=true;
    for(auto x : preki2[now]){
        dfs2(x);
    }
}

int main(){
    cin >> n >> m >> p;
    map<P,int> cost;
    vector<vector<int> > prekiki(n);
    preki=preki2=prekiki;

    vector<bool> exx(false,0);

    visited=visited2=exx;
    
    vector<P> sidelist;
    rep(i,m){
        int a,b,c; cin >> a >> b >> c;
        a--; b--;
        sidelist.push_back(P(a,b));
        preki[a].push_back(b);
        preki2[b].push_back(a);
        cost[P(a,b)]=-c+p;
    }
    dfs(0);
    visited=exx;
    dfs2(n-1);

    vector<P> ki;

    rep(i,m){
        int a=sidelist[i].first;
        int b=sidelist[i].second;
        bool check=visted[a]&visited[b];
        bool check2=visited2[a]&visited2[b];
        check=check&check2;
        if(check) ki.push_back(P(a,b));
    }

    vector<int> ans(n,INF);
    ans[0]=0;

    bool update=true;
    int times=0;

    while(update){
        times++;
        update=false;
        rep(i,ki.size()){
            int res1=ki[i].first;
            int res2=ki[i].second;
            int newcost=ans[res1]+cost[ki[i]];
            if(ans[res2]>newcost){
                update=true;
                ans[res2]=newcost;
            }
        }
        if(times>n){
            cout << -1 << endl;
            return 0;
        }
    }

    if(ans[n-1]>0) ans[n-1]=0;
    cout << -ans[n-1] << endl;
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:60:20: error: 'visted' was not declared in this scope; did you mean 'visited'?
   60 |         bool check=visted[a]&visited[b];
      |                    ^~~~~~
      |                    visited
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int,int>
#define PP pair<P,P>
using namespace std;

int n,m,p;
vector<vector<int> > preki,preki2;
vector<bool> visited,visited2;

void dfs(int now){
    if(visited[now]) return;
    visited[now]=true;
    for(auto x : preki[now]){
        dfs(x);
    }
}

void dfs2(int now){
    if(visited2[now]) return;
    visited2[now]=true;
    for(auto x : preki2[now]){
        dfs2(x);
    }
}

int main(){
    cin >> n >> m >> p;
    map<P,int> cost;
    vector<vector<int> > prekiki(n);
    preki=preki2=prekiki;

    vector<bool> exx(false,0);

    visited=visited2=exx;
    
    vector<P> sidelist;
    rep(i,m){
        int a,b,c; cin >> a >> b >> c;
        a--; b--;
        sidelist.push_back(P(a,b));
        preki[a].push_back(b);
        preki2[b].push_back(a);
        cost[P(a,b)]=-c+p;
    }
    dfs(0);
    visited=exx;
    dfs2(n-1);

    vector<P> ki;

    rep(i,m){
        int a=sidelist[i].first;
        int b=sidelist[i].second;
        int check=visted[a]&visited[b]&visited2[a]&visited2[b];
        if(check) ki.push_back(P(a,b));
    }

    vector<int> ans(n,INF);
    ans[0]=0;

    bool update=true;
    int times=0;

    while(update){
        times++;
        update=false;
        rep(i,ki.size()){
            int res1=ki[i].first;
            int res2=ki[i].second;
            int newcost=ans[res1]+cost[ki[i]];
            if(ans[res2]>newcost){
                update=true;
                ans[res2]=newcost;
            }
        }
        if(times>n){
            cout << -1 << endl;
            return 0;
        }
    }

    if(ans[n-1]>0) ans[n-1]=0;
    cout << -ans[n-1] << endl;
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:60:19: error: 'visted' was not declared in this scope; did you mean 'visited'?
   60 |         int check=visted[a]&visited[b]&visited2[a]&visited2[b];
      |                   ^~~~~~
      |                   visited
Language: Java

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;

public class Main {
	static long INF = Long.MAX_VALUE >> 1;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//		BufferedReader br = new BufferedReader(new FileReader("Graph.in"));
		String[] tokens = br.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int M = Integer.parseInt(tokens[1]);
		int P = Integer.parseInt(tokens[2]);
		Edge[] edges = new Edge[M];
		for (int i = 0; i < M; i++) {
			tokens = br.readLine().split(" ");
			int src = Integer.parseInt(tokens[0]) - 1;
			int dest = Integer.parseInt(tokens[1]) - 1;
			int weight = Integer.parseInt(tokens[2]) - P;
			edges[i] = new Edge(src, dest, weight);
		}
		long[] dist = new long[N];
		Arrays.fill(dist, -INF);
		dist[0] = 0;
		for (int i = 1; i < N; i++) {
			for (Edge e : edges) {
				if (dist[e.u] != -INF && dist[e.v] < dist[e.u] + e.w) {
					dist[e.v] = dist[e.u] + e.w;
				}
			}
		}
		long max = dist[N - 1];
		for (Edge e : edges) {
			if (dist[e.u] != -INF && dist[e.v] < dist[e.u] + e.w) {
				dist[e.v] = INF;
			}
		}
//		System.out.println(Arrays.toString(dist));
		System.out.println(Math.abs(dist[N - 1]) >= (5e10) ? -1 : Math.max(0, max));
	}

	static class Edge {
		int u;
		int v;
		int w;

		Edge(int src, int dest, int w) {
			u = src;
			v = dest;
			this.w = w;
		}

		Edge(Edge e) {
			u = e.u;
			v = e.v;
			w = e.w;
		}

		@Override
		public String toString() {
			return String.format("[%d, %d, %d]", u, v, w);
		}

	}
}

Compiler output:
Main.java:10: error: cannot find symbol
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		                                           ^
  symbol:   class InputStreamReader
  location: class Main
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class TEST {
	static long INF = (long) 1e9 + 7;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tokens = br.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int M = Integer.parseInt(tokens[1]);
		int P = Integer.parseInt(tokens[2]);
		Edge[] edges = new Edge[M];
		for (int i = 0; i < M; i++) {
			tokens = br.readLine().split(" ");
			int src = Integer.parseInt(tokens[0]) - 1;
			int dest = Integer.parseInt(tokens[1]) - 1;
			int weight = Integer.parseInt(tokens[2]);
			edges[i] = new Edge(src, dest, weight);
		}
		long[] dist = new long[N];
		Arrays.fill(dist, -INF);
		dist[0] = 0;
		long max = 0;
		for (int i = 1; i < N; i++) {
			long[] curr = new long[N];
			Arrays.fill(curr, -INF);
			for (Edge e : edges) {
				curr[e.v] = Math.max(curr[e.v], dist[e.u] + e.w);
			}
			if (curr[N - 1] != INF)
				max = Math.max(max, curr[N - 1] - P * i);
			for (int v = 0; v < N; v++) {
				dist[v] = Math.max(dist[v], curr[v]);
			}
		}
//		System.out.println(Arrays.toString(dist));
		for (Edge e : edges) {
			if (e.v == N - 1)
				if (dist[e.v] < dist[e.u] + e.w) {
					System.out.println(-1);
					return;
				}
		}
		System.out.println(dist[N - 1] == INF ? -1 : max);
	}

	static class Edge {
		int u;
		int v;
		int w;

		Edge(int src, int dest, int w) {
			u = src;
			v = dest;
			this.w = w;
		}

		Edge(Edge e) {
			u = e.u;
			v = e.v;
			w = e.w;
		}

		@Override
		public String toString() {
			return String.format("[%d, %d, %d]", u, v, w);
		}
	}
}


Compiler output:
Main.java:6: error: class TEST is public, should be declared in a file named TEST.java
public class TEST {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

struct Edge {
    int to;
    int c;
    Edge (int to, int c): to(to), c(c) {}
}

vector<Edge> g[2505];


int main(){
    int n, m, p;
    cin >> n >> m >> p;
    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        g[a].emplace_back(b, p-c);
    }
    int ans = 0;
    
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc:21:14: error: invalid declarator before 'g'
   21 | vector<Edge> g[2505];
      |              ^
a.cc: In function 'int main()':
a.cc:31:9: error: 'g' was not declared in this scope
   31 |         g[a].emplace_back(b, p-c);
      |         ^
Language: C++

#include <iostream>
#include <bits/stdc++.h>

using namespace std;
#define mf 100000000000LL
int n,m,p;
vector<pair<int,int>> rad[3000];
long long dp[3000];
int rcnt[3000],mn;
bool nv[3000];

void dfs(int now,long long sc)
{
    if(sc>1000000000||++rcnt[now]>max(mn)) {
        nv[now] = true;sc=mf;
    }
    dp[now]=sc;

    for(int i=0;i<rad[now].size();++i){
        if(dp[rad[now][i].first]>=sc+rad[now][i].second-p
           ||nv[rad[now][i].first])
        continue;
        dfs(rad[now][i].first,sc+rad[now][i].second-p);
    }
}

int main()
{
    scanf("%d%d%d",&n,&m,&p);mn = max(m,n);
    for(int i=1;i<=n;++i){
        dp[i] = -1000000000;
    }
    int a,b,c;
    for(int i=0;i<m;++i){
        scanf("%d%d%d",&a,&b,&c);
        rad[a].push_back(pair<int,int>(b,c));
    }
    dfs(1,0);
    if(dp[n]==-1000000000||dp[n]>1000000000) printf("-1\n");
    else printf("%lld\n",max(dp[n],0LL));
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, long long int)':
a.cc:14:38: error: no matching function for call to 'max(int&)'
   14 |     if(sc>1000000000||++rcnt[now]>max(mn)) {
      |                                   ~~~^~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:14:38: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |     if(sc>1000000000||++rcnt[now]>max(mn)) {
      |                                   ~~~^~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided