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

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
#define INF 0x3f3f3f3f
int map[220][220];
int r[220];
int N,M,R;
void floyd()
{
	for(int k=1;k<=N;k++)
    {
        for(int i=1;i<=N;i++)
        {
            for(int j=1;j<=N;j++)
            {
               map[i][j]=min(map[i][k]+map[k][j],map[i][j]);
        }
    }
}
int main()
{
	while(~scanf("%d%d%d",&N,&M,&R))
	{
		for(int i=0;i<R;++i)
			scanf("%d",&r[i]);
		//memset(map,INF,sizeof(map));
		for(int i=0;i<=N;++i)
		{
			for(int j=0;j<=N;++j)
				if(i == j)
					map[i][j] = 0;
				else
					map[i][j] = INF;
		}

		for(int i=0;i<M;++i)
		{
			int x,y,z;
			scanf("%d%d%d",&x,&y,&z);
			map[x][y]=map[y][x]=z;
		}
		floyd();
		int ans = INF;
		do
		{
			int sum = 0;
			for(int i=0;i<R-1;++i)
			{
				sum+=map[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 'void floyd()':
a.cc:22:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   22 | int main()
      |         ^~
a.cc:22:9: note: remove parentheses to default-initialize a variable
   22 | int main()
      |         ^~
      |         --
a.cc:22:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:23:1: error: a function-definition is not allowed here before '{' token
   23 | {
      | ^
a.cc:57:2: error: expected '}' at end of input
   57 | }
      |  ^
a.cc:11:1: note: to match this '{'
   11 | {
      | ^
Language: C++

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

#define INF (200*100000+1)
unsigned long Rpath[8][8];
unsigned long minpath[201][201];
bool calced[201][201];

int r[8];
bool used[8];

int N, M, R;
unsigned long getminpath(int from, int left)
{
	used[from] = true;
	unsigned long minpath = INF;
	for (int to = 0; to < R; to++) {
		if (used[to]) continue;
		if (left == 1) {
			used[from] = false;
			return Rpath[from][to];
		}
		minpath = min(minpath, Rpath[from][to] + getminpath(to, left-1));
	}
	used[from] = false;
	return minpath;
}


void main(void)
{
	cin >> N >> M >> R;
	
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < R; j++) {
			Rpath[i][j] = INF;
		}
		used[i] = false;
	}
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			if (i == j) {
				minpath[i][j] = 0;
				calced[i][j] = true;
			} else {
				minpath[i][j] = INF;
				calced[i][j] = false;
			}
			
		}
	}
	for (int i = 0; i < R; i++) {
		cin >> r[i];
	}

	vector <pair<int, int> > dist[201];
	for (int i = 1; i <= M; i++) {
		int city[2], road;
		cin >> city[0] >> city[1] >> road;
		dist[city[0]].push_back(make_pair(city[1], road));
		dist[city[1]].push_back(make_pair(city[0], road));
	}

	for (int i = 0; i < R; i++) {
		int basepos = r[i];
		int stpos = basepos;
		bool finish;
		do {
			finish = true;
			unsigned long mindist = INF;

			for (unsigned int j = 0; j < dist[stpos].size(); j++) {
				int nextpos = dist[stpos][j].first;
				if (calced[basepos][nextpos]) continue;

				// update dist
				unsigned long tmpdist = minpath[basepos][stpos] + dist[stpos][j].second;
				if (tmpdist <= minpath[basepos][nextpos]) {
					minpath[basepos][nextpos] = tmpdist;
				}
			}
			// search minpos
			for (int nextpos = 1; nextpos <= N; nextpos++) {
				if (calced[basepos][nextpos]) continue;
				if (minpath[basepos][nextpos] <= mindist) {
					mindist = minpath[basepos][nextpos];
					stpos = nextpos;
					finish = false;
				}
			}
			if (finish) break;
			calced[basepos][stpos] = true;
			minpath[basepos][stpos] = mindist;
			calced[stpos][basepos] = true;
			minpath[stpos][basepos] = mindist;

		} while (!finish);
	}
	
	for (int i = 0; i < R; i++) {
		for (int j = i+1; j < R; j++) {
			Rpath[i][j] = Rpath[j][i] = minpath[r[i]][r[j]];
		}
	}
	
	
	
	unsigned long ans = INF;
	for (int stpos = 0; stpos < R; stpos++) {
		unsigned long tmp_ans = getminpath(stpos, R-1);
		ans = min(ans, tmp_ans);
	}
	cout << ans << endl;

	return;
}

Compiler output:
a.cc:32:1: error: '::main' must return 'int'
   32 | void main(void)
      | ^~~~
a.cc: In function 'int main()':
a.cc:117:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
  117 |         return;
      |         ^~~~~~
Language: C++

// D.

#include <iostream>
#include <algorithm>
#include <numeric>

using namespace std;

int main(int argc, char *argv[])
{
	int n, m, r, a, b, c, d[200][200];
	cin >> n >> m >> r;
	int vis[8];
	for (int i = 0; i < r; ++i) {
		cin >> vis[i];
		--vis[i];
	}
	sort(vis, vis + r);
	memset(d, 0x3f, sizeof(d));
	for (int i = 0; i < m; ++i) {
		cin >> a >> b >> c;
		d[a-1][b-1] = d[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]);
			}
		}
	}
	int ans = 1<<30;
	do {
		int cost = 0;
		for (int i = 1; i < r; ++i) {
			cost += d[vis[i-1]][vis[i]];
		}
		ans = min(ans, cost);
	} while (next_permutation(vis, vis + r));
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:19:9: error: 'memset' was not declared in this scope
   19 |         memset(d, 0x3f, sizeof(d));
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <numeric>
  +++ |+#include <cstring>
    6 |
Language: C++

// D.

#include <iostream>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
	int n, m, r, a, b, c, d[200][200];
	cin >> n >> m >> r;
	int vis[8];
	for (int i = 0; i < r; ++i) {
		cin >> vis[i];
		--vis[i];
	}
	sort(vis, vis + r);
	memset(d, 0x3f, sizeof(d));
	for (int i = 0; i < m; ++i) {
		cin >> a >> b >> c;
		d[a-1][b-1] = d[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]);
			}
		}
	}
	int ans = 1<<30;
	do {
		int cost = 0;
		for (int i = 1; i < r; ++i) {
			cost += d[vis[i-1]][vis[i]];
		}
		ans = min(ans, cost);
	} while (next_permutation(vis, vis + r));
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:17:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |         sort(vis, vis + r);
      |         ^~~~
      |         short
a.cc:18:9: error: 'memset' was not declared in this scope
   18 |         memset(d, 0x3f, sizeof(d));
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <set>
  +++ |+#include <cstring>
    5 | 
a.cc:37:18: error: 'next_permutation' was not declared in this scope
   37 |         } while (next_permutation(vis, vis + r));
      |                  ^~~~~~~~~~~~~~~~
Language: C++

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

#define REP(i,n) for(int i=0; i<(int)(n); i++)

int main() {
  /////////// INPUT ///////////
  int N, M, R; cin >> N >> M >> R;
  vector<int> r(R);
  REP(i, R) {
    cin >> r[i];
    r[i]--;  // 0-based index
  }
  // dist[i][j]: Distance from i-th node to j-th.
  vector<vector<int>> dist(N, vector<int>(N, 1000000000));
  REP(i, M) {
    int A, B, C; cin >> A >> B >> C;
    A--; B--;  // 0-based index
    dist[A][B] = dist[B][A] = C;
  }
  
  /////////// SOLVE ///////////
  // Compute minimum distances for all pairs of towns.
  REP(k, N) REP(i, N) REP(j, N)
    dist[i][j] = min(dist[i][k] + dist[k][j], dist[i][j]);

  // Compute total distance for all possible visiting order.
  int answer = 1000000000;
  sort(r.begin(), r.end());  // r must be sorted array to start next_permutation.
  do {
    int total_distance = 0;
    REP(i, R-1)
      total_distance += dist[r[i]][r[i+1]];
    answer = min(answer, total_distance);
  } while (next_permutation(r.begin(), r.end()));

  /////////// OUTPUT ///////////
  cout << answer << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   30 |   sort(r.begin(), r.end());  // r must be sorted array to start next_permutation.
      |   ^~~~
      |   short
a.cc:36:12: error: 'next_permutation' was not declared in this scope
   36 |   } while (next_permutation(r.begin(), r.end()));
      |            ^~~~~~~~~~~~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>

int N,M,R,r[8],cost[201][201];

int dfs(int now){
    int i,ret,rt,tmpcost;

    ret = 0;
    for(i=0;i<M;i++){
        if(r[i]>0){
            rt=r[i];
            r[i]=0;
            tmpcost = cost[now][rt] + dfs(r,n,rt);
            r[i]=rt;
            if(tmpcost<ret)ret=tmpcost;
        }
    }
    return ret;
}

int main(){
    int a,b,c;
    int i,j,k;

    scanf("%d %d %d",&N,&M,&R);
    for(i=0;i<R;i++){
        scanf("%d",&r[i]);
    }

    for(i=1;i<=N;i++){
        for(j=1;j<=N;j++){
            cost[i][j]=100000000;
        }
        cost[0][i]=cost[i][0]=0;
    }

    for(i=0;i<M;i++){
        scanf("%d %d %d",&a,&b,&c);
        cost[a][b] = cost[b][a] = c;
    }

    /* ワーシャルフロイド */
    for(k=1;k<=N;k++){
        for(i=1;i<=N;i++){
            for(j=1;j<=N;j++){
                if(cost[i][j] > cost[i][k] + cost[k][j]){
                    cost[i][j] = cost[i][k] + cost[k][j];
                }
            }
        }
    }

    printf("%d\n",dfs(0));
    return 0;
}


Compiler output:
main.c: In function 'dfs':
main.c:14:45: error: 'n' undeclared (first use in this function)
   14 |             tmpcost = cost[now][rt] + dfs(r,n,rt);
      |                                             ^
main.c:14:45: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:43: error: passing argument 1 of 'dfs' makes integer from pointer without a cast [-Wint-conversion]
   14 |             tmpcost = cost[now][rt] + dfs(r,n,rt);
      |                                           ^
      |                                           |
      |                                           int *
main.c:6:13: note: expected 'int' but argument is of type 'int *'
    6 | int dfs(int now){
      |         ~~~~^~~
main.c:14:39: error: too many arguments to function 'dfs'
   14 |             tmpcost = cost[now][rt] + dfs(r,n,rt);
      |                                       ^~~
main.c:6:5: note: declared here
    6 | int dfs(int now){
      |     ^~~
Language: C++

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

constexpr int k(int n) { return (n==0) ? 1 : n*k(n-1); }
const int INF = 0x3f3f3f3f3f3f3f3fLL;

int N, M, R;
int dp[202][202];
int r[9];

signed main() {
  
  cin>>N>>M>>R;
  int a,b,c;
  rep(i,N+1) {
    rep(j, N+1) {
      d[i][j] = INF;
    }
  }
  
  rep(i, R)cin>>r[i];
  
  rep(i, M) {
    cin>>a>>b>>c;
    dp[a][b] = c;
  }
  
  rep(i, N) {
    rep(j, N) {
      rep(k, N)dp[i+1][j+1] = min(dp[i+1][j+1], dp[i+1][k+1]+dp[k+1][j+1]);
    }
  }
  
  int s = INF, t;
  
  rep(i, k(R)) {
    t = 0;
    for_(j, 1, R)t += dp[r[j-1]][r[j]]; 
    s = min(s, t);
    
    next_permutation(r, r+R); 
  }
  
  cout<<s<<endl;
  
  return 0;
}

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

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

constexpr int k(int n) { return (n==0) ? 1 : n*k(n-1); }
const int INF = 0x3f3f3f3f3f3f3f3fLL;

int N, M, R;
int dp[202][202];
int r[9];

signed main() {
  
  cin>>N>>M>>R;
  int a,b,c;
  rep(i,N+1) {
    rep(j, N+1) {
      d[i][j] = INF;
    }
  }
  
  rep(i, R)cin>>r[i];
  
  rep(i, M) {
    cin>>a>>b>>c;
    dp[a][b] = c;
  }
  
  rep(i, N) {
    rep(j, N) {
      rep(k, N)dp[i+1][j+1] = min(dp[i+1][j+1], dp[i+1][k+1]+dp[k+1][j+1]);
    }
  }
  
  int s = INF, t;
  
  rep(i, k(R)) {
    t = 0;
    for_(j, R)t += dp[r[j-1]][r[j]]; 
    s = min(s, t);
    
    next_permutation(r, r+R); 
  }
  
  cout<<s<<endl;
  
  return 0;
}

Compiler output:
a.cc:41:14: error: macro "for_" requires 3 arguments, but only 2 given
   41 |     for_(j, R)t += dp[r[j-1]][r[j]];
      |              ^
a.cc:4:9: note: macro "for_" defined here
    4 | #define for_(i, a, b) for(int i=(a);i<(b);i++)
      |         ^~~~
a.cc: In function 'int main()':
a.cc:20:7: error: 'd' was not declared in this scope
   20 |       d[i][j] = INF;
      |       ^
a.cc:41:5: error: 'for_' was not declared in this scope
   41 |     for_(j, R)t += dp[r[j-1]][r[j]];
      |     ^~~~
Language: C++

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

constexpr int k(int n) { return (n==0) ? 1 : n*k(n-1); }
const int INF = 0x3f3f3f3f3f3f3f3fLL;

int N, M, R;
int d[202][202];
int r[9];

signed main() {
  
  cin>>N>>M>>R;
  int a,b,c;
  rep(i,N+1) {
    rep(j, N+1) {
      d[i][j] = INF;
    }
  }
  
  rep(i, R)cin>>r[i];
  
  rep(i, M) {
    cin>>a>>b>>c;
    dp[a][b] = c;
  }
  
  rep(i, N) {
    rep(j, N) {
      rep(k, N)dp[i+1][j+1] = min(dp[i+1][j+1], dp[i+1][k+1]+dp[k+1][j+1]);
    }
  }
  
  int s = INF, t;
  
  rep(i, k(R)) {
    t = 0;
    for_(j, R)t += dp[r[j-1]][r[j]]; 
    s = min(s, t);
    
    next_permutation(r, r+R); 
  }
  
  cout<<s<<endl;
  
  return 0;
}

Compiler output:
a.cc:41:14: error: macro "for_" requires 3 arguments, but only 2 given
   41 |     for_(j, R)t += dp[r[j-1]][r[j]];
      |              ^
a.cc:4:9: note: macro "for_" defined here
    4 | #define for_(i, a, b) for(int i=(a);i<(b);i++)
      |         ^~~~
a.cc: In function 'int main()':
a.cc:28:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   28 |     dp[a][b] = c;
      |     ^~
      |     dup
a.cc:33:16: error: 'dp' was not declared in this scope; did you mean 'dup'?
   33 |       rep(k, N)dp[i+1][j+1] = min(dp[i+1][j+1], dp[i+1][k+1]+dp[k+1][j+1]);
      |                ^~
      |                dup
a.cc:41:5: error: 'for_' was not declared in this scope
   41 |     for_(j, R)t += dp[r[j-1]][r[j]];
      |     ^~~~
Language: C++

#include <bits/stdc++h>
using namespace std;
#define int long long;
#define for_(i, a, b) for(int i=(a);i<(b);i++)
#define rep(i, n) for_(i, 0, n)

constexpr ll k(int n) { return (n==0) ? 1 : n*k(n-1); }
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

int N, M, R;
int d[202][202];
int r[9];

signed main() {
  
  cin>N>M>>R;
  int a,b,c;
  rep(i,N+1) {
    rep(j, N+1) {
      d[i][j] = LINF;
    }
  }
  
  rep(i, R)cin>>r[i];
  
  rep(i, M) {
    cin>>a>>b>>c;
    dp[a][b] = c;
  }
  
  rep(i, N) {
    rep(j, N) {
      rep(k, N)dp[i+1][j+1] = min(dp[i+1][j+1], dp[i+1][k+1]+dp[k+1][j+1]);
    }
  }
  
  int s = LINF, t;
  
  rep(i, k(R)) {
    t = 0;
    for_(j, R)t += dp[r[j-1]][r[j]]; 
    s = min(s, t);
    
    next_permutation(r, r+R); 
  }
  
  cout<<s<<endl;
  
  return 0;
}

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<bits/stdc++.h>
using namespace std;

#define ll long long
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
#define PP pair<P,int>
#define fi first
#define se second
#define INF (1<<30)
#define MOD 1000000007
#define all(a) (a).begin(),(a).end()


signed main(){
    int n,m,r;
    cin>>n>>m>>r;
    vi vec;
    for(int i=0;i<r;i++){
        int t;
        cin>>t;
        r.pb(t);
    }
    vector<vi> d(n,vi(n,INF));
    for(int i=0;i<n;i++){
        d[i][i]=0;
    }
    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]);
            }
        }
    }
    sort(all(vec));
    int ans=INF;
    do{
        int c=0;
        for(int i=1;i<r;i++){
            c+=d[vec[i-1]][vec[i]];
        }
        ans=min(ans,c);
    }while(next_permutation(all(vec)));
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: request for member 'push_back' in 'r', which is of non-class type 'int'
    6 | #define pb push_back
      |            ^~~~~~~~~
a.cc:23:11: note: in expansion of macro 'pb'
   23 |         r.pb(t);
      |           ^~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <utility>
#include <functional>

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)

using ll = long long;
using P = std::pair<int, int>;
using namespace std;

constexpr int INF = 1000000000; // 2 * 1e9
constexpr ll LLINF = 9223372036854775807; // 9 * 1e18
constexpr int MAX_N = 201;

// d[i][j]はi->jの最小コスト
int d[MAX_N][MAX_N];
// S->すでに訪れた点の集合, v->現在位置, dp[S][v]: 左の状況での最小コスト
int dp[256][8];
int N, M, R;
vector<int> r;

// dpテーブルを埋める
void solve() {
	for (int s = (1 << R) - 1; s >= 0; --s) {
	{
		for (int v = 0; v < R; v++)
		{
			for (int u = 0; u < R; u++)
			{
				//v<-uと移動したとする
				if ((s >> u) & 1) {
					dp[s & ~(1 << u)][u] = min(dp[s & ~(1 << u)][u], d[r[u]][r[v]] + dp[s][v]);
				}
			}
		}
	}
	//for (int s = (1 << R) - 2; s >= 0; --s) {
	//	REP(v, R) {
	//		REP(u, R) {
	//			if (!((s >> u) & 1)) {
	//				dp[s][v] = min(dp[s][v], dp[s | 1 << u][u] + d[r[v]][r[u]]);
	//			}
	//		}
	//	}
	//}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	// 初期化
	cin >> N >> M >> R;
	r = vector<int>(R);
	REP(i, R) cin >> r[i];
	for (int i = 0; i < N; ++i) {
		fill(d[i], d[i] + N, INF);
		d[i][i] = 0;
	}
	REP(i, M) {
		int a, b, c;
		cin >> a >> b >> c;
		d[a][b] = c;
		d[b][a] = c;
	}
	for (int S = 0; S < 1 << R; ++S) {
		fill(dp[S], dp[S] + R, INF);
	}

	// WF法

	REP(k, N + 1) {
		REP(i, N + 1) {
			REP(j, N + 1) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}

	// ビットDP

	REP(i, R) dp[(1 << R) - 1][i] = 0; // 全て通った後のコストを0にする

	solve();

	int m = INF;
	REP(i, R) {
		m = min(m, dp[1 << i][i]);
	}

	cout << m << "\n";

	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:56:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   56 | int main() {
      |         ^~
a.cc:56:9: note: remove parentheses to default-initialize a variable
   56 | int main() {
      |         ^~
      |         --
a.cc:56:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:56:12: error: a function-definition is not allowed here before '{' token
   56 | int main() {
      |            ^
a.cc:101:2: error: expected '}' at end of input
  101 | }
      |  ^
a.cc:31:14: note: to match this '{'
   31 | void solve() {
      |              ^
Language: C++

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int visit[8];
int perm[8];
int floyd[201][201];
int main()
{
	int n,m,r;
	scanf("%d%d%d",&n,&m,&r);
	for(int i = 0;i < r;++i) {
		scanf("%d",&visit[i]);
		--visit[i];
		perm[i] = i;
	}
	memset(floyd,-1,sizeof(floyd));
	for(int i = 0;i < m;++i) {
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);--a,--b;
		if(floyd[a][b] == -1 || floyd[a][b] > c) floyd[a][b] = floyd[b][a] = c;
	}
	for(int k = 0;k < n;++k) {
		for(int i = 0;i < n;++i) if(floyd[i][k] != -1) {
			for(int j = 0;j < n;++j) if(floyd[k][j] != -1) {
				if(floyd[i][j] == -1 || floyd[i][j] > floyd[i][k] + floyd[k][j])
					floyd[i][j] = floyd[i][k] + floyd[k][j];
			}
		}
	}
	
	int minans = -1;
	do {
		int ans = 0;
		for(int i = 1;i < r;++i)
			ans += floyd[visit[perm[i-1]]][visit[perm[i]]];
		}
		if(minans == -1 || minans > ans) minans = ans;
	} while(std::next_permutation(perm,perm+r));
	printf("%d\n",minans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:19: error: expected 'while' before '(' token
   39 |                 if(minans == -1 || minans > ans) minans = ans;
      |                   ^
a.cc:39:45: error: 'ans' was not declared in this scope; did you mean 'abs'?
   39 |                 if(minans == -1 || minans > ans) minans = ans;
      |                                             ^~~
      |                                             abs
a.cc:39:49: error: expected ';' before 'minans'
   39 |                 if(minans == -1 || minans > ans) minans = ans;
      |                                                 ^~~~~~~
      |                                                 ;
a.cc: At global scope:
a.cc:40:11: error: expected unqualified-id before 'while'
   40 |         } while(std::next_permutation(perm,perm+r));
      |           ^~~~~
a.cc:41:15: error: expected constructor, destructor, or type conversion before '(' token
   41 |         printf("%d\n",minans);
      |               ^
a.cc:42:1: error: expected declaration before '}' token
   42 | }
      | ^
Language: C++

#pragma comment(linker,"/STACK:10240000")
#include<iostream>
#include<stack>
#include<cstdlib>
#include<cstdio>
#include<set>
#define N 250
using namespace std;
int dp[N][N];
int result=INT_MAX;
void swap(int *a, int *b)
{
    int m;
    m = *a;
    *a = *b;
    *b = m;
}
void perm(int list[], int k, int m)
{
    int i;
    //cout<<"1"<<endl;
    if(k > m)
    {
         //cout<<"2"<<endl;
        //for(i = 0; i <= m; i++)
        //    printf("%d ", list[i]);
        //printf("\n");
        //n++;
       //int tempresult = getcount(list,m);
       int tempresult=0;
       for(int i=0;i<m;i++){
          //  cout<<list[i]<<"-"<<list[i+1]<<endl;
         if(dp[list[i]][list[i+1]]!=INT_MAX){
            tempresult+=dp[list[i]][list[i+1]];
         }
         else{
            tempresult=INT_MAX;
            break;
         }
       }
       //cout<<"-----"<<tempresult<<endl;
       if(tempresult<result){
        result = tempresult;
       }
       //return;
    }
    else
    {
        for(i = k; i <= m; i++)
        {
            swap(&list[k], &list[i]);
            perm(list, k + 1, m);
            swap(&list[k], &list[i]);
        }
    }
}
int main()
{
    int n,e,r;     //表示输入的顶点数和边数
    int a[8];
    //set<int> st;
    while(cin>>n>>e>>r&&e!=0)
    {   for(int i=0;i<r;i++){
         cin>>a[i];
        }
        int i,j;
        int s,t,w;      //表示存在一条边s->t,权值为w
        for(i=0;i<N;i++){
            for(j=0;j<N;j++){
                dp[i][j]=100005;
            }
        }
        for(i=0;i<e;i++)
        {
            cin>>s>>t>>w;
            dp[s][t]=w;
            dp[t][s]=w;
        }
      for(int k=1;k<=n;k++){
         for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++) {
                if(dp[i][k]+dp[k][j]<dp[i][j]) {
                    dp[i][j]=dp[i][k]+dp[k][j];
                    //path[i][j]=path[i][k];
                }
            }
         }
      }
      perm(a,0,r-1);



        cout<<result<<endl;
    }
    return 0;
}


Compiler output:
a.cc:10:12: error: 'INT_MAX' was not declared in this scope
   10 | int result=INT_MAX;
      |            ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include<set>
  +++ |+#include <climits>
    7 | #define N 250
a.cc: In function 'void perm(int*, int, int)':
a.cc:33:37: error: 'INT_MAX' was not declared in this scope
   33 |          if(dp[list[i]][list[i+1]]!=INT_MAX){
      |                                     ^~~~~~~
a.cc:33:37: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#pragma comment(linker,"/STACK:10240000")
#include<iostream>
#include<stack>
#include<cstdlib>
#include<cstdio>
#include<set>
#define N 250
using namespace std;
int dp[N][N];
int result=INT_MAX;
void swap(int *a, int *b)
{
    int m;
    m = *a;
    *a = *b;
    *b = m;
}
void perm(int list[], int k, int m)
{
    int i;
    //cout<<"1"<<endl;
    if(k > m)
    {
         //cout<<"2"<<endl;
        //for(i = 0; i <= m; i++)
        //    printf("%d ", list[i]);
        //printf("\n");
        //n++;
       //int tempresult = getcount(list,m);
       int tempresult=0;
       for(int i=0;i<m;i++){
          //  cout<<list[i]<<"-"<<list[i+1]<<endl;
         if(dp[list[i]][list[i+1]]!=INT_MAX){
            tempresult+=dp[list[i]][list[i+1]];
         }
         else{
            tempresult=INT_MAX;
            break;
         }
       }
       //cout<<"-----"<<tempresult<<endl;
       if(tempresult<result){
        result = tempresult;
       }
       //return;
    }
    else
    {
        for(i = k; i <= m; i++)
        {
            swap(&list[k], &list[i]);
            perm(list, k + 1, m);
            swap(&list[k], &list[i]);
        }
    }
}
int main(int argc, char *argv[])
{
    int n,e,r;     //表示输入的顶点数和边数
    int a[8];
    //set<int> st;
    while(cin>>n>>e>>r&&e!=0)
    {   for(int i=0;i<r;i++){
         cin>>a[i];
        }
        int i,j;
        int s,t,w;      //表示存在一条边s->t,权值为w
        for(i=0;i<N;i++){
            for(j=0;j<N;j++){
                dp[i][j]=100005;
            }
        }
        for(i=0;i<e;i++)
        {
            cin>>s>>t>>w;
            dp[s][t]=w;
            dp[t][s]=w;
        }
      for(int k=1;k<=n;k++){
         for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++) {
                if(dp[i][k]+dp[k][j]<dp[i][j]) {
                    dp[i][j]=dp[i][k]+dp[k][j];
                    //path[i][j]=path[i][k];
                }
            }
         }
      }
      //for(int i=1;i<=n;i++){
      //  for(int j=1;j<=n;j++){
     //       cout<<dp[i][j]<<" ";
       // }
     //   cout<<endl;
     // }
     //  cout<<endl;
      //result=getcount(a,r);
     // cout<<"1"<<endl;
      perm(a,0,r-1);



        cout<<result<<endl;
    }
    return 0;
}


Compiler output:
a.cc:10:12: error: 'INT_MAX' was not declared in this scope
   10 | int result=INT_MAX;
      |            ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include<set>
  +++ |+#include <climits>
    7 | #define N 250
a.cc: In function 'void perm(int*, int, int)':
a.cc:33:37: error: 'INT_MAX' was not declared in this scope
   33 |          if(dp[list[i]][list[i+1]]!=INT_MAX){
      |                                     ^~~~~~~
a.cc:33:37: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<iostream>
#include<stack>
#include<cstdlib>
#include<cstdio>
#include<set>
#define N 250
using namespace std;
int dp[N][N];
int result=INT_MAX;
void swap(int *a, int *b)
{
    int m;
    m = *a;
    *a = *b;
    *b = m;
}
int getcount(int list[],int r){
    int result=0;
      for(int i=0;i<=r;i++){
        result+=dp[list[i]][list[i+1]];
      }
    return result;
}
void perm(int list[], int k, int m)
{
    int i;
    if(k > m)
    {
        //for(i = 0; i <= m; i++)
        //    printf("%d ", list[i]);
        //printf("\n");
        //n++;
       int tempresult = getcount(list,m);
       if(tempresult<result){
        result = tempresult;
       }
    }
    else
    {
        for(i = k; i <= m; i++)
        {
            swap(&list[k], &list[i]);
            perm(list, k + 1, m);
            swap(&list[k], &list[i]);
        }
    }
}
int main(int argc, char *argv[])
{
    int n,e,r;     //表示输入的顶点数和边数
    int a[8];
    //set<int> st;
    while(cin>>n>>e>>r&&e!=0)
    {   for(int i=0;i<r;i++){
         cin>>a[i];
        }
        int i,j;
        int s,t,w;      //表示存在一条边s->t,权值为w
        for(i=0;i<N;i++){
            for(j=0;j<N;j++){
                dp[i][j]=INT_MAX;
            }
        }
        for(i=0;i<e;i++)
        {
            cin>>s>>t>>w;
            dp[s][t]=w;
            dp[t][s]=w;
        }
      for(int k=1;k<=n;k++){
         for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++) {
                if(dp[i][k]+dp[k][j]<dp[i][j]) {
                    dp[i][j]=dp[i][k]+dp[k][j];
                    //path[i][j]=path[i][k];
                }
            }
         }
      }
      //result=getcount(a,r);
      cout<<"1"<<endl;
      perm(a,0,r-1);



        cout<<result<<endl;
    }
    return 0;
}


Compiler output:
a.cc:9:12: error: 'INT_MAX' was not declared in this scope
    9 | int result=INT_MAX;
      |            ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include<set>
  +++ |+#include <climits>
    6 | #define N 250
a.cc: In function 'int main(int, char**)':
a.cc:61:26: error: 'INT_MAX' was not declared in this scope
   61 |                 dp[i][j]=INT_MAX;
      |                          ^~~~~~~
a.cc:61:26: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 222;
const ll inf = 1e15;
ll dis[N][N];
ll dp[N][1<<8];
void MIN(ll &a, ll b) {if (a > b) a = b;}
int n, m, r;
int to[N], a[N];
int main() a{
	scanf("%d%d%d", &n, &m, &r);
	
	for (int i = 1; i <= r; ++i) scanf("%d", &a[i]);
	sort(a + 1, a + r + 1);
	
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= n; ++j) dis[i][j] = i == j ? 0 : inf;
	for (int i = 1; i <= m; ++i) {
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		MIN(dis[x][y], (ll)z);
		MIN(dis[y][x], (ll)z);
	}
	for (int k = 1; k <= n; ++k)	
		for (int i = 1; i <= n; ++i)
			for (int j = 1; j <= n; ++j) MIN(dis[i][j], dis[i][k] + dis[k][j]);
			
	for (int i = 1; i <= n; ++i) to[i] = -1;
	for (int i = 1; i <= r; ++i) to[a[i]] = 1 << (i - 1);
	
	for (int i = 1; i <= r; ++i)
		for (int s = 0; s < (1 << r); ++s) dp[i][s] = inf;
	for (int i = 1; i <= r; ++i) dp[i][to[a[i]]] = 0;
	
	for (int s = 0; s < (1 << r); ++s) 
		for (int i = 1; i <= r; ++i)
		if (dp[i][s] != inf) {
			for (int j = 1; j <= r; ++j) {
				int pos = to[a[j]];
				if (~pos) MIN(dp[j][s | pos],dp[i][s] + dis[a[i]][a[j]]);
				else MIN(dp[j][s], dp[i][s] + dis[a[i]][a[j]]);
			}
		}
	ll mx = 1e15;
	for (int i = 1; i <= r; ++i) MIN(mx, dp[i][(1 << r) - 1]);
	cout << mx << endl;
	return 0;
} 

Compiler output:
a.cc:11:12: error: expected initializer before 'a'
   11 | int main() a{
      |            ^
Language: C++

    #include <bits/stdc++.h>
     
    int main()
    {
    	std::ios_base::sync_with_stdio(0);
    	std::cin.tie(0);
    	long long int n, m, r, rs[210];
    	std::cin >> n >> m >> r;
    	
    	for (int i = 0; i < r; ++i)
    	{
    		std::cin >> rs[i];
    		--rs[i];
    	}
    	
    	
    	long long int dist[1010][1010] = { 0 };
    	
    	for (int i = 0; i < m; ++i)
    	{
    		long long int a, b;
    		long long int c;
    		std::cin >> a >> b >> c;
            
            if (dist[a - 1][b - 1] == 0)
            {
    		  dist[a - 1][b - 1] = c;
    		  dist[b - 1][a - 1] = c;
            }
            else
            {
                dist[a - 1][b - 1] = std::min(dist[a - 1][b - 1], c);
                dist[b - 1][a - 1] = std::min(dist[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 (dist[i][j] != 0)
        	            dist[i][j] = std::min( dist[i][j], dist[i][k] * 1LL + dist[k][j] * 1LL );
                   else
                        dist[i][j] = dist[i][k] + dist[k][j];
        	    }
        	}
    	}
    	
    	std::sort(rs, rs + r);
    	
    	long long int LONG_MAX = 0;
    	
    	do {
    		long long int count = 0;
    		for (int i = 1; i < r; ++i)
    		{
    			count += dist[rs[i - 1]][rs[i]];
    		}
    		
            std::min(min, count);
      	} while ( std::next_permutation(rs, rs + r) );
      	
      	std::cout << min;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:50:23: error: expected unqualified-id before numeric constant
   50 |         long long int LONG_MAX = 0;
      |                       ^~~~~~~~
a.cc:59:22: error: 'min' was not declared in this scope; did you mean 'std::min'?
   59 |             std::min(min, count);
      |                      ^~~
      |                      std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:62:22: error: 'min' was not declared in this scope; did you mean 'std::min'?
   62 |         std::cout << min;
      |                      ^~~
      |                      std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

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

int arr[201][201];

void warshall(int v){
    for(int k=1;k<=v;k++)
        for(int i=1;i<=v;i++)
            for(int j=1;j<=v;j++)
                    arr[i][j] = min(arr[i][j], arr[i][k]+arr[k][j]);
}

void init(int v){
    for(int i=1;i<=v;i++)
        for(int j=1;j<=v;j++)
            if(i!=j)
                arr[i][j] =  (1 < <29);
}

int main()
{
    int v,e,r,x,y,d,ans= (1 < <29);
    cin>>v>>e>>r;
    vector<int> R;
    for(int i=0;i<r;i++){
        cin>>x;
        R.push_back(x);
    }

    init(v);

    for(int i=0;i<e;i++){
        cin>>x>>y>>d;
        arr[x][y] = min(arr[x][y], d);
        arr[y][x] = min(arr[y][x], d);
    }

    warshall(v);

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




    int temp = 0;
    do{
        temp = 0;

        for(int i=0;i<r-1;i++)
        {
            temp += arr[R[i]][R[i+1]];
        }

        ans=min(ans,temp);
    }while(next_permutation(R.begin(),R.end()));

    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'void init(int)':
a.cc:19:35: error: expected primary-expression before '<' token
   19 |                 arr[i][j] =  (1 < <29);
      |                                   ^
a.cc: In function 'int main()':
a.cc:24:31: error: expected primary-expression before '<' token
   24 |     int v,e,r,x,y,d,ans= (1 < <29);
      |                               ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <array>
#include <cstdio>
#include <vector>

using namespace std;

const int NMAX = 200;

const int CMAX = 100000;

int main()
{
    int N, M, R;
    if (scanf("%d%d%d", &N, &M, &R) < 3) return 0;

    vector<int> r;
    for (int i = 0; i < R; i++)
    {
        int tmp;
        if (scanf("%d", &tmp) < 1) return 0;
        r.push_back(tmp);
    }

    array<array<int, NMAX>, NMAX> d;

    for (int i = 0; i < NMAX; i++)
    {
        d[i].fill(CMAX);
    }

    for (int i = 0; i < M; i++)
    {
        int a, b, c;
        if (scanf("%d%d%d", &a, &b, &c) < 3) return 0;

        // 0-indexed
        a--;
        b--;

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

    // Warshall–Floyd
    // kは中継点
    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[j][k] + d[k][i]);

    int mintotal = INT_MAX;

    while (next_permutation(r.begin(), r.end()))
    {
        int bk = -1;
        int dist = 0;
        for (auto x : r)
        {
            if (bk < 0)
            {
                bk = x;
                continue;
            }

            dist += d[bk - 1][x - 1];

            bk = x;
        }
        mintotal = min(mintotal, dist);
    }

    printf("%d\n", mintotal);
    return 0;
}


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

#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
#include<utility>
 
using namespace std;
 
int main() {
  int n, m, r;
  cin >> n >> m >> r;
  vector<int> c(r);
  for(int i = 0; i < r; i++) cin >> c[i];
  for(int i = 0; i < r; i++) --c[i];
  vector<vector<long long>> p(n);
  for(int i = 0; i < n; i++) p[i].resize(n);
  for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) p[i][j] = 1000000000;
  for(int i = 0; i < m; i++) {
    long long A, B, C;
    cin >> A >> B >> C;
    A--; B--;
    p[A][B] = p[B][A] = C;
  }
 
  for(int k = 0; k < n; k++) for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) p[i][j] = min(p[i][j], p[i][k] + p[k][j]);
 
  long long ans = 1000000000000000;
  long long l = 1;
  for(int i = 1; i <= r; i++) l *= i;
  sort(c.begin(), c.end());
  for(int i = 0; i < l; i++) {
    next_permutation(c.begin(), c.end());
    long long cr = 0;
    for(int i = 1; i < r; i++) cr += p[c[i - 1]][c[i]];
    ans = min(ans, cr);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'cin' was not declared in this scope
   15 |   cin >> n >> m >> r;
      |   ^~~
a.cc:10:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    9 | #include<utility>
  +++ |+#include <iostream>
   10 | 
a.cc:41:3: error: 'cout' was not declared in this scope
   41 |   cout << ans << endl;
      |   ^~~~
a.cc:41:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

# include < bits/stdcc+.h >
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:  bits/stdcc+.h : No such file or directory
    1 | # include < bits/stdcc+.h >
      |           ^~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF2 1000000000000000
#define INF 2000000000
#define int long long int

int V, E;
int cost[1010][1010];

void warshall_floyd() {
    for (int k = 0; k <= V; k++) {
        for (int i = 0; i <= V; i++) {
            for (int j = 0; j <= V; j++) {
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
            }
        }
    }
}
signed main(void)
{
    int R;
    cin >> V >> E >> R;
    int r[R];
    rep(i, R){
        cin >> r[i];
    }
    for (int i = 0; i < 1010; i++) {
        for (int j = 0; j < 1010; j++) {
            cost[i][j] = INF2;
        }
    }
    rep(i ,E){
        int s, t, c;
        cin >> s >> t >> c;
        if(cost[s][t] > c) {
            cost[s][t] = c;
            cost[t][s] = c;
        }
    }
    int m = INF2;
    int tmp = 0;
    warshall_floyd();
    do { 
        tmp = 0;
        for (int i = 0; i < R-1; i++) {
            tmp += cost[r[i]][r[i+1]];
        }
        m = min(m,tmp);
    } while( next_permutation(r.begin(), r.end()) );    

    cout << m << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:33: error: request for member 'begin' in 'r', which is of non-class type 'long long int [R]'
   51 |     } while( next_permutation(r.begin(), r.end()) );
      |                                 ^~~~~
a.cc:51:44: error: request for member 'end' in 'r', which is of non-class type 'long long int [R]'
   51 |     } while( next_permutation(r.begin(), r.end()) );
      |                                            ^~~
Language: C++

# include <bits/stdc++.h>
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:19: error: expected primary-expression before '<' token
    3 | # define INF (1 < <29)
      |                   ^
a.cc:29:91: note: in expansion of macro 'INF'
   29 | for ( int i =1; i <= N ; i ++) for ( int j =1; j <= N ; j ++) if ( i != j ) d [ i ][ j ]= INF ;
      |                                                                                           ^~~
a.cc:3:19: error: expected primary-expression before '<' token
    3 | # define INF (1 < <29)
      |                   ^
a.cc:41:7: note: in expansion of macro 'INF'
   41 | res = INF ;
      |       ^~~
a.cc:43:10: warning: unknown escape sequence: '\040'
   43 | printf ( " % d \ n " , res );
      |          ^~~~~~~~~~~
Language: C++

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;

using lli = long long int;
using ulli = unsigned long long int;

#define INF 999999999;

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

typedef pair<int, int> P;

int N, M, R;
int r[8];
bool rF[8];
int a, b, c;
lli d[200][200];
deque<int> rt;
lli cost = INF;
//bool f[200][200];
//vector< P > rs[8];

int main(){
	cin.tie(0);
	std::ios::sync_with_stdio(false);
	cin >> N >> M >> R;
	for(int i = 0; i < R; i++){
		cin >> r[i];
		r[i]--;
	}
	/*
	for(int i = 0; i < R-1; i++){
		for(int j = i+1; j < R; j++){
			f[r[i]][r[j]] = true;
			f[r[j]][r[i]] = true;
		}
	}
	*/
	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if(i == j) d[i][j] = 0;
			else	d[i][j] = INF;
		}
	}
	for(int i = 0; i < M; i++){
		cin >> a >> b >> c;
		d[a-1][b-1] = c;
		d[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]);
			}
		}
	}

	for(int i = 0; i < R; i++){
		for(int j = 0; j < R; j++){
			dbug(r[i]);dbug(r[j]);
			dbug(d[r[i]][r[j]]);
			dbugln;
		}
	}

	/*
	int frm, to;
	lli minC;
	bool fob;
	rt.push_back(0);
	rF[0] = true;
	for(int i = 0; i < R-1; i++){
		minC=INF;
		frm = rt.front();
		dbug(frm);
		for(int j = 0; j < R; j++){
			if(rF[j]) continue;
			if(r[j] == r[frm]) continue;
			if(minC > d[r[frm]][r[j]]){
				to = j;
				fob = true;
				minC = d[r[frm]][r[j]];
			}
		}

		if(rt.size() > 1){
			frm = rt.back();
			dbug(frm);
			for(int j = 0; j < R; j++){
				if(rF[j]) continue;
				if(r[j] == r[frm]) continue;
				if(minC > d[r[frm]][r[j]]){
					to = j;
					fob = false;
					minC = d[r[frm]][r[j]];
				}
			}
		}
		dbug(fob);
		dbug(to);
		dbug(minC);
		dbugln;
		if(fob) rt.push_front(to);
		else rt.push_back(to);
		rF[to] = true;
		cost += minC;
	}
	*/

	lli buff;
	vector<int> perm(R);
	iota(perm.begin(), perm.end(), 0);
	do{
		buff = 0;
		for(int i = 0; i < R-1; i++){
			buff += d[r[perm[i]]][r[perm[i+1]]];
			dbug(r[perm[i]]);dbug(r[perm[i+1]]);
			dbug(buff);dbugln;
		}
		cost = min(cost, buff);
		dbug(cost);dbugln;dbugln;
	}while( next_permutation( perm.begin(), perm.end() ) );

	cout << cost;

	return 0;
}


Compiler output:
a.cc:20:12: error: 'iota' has not been declared in 'std'
   20 | using std::iota;
      |            ^~~~
a.cc: In function 'int main()':
a.cc:145:9: error: 'iota' was not declared in this scope
  145 |         iota(perm.begin(), perm.end(), 0);
      |         ^~~~
Language: C++

#include<bits/stdc++.h>

#define N (200)

using namespace std;

typedef long long int Int;
typedef pair<int,int> P;

Int cost[N+10][N+10] = {1e9};
Int city[10];

int main(void)
{
    int n,m,r;
    cin>>n>>m>>r;

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

    sort(city,city+r);
    
    for(int i = 0;i < m;i++)
    {
	int a,b,c;
	cin>>a>>b>>c;
	cost[a][b]=cost[b][a] = c;
    }

    for(int i = 1;i <= n;i++)
	for(int j = 1;j <= n;j++)
	    for(int k = 1;k <= n;k++)
		cost[i][j] = min(cost[i][j],cost[i][k]+cost[k][j]);

    Int ans = 1e9;
    do
    {
	Int c = 0;
	for(int i = 0;i < r-1;i++)
	    c += cost[city[i]][city[i+1]];

	ans = min(ans,c);

    }while(next_permutation(city,city+r));

    cout<<ans<<endl;

    return 0;
}


Compiler output:
a.cc:10:25: error: narrowing conversion of '1.0e+9' from 'double' to 'Int' {aka 'long long int'} [-Wnarrowing]
   10 | Int cost[N+10][N+10] = {1e9};
      |                         ^~~
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:19: error: expected primary-expression before '<' token
    3 | # define INF (1 < <29)
      |                   ^
a.cc:29:91: note: in expansion of macro 'INF'
   29 | for ( int i =1; i <= N ; i ++) for ( int j =1; j <= N ; j ++) if ( i != j ) d [ i ][ j ]= INF ;
      |                                                                                           ^~~
a.cc:3:19: error: expected primary-expression before '<' token
    3 | # define INF (1 < <29)
      |                   ^
a.cc:41:7: note: in expansion of macro 'INF'
   41 | res = INF ;
      |       ^~~
a.cc:43:10: warning: unknown escape sequence: '\040'
   43 | printf ( " % d \ n " , res );
      |          ^~~~~~~~~~~