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

#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF (1e10)
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a * b / g;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

int N,M;
ll d[200][200];
int R;
ll ans=INF;
int visited[8];
void dfs(int depth,int id,ll cost,vector<int> v){
  if(depth==R){
    ans=min(ans,cost);
  }else{
    REP(i,0,v.size()){
      int idx=v[i];
      vector<int> v2(v.size());
      copy(v.begin(),v.end(),v2.begin());
      v2.erase(v2.begin()+i);
      dfs(depth+1,idx,cost+d[id][idx],v2);
    }
  }
}
int main()
{
  cin>>N>>M>>R;

  vector<int> r(R);
  REP(i,0,N){
    REP(j,0,N){
      if(i==j){
        d[i][j]=0;
      }else{
        d[i][j]=INF:
      }
    }
  }

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

  REP(i,0,M){
    int a,b;
    ll c;
    cin>>a>>b>>c;
    a--;b--;
    d[a][b]=c;
    d[b][a]=c;
  }
  REP(k,0,N){
    REP(i,0,N){
      REP(j,0,N){
        if(d[i][j]>d[i][k]+d[k][j]){
          d[i][j]=d[i][k]+d[k][j];
        }
      }
    }
  }

  
  REP(i,0,R){
    dfs(0,r[i],0,r);
  }
  cout<<ans<<endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:116:20: error: expected ';' before ':' token
  116 |         d[i][j]=INF:
      |                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<vector<int>> d;
vector<bool> visited;
vector<int> r;
int res;
int inf=1e18;
int N,M,R;



void dfs(int i,int pre,int dis){
	
	if(i==R){
		res=min(res,dis);
		return;}	

	for(auto&& w:r){
	if(visited[w])continue;
	visited[w]=true;
		if(pre==-1)dfs(i+1,w,0);
		else dfs(i+1,w,dis+d[w][pre]);
	visited[w]=false;
	}
	return;	
}


signed main(){
	cin>>N>>M>>R;
	r.resize(R);
	for(auto&& w:r)cin>>w;w--;
	d.resize(N,vector<int>(N,inf));
	visited.resize(N,false);
	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]=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++){
		d[j][k]=min(d[j][k],d[j][i]+d[i][k]);
}
}	
}
	res=inf;
	dfs(0,-1,0);
	cout<<res<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:31: error: 'w' was not declared in this scope
   33 |         for(auto&& w:r)cin>>w;w--;
      |                               ^
Language: C++

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

typedef long long LL;
const LL INF = 100000000;

class Graph{
    private:
        vector<vector<LL>> data;
    public: 
    Graph(LL n, LL initDist=0){
        init(n, initDist);
    }
    void init(LL n, LL initDist){
        data = vector<vector<LL>>(n, vector<LL>(n, initDist));
        for(LL i=0;i<n;i++)data[i][i] = 0;
    }
    void setCost(LL node1, LL node2, LL cost){
        LL index1 = min(node1, node2);
        LL index2 = max(node1, node2);
        data[index1][index2] = cost;
    }
    LL getCost(LL node1, LL node2){
        LL index1 = min(node1, node2);
        LL index2 = max(node1, node2);
        return data[index1][index2];
    }
    void warshall_floyd() {
        for (LL i = 0; i < data.size(); i++){
            for (LL j = 0; j < data.size(); j++){
                for (LL k = 0; k < data.size(); k++){
                    LL dist = min(getCost(j,k), getCost(j,i) + getCost(i,k));
                    setCost(j, k, dist);
                }
            }
        }
    }

    friend std::ostream &operator<<(std::ostream &out, const Graph &tgt){
        for (LL i = 0; i < tgt.data.size(); i++) {
            for (LL j = 0; j < tgt.data.size(); j++) {
                if (i != j && tgt.data[i][j] != INF){
                    out << i << "から" << j << "へのコスト: " << tgt.data[i][j] << endl;
                }
            }
        }
        return out;
    }
};

using namespace std;
LL main()
{
#ifdef LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    LL N, M, R;
    cin >> N >> M >> R;

    vector<LL> r;
    r.resize(R);
    for(LL i=0;i<R;i++){
        cin >>r[i];
    }

    Graph graph = Graph(N, INF);

    for(LL i=0;i<M;i++){
        LL a, b, c;
        cin >> a >> b >> c;
        graph.setCost(a-1, b-1, c);
    }

    graph.warshall_floyd();

    LL min = INF;
    do{
        LL costSum = 0;
        for(LL i=0;i<r.size()-1;i++){
            costSum += graph.getCost(r[i]-1, r[i+1]-1);
        }
        if(min > costSum){
            min = costSum;
        }
        
    }
    while(std::next_permutation(r.begin(),r.end()));

    cout << min << endl;
    
    return 0;
}

Compiler output:
a.cc:57:1: error: '::main' must return 'int'
   57 | LL main()
      | ^~
Language: C

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

vector<vector<ll>> dist;

void warshall_floyd(int n) { // nは頂点数
  for (int i = 1; i <= n; i++)      // 経由する頂点
    for (int j = 1; j <= n; j++)    // 開始頂点
      for (int k = 1; k <= n; k++){  // 終端
    	  if(i==j||j==k||i==k)continue;
        dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
        dist[k][j]=dist[j][k];
      }
}

int main(){
	int n,m,r;
	cin>>n>>m>>r;
	vector<ll> a(m),b(m),c(m);
	vector<ll>list(r);
	dist=vector<vector<ll>>(n+1,vector<ll>(n+1,-1));

	for(ll i=0;i<r;i++)cin>>list[i];
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i]>>c[i];
		dist[a[i]][b[i]]=c[i];
		dist[b[i]][a[i]]=c[i];
	}
	ll res=1000000001,tmp=0;
	warshall_floyd(n);
	do{
		tmp=0;
		for(int i=0;i<r-1;i++){
			//cout<<"i:"<<i<<" "<<list[i]<<list[i+1]<<endl;
			//cout<<dist[list[i]][list[i+1]]<<endl;
			tmp+=dist[list[i]][list[i+1]];
		}
		res=min(res,tmp);
	}while(next_permutation(list.begin(),list.end()));

	cout<<res<<endl;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<set>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,M,R;
int r[10];
int a,b,c;
struct edge{int from,to,cost;};
int dist[200][200];
int main(){
    cin >> N >> M >> R;
    //init()
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            dist[i][j] = MM;
        }
    }
    for(int i = 0; i < R; i++) cin >> r[i];
    sort(r,r+R);
    for(int i = 0; i < M; i++){
        cin >> a >> b >> c;
        a--; b--;
        dist[a][b] = dist[b][a] = c;
    }
    for(int id = 0; id < N; id++){
        for(int i = 0; i < N; i++){
            for(int j = 0; j < N; j++){
                dist[i][j] = min(dist[i][j],dist[i][id]+ dist[id][j]);
            }
        }
    }
    int ans = MM;
    sort(r+1,r+R+1);
    do {
        int sum = 0;
        for(int i = 2; i <= R; i++){
            sum += d[r[i-1]][r[i]];
        }
        ans = min(sum,ans);
    } while(next_permutation(r+1,r+R+1));
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:54:20: error: 'd' was not declared in this scope
   54 |             sum += d[r[i-1]][r[i]];
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

//long longのシフト演算には気をつけよう

const int INF = (1<<29);

int N, R;
ll res
ll d[205][205], r[10];
bool used[10];

void dfs(int c, int las, int dist){
    if(c == R){
        if(res > dist) res = dist;
        return;
    }
    for(int i=1; i<=R; i++) if(!used[r[i]]){
        used[r[i]] = true;
        if(las == -1) dfs(c+1, i, 0);
        else dfs(c+1, i, dist+d[r[las]][r[i]]);
        used[r[i]] = false;
    }
}

void floyd(){
    for(int k=1; k<=N; k++){
        for(int i=1; i<=N; i++){
            if(d[i][k] == INF) continue;
            for(int j=1; j<=N; j++){
                if(d[k][j] == INF) continue;
                d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
            }
        }
    }
}

int main(){
    int M; cin >> N >> M >> R;
    for(int i=1; i<=R; i++) cin >> r[i];

    for(int i=1; i<=N; i++){
        for(int j=1; j<=N; j++) d[i][j] = ((i == j)? 0 : INF);
    }

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

    floyd();

    res = INF;
    dfs(0, -1, 0);
    cout << res << endl;
}

Compiler output:
a.cc:13:1: error: expected initializer before 'll'
   13 | ll d[205][205], r[10];
      | ^~
a.cc: In function 'void dfs(int, int, int)':
a.cc:18:12: error: 'res' was not declared in this scope
   18 |         if(res > dist) res = dist;
      |            ^~~
a.cc:21:38: error: 'r' was not declared in this scope
   21 |     for(int i=1; i<=R; i++) if(!used[r[i]]){
      |                                      ^
a.cc:24:31: error: 'd' was not declared in this scope
   24 |         else dfs(c+1, i, dist+d[r[las]][r[i]]);
      |                               ^
a.cc: In function 'void floyd()':
a.cc:32:16: error: 'd' was not declared in this scope
   32 |             if(d[i][k] == INF) continue;
      |                ^
a.cc:34:20: error: 'd' was not declared in this scope
   34 |                 if(d[k][j] == INF) continue;
      |                    ^
a.cc:35:17: error: 'd' was not declared in this scope
   35 |                 d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
      |                 ^
a.cc: In function 'int main()':
a.cc:43:36: error: 'r' was not declared in this scope
   43 |     for(int i=1; i<=R; i++) cin >> r[i];
      |                                    ^
a.cc:46:33: error: 'd' was not declared in this scope
   46 |         for(int j=1; j<=N; j++) d[i][j] = ((i == j)? 0 : INF);
      |                                 ^
a.cc:51:9: error: 'd' was not declared in this scope
   51 |         d[a][b] = d[b][a] = c;
      |         ^
a.cc:56:5: error: 'res' was not declared in this scope
   56 |     res = INF;
      |     ^~~
Language: C++

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


int main()
{
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r(R), A(M), B(M), C(M);
    for( int i = 0; i < R; ++i ) cin >> r[i];
    for( int i = 0; i < M; ++i ) cin >> A[i] >> B[i] >> C[i];


    int length[201][201] = {INT_MAX};
    for( int i = 0; i < M; ++i ){
        length[A[i]][B[i]] = C[i];
        length[B[i]][A[i]] = C[i];
    }

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

    int ans = INT_MAX;
    sort( r.begin(), r.end() );
    do{
        int total_length = 0;
        for( int i = 0; i < R-1; ++i ) total_length += length[r[i]][r[i+1]];
        ans = min( ans, total_length );
    }while( next_permutation( r.begin(), r.end() ) );

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:29: error: 'INT_MAX' was not declared in this scope
   17 |     int length[201][201] = {INT_MAX};
      |                             ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <utility>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

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


int main()
{
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r(R), A(M), B(M), C(M);
    for( int i = 0; i < R; ++i ) cin >> r[i];
    for( int i = 0; i < M; ++i ) cin >> A[i] >> B[i] >> C[i];


    int length[201][201] = {INT_MAX};
    for( int i = 0; i < M; ++i ){
        length[A[i]][B[i]] = C[i];
        length[B[i]][A[i]] = C[i];
    }

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

    int ans = INT_MAX;
    sort( r.begin(), r.end() );
    do{
        int total_length = 0;
        for( int i = 0; i < R-1; ++i ) total_length += length[r[i]][r[i+1]];
        ans = min( ans, total_length );
    }while( next_permutation( r.begin(), r.end() ) );

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:29: error: 'INT_MAX' was not declared in this scope
   16 |     int length[201][201] = {INT_MAX};
      |                             ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C

#include<stdio.h>
#define ERROR -1
#define int long long
#define %d %lld

void fl(int M,int dp[M][M]);

signed next_perm(int *p, int n)
{
  int i, j, k, tmp;
  /* 上位桁のほうが下位桁よりも小さいところまで移動 */
  for(i = n - 1; i > 0 && p[i-1] >= p[i]; i--);
  /* pが最大(次の並べ替えがない) */
  if(i == 0) return 0;
  /* p[i-1]より値の大きい最も下位の桁をp[j]とする */
  for(j = n - 1; j > i && p[i-1] >= p[j]; j--);
  /* p[i-1]とp[j]とを交換 */
  tmp = p[i-1], p[i-1] = p[j], p[j] = tmp;
  /* p[i]から最下位までを逆順 */
  for(k = 0; k <= ((n-1)-i)/2; k++)
    tmp = p[i+k], p[i+k] = p[(n-1)-k], p[(n-1)-k] = tmp;
  return 1;
}

signed main(){
	int N,M,R;//N=街の数 M=道の数 R=訪れる街の数
	int i,j;//ループ用変数
	scanf("%d %d %d",&N,&M,&R);
	if(N<2||N>200)return ERROR;
	if(M<1||M>N*(N-1)/2)return ERROR;
	if(R<2||R>8||R>N)return ERROR;
	int res=0,res_tmp[100001],R_ka=1;
	int R_num[R];
	int dist[M];//キョリ
	int d[N][N];//どこからどこへ？のキョリ格納用
	int a,b,tmp;//一時変数

	for(i=1;i<N+1;i++){
		for(j=1;j<N+1;j++){
			d[i][j]=100001;
		}
	}

	if(N<R)return ERROR;
	for(i=0;i<R;i++){
		scanf("%d ",&R_num[i]);
	}
	for(i=0;i<M;i++){
		scanf("%d %d %d",&a,&b,&dist[i]);
		if(a==b||a==0||b==0||dist==0)return ERROR;
		d[a][b]=dist[i];//ex:a=1,b=2,dist=2→d[1][2]=2
	}
	for(i=1;i<N+1;i++){
		for(j=1;j<N+1;j++){
			if(d[i][j]!=100001&&d[j][i]==100001){
				d[j][i]=d[i][j];
			}
			else if(d[i][j]!=100001&&d[j][i]!=100001){
				if(d[i][j]>d[j][i]){
					d[i][j]=d[j][i];
				}else{
					d[j][i]=d[i][j];
				}
			}
		}
	}

	/*for(i=1;i<=N;i++){
		for(j=1;j<=N;j++){
			printf("%dと%dの最短距離＝%d\n",i,j,d[i][j]);
		}
	}*/
	fl(N,d);
    for(i=1;i<N+1;i++){
    	for(j=1;j<N+1;j++){
			if(d[i][j]==100001){
				d[i][j]=-1;
			}
			if(i==j){
				d[i][i]=-1;
			}
    	}
    }

    for(i=R;i!=1;i--){
    	R_ka=i*R_ka;
    }
    int cnt=0;
    //printf("R!=%d\n",R_ka);
    for(j=0;j<R_ka;){
    	  /* 並べ替え */
    	  do {
    		  res=0;
    		  for(i=0;i<R-1;i++){
    			  res+=d[R_num[i]][R_num[i+1]];
    			  /*for(tmp=0;tmp<R;tmp++){
    				  printf("%d",R_num[tmp]);
    			  }printf("\n");*/
    		  }
    		 // printf("res=%d\n",res);
   			res_tmp[j]=res;
   			j++;
   			cnt++;
   			if(cnt==R_ka)break;
    	  } while(next_perm(R_num, R));
		/*for(i=0;i<R-1;i++){
			res+=d[R_num[i]][R_num[i+1]];
		}*/
		/*tmp=R_num[0];
		for(i=0;i<R;i++){
			if(i==R-1){
				R_num[i]=tmp;
			}else{
				R_num[i]=R_num[i+1];
			}
		}*/
    }
	/*for(i=1;i<=N;i++){
		for(j=1;j<=N;j++){
			printf("%dと%dの最短距離＝%d\n",i,j,d[i][j]);
		}
	}*/
   // printf("cnt=%d\n",cnt);
    res=100001;
    for(i=0;i<R_ka;i++){
    	if(res>res_tmp[i]){
    		res=res_tmp[i];
    	}
    }
    /*for(i=0;i<R_ka;i++){
    	printf("res_tmp=%d\n",res_tmp[i]);
    }*/
    printf("%d\n",res);
    return 0;
}

void fl(int M,int dp[M][M]){
	int i,j,k;
    for (k = 1; k < M+1; k++) {
      for (j = 1; j < M+1; j++) {
    	  for(i=1;i<M+1;i++){
			if (dp[i][j] > dp[i][k] + dp[k][j]){
			  dp[i][j] = dp[i][k] + dp[k][j];
			}
        }
      }
    }
}



Compiler output:
main.c:4:9: error: macro names must be identifiers
    4 | #define %d %lld
      |         ^
Language: C++

#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//do {
//    print(v);
//  } while (std::next_permutation(v.begin(), v.end()));
int N,M,R;
int G[201][201];
void warshall(){
	eFOR(i,1,N){
		eFOR(j,1,N){
			eFOR(k,1,N){
				G[j][k]=min(G[j][k],G[j][i]+G[i][k]);
			}
		}
	}
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
	REP(i,201){
		REP(j,201)G[i][j]=INF;
	cin>>N>>M>>R;
	VI r(R);
	REP(i,R)cin>>r[i];
	REP(i,M){
		int a,b,c;
		cin>>a>>b>>c;
		G[a][b]=c;
		G[b][a]=c;
	}
	int ans=INF;
	warshall();
	SORT(r);
	do {
    	int cnt=0;
		REP(i,R-1)
			cnt+=G[r[i]][r[i+1]];
		ans=min(ans,cnt);
	 }while (std::next_permutation(r.begin(), r.end()));
	
	cout<<ans<<endl;
	
	return 0;
}




















Compiler output:
a.cc: In function 'int main()':
a.cc:70:2: error: expected '}' at end of input
   70 | }
      |  ^
a.cc:43:11: note: to match this '{'
   43 | int main(){
      |           ^
Language: Java

import java.util.Scanner;
public class Main{
	static int[][] t;
	static int[] r1;
	static long ans;
	static boolean[] used;
	static int R;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		R = sc.nextInt();
		used=new boolean[R];
		ans=Integer.MAX_VALUE;
		t = new int[n+1][n+1];
		r1 = new int[R];
		for(int i= 0; i<R; i++){
			r1[i]= sc.nextInt();
		}
		for(int i = 1; i<=n; i++){
			for(int j = 1; j<=n; j++){
				if(i!=j){
					t[i][j]=19900000001
				}
			}
		}
		for(int i = 0; i<m; i++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			t[a][b]=c;
			t[b][a]=c;
		}
		for(int i = 1; i<=n; i++){
			for(int j = 1; j<=n; j++){
				for(int k = 1; k<=n; k++){
						t[j][k]=Math.min(t[j][k],t[j][i]+t[i][k]);
				}
			}
		}
		dfs(0,-1,0);
			System.out.println(ans);
			
	}
	static void dfs(int count, int last, int sum){
		if(count==R){
			ans=Math.min(ans,sum);
			return;
		}
		for(int i = 0; i<R; i++){
			if(!used[i]){
				used[i]=true;
				if(last==-1){
					dfs(count+1,i,0);
				}else{
					dfs(count+1,i,sum+t[r1[last]][r1[i]]);
				}
				used[i]=false;
			}
		}
	}
}

Compiler output:
Main.java:23: error: integer number too large
					t[i][j]=19900000001
					        ^
Main.java:23: error: ';' expected
					t[i][j]=19900000001
					                   ^
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pll;
ll inf=10000000000000;
ll n,m,R;
ll r[8];
ll md[201][201];
bool used[8];
ll dfs(ll now,ll dis){
  used[now]=true;
  ll ret=inf;
  for(ll i=0;i<R;i++){
    if(!used[i]){
      ret=min(ret,dfs(i,dis+md[r[now]][r[i]]));
    }
  }
  used[now]=false;
  if(ret==inf)return dis;
  
  return ret;
}
int main(){
  cin>>n>>m>>R;
  for(ll i=0;i<R;i++){
    cin>>r[i];
  }
  ll a[m],b[m],c[m];
  vector<ll>list[n+1];
  ll dis[n+1][n+1];
  for(ll i=0;i<m;i++){
    cin>>a[i]>>b[i]>>c[i];
    list[a[i]].push_back(b[i]);
    list[b[i]].push_back(a[i]);
    dis[a[i]][b[i]]=c[i];
    dis[b[i]][a[i]]=c[i];
  }
 
  for(ll i=0;i<=n;i++)for(ll j=0;j<=n;j++)md[i][j]=inf;
  for(int i=1;i<=n;i++){
    md[i][i]=0;
    priority_queue<pll,vector<pll>,greater<pll>>q;
    q.push(make_pair(0,i));
    while(q.size()>0){
      pll pnow=q.top();q.pop();
      ll pf=p.first;
      ll ps=p.second;
      for(ll j=0;j<list[ps].size();j++){
        ll k=list[ps][j];
        if(md[i][k]>pf+dis[ps][k]){
          md[i][k]=pf+dis[ps][k];
          q.push(make_pair(md[i][k],k));
        }
      }
    }
  }
  ll ans=inf;
  for(ll i=0;i<R;i++){
    ans=min(ans,dfs(i,(ll)0));
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:13: error: 'p' was not declared in this scope; did you mean 'pf'?
   46 |       ll pf=p.first;
      |             ^
      |             pf
Language: C++

#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 10e9;
const int MAX_V = 201;
int t[100010];
struct edge {
	int to;
	ll cost;
	edge(int _to, ll _cost) {
		to = _to;
		cost = _cost;
	}
};
vector<edge> e[MAX_V];
int d[202];

void dik(int start) {
	fill(d, d + MAX_V, INF);
	d[start] = 0;
	queue<pii> q;
	q.push(pii(start, 0));
	while (true)
	{
		pii p = q.front();
		q.pop();
		int v = p.first;
		int c = p.second;
		if (d[v] < c) continue;

		for (size_t i = 0; i < e[v].size(); i++)
		{
			edge nex = e[v][i];
			if (d[nex.to] > d[v] + nex.cost) {
				d[nex.to] = d[v] + nex.cost;
				q.push(pii(nex.to, d[nex.to]));
			}
		}

	}
}

void joisinostravel() {
	int n,m;
	cin >> n >> m;

	for (size_t i = 0; i < m; i++)
	{
		int a, b, c;
		cin >> a >> b >> c;
		e[a].push_back(edge(b, c));
		e[b].push_back(edge(a, c));
	}

	for (size_t i = 0; i < ; i++)
	{

	}
}

int main() {
	joisinostravel();
	return 0;
}



Compiler output:
a.cc:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
a.cc:21:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
   21 | const int INF = 10e9;
      |                 ^~~~
a.cc: In function 'void joisinostravel()':
a.cc:72:32: error: expected primary-expression before ';' token
   72 |         for (size_t i = 0; i < ; i++)
      |                                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,m,r,c,d;
vector<int> R;
vector<vector<int>> ab;
vector<bool> edge;
void dfs(int i,int j){
  bool f=true;
  for(int k=0;k<r;k++){
    if(!edge[k])f=false
  }
  if(f){
    c=min(c,d);
  }else{
    for(int k=0;k<r;k++){
      if(edge[k]) continue;
      else{
        edge[k]=true;
        d+=ab[R[i]][R[k]];
        dfs(k,j);
        d-=ab[R[i]][R[k]];
        edge[k]=false;
      }
    }
  }
}
int main(){
  cin>>n>>m>>r;
  R.resize(r);
  for(int i=0;i<r;i++){
    cin>>R[i];
    R[i]--;
  }
  ab.resize(n);
  for(int i=0;i<n;i++){
    ab[i].resize(n);
    for(int j=0;j<n;j++){
      ab[i][j]=1000000000;
    }
  }
  for(int i=0;i<m;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--,b--;
    ab[a][b]=c;
    ab[b][a]=c;
  }
  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        ab[i][j]=min(ab[i][j],ab[i][k]+ab[k][j]);
      }
    }
  }
  edge.resize(r);
  for(int i=0;i<r;i++){
    edge[i]=false;
  }
  c=1000000000;
  d=0;
  for(int i=0;i<r-1;i++){
    for(int j=i+1;j<r;j++){
      edge[i]=true;
      dfs(i,j);
      edge[i]=false;
    }
  }
  cout<<c;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:10:24: error: expected ';' before '}' token
   10 |     if(!edge[k])f=false
      |                        ^
      |                        ;
   11 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,m,r,c,d;
vector<int> R;
vector<vector<int>> ab;
vector<bool> edge;
void dfs(int i,int j){
  bool f=true;
  for(int k=0;k<r;k++){
    if(!edge[k])f=false
  }
  if(f){
    c=min(c,d);
  }else{
    for(int k=0;k<r;k++){
      if(edge[k]) continue;
      else{
        edge[k]=true;
        d+=ab[R[i]][R[k]];
        dfs(k,j);
        d-=ab[R[i]][R[k]];
        edge[k]=false;
      }
    }
  }
}
int main(){
  cin>>n>>m>>r;
  R.resize(r);
  for(int i=0;i<r;i++){
    cin>>R[i];
    R[i]--;
  }
  ab.resize(n);
  for(int i=0;i<n;i++){
    ab[i].resize(n);
  }
  memset(ab,1000000000,sizeof ab);
  for(int i=0;i<m;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--,b--;
    ab[a][b]=c;
    ab[b][a]=c;
  }
  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        ab[i][j]=min(ab[i][j],ab[i][k]+ab[k][j]);
      }
    }
  }
  edge.resize(r);
  memset(edge,false,sizeof edge);
  c=1000000000;
  d=0;
  for(int i=0;i<r-1;i++){
    for(int j=i+1;j<r;j++){
      edge[i]=true;
      dfs(i,j);
      edge[i]=false;
    }
  }
  cout<<c;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:10:24: error: expected ';' before '}' token
   10 |     if(!edge[k])f=false
      |                        ^
      |                        ;
   11 |   }
      |   ~                     
a.cc: In function 'int main()':
a.cc:38:10: error: cannot convert 'std::vector<std::vector<int> >' to 'void*'
   38 |   memset(ab,1000000000,sizeof ab);
      |          ^~
      |          |
      |          std::vector<std::vector<int> >
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
a.cc:54:10: error: cannot convert 'std::vector<bool>' to 'void*'
   54 |   memset(edge,false,sizeof edge);
      |          ^~~~
      |          |
      |          std::vector<bool>
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,m,r;
vector<int> r;
vector<vector<int>> ab,R;
vector<bool> edge;
int main(){
  cin>>n>>m>>rr;
  r.resize(rr);
  R.resize(rr);
  for(int i=0;i<rr;i++){
    R.resize(rr);
    cin>>r[i];
    r[i]--;
  }
  memset(R,10000000,sizeof R);
  ab.resize(n);
  for(int i=0;i<n;i++){
    ab[i].resize(n);
  }
  memset(ab,10000000,sizeof ab);
  for(int i=0;i<m;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--,b--;
    ab[a][b]=c;
    ab[b][a]=c;
  }
  for(int i=0;i<rr;i++){
    for(int j=i+1;j<rr;j++){
      

Compiler output:
a.cc:4:13: error: conflicting declaration 'std::vector<int> r'
    4 | vector<int> r;
      |             ^
a.cc:3:9: note: previous declaration as 'int r'
    3 | int n,m,r;
      |         ^
a.cc: In function 'int main()':
a.cc:8:14: error: 'rr' was not declared in this scope; did you mean 'r'?
    8 |   cin>>n>>m>>rr;
      |              ^~
      |              r
a.cc:9:5: error: request for member 'resize' in 'r', which is of non-class type 'int'
    9 |   r.resize(rr);
      |     ^~~~~~
a.cc:13:11: error: invalid types 'int[int]' for array subscript
   13 |     cin>>r[i];
      |           ^
a.cc:14:6: error: invalid types 'int[int]' for array subscript
   14 |     r[i]--;
      |      ^
a.cc:16:10: error: cannot convert 'std::vector<std::vector<int> >' to 'void*'
   16 |   memset(R,10000000,sizeof R);
      |          ^
      |          |
      |          std::vector<std::vector<int> >
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
a.cc:21:10: error: cannot convert 'std::vector<std::vector<int> >' to 'void*'
   21 |   memset(ab,10000000,sizeof ab);
      |          ^~
      |          |
      |          std::vector<std::vector<int> >
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
a.cc:30:29: error: expected '}' at end of input
   30 |     for(int j=i+1;j<rr;j++){
      |                            ~^
a.cc:30:29: error: expected '}' at end of input
a.cc:29:24: note: to match this '{'
   29 |   for(int i=0;i<rr;i++){
      |                        ^
a.cc:30:29: error: expected '}' at end of input
   30 |     for(int j=i+1;j<rr;j++){
      |                             ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((a) >> (b)) & 1
#define bitcount(a) __builtin_popcount((a))

typedef long long lint;
typedef pair<int, int> P;
typedef vector<int> vec;
typedef vector<vec> mat;

const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};

struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int N, M, R;
int d[210][210];

signed main() {
  cin >> N >> M >> R;
  vec v;
  for (int i = 0; i < R; i++) {
    int r;
    cin >> r;
    r--;
    v.push_back(r);
  }

  for (int i = 0; i < 205; i++) {
    for (int j = 0; j < 205; j++) {
      d[i][j] = INF;
      if (i == j) {
        d[i][j] = 0LL;
      }
    }
  }

  for (int i = 0; i < M; i++) {
    int a, b, c;4 6 3
    cin >> a >> b >> c;
    a--, b--;
    d[a][b] = 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]);
      }
    }
  }

  int ans = INF;
  do {
    int sum = 0;
    for (int i = 1; i < R; i++) {
      sum += d[v[i - 1]][v[i]];
    }
    ans = min(ans, sum);
  } while (next_permutation(v.begin(), v.end()));

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


Compiler output:
a.cc: In function 'int main()':
a.cc:54:18: error: expected ';' before numeric constant
   54 |     int a, b, c;4 6 3
      |                  ^~
      |                  ;
Language: C++

from itertools import permutations

N, M, R = map(int, input().split())
r = list(map(int, input().split()))

way = [[float("inf") if i != j else 0 for i in range(N + 1)] for j in range(N + 1)]
for m in range(M):
    a, b, c = map(int, input().split())
    way[a][b] = c
    way[b][a] = c

for i in range(N + 1):
    for j in range(N + 1):
        for k in range(N + 1):
            way[j][k] = min(way[j][k], way[j][i] + way[i][k])
ans = float("inf")
for path in list(permutations(r)):
    time = 0
    for i in range(len(path) - 1):
        time += way[path[i]][path[i + 1]]
    ans = min(ans, time)
print(ans)


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from itertools import permutations
      | ^~~~
Language: C++


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

const int INF = int(1e5 + 1);
int N, M, R;
int d[201][201];
int r[8];
int min_cost = 7 * INF;

void dfs(int from_idx, int dist, int used) {

    if (used == (1 << R) - 1) {
        min_cost = min(min_cost, dist);
        return;
    }

    for (int to_idx = 0; to_idx < R; ++to_idx) if (!(used >> to_idx & 1)) {
        if (dist == -1) {
            dfs(to_idx, 0, used | 1 << to_idx);
        } else {
            dfs(to_idx, dist + d[r[from_idx]][r[to_idx]], used | 1 << to_idx);
        }
    }
}


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    cin >> N >> M >> R;

    for (int i = 1; i <= N; ++i) {
        fill(d[i] + 1, d[i] + N + 1, INF);
        d[i][i] = 0;
    }
    for (int i = 0; i < R; ++i) {
        cin >> r[i];
    }
    int a, b, c;
    for (int i = 0; i < M; ++i) {
        cin >> 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) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

    dfs(0, -1, 0);
	
  	printf ("%d\n", min_cost)
  	//cout << min_cost << '\n';

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:34: error: expected ';' before 'return'
   56 |         printf ("%d\n", min_cost)
      |                                  ^
      |                                  ;
......
   59 |     return 0;
      |     ~~~~~~
Language: C++

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int;
int main(void){
    // Your code here!
    int n,m,r;
    cin>>n>>m>>r;
    int s[r];
    for(int i=0;i<r;i++){
        cin>>s[i];
    }
    int dp[n][n];
    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]=1<<30;
        }
    }
    //for(int i=0;i<200;i++){
    //    cout<<ch[i]<<endl;
    //}
    for(int i=0;i<m;i++){
        int a,b,c;
        cin>>a>>b>>c;
        dp[a-1][b-1]=c;
        dp[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++){
                if(dp[i][j]>dp[i][k]+dp[k][j]){
                    dp[i][j]=dp[i][k]+dp[k][j];
                }
            }
        }
    }
    int ans=1<<30;
    vector<int> v;
    for(int i=0;i<r;i++){
        v.push_back(s[i]-1);
    }
    sort(v.begin(),v.end());
    do{
        int p=0;
        for(int i=0;i<r-1;i++)p+=dp[v[i]][v[i+1]];
        ans=min(ans,p);
    }while(next_permutation(v.begin(),v.end()));
    cout<<ans<<endl;
}


Compiler output:
a.cc:4:19: error: declaration does not declare anything [-fpermissive]
    4 | typedef long long int;
      |                   ^~~
Language: C++

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m, r;
    cin >> n >> m >> r;

    vector<int> R(r);
    REP(i, r){
        cin >> R[i];
        R[i]--;
    }
    sort(R.begin(), R.end());

    /*
    int A[n][n] = {};
    REP(i, n){
        REP(j, n){
            if(i != j) A[i][j] = 1e9;
        }
    }
    */

    REP(i, m){
        int a, b, c;
        cin >>  a >> b >> c;
        a--; b--;
        A[a][b] = c;
        A[b][a] = c;
    }

    REP(i, n){
        REP(j, n){
            REP(k, n){
                A[j][k] = min(A[j][k], A[j][i] + A[i][k]);
            }
        }
    }

    int ans = 1e9;
    do{
        int cost = 0;
        REP(i, r - 1){
            cost += A[R[i]][R[i + 1]];
        }
        ans = min(ans, cost);
    }while(next_permutation(R.begin(), R.end()));

    cout << ans << endl; 

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: 'A' was not declared in this scope
   32 |         A[a][b] = c;
      |         ^
a.cc:39:17: error: 'A' was not declared in this scope
   39 |                 A[j][k] = min(A[j][k], A[j][i] + A[i][k]);
      |                 ^
a.cc:48:21: error: 'A' was not declared in this scope
   48 |             cost += A[R[i]][R[i + 1]];
      |                     ^
Language: C++

https://beta.atcoder.jp/contests/abc073/tasks/abc073_d#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m, r;
    cin >> n >> m >> r;

    vector<int> R(r);
    REP(i, r){
        cin >> R[i];
        R[i]--;
    }
    sort(R.begin(), R.end());

    int A[n][n] = {};
    REP(i, n){
        REP(j, n){
            if(i != j) A[i][j] = 1e9;
        }
    }

    REP(i, m){
        int a, b, c;
        cin >>  a >> b >> c;
        a--; b--;
        A[a][b] = c;
        A[b][a] = c;
    }

    REP(i, n){
        REP(j, n){
            REP(k, n){
                A[j][k] = min(A[j][k], A[j][i] + A[i][k]);
            }
        }
    }

    int ans = 1e9;
    do{
        int cost = 0;
        REP(i, r - 1){
            cost += A[R[i]][R[i + 1]];
        }
        ans = min(ans, cost);
    }while(next_permutation(R.begin(), R.end()));

    cout << ans << endl; 

    return 0;
}


Compiler output:
a.cc:1:1: error: 'https' does not name a type
    1 | https://beta.atcoder.jp/contests/abc073/tasks/abc073_d#include <bits/stdc++.h>
      | ^~~~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin.tie(0);
      |     ^~~
a.cc:7:5: error: 'ios' has not been declared
    7 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:12:5: error: 'vector' was not declared in this scope
   12 |     vector<int> R(r);
      |     ^~~~~~
a.cc:12:12: error: expected primary-expression before 'int'
   12 |     vector<int> R(r);
      |            ^~~
a.cc:14:16: error: 'R' was not declared in this scope
   14 |         cin >> R[i];
      |                ^
a.cc:17:10: error: 'R' was not declared in this scope
   17 |     sort(R.begin(), R.end());
      |          ^
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |     sort(R.begin(), R.end());
      |     ^~~~
      |     short
a.cc:37:27: error: 'min' was not declared in this scope; did you mean 'main'?
   37 |                 A[j][k] = min(A[j][k], A[j][i] + A[i][k]);
      |                           ^~~
      |                           main
a.cc:48:15: error: 'min' was not declared in this scope; did you mean 'main'?
   48 |         ans = min(ans, cost);
      |               ^~~
      |               main
a.cc:49:12: error: 'next_permutation' was not declared in this scope
   49 |     }while(next_permutation(R.begin(), R.end()));
      |            ^~~~~~~~~~~~~~~~
a.cc:51:5: error: 'cout' was not declared in this scope
   51 |     cout << ans << endl;
      |     ^~~~
a.cc:51:20: error: 'endl' was not declared in this scope
   51 |     cout << ans << endl;
      |                    ^~~~
Language: C++

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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e9;

#define MAX_V 1000000

ll d[MAX_V][MAX_V];
int V, M, R;
int r[8];
void warshall_floyd() {
	rep(k, 0, V) rep(i, 0, V) rep(j, 0, V) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> V >> M >> R;
	rep(i, 0, R) {
		cin >> r[i];
		r[i]--;
	}
	rep(i, 0, V) rep(j, 0, V) d[i][j] = INF;

	rep(i, 0, M) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		d[a][b] = c;
		d[b][a] = c;
	}

	warshall_floyd();

	vector<int> v(R);
	rep(i, 0, R) v[i] = r[i];
	ll res = INF;
	do {
		ll tmp = 0;
		rep(i, 1, R) tmp += d[v[i - 1]][v[i]];
		res = min(tmp, res);
	} while(next_permutation(v.begin(), v.end()));

	cout << res << endl;
}


Compiler output:
/tmp/ccC9mUIQ.o: in function `warshall_floyd()':
a.cc:(.text+0xeb): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccC9mUIQ.o
a.cc:(.text+0xfe): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccC9mUIQ.o
a.cc:(.text+0x111): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccC9mUIQ.o
/tmp/ccC9mUIQ.o: in function `main':
a.cc:(.text+0x14c): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccC9mUIQ.o
a.cc:(.text+0x168): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccC9mUIQ.o
a.cc:(.text+0x17d): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccC9mUIQ.o
a.cc:(.text+0x1a5): relocation truncated to fit: R_X86_64_PC32 against symbol `r' defined in .bss section in /tmp/ccC9mUIQ.o
a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `r' defined in .bss section in /tmp/ccC9mUIQ.o
a.cc:(.text+0x1e8): relocation truncated to fit: R_X86_64_PC32 against symbol `r' defined in .bss section in /tmp/ccC9mUIQ.o
a.cc:(.text+0x1f5): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccC9mUIQ.o
a.cc:(.text+0x242): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

int main(){
  int n, m, r, s[8], d[205][205], i, j, k, a, b, c, sum = 0, ans = INF;
  vector<int> p;
  scanf("%d%d%d", &n, &m, &r);
  for(i = 0; i < n; i++) for(j = 0; j < n; j++) d[i][j] = (i == j ? 0 : INF);
  for(i = 0; i < r; i++)　scanf("%d", &s[i]);
  sort(s, s+r);
  for(i = 0; i < m; i++){
    scanf("%d%d%d", &a, &b, &c);
    d[a][b] = c;
    d[b][a] = c;
  }
  for(k = 1; k <= n; k++){
    for(i = 1; i <= n; i++){
      if(d[i][k] == INF) continue;
      for(j = 1; j <= n; j++){
        if(d[k][j] == INF) continue;
        if(d[i][k] + d[k][j] < d[i][j]) d[i][j] = d[i][k] + d[k][j];
      }
    }
  }
  do{
    sum = 0;
    for(i = 1; i < r; i++) sum += d[s[i-1]][s[i]];
    if(ans > sum) ans = sum;
  }while(next_permutation(s, s+r));
  printf("%d", ans);
}


Compiler output:
a.cc:10:25: error: extended character 　 is not valid in an identifier
   10 |   for(i = 0; i < r; i++)　scanf("%d", &s[i]);
      |                         ^
a.cc: In function 'int main()':
a.cc:10:25: error: '\U00003000scanf' was not declared in this scope; did you mean 'wscanf'?
   10 |   for(i = 0; i < r; i++)　scanf("%d", &s[i]);
      |                         ^~~~~~~
      |                         wscanf
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: In function 'int main()':
a.cc:3:18: error: expected primary-expression before '<' token
    3 | #define INF (1 < <29)
      |                  ^
a.cc:28:91: note: in expansion of macro 'INF'
   28 | for ( int i =1; i <= N ; i ++) for ( int j =1; j <= N ; j ++) if ( i != j ) d [ i ][ j ]= INF ;
      |                                                                                           ^~~
a.cc:3:18: error: expected primary-expression before '<' token
    3 | #define INF (1 < <29)
      |                  ^
a.cc:40:7: note: in expansion of macro 'INF'
   40 | res = INF ;
      |       ^~~
a.cc:42:10: warning: unknown escape sequence: '\040'
   42 | printf ( " % d \ n " , res );
      |          ^~~~~~~~~~~
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:10: fatal error:  cstdio : No such file or directory
    1 | #include < cstdio >
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<time.h>
#include<ctime>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int inf = 1000000000;
ll llinf = 1000000000000000000;
template<typename T>
T GCD(T a, T b) {
	while (max(a, b) % min(a, b)) {
		if (a > b)a = a % b;
		else b = b % a;
	}
	return min(a, b);
}
template<typename T>
T LCM(T a, T b) {
	return a / GCD(a, b)*b;
}
bool prime(ll a) {
	for (int i = 2; i <= sqrt(a); i++) {
		if (!(a%i))return false;
	}
	return true;
}
ll n, m, r, f[10], a[40010], b[40010], c[40010];
ll wsfd[210][210];
int main() {
	cin >> n >> m >> r;
	for (int i = 0; i < r; i++) {
		cin >> f[i];
		f[i]--;
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++)wsfd[i][j] = llinf;
	}
	for (int i = 0; i < n; i++)wsfd[i][j] = 0;
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i] >> c[i];
		wsfd[a[i] - 1][b[i] - 1] = c[i];
		wsfd[b[i] - 1][a[i] - 1] = c[i];
	}
	for (int k = 0; k < n; k++) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				wsfd[i][j] = min(wsfd[i][j], wsfd[i][k] + wsfd[k][j]);
			}
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cout << wsfd[i][j] << " ";
		}
		cout << endl;
	}
	ll ans = inf;
	do {
		ll cnt = 0;
		for (int i = 0; i < r - 1; i++)cnt += wsfd[f[i]][f[i + 1]];
		if (ans > cnt)ans = cnt;
	} while (next_permutation(f, f + r));
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:44: error: 'j' was not declared in this scope
   48 |         for (int i = 0; i < n; i++)wsfd[i][j] = 0;
      |                                            ^