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


import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(final String args[]) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		edge[] e = new edge[M];
		int dist[][] = new int[N][N];
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(i!=j) dist[i][j] = Integer.MAX_VALUE;
				else dist[i][j] = 0;
			}
		}
		ArrayList<Integer> cities = new ArrayList<>();
		for (int i = 0; i < R; i++) {
			cities.add(Integer.parseInt(sc.next()));
		}
		for (int i = 0; i < M; i++) {
			int a = Integer.parseInt(sc.next()) - 1;
			int b = Integer.parseInt(sc.next()) - 1;
			int c = Integer.parseInt(sc.next());
			edge[i] = new edge(a,b,c);
			dist[a][b] = Math.min(c,dist[a][b]);
			dist[b][a] = Math.min(c,dist[b][a]);
		}

		for(int k=0;k<N;k++){
			for(int i=0;i<N;i++){
				for(int j=0;j<N;j++){
					dist[i][j] = Math.min(dist[i][j],dist[i][k]+dist[k][j]);
				}
			}
		}

		int result = 0;
		for(int i=0;i<cities.size()-1;i++){
			result += dist[i][i+1];
		}


		out.println(result);
		out.flush();
	}
}
 class edge {
	int cost;

	public edge(final int a, final int b, final int c) {
		this.cost = c;
	}
 }


Compiler output:
Main.java:30: error: cannot find symbol
			edge[i] = new edge(a,b,c);
			^
  symbol:   variable edge
  location: class Main
1 error
Language: C++

package contest;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(final String args[]) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		edge[] e = new edge[M];
		int dist[][] = new int[N][N];
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(i!=j) dist[i][j] = Integer.MAX_VALUE;
				else dist[i][j] = 0;
			}
		}
		ArrayList<Integer> cities = new ArrayList<>();
		for (int i = 0; i < R; i++) {
			cities.add(Integer.parseInt(sc.next()));
		}
		for (int i = 0; i < M; i++) {
			int a = Integer.parseInt(sc.next()) - 1;
			int b = Integer.parseInt(sc.next()) - 1;
			int c = Integer.parseInt(sc.next());
			edge[i] = new edge(a,b,c);
			dist[a][b] = Math.min(c,dist[a][b]);
			dist[b][a] = Math.min(c,dist[b][a]);
		}

		for(int k=0;k<N;k++){
			for(int i=0;i<N;i++){
				for(int j=0;j<N;j++){
					dist[i][j] = Math.min(dist[i][j],dist[i][k]+dist[k][j]);
				}
			}
		}

		int result = 0;
		for(int i=0;i<cities.size()-1;i++){
			result += dist[i][i+1];
		}


		out.println(result);
		out.flush();
	}
}
 public class edge {
	int cost;

	public edge(int a, int b, int c) {
		this.cost = c;
	}
 }



Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package contest;
      | ^~~~~~~
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.PrintWriter;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.ArrayList;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.HashMap;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import java.util.Scanner;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: expected unqualified-id before 'public'
    8 | public class Main {
      | ^~~~~~
a.cc:54:2: error: expected unqualified-id before 'public'
   54 |  public class edge {
      |  ^~~~~~
Language: Java

package contest;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(final String args[]) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		edge[] e = new edge[M];
		int dist[][] = new int[N][N];
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(i!=j) dist[i][j] = Integer.MAX_VALUE;
				else dist[i][j] = 0;
			}
		}
		ArrayList<Integer> cities = new ArrayList<>();
		for (int i = 0; i < R; i++) {
			cities.add(Integer.parseInt(sc.next()));
		}
		for (int i = 0; i < M; i++) {
			int a = Integer.parseInt(sc.next()) - 1;
			int b = Integer.parseInt(sc.next()) - 1;
			int c = Integer.parseInt(sc.next());
			edge[i] = new edge(a,b,c);
			dist[a][b] = Math.min(c,dist[a][b]);
			dist[b][a] = Math.min(c,dist[b][a]);
		}

		for(int k=0;k<N;k++){
			for(int i=0;i<N;i++){
				for(int j=0;j<N;j++){
					dist[i][j] = Math.min(dist[i][j],dist[i][k]+dist[k][j]);
				}
			}
		}

		int result = 0;
		for(int i=0;i<cities.size()-1;i++){
			result += dist[i][i+1];
		}


		out.println(result);
		out.flush();
	}

 class edge {
	int cost;

	public edge(final int a, final int b, final int c) {
		this.cost = c;
	}
 }
}

Compiler output:
Main.java:31: error: cannot find symbol
			edge[i] = new edge(a,b,c);
			^
  symbol:   variable edge
  location: class Main
Main.java:31: error: non-static variable this cannot be referenced from a static context
			edge[i] = new edge(a,b,c);
			          ^
2 errors
Language: Java

package contest;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(final String args[]) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		edge[] e = new edge[M];
		int dist[][] = new int[N][N];
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(i!=j) dist[i][j] = Integer.MAX_VALUE;
				else dist[i][j] = 0;
			}
		}
		ArrayList<Integer> cities = new ArrayList<>();
		for (int i = 0; i < R; i++) {
			cities.add(Integer.parseInt(sc.next()));
		}
		for (int i = 0; i < M; i++) {
			int a = Integer.parseInt(sc.next()) - 1;
			int b = Integer.parseInt(sc.next()) - 1;
			int c = Integer.parseInt(sc.next());
			edge[i] = new edge(a,b,c);
			dist[a][b] = Math.min(c,dist[a][b]);
			dist[b][a] = Math.min(c,dist[b][a]);
		}

		for(int k=0;k<N;k++){
			for(int i=0;i<N;i++){
				for(int j=0;j<N;j++){
					dist[i][j] = Math.min(dist[i][j],dist[i][k]+dist[k][j]);
				}
			}
		}

		int result = 0;
		for(int i=0;i<cities.size()-1;i++){
			result += dist[i][i+1];
		}


		out.println(result);
		out.flush();
	}

 class edge {
	int cost;

	public edge(final int a, final int b, final int c) {
		this.cost = c;
	}
}

Compiler output:
Main.java:60: error: reached end of file while parsing
}
 ^
1 error
Language: Java

package contest;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(final String args[]) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		edge[] e = new edge[M];
		int dist[][] = new int[N][N];
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(i!=j) dist[i][j] = Integer.MAX_VALUE;
				else dist[i][j] = 0;
			}
		}
		ArrayList<Integer> cities = new ArrayList<>();
		for (int i = 0; i < R; i++) {
			cities.add(Integer.parseInt(sc.next()));
		}
		for (int i = 0; i < M; i++) {
			int a = Integer.parseInt(sc.next()) - 1;
			int b = Integer.parseInt(sc.next()) - 1;
			int c = Integer.parseInt(sc.next());
			edge[i] = new edge(a,b,c);
			dist[a][b] = Math.min(c,dist[a][b]);
			dist[b][a] = Math.min(c,dist[b][a]);
		}

		for(int k=0;k<N;k++){
			for(int i=0;i<N;i++){
				for(int j=0;j<N;j++){
					dist[i][j] = Math.min(dist[i][j],dist[i][k]+dist[k][j]);
				}
			}
		}

		int result = 0;
		for(int i=0;i<cities.size()-1;i++){
			result += dist[i][i+1];
		}


		out.println(result);
		out.flush();
	}



public class edge {
	int cost;

	public edge(final int a, final int b, final int c) {
		this.cost = c;
	}
}
}

Compiler output:
Main.java:31: error: cannot find symbol
			edge[i] = new edge(a,b,c);
			^
  symbol:   variable edge
  location: class Main
Main.java:31: error: non-static variable this cannot be referenced from a static context
			edge[i] = new edge(a,b,c);
			          ^
2 errors
Language: Java

package contest;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(final String args[]) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		edge[] e = new edge[M];
		int dist[][] = new int[N][N];
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(i!=j) dist[i][j] = Integer.MAX_VALUE;
				else dist[i][j] = 0;
			}
		}
		ArrayList<Integer> cities = new ArrayList<>();
		for (int i = 0; i < R; i++) {
			cities.add(Integer.parseInt(sc.next()));
		}
		for (int i = 0; i < M; i++) {
			int a = Integer.parseInt(sc.next()) - 1;
			int b = Integer.parseInt(sc.next()) - 1;
			int c = Integer.parseInt(sc.next());
			edge[i] = new edge(a,b,c);
			dist[a][b] = Math.min(c,dist[a][b]);
			dist[b][a] = Math.min(c,dist[b][a]);
		}

		for(int k=0;k<N;k++){
			for(int i=0;i<N;i++){
				for(int j=0;j<N;j++){
					dist[i][j] = Math.min(dist[i][j],dist[i][k]+dist[k][j]);
				}
			}
		}

		int result = 0;
		for(int i=0;i<cities.size()-1;i++){
			result += dist[i][i+1];
		}


		out.println(result);
		out.flush();
	}

}

public class edge {
	int cost;

	public edge(final int a, final int b, final int c) {
		this.cost = c;
	}
}

Compiler output:
Main.java:56: error: class edge is public, should be declared in a file named edge.java
public class edge {
       ^
Main.java:31: error: cannot find symbol
			edge[i] = new edge(a,b,c);
			^
  symbol:   variable edge
  location: class Main
2 errors
Language: Java

package contest;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(final String args[]) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		edge[] e = new edge[M];
		int dist[][] = new int[N][N];
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(i!=j) dist[i][j] = Integer.MAX_VALUE;
				else dist[i][j] = 0;
			}
		}
		ArrayList<Integer> cities = new ArrayList<>();
		for (int i = 0; i < R; i++) {
			city.add(Integer.parseInt(sc.next()));
		}
		for (int i = 0; i < M; i++) {
			int a = Integer.parseInt(sc.next()) - 1;
			int b = Integer.parseInt(sc.next()) - 1;
			int c = Integer.parseInt(sc.next());
			edge[i] = new edge(a,b,c);
			dist[a][b] = Math.min(c,dist[a][b]);
			dist[b][a] = Math.min(c,dist[b][a]);
		}

		for(int k=0;k<N;k++){
			for(int i=0;i<N;i++){
				for(int j=0;j<N;j++){
					dist[i][j] = Math.min(dist[i][j],dist[i][k]+dist[k][j]);
				}
			}
		}

		int result = 0;
		for(int i=0;i<cities.length-1;i++){
			result += dist[i][i+1];
		}


		out.println(result);
		out.flush();
	}

}

public class edge {
	int cost;

	public edge(final int a, final int b, final int c) {
		this.cost = c;
	}
}

Compiler output:
Main.java:56: error: class edge is public, should be declared in a file named edge.java
public class edge {
       ^
Main.java:25: error: cannot find symbol
			city.add(Integer.parseInt(sc.next()));
			^
  symbol:   variable city
  location: class Main
Main.java:31: error: cannot find symbol
			edge[i] = new edge(a,b,c);
			^
  symbol:   variable edge
  location: class Main
Main.java:45: error: cannot find symbol
		for(int i=0;i<cities.length-1;i++){
		                    ^
  symbol:   variable length
  location: variable cities of type ArrayList<Integer>
4 errors
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 100000
using namespace std;
int main()
{
    int N, M, R;
    int ans = INF;
    cin >> N >> M >> R;
    vector<int> r(R);
    rep(i, R) cin >> r[i];
    sort(r.begin(), r.end());
    vector<vector<int>> d(N, vector<int>(N, INF));
    rep(i, N) d[i][i] = 0;
    rep(i, M)
    {
        int a, b, c;
        cin >> a >> b >> c;
        d[a - 1][b - 1] = [b - 1][a - 1] = c;
    }
    for (int k = 0; k < N; k++)
        for (int i = 0; i < N; i++)
            for (int j = 0; j < N; j++)
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    do
    {
        int sum = 0;
        rep(i, R - 1) sum += d[r[i] - 1][r[i + 1] - 1];
        if (sum < ans)
            ans = sum;
    } while (next_permutation(r.begin(), r.end()));
    cout
        << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:29: error: expected ',' before '-' token
   21 |         d[a - 1][b - 1] = [b - 1][a - 1] = c;
      |                             ^~
      |                             ,
a.cc:21:30: error: expected identifier before '-' token
   21 |         d[a - 1][b - 1] = [b - 1][a - 1] = c;
      |                              ^
a.cc: In lambda function:
a.cc:21:34: error: expected '{' before '[' token
   21 |         d[a - 1][b - 1] = [b - 1][a - 1] = c;
      |                                  ^
a.cc: In function 'int main()':
a.cc:21:34: error: no match for 'operator[]' (operand types are 'main()::<lambda()>' and 'int')
Language: C++

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

long long node,edge,r;
long long dist[500][500];
long long cities[400];

void fw(long long n)
{
    for(long long i=1;i<=n;i++)
    {
        for(long long j=1;j<=n;j++)
        {
            for(long long k=1;k<=n;k++)
            {
                dist[j][k] = min(dist[j][k],dist[j][i]+dist[i][k]);
            }
        }
    }
}

long long main()
{
    cin >> node >> edge >> r;
    for(long long i=1;i<=node;i++)
        for(long long j=1;j<=node;j++)
        {
            if(i==j)    dist[i][j]=0;
            else        dist[i][j]=INT_MAX;
        }
    for(long long i=0;i<r;i++)
        cin >> cities[i] ;
    sort(cities,cities+r);



    for(long long i=0;i<edge;i++)
    {
        long long x,y,d;
        cin >> x >> y >> d;
        if(dist[x][y]>d)    dist[x][y]=d;
        if(dist[y][x]>d)    dist[y][x]=d;
    }


     fw(node);

    long long ans=INT_MAX;
    do
    {
        long long res = 0;
        for(long long i=1;i<node;i++)   res+=dist[cities[i-1]][cities[i]];
        ans = min(ans,res);
    }while(next_permutation(cities,cities+r));
    cout << ans << '\n';
    return 0;
}


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

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int N, M, R;
int r[10];
int g[205][205];
int ans;

int main() {
  scanf("%d %d %d", &N, &M, &R);
  for (int i=0; i<R; i++)
    scanf("%d", &r[i]);
  for (int i=0; i<M; i++) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    g[a][b] = c;
    g[b][a] = c;
  }

  for (int i=1; i<=N; i++) g[i][i]=0
  for (int k=1; k<=N; k++) {
    for (int i=1; i<=N; i++) {
      for (int j=1; j<=N; j++) {
        if (g[i][j] > g[i][k] + g[k][j])
          g[i][j] = g[i][k] + g[k][j];
      }
    }
  }

  ans = (1<<29);
  sort(r, r+R);
  do {
    int sum=0;
    for (int i=0; i<R-1; i++) {
      sum += g[r[i]][r[i+1]];
    }
    ans = min(ans, sum);
  } while (next_permutation(r, r+R));

  printf("%d\n", ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:37: error: expected ';' before 'for'
   22 |   for (int i=1; i<=N; i++) g[i][i]=0
      |                                     ^
      |                                     ;
   23 |   for (int k=1; k<=N; k++) {
      |   ~~~                                
a.cc:23:17: error: 'k' was not declared in this scope
   23 |   for (int k=1; k<=N; k++) {
      |                 ^
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <iomanip>
#include <map>
#include <bits/stl_numeric.h>

#define DEBUG 0
#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

int d[200][200] = {};


void warshallFloyd(int n) {
  for (int k = 0; k < n; ++k){       // 経由する頂点
    for (int i = 0; i < n; ++i) {    // 始点
      for (int j = 0; j < n; ++j) {  // 終点
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
 
      }
    }
  }
}

int main(){

    int N,M,R;
    cin >> N >> M >> R;
    //訪れる街のリスト(最大8))
    vector <int> r;
    r.resize(R);

    REP(i,R)
    {
        cin >> r[i];
        --r[i];
    }



    REP(i,N)
    {
        REP(j,N)
        {
            if(i == j) d[i][j] = 0;
            else    d[i][j] = INF;
        }
    }

    REP(i,M)
    {
        int a,b,c;
        cin >> a >> b >> c;
        --a;--b;

        d[a][b] = c;
        d[b][a] = c;
    }

    //各橋を結んで、最小を更新する(ワーシャルフロイド)
    warshallFloyd(N);
    

    ll res = INF;
    sort(r.begin(),r.end()); //permutationを使う前はソートする。
    do {
        ll tmp = 0;
        bool flg = true;
        for(int i = 0; i < R-1; ++i)
        {
            int from = r[i];
            int to = r[i+1]];
            if(d[from][to] == -1)
            {
                flg = false;
                break;
            }
            //町から町へのコストを足す
            tmp += d[from][to];
        }
        if(flg)
        {
            res = min(res,tmp);
        }

    } while( next_permutation(r.begin(), r.end()) );     // 次の順列を生成

    cout << res << endl;

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:52:31: warning: overflow in conversion from 'long long int' to 'int' changes value from '1000000000000000000' to '-1486618624' [-Woverflow]
   52 |             else    d[i][j] = INF;
      |                               ^~~
a.cc:78:28: error: expected ',' or ';' before ']' token
   78 |             int to = r[i+1]];
      |                            ^
Language: C++

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

ll const INF = 1e18;


int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, M, R; cin >> N >> M >> R;
    ll r[R];
    rep(i, R){
        cin >> r[i];
        r[i]--;
    }

    sort(r, r+n);
    
    ll d[N][N] = {};
    rep(i, N){
        rep(j, N){
            if(i == j) continue;

            d[i][j] = INF;
        }
    }

    rep(i, M){
        int a, b, c; cin >> a >> b >> c;
        a--; b--;

        d[a][b] = c;
        d[b][a] = c;
    }

    for(int k=0; k<N; k++){
        for(int i=0; i<N; i++){
            for(int j=0; j<N; j++){
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

    // cout << d[0][1] << endl;

    ll ans = 1e18;
    do{
        ll tmp = 0;
        reps(i, 1, R){
            tmp += d[r[i-1]][r[i]];
        }
        ans = min(ans, tmp);
    }while(next_permutation(r, r+R));

    cout << ans << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:15: error: 'n' was not declared in this scope
   39 |     sort(r, r+n);
      |               ^
Language: C++

//#include <bits/stdc++.h>
//#include "includes.h"
#include <iostream>
#include <vector>
//#include <>
using namespace std;
//using P = pair<long long, long long>;
typedef long long ll;
#define INF 10000000000000
//typedef struct edge{
//    ll from;
//    ll to;
//    ll cost;
//} edge;
//
int main() {
    ll n, m, r, from, to, cost;
  	cin >> n >> m >> r;
    vector<int> town(r);
    sort(town.begin(), town.end());
    ll ans = INF;
    ll dp[n][n];
    ll temp;
    for(int i=0;i<r;i++) {
        cin >> temp;
        town[i] = temp-1;
    }
    for(int i=0;i<n;i++) {
        for(int j=0;j<n;j++) {
            if(i==j) dp[i][j] = 0;
            else dp[i][j] = INF;
        }
    }
    for(int i=0;i<m;i++) {
        cin >> from >> to >> cost;
        dp[from-1][to-1] = cost;
        dp[to-1][from-1] = cost;
    }

    for(int k=0;k<n;k++) {
        for(int i=0;i<n;i++) {
            for(int j=0;j<n;j++) {
                if(dp[i][k] != INF && dp[k][j] != INF) {
                    dp[i][j] = min(dp[i][j], dp[i][k]+dp[k][j]);
                }
            }
        }
    }


    //for(int i=0;i<n;i++) {
    //    for(int j=0;j<n;j++) {
    //        cout << dp[i][j] << " ";
    //    }
    //    cout << endl;
    //}
    ll t;
    do {
        t = 0;
        for(int i=0;i<r-1;i++) {
            t+=dp[town[i]][town[i+1]];
        }
        ans = min(ans, t);
    }while (next_permutation(town.begin(), town.end()));
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   20 |     sort(town.begin(), town.end());
      |     ^~~~
      |     short
a.cc:64:13: error: 'next_permutation' was not declared in this scope
   64 |     }while (next_permutation(town.begin(), town.end()));
      |             ^~~~~~~~~~~~~~~~
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <limits>

#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;
int link[210][210], rr[210];
int a, b, c;
using namespace std;
int main()
{
    memset(link, 0, sizeof(link)); //cout << link[2][2] << endl;
    int n, m, r;
    scanf("%d%d%d", &n, &m, &r);
    for(int i = 0; i < r; i++)
    {
        cin >> rr[i];
        rr[i]--;
    }

    sort(rr, rr+r);
    for(int i = 0; i < m; i++)
    {
        scanf("%d%d%d", &a, &b, &c);
        link[a - 1][b - 1] = link[b - 1][a - 1] = c;
    }
    int ans = 0;
    for(int k = 0; k < n; k++)
    {
        for(int i = 0; i < n; i++)
        {
            for(int j = 0; j < n; j++)
            {
                link[i][j] = min( link[i][j], link[i][k] + link[k][j]);
            }
        }
    }
    int mi = INT_MAX;
    do
    {
        int ans = 0;

        for(int i = 0; i + 1 < r; i++)
        {
            ans += link[rr[i]][rr[i+1]];

        }
        mi = min(ans, mi);
    }
    while(next_permutation(rr, rr + r));
    cout << mi << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:14: error: 'INT_MAX' was not declared in this scope
   46 |     int mi = INT_MAX;
      |              ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <limits>
  +++ |+#include <climits>
    7 |
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define MOD 1000000007
#define INT long long int
using namespace std;
const long long INF = numeric_limits<long long>::max();


int main()
{
    int n,m,r;
    int i,j,k;
    cin >> n >> m >> r;
    int town[r];
    for (i=0;i<r;i++){
        cin >> town[i];
        town[i]--;
    }

    int a,b,c;
    int d[201][201];
    for (i=0;i<n;i++) for(j=0;j<n;j++) d[i][j] = 1e9;
    for (i=0;i<M;i++) {
        cin >> a >> b >> c;
        a--;b--;
        d[a][b] = d[b][a] = c;
    }
    for (i=0;i<n;i++) for(j=0;j<n;j++) for (k=0;k<n;k++){
        d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
    }

    sort(town,town+r);
    int ans = 1e9;
    int tmp;
    while(next_permutation(town,town+r)){
        tmp = 0;
        for (i=0;i<r-1;i++){
            tmp += d[town[i]][town[i+1]];
        }
        ans = min(ans,tmp);
    }
    cout << ans << endl;
    return 0;

}

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

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define MOD 1000000007
#define INT long long int
using namespace std;
const long long INF = numeric_limits<long long>::max();


int main()
{
    int n,m,r;
    int i,j,k;
    cin >> n >> m >> r;
    int town[r];
    for (i=0;i<r;i++){
        cin >> town[i];
        town[i]--;
    }

    int a,b,c;
    int d[201][201];
    for (i=0;i<n;i++) for(j=0;j<n;j++) d[i][j] = 1e9;
    for (i=0;i<M;i++) {
        cin >> a >> b >> c;
        a--;b--;
        d[a][b] = d[b][a] = c;
    }
    for (i=0;i<n;i++) for(j=0;j<n;j++) for (k=0;k<n;k++){
        d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
    }

    sort(town,town+r);
    int ans = 1e9;
    int tmp;
    while(next_permutation(town,town+r)){
        tmp = 0;
        for (i=0;i<r-1;i++){
            tmp += d[town[i]][town[i+1]];
        }
        ans = min(ans,tmp);
    }
    cout << ans << endl;
    return 0;


    return 0;
}

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

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

static const int MAX_V = 210;
const int INF = 1e9;

int d[MAX_V][MAX_V];
int V;

void warshall_floyde(){
    for(int k = 0; k < V; k++){
        for(int i = 0; i < V; i++){
            for(int j = 0; j < V; j++) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
    }
}

int R;
bool visited[210];
vector<int> r;

int dfs(int v, int p = -1, int length = 0, int depth = 1){
    //if(length == 2 && depth == R - 1) cout << "closest!" << v << endl; 
    if(depth == R) return length;
    //cout << v << endl;
    int ans = INF;
    rep(i, R){
        int nv = r[i];
        if(visited[nv] || nv == p) continue;
        visited[nv] = true;
        ans = min(ans, dfs(nv, v, length + d[v][nv], depth + 1));
        // if(ans == 2) cout << "closest!" << v << endl;
        visited[nv] = false;
    }
    //cout << ans << endl;
    return ans;
}

int main(){
    int M; cin >> V >> M >> R;
    r.resize(R);
    rep(i,R) {cin >> r[i]; r[i]--;}
    rep(i, N) rep(j, N){
        if(i != j) d[i][j] = INF;
        else d[i][j] = 0;
    }
    rep(i, M){
        int a, b, c; cin >> a >> b >> c;
        a--, b--;
        d[a][b] = c;
        d[b][a] = c;
    }
    warshall_floyde();
    int ans = INF;
    rep(j, 205) visited[j] = 0;
    rep(i, R){
        visited[r[i]] = true;
        ans = min(ans, dfs(r[i]));
        visited[r[i]] = false;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:12: error: 'N' was not declared in this scope
   44 |     rep(i, N) rep(j, N){
      |            ^
a.cc:3:38: note: in definition of macro 'rep'
    3 | #define rep(i, N) for(int i = 0; i < N; i++)
      |                                      ^
Language: C++

#include <bits/stdc++.h>
#include <stdlib.h>
#include <cmath>
using namespace std;
typedef long long ll;
ll mod=1000000007;
ll BIG=1e15;

ll d[201][201];

int main(){
    int N,M,R; cin>>N>>M>>R;
    for(int i=0;i<201;i++){
        for(int j=0;j<201;j++) if(i!=j) d[i][j]=BIG;
    }
    vector<int> v(R);
    for(int i=0;i<R;i++) cin>>v.at(i);

    for(int i=0;i<M;i++){
        int A,B; cin>>A>>B;
        ll C; cin>>C;
        d[A][B]=C;
        d[B][A]=C;
    }
    for(int k=1;k<201;k++){
        for(int i=1;i<201;i++){
            for(int j=1;j<201;j++){
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
    ll ans=BIG;
    do{
        ll kari=0;
        for(int i=0;i<R-1;i++) kari+=d[v.at(i)][v.at(i+1)];
        ans=min(kari,ans);
    }while(next_permutation(v.begin(),v.end()))
    cout<<ans<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:48: error: expected ';' before 'cout'
   37 |     }while(next_permutation(v.begin(),v.end()))
      |                                                ^
      |                                                ;
   38 |     cout<<ans<<endl;
      |     ~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m,r;
    cin>>n>>m>>r;
    vector<int> t(r);
    for(int i=0;i<r;i++)cin>>t[i];
    for(int i=0;i<r;i++)t[i]--;

    //グラフの初期化
    int d[201][201];
    for(int i=0;i<201;i++){
        for(int j=0;j<201;j++){
            d[i][j]=inf;
        }
    }

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

    //ワ―シャルフロイド
    for(int k=0;k<200;k++){
        for(int i=0;i<200;i++){
            for(int j=0;j<200;j++){
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }

    //next_permutationで全部調べる
    int res=inf;
    sort(All(t))
    do{
        int sd=0;
        for(int i=1;i<r;i++){
            sd+=d[t[i-1]][t[i]];
        }
        res=min(res,sd);
    }while(next_permutation(All(t)));

    cout<<res<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:17: error: expected ';' before 'do'
   63 |     sort(All(t))
      |                 ^
      |                 ;
   64 |     do{
      |     ~~
Language: C++

#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, t) for (int i = (s); i < (int)(t); i++)
typedef long long ll;
const ll mod = 1e9 + 7;

struct warshall_floyd {

    vector<vector<int>> dist;

    warshall_floyd(vector<vector<int>> &adj) {
        dist = adj;
        int len = adj.size();
        for (int i: irange(len)) {
            dist[i][i] = 0;
        }
        rep(i, len)rep(j, len)rep(k, len) dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
    }

    int distance(int start, int goal) {
        return dist[start][goal];
    }
};

int main() {
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r(R);
    rep(i, R) cin >> r[i];
    vector<vector<int>> adj(N + 1, vector<int>(N, 1000000));
    rep(i, M) {
        int A, B, C;
        cin >> A >> B >> C;
        adj[A - 1][B - 1] = C;
        adj[B - 1][A - 1] = C;
    }


    warshall_floyd wf(adj);
    int ans = INT_MAX;
    do {
        int cost = 0;
        rep2(i, 1, R) {
            int d = wf.distance(r[i - 1] - 1, r[i] - 1);
            cost += d;
        }
        ans = min(ans, cost);
    } while (next_permutation(r.begin(), r.end()));
    cout << ans << endl;
}

Compiler output:
a.cc:2:10: fatal error: boost/range/irange.hpp: No such file or directory
    2 | #include <boost/range/irange.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<30;
const int MOD = 1000000007;

void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

const int MAX = 210;

int N, M, R;
long long dist[MAX][MAX];

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M >> R;
    vector<int> vr;
    rep(i,R) {  int r; cin >> r; --r; vr.push_back(r); }
    for (int i = 0; i < 210; ++i) {
        for (int j = 0; j < 210; ++j) dist[i][j] = INF;
        dist[i][i] = 0;
    }

    for (int i = 0; i < M; ++i) {
        int a, b, c; cin >> a >> b >> c; --a, --b;
        dist[a][b] = c;
        dist[b][a] = c;
    }

    rep(k,N)rep(i,N)rep(j,N) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);

    ll ans = LLINF;
    sort(all(vr));
    do{
      ll tmp = 0;
      for (int i = 1; i < vr.size(); ++i) tmp += dist[vr[i]][vr[i-1]];
      chmin(ans,tmp);
    } while (next_permutation(vr.begin(), vr.end()));

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:52: error: 'INF' was not declared in this scope
   35 |         for (int j = 0; j < 210; ++j) dist[i][j] = INF;
      |                                                    ^~~
Language: C++

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>

const int MOD = 1000000007;
const int INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	os << "\n";
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

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

	vector<int> r(R);
	for (int i = 0; i < R; i++) {
		cin >> r[i];
		r[i]--;
	}

	vector<vector<int>> d(N, vector<int>(N, INF));
	for (int i = 0; i < N; i++) d[i][i] = 0;
	
	for (int i = 0; i < M; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		d[a][b] = c;
		d[b][a] = c;
	}

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < N; k++) {
				if d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}

	sort(r.begin(), r.end());
	int ans = INF, tmp;
	do {

		tmp = 0;
		for (int i = 0; i < R - 1; i++) tmp += d[r[i]][r[i + 1]];
		ans = min(ans, tmp);

	} while (next_permutation(r.begin(), r.end()));

	cout << ans << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:36: error: expected '(' before 'd'
   68 |                                 if d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      |                                    ^
      |                                    (
Language: C

#include<stdio.h>
int ans;
int d[202][202];
void solve(int g[], int n[], int gn, int nn)
{
	if (nn == 0)
	{
		int scor = 0;
		int i;
		for (i = 0; i < gn - 1; i++)
			scor += d[g[i]][g[i + 1]];
		if (ans > scor)
			ans = scor;
	}
	else
	{
		int a[11], b[11];
		int i, j, k;
		for (i = 0; i < nn; i++)
		{
			k = 0;
			for (j = 0; j < nn; j++)
			{
				if (i != j)
				{
					a[k] = n[j];
					k++;
				}
			}
			for (j = 0; j < gn; j++)
				b[j] = g[j];
			b[gn] = n[i];
			solve(b, a, gn + 1, nn - 1);
		}
	}
	return;
}
int main()
{
	int n, m, R;
	scanf("%d %d %d", &n, &m, &R);
	int i, j, k;
	int r[10];
	for (i = 0; i < R; i++)
	{
		scanf("%d", &r[i]);
		r[i]--;
	}
	int a[20004], b[20004], c[20004];
	for (i = 0; i < m; i++)
	{
		scanf("%d %d %d", &a[i], &b[i], &c[i]);
		a[i]--;
		b[i]--;
	}
	for (i = 0; i < n; i++)
		for (j = 0; j < n; j++)
			d[i][j] = 1e9;
	for (i = 0; i < m; i++)
		d[a[i]][b[i]] = d[b[i]][a[i]] = c[i];
	for (k = 0; k < n; k++)
		for (i = 0; i < n; i++)
			for (j = 0; j < n; j++)
				if (d[i][j] > d[i][k] + d[k][j])
					d[i][j] = d[i][k] + d[k][j];
	ans = 1e9;
	solve({ 0 }, r, 0, R);
	printf("%d\n", ans);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:67:15: error: expected expression before '{' token
   67 |         solve({ 0 }, r, 0, R);
      |               ^
main.c:67:9: error: too few arguments to function 'solve'
   67 |         solve({ 0 }, r, 0, R);
      |         ^~~~~
main.c:4:6: note: declared here
    4 | void solve(int g[], int n[], int gn, int nn)
      |      ^~~~~
Language: C++

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

int main() {
	long long N, M, R, X[8], INF = 1000000000, ANS = 1000000000;
	static long long Dist[200][200] = {};
	cin >> N >> M >> R;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (i == j) Dist[i][j] = 0;
			else Dist[i][j] = INF;
		}
	}
	for (int i = 0; i < R; i++) cin >> X[i], X[i]--;
	for (int i = 0; i < M; i++) {
		int A, B, C;
		cin >> A >> B >> C;
		A--, B--;
		Dist[A][B] = C;
		Dist[B][A] = C;
	}
	for (int k = 0; k < N; k++) {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				Dist[i][j] = min(Dist[i][j], Dist[i][k] + Dist[k][j]);
			}
		}
	}
	vector<int> V;
	for (int i = 0; i < R; i++) V.push_back(i);
	do {
		long long COUNT = 0;
		for (int i = 0; i < R - 1; i++) {
			COUNT += Dist[X[V[i]]][X[V[i + 1]]];
		}
		ANS = min(ANS, COUNT);
	} while (next_permutation(V.begin(), V.end()));
	cout << ANS << endl;
}

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

#include <iostream>
#include <tuple>
#include <vector>
#include <queue>
#include <limits>

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

  int R_arr[8] = {};
  std::vector<std::tuple<int,int>> t_arr[201];
  for(int i = 0; i < R; i++) std::cin >> R_arr[i];
  for(int i = 0; i < M; i++){
    int a,b,c;
    std::cin >> a >> b >> c;
    t_arr[a].push_back(std::make_tuple(b,c));
    t_arr[b].push_back(std::make_tuple(a,c));
  }

  int rr_arr[8][8] = {};
  for(int ri = 0; ri < R; ri++){
    int r = R_arr[ri];
    std::vector<int> node_l(N+1, -1);
    std::priority_queue<std::tuple<int, int>> pq;
    pq.push(std::make_tuple(0,r));
    while(pq.size() > 0){
      int node, length;
      std::tie(length, node) = pq.top();
      pq.pop();
      if(node_l[node] != -1) continue;
      node_l[node] = -length;
      for(auto&& it: t_arr[node]){
        int neigh, nlength;
        std::tie(neigh, nlength) = it;
        pq.push(std::make_tuple(length-nlength, neigh));
      }
    }
    for(int i = 0; i < R; i++){
      rr_arr[ri][i] = node_l[R_arr[i]];
    }
  }

  int length_min = std::numeric_limits<int>::max();
  std::vector<int> r_p(R);
  for(int i = 0; i < R; i++) r_p[i] = i;
  do{
    int length = 0;
    for(int ri = 0; ri < R-1; ri++){
      length += rr_arr[r_p[ri]][r_p[ri+1]];
    }
    length_min = std::min(length_min, length);
  }while(std::next_permutation(r_p.begin(), r_p.end()));

  std::cout << length_min;

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:53:15: error: 'next_permutation' is not a member of 'std'; did you mean 'is_permutation'?
   53 |   }while(std::next_permutation(r_p.begin(), r_p.end()));
      |               ^~~~~~~~~~~~~~~~
      |               is_permutation
Language: C++


# include < cstdio >
using namespace std;
# define INF (1 <<29)
int N, M, R;
int d[201][201];
int r[9];
int A, B, C;
int res;
bool used[9];

void dfs(int c, int las, int dist)
{
	if (c == R + 1)
	{
		if (res > dist) res = dist;
		return;
	}
	for (int i = 1; i <= R; i++) if (!used[i])
	{
		used[i] = true;
		if (las == -1) dfs(c + 1, i, 0);
		else dfs(c + 1, i, dist + d[r[las]][r[i]]);
		used[i] = false;
	}
}
int main()
{
	scanf(" % d % d % d ", &N, &M, &R);
	for (int i = 1; i <= N; i++) for (int j = 1; j <= N; j++) if (i != j) d[i][j] = INF;
	for (int i = 1; i <= R; i++) scanf(" % d ", &r[i]);
	for (int i = 1; i <= M; i++)
	{
		scanf(" % d % d % d ", &A, &B, &C);
		if (d[A][B] > C) d[A][B] = d[B][A] = C;
	}
	for (int k = 1; k <= N; k++)
		for (int i = 1; i <= N; i++)
			for (int j = 1; j <= N; j++)
				if (d[i][j] > d[i][k] + d[k][j])
					d[i][j] = d[i][k] + d[k][j];
	res = INF;
	dfs(1, -1, 0);
	printf(" % d \ n ", res);
}

Compiler output:
a.cc:2:11: fatal error:  cstdio : No such file or directory
    2 | # include < cstdio >
      |           ^~~~~~~~~~
compilation terminated.
Language: C++

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

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

  int R_arr[8] = {};
  std::vector<std::tuple<int,int>> t_arr[201];
  for(int i = 0; i < R; i++) std::cin >> R_arr[i];
  for(int i = 0; i < M; i++){
    int a,b,c;
    std::cin >> a >> b >> c;
    t_arr[a].push_back(std::make_tuple(b,c));
    t_arr[b].push_back(std::make_tuple(a,c));
  }

  int rr_arr[8][8] = {};
  for(int ri = 0; ri < R; ri++){
    int r = R_arr[ri];
    std::vector<int> node_l(N+1, -1);
    std::priority_queue<std::tuple<int, int>> pq;
    pq.push(std::make_tuple(0,r));
    while(pq.size() > 0){
      int node, length;
      std::tie(length, node) = pq.top();
      pq.pop();
      if(node_l[node] != -1) continue;
      node_l[node] = -length;
      for(auto&& it: t_arr[node]){
        int neigh, nlength;
        std::tie(neigh, nlength) = it;
        pq.push(std::make_tuple(length-nlength, neigh));
      }
    }
    for(int i = 0; i < R; i++){
      rr_arr[ri][i] = node_l[R_arr[i]];
    }
  }

  int length_min = std::numeric_limits<int>::max();
  std::vector<int> r_p(R);
  for(int i = 0; i < R; i++) r_p[i] = i;
  do{
    int length = 0;
    for(int ri = 0; ri < R-1; ri++){
      length += rr_arr[r_p[ri]][r_p[ri+1]];
    }
    length_min = std::min(length_min, length);
  }while(std::next_permutation(r_p.begin(), r_p.end()));

  std::cout << length_min;

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:43:25: error: 'numeric_limits' is not a member of 'std'
   43 |   int length_min = std::numeric_limits<int>::max();
      |                         ^~~~~~~~~~~~~~
a.cc:43:40: error: expected primary-expression before 'int'
   43 |   int length_min = std::numeric_limits<int>::max();
      |                                        ^~~
a.cc:52:15: error: 'next_permutation' is not a member of 'std'; did you mean 'is_permutation'?
   52 |   }while(std::next_permutation(r_p.begin(), r_p.end()));
      |               ^~~~~~~~~~~~~~~~
      |               is_permutation
Language: Java

import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int r=sc.nextInt();
        int[] tovisit=new int[r];
        for(int i=0;i<r;i++){
          tovisit[i]=sc.nextInt();
        }
        int[][][] warshall=new int[n+1][n][n];
        int a;
        int b;
        for(int i=0;i<n;i++){
          for(int j=0;j<n;j++){
            warshall[0][i][j]=200000;
          }
        }
        for(int i=0;i,m;i++){
          a=sc.nextInt();
          b=sc.nextInt();
          warshall[0][a-1][b-1]=warshall[0][b-1][a-1]=sc.nextInt();
        }
        for(int i=1;i<n+1;i++){
          for(int j=0;j<n;j++{
            for(int k=0;k<n;k++){
              warshall[i][j][k]=Math.min(warshall[i-1][j][k],warshall[i-1][j][i]+warshall[i-1][i][k]);
            }
          }
        }
        
        
    }
 
    
}


Compiler output:
Main.java:22: error: ';' expected
        for(int i=0;i,m;i++){
                     ^
Main.java:22: error: not a statement
        for(int i=0;i,m;i++){
                      ^
Main.java:22: error: ')' expected
        for(int i=0;i,m;i++){
                       ^
Main.java:22: error: ';' expected
        for(int i=0;i,m;i++){
                           ^
Main.java:28: error: ')' expected
          for(int j=0;j<n;j++{
                             ^
5 errors
Language: C++

#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;

// graph template
template<typename T>
class edge{
    public:
        int src, to; T cost;

        edge(int to, T cost): src(-1), to(to), cost(cost){}
        edge(int src, int to, T cost): src(src), to(to), cost(cost){}
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using AdjacencyList = vector<Edges<T>>;
template<typename T>
using Matrix = vector<vector<T>>;

template<typename T>
void warshall_floyd(Matrix<T> &g, T INF){
    for(int k = 0; k < (int)g.size(); k++){
        for(int i = 0; i < (int)g.size(); i++){
            for(int j = 0; j < (int)g.size(); j++){
                if(g[i][k] == INF or g[k][j] == INF) continue;
                g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
            }
        }
    }
}

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

    int r[8];
    for(int i = 0; i < R; i++){
        cin >> r[i];
        r[i]--;
    }

    Matrix<ll> mat(N, vector<ll>(N));
    for(int i = 0; i < M; i++){
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        mat[a][b] = mat[b][a] = c;
    }

    warshall_floyd(mat, INF);  

    sort(r, r + R);
    ll res = INF;
    do{
        ll dist = 0;
        for(int i = 0; i < R - 1; i++){
            dist += mat[r[i]][r[i+1]];
        }
        res = min(res, dist);
    }while(next_permutation(r, r + R));

    cout << res << '\n';

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:19: error: no matching function for call to 'warshall_floyd(Matrix<long long int>&, const int&)'
   54 |     warshall_floyd(mat, INF);
      |     ~~~~~~~~~~~~~~^~~~~~~~~~
a.cc:25:6: note: candidate: 'template<class T> void warshall_floyd(Matrix<T>&, T)'
   25 | void warshall_floyd(Matrix<T> &g, T INF){
      |      ^~~~~~~~~~~~~~
a.cc:25:6: note:   template argument deduction/substitution failed:
a.cc:54:19: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   54 |     warshall_floyd(mat, INF);
      |     ~~~~~~~~~~~~~~^~~~~~~~~~
Language: C++

# include < cstdio >
using namespace std ;
# define INF (1 < <29)
int N ,M , R ;
int d [201][201];
int r [9];
int A ,B , C ;
int res ;
bool used [9];

void dfs ( int c , int las , int dist )
{
if ( c == R +1)
{
if ( res > dist ) res = dist ;
return ;
}
for ( int i =1; i <= R ; i ++) if (! used [ i ])
{
used [ i ]= true ;
if ( las == -1) dfs ( c +1 ,i ,0);
else dfs ( c +1 ,i , dist + d [ r [ las ]][ r [ i ]]);
used [ i ]= false ;
}
}
int main ()
{
scanf ( " % d % d % d " ,&N ,& M ,& R );
for ( int i =1; i <= N ; i ++) for ( int j =1; j <= N ; j ++) if ( i != j ) d [ i ][ j ]= INF ;
for ( int i =1; i <= R ; i ++) scanf ( " % d " ,& r [ i ]);
for ( int i =1; i <= M ; i ++)
{
scanf ( " % d % d % d " ,&A ,& B ,& C );
if ( d [ A ][ B ] > C ) d [ A ][ B ]= d [ B ][ A ]= C ;
}
for ( int k =1; k <= N ; k ++)
for ( int i =1; i <= N ; i ++)
for ( int j =1; j <= N ; j ++)
if ( d [ i ][ j ] > d [ i ][ k ]+ d [ k ][ j ])
d[ i ][ j ]= d [ i ][ k ]+ d [ k ][ j ];
res = INF ;
dfs (1 , -1 ,0);
printf ( " % d \ n " , res );
}

Compiler output:
a.cc:1:11: fatal error:  cstdio : No such file or directory
    1 | # include < cstdio >
      |           ^~~~~~~~~~
compilation terminated.