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

#include"stdafx.h"
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include <numeric>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 99999999

using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };




ll m = 1000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

int root[40000][3];
int dist[200][200];
int N, M, R;
int r[8];


int main() {
	cin >> N >> M >> R;
	REP(i, N) {
		REP(j, N) {
			dist[i][j] = 1000001;
		}
	}
	REP(i, R)cin >> r[i];
	REP(i, M) {
		int a, b, c;
		cin >> a >> b >> c;
		dist[a][b] = c;
		dist[b][a] = c;
	}
	REP(k, N) {
		REP(i, N) {
			REP(j, N) {
				dist[i][j] = min(dist[i][j], (dist[i][k] + dist[k][j]));
			}
		}
	}
	vector<int> v(R);
	REP(i, R) {
		v[i] = r[i];
	}
	ll ans = INF;
	do {
		ll cnt = 0;
		REP(i, R - 1) {
			cnt += dist[v[i]][v[i+1]];
		}
		ans = min(ans, cnt);
	} while (next_permutation(v.begin(), v.end()));     // 次の順列を生成
	cout << ans << endl;
	return 0;
}

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

#include <stdio.h>
typedef long long ll;
using namespace std;
ll now[8], n, m, r[8], dis[200][200], ans = 10e17, rn, flg[8];

void dfs(ll a) {
  ll i, j, k;
  if(a == rn) {
    ll tmp = 0;
    for(i = 0; i < rn - 1; ++i) tmp += dis[r[now[i]]][r[now[i + 1]]];
    if(ans > tmp) ans = tmp;
  } else {
    for(i = 0; i < rn; ++i) if(flg[i]) {
      now[a] = i; flg[i] = 0;
      dfs(a + 1);
      flg[i] = 1;
    }
  }
}

int main(void) {
  ll i, j, k, a, b, c;
  scanf("%lld%lld%lld", &n, &m, &rn);
  for(i = 0; i < rn; ++i) scanf("%lld", &r[i]), r[i]--;
  for(i = 0; i < n; ++i) for(j = 0; j < n; ++j) {
    if(i != j) dis[i][j] = 10e17;
    else dis[i][j] = 0;
  }
  for(i = 0; i < m; ++i) {
    scanf("%lld%lld%lld", &a, &b, &c);
    a--, b--;
    if(dis[a][b] > c) dis[a][b] = dis[b][a] = c;
  }
 　for(k = 0; k < n; ++k) for(i = 0; i < n; ++i) for(j = 0; j < n; ++j) if(dis[i][k] + dis[k][j] < dis[i][j]) dis[i][j] = dis[i][k] + dis[k][j];
  for(i = 0; i < rn; ++i) flg[i] = 1;
  dfs(0);
  printf("%lld", ans);
  return 0;
}

Compiler output:
a.cc:34:2: error: extended character 　 is not valid in an identifier
   34 |  　for(k = 0; k < n; ++k) for(i = 0; i < n; ++i) for(j = 0; j < n; ++j) if(dis[i][k] + dis[k][j] < dis[i][j]) dis[i][j] = dis[i][k] + dis[k][j];
      |  ^
a.cc: In function 'int main()':
a.cc:34:13: error: expected ')' before ';' token
   34 |  　for(k = 0; k < n; ++k) for(i = 0; i < n; ++i) for(j = 0; j < n; ++j) if(dis[i][k] + dis[k][j] < dis[i][j]) dis[i][j] = dis[i][k] + dis[k][j];
      |       ~     ^
      |             )
a.cc:34:25: error: expected ';' before ')' token
   34 |  　for(k = 0; k < n; ++k) for(i = 0; i < n; ++i) for(j = 0; j < n; ++j) if(dis[i][k] + dis[k][j] < dis[i][j]) dis[i][j] = dis[i][k] + dis[k][j];
      |                         ^
      |                         ;
a.cc:34:48: error: expected ';' before ')' token
   34 |  　for(k = 0; k < n; ++k) for(i = 0; i < n; ++i) for(j = 0; j < n; ++j) if(dis[i][k] + dis[k][j] < dis[i][j]) dis[i][j] = dis[i][k] + dis[k][j];
      |                                                ^
      |                                                ;
a.cc:34:71: error: expected ';' before ')' token
   34 |  　for(k = 0; k < n; ++k) for(i = 0; i < n; ++i) for(j = 0; j < n; ++j) if(dis[i][k] + dis[k][j] < dis[i][j]) dis[i][j] = dis[i][k] + dis[k][j];
      |                                                                       ^
      |                                                                       ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int N,M,R;
vector<int>v;
int dist[222][222],ans=2e9;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>N>>M>>R;
    for(int i=0;i<R;i++){
        int x;
        cin>>x;
        v.push_back(--x);
    }
    for(int i=0;i<N;i++)for(int j=0;j<N;j++)if(i!=j)dist[i][j]=2e9;
    for(int i=0;i<M;i++){
        int a,b,x;
        cin>>a>>b>>x;
        a--;b--;
        dist[a][b]=dist[b][a]=x;
    }
    for(int i=0;i<N;i++)
        for(int j=0;j<N;j++)
            for(int k=0;k<N;k++)
                dist[j][k]=min(dist[j][k],dist[j][i]+dist[i][k]);
    sort(v.begin(),v.end());
    do {
        long long sum=0LL;
        int x=v.front();
        for(int i:v){
            sum+=dist[x][i];
            x=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:34:16: error: no matching function for call to 'min(int&, long long int&)'
   34 |         ans=min(ans,sum);
      |             ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:34:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   34 |         ans=min(ans,sum);
      |             ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:34:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   34 |         ans=min(ans,sum);
      |             ~~~^~~~~~~~~
Language: C++

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

int main() {
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r(R);
    for(auto& e : r) cin >> e, e--;
    vector<int> a(M), b(M), c(M);
    for(int i = 0; i < M; i++) cin >> a[i] >> b[i] >> c[i], a[i]--, b[i]--;

    vector<vector<int> > dist(N, vector<int>(N, 1e9+1));
    for(int i = 0; i < N; i++) dist[i][i] = 0;
    for(int i = 0; i < M; i++) dist[a[i]][b[i]] = c[i], dist[b[i]][a[i]] = c[i];

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

    int ans = 1e9+1;
    do {
        int sum = 0;
        for(int i = 1; i < r.size(); i++) {
            sum += dist[r[i-1]][r[i]];
        }
        ans = min(ans, sum);
    }while(next_permutation(r.begin(), r.end()));

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:12: error: 'next_permutation' was not declared in this scope
   33 |     }while(next_permutation(r.begin(), r.end()));
      |            ^~~~~~~~~~~~~~~~
Language: C++

/home/hamuhei/compro/test/main.cpp:-1: In function ‘std::vector<long long int> dijkstra(int, int, std::vector<std::vector<Edge> >)’:

Compiler output:
a.cc:1:52: error: extended character ‘ is not valid in an identifier
    1 | /home/hamuhei/compro/test/main.cpp:-1: In function ‘std::vector<long long int> dijkstra(int, int, std::vector<std::vector<Edge> >)’:
      |                                                    ^
a.cc:1:131: error: extended character ’ is not valid in an identifier
    1 | /home/hamuhei/compro/test/main.cpp:-1: In function ‘std::vector<long long int> dijkstra(int, int, std::vector<std::vector<Edge> >)’:
      |                                                                                                                                   ^
a.cc:1:1: error: expected unqualified-id before '/' token
    1 | /home/hamuhei/compro/test/main.cpp:-1: In function ‘std::vector<long long int> dijkstra(int, int, std::vector<std::vector<Edge> >)’:
      | ^
Language: C++

#include<cstdio>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> P;
map <int,int> mp;
vector<int> V;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define EPS (1e-10)
static const int MAX=200;
static const int MOD=1e9+7;
static const int NMAX=50;
static const int MMAX=50;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
int N,M,R;
int d[MAX+2][MAX+1];
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:5:9: error: 'pair' does not name a type
    5 | typedef pair<int, int> P;
      |         ^~~~
a.cc:6:1: error: 'map' does not name a type
    6 | map <int,int> mp;
      | ^~~
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<int> V;
      | ^~~~~~
Language: C++

import heapq
import itertools

def solve():
    N, M, _ = list(map(int, input().split()))
    R = list(map(int, input().split()))
    R = map(lambda x: x-1, R)
    G = [[] for i in range(N)]

    for i in range(M):
        A, B, C = list(map(int, input().split()))
        A -= 1
        B -= 1
        G[A].append([C, B])
        G[B].append([C, A])


    def dijkstra(d):
        que = []

        for i in range(len(d)):
            if d[i] == -1:
                break
            heapq.heappush(que, (d[i], i))

        while len(que) != 0:
            dist, node = heapq.heappop(que)
            for (cost, to) in G[node]:
                if d[to] == -1 or d[to] > d[node] + cost:
                    d[to] = d[node] + cost
                    heapq.heappush(que, (dist + cost, to))

        return d


    ds = [[-1 for i in range(N)] for j in range(N)]

    for i in range(N):
        ds[i][i] = 0

    for i in range(N):
        ds[i] = dijkstra(ds[i])
        for j in range(N):
            ds[j][i] = ds[i][j]

    res = 100000*200
    for r in list(itertools.permutations(R)):
        d = 0
        for i in range(len(r)-1):
            d += ds[r[i]][r[i+1]]
        res = min(res, d)

    return res

print(solve())

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import heapq
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <climits>
#include <tuple>
#define int long long

using namespace std;

struct edge {
  int to, cost;
};

using graph_t = vector<vector<edge>>;

vector<int> shortest_path(graph_t const& graph, int start) {
  int V = graph.size();
  vector<int> dists(V, LLONG_MAX / 3);
  using P = pair<int, int>;
  priority_queue<P, vector<P>, greater<P>> que;
  dists[start] = 0;
  que.emplace(0, start);
  while (!que.empty()) {
    int d, v;
    tie(d, v) = que.top();
    que.pop();
    if (d > dists[v]) continue;
    for (auto&& e : graph[v]) {
      if (d + e.cost >= dists[e.to]) continue;
      dists[e.to] = d + e.cost;
      que.emplace(d + e.cost, e.to);
    }
  }
  return dists;
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m, r;
  cin >> n >> m >> r;
  vector<int> rs(r);
  for (auto& v : rs) {
    cin >> v;
    v--;
  }
  graph_t graph(n);
  for (int i = 0; i < m; i++) {
    int a, b, t;
    cin >> a >> b >> t;
    a--; b--;
    graph[a].push_back({b, t});
    graph[b].push_back({a, t});
  }
  vector<vector<int>> dists(n);
  for (int i = 0; i < n; i++)
    dists[i] = shortest_path(graph, i);
  int result = LLONG_MAX;
  vector<vector<int>::iterator> order(r);
  for (int i = 0; i < r; i++)
    order[i] = begin(rs) + i;
  do {
    int len = 0;
    for (int i = 0; i < r - 1; i++)
      len += dists[*order[i]][*order[i+1]];
    result = min(result, len);
  } while (next_permutation(begin(order), end(order)));
  cout << result << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:12: error: 'next_permutation' was not declared in this scope
   67 |   } while (next_permutation(begin(order), end(order)));
      |            ^~~~~~~~~~~~~~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <stdint.h>
#define ll long long
#define oku7 1000000007
using namespace std;


//う ず ま き
int x=-1, y=0, d=1;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { -1, 0, 1, 0 };

const int MAXINT = 2147483647 / 3;
int G[201][201];

int main(){
	int N, M, R;
	cin >> N >> M >> R;
	vector<int> iku;
	for (int i = 0; i < R; i++){
		int tmp;
		cin >> tmp;
		iku.push_back(tmp);
	}
	for (int i = 0; i < 201; i++){
		for (int j = 0; j < 201; j++){
			G[i][j] = MAXINT;
		}
      	G[i][i] = 0;
	}
	for (int i = 0; i < M; i++){
		int a, b, c;
		cin >> a >> b >> c;
		G[a][b] = G[b][a] = c;
	}


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

	sort(iku.begin(), iku.end());
	int ans = MAXINT;
  	do {
		int tmp = 0;
		for (int i = 0; i < (int)iku.size() - 1; i++){
			tmp += G[iku[i]][iku[i + 1]];
		}
		if (tmp < ans) ans = tmp;
	}
	while (next_permutation(iku.begin(), iku.end()))
	cout << ans << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:57: error: expected ';' before 'cout'
   68 |         while (next_permutation(iku.begin(), iku.end()))
      |                                                         ^
      |                                                         ;
   69 |         cout << ans << "\n";
      |         ~~~~
Language: C++

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

int n,m,r;

// char X[100][100];
// int dp[1000000001];
bool used[8];
int ans;

int main(void){
    cin >> n >> m >> r;
    int r[r];
    
    REP(i,0,r) {
        cin >> r[i];
    }
    
    int d[n+1][n+1];
    REP(i,1,n+1) REP(j,1,n+1) {
        if (i == j) d[i][j] = 0;
        else d[i][j] = INF;
    }

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

    
    REP(k,1,n+1) REP(i,1,n+1) REP(j,1,n+1) {
        if (d[i][k] + d[k][j] < d[i][j]) d[i][j] = d[i][k] + d[k][j];
    }

    int ans = INF;
    do {
        int res = 0;
        REP(i,0,r-1) {
            res += d[target[i]][target[i+1]];
        }
        ans = min(ans,res);
    } while(next_permutation(target, target + r));

    
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:37: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    3 | #define REP(i,x,n) for(int i = x; i < n; i++)
      |                                     ^
a.cc:18:5: note: in expansion of macro 'REP'
   18 |     REP(i,0,r) {
      |     ^~~
a.cc:3:37: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    3 | #define REP(i,x,n) for(int i = x; i < n; i++)
      |                                     ^
a.cc:45:9: note: in expansion of macro 'REP'
   45 |         REP(i,0,r-1) {
      |         ^~~
a.cc:46:22: error: 'target' was not declared in this scope
   46 |             res += d[target[i]][target[i+1]];
      |                      ^~~~~~
a.cc:49:30: error: 'target' was not declared in this scope
   49 |     } while(next_permutation(target, target + r));
      |                              ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <limits>

using namespace std;

long path[201][201];

long dfs(long d, int p, vector<long> &r) {
	long result = numeric_limits<long>::max();
	bool flag = false;
	for (int i = 0; i < r.size(); i++) {
		if (r[i] == 0) continue;
		long n = r[i];
		r[i] = 0;
		result = min(result, dfs(d + path[p][n], n, r));
		r[i] = n;
		flag = true;
	}
	if (!flag) return d;
	return result;
}

int main(int argc, char *argv[]) {
	int N, M, R;
	cin >> N >> M >> R;

	vector<int> r;
	for (int i = 0; i < R; i++) {
		int ri;
		cin >> ri;
		r.push_back(ri);
	}

	for (int i = 0; i < M; i++) {
		int A, B, C;
		cin >> A >> B >> C;
		path[A][B] = path[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 (path[i][j] > path[i][k] + path[k][j]) {
					path[i][j] = path[i][k] + path[k][j];
				}
			}
		}
	}

	long ans = dfs(0, 0, r);

	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:51:30: error: invalid initialization of reference of type 'std::vector<long int>&' from expression of type 'std::vector<int>'
   51 |         long ans = dfs(0, 0, r);
      |                              ^
a.cc:9:39: note: in passing argument 3 of 'long int dfs(long int, int, std::vector<long int>&)'
    9 | long dfs(long d, int p, vector<long> &r) {
      |                         ~~~~~~~~~~~~~~^
Language: C++

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

using u64 = uint64_t;
constexpr const u64 INF = UINT64_MAX / 2;

void warshall_floyd(vector<vector<u64>> &graph) {
    int N = graph.size();
    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]);
            }
        }
    }
}

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

    vector<int> visits(R);
    for (int r = 0; r < R; r++) {
        cin >> visits[r];
        visits[r]--;
    }
    sort(visit.begin(), visit.end());

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

    u64 msum = INF;
    do {
        u64 sum = 0;
        for (int i = 1; i < R; i++) {
            sum += graph[visits[i-1]][visits[i]];
        }
        msum = min(msum, sum);
    } while (next_permutation(visits.begin(), visits.end()));
    cout << msum << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:16: error: overloaded function with no contextual type information
   27 |     sort(visit.begin(), visit.end());
      |                ^~~~~
a.cc:27:31: error: overloaded function with no contextual type information
   27 |     sort(visit.begin(), visit.end());
      |                               ^~~
Language: C++

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

int table[201][201];

int  INF = 1<<29;

int main() {

    int n,m,R;

    cin >> n >> m >> R;

    vector<int> r;

    for(int i=0; i<R; i++){
        int input_r;
        cin >> input_r;
        r.push_back(input_r);
    }

    for(int i=1; i<=n; i++){
        for(int j=1; j<=n; j++){
            if(i != j) {
                table[i][j] = INF;
            }
        }
    }

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

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

    long long int ans = INF;

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

    cout << ans << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:18: error: no matching function for call to 'min(long long int&, int&)'
   54 |         ans = min(ans,tmp_ans);
      |               ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:54:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   54 |         ans = min(ans,tmp_ans);
      |               ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:54:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   54 |         ans = min(ans,tmp_ans);
      |               ~~~^~~~~~~~~~~~~
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:18: 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:18: 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 < 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 <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<ll> Vector;
typedef vector<Vector> DVector;

#define fi          first
#define se          second
#define pb          push_back
#define INF         INT_MAX
#define bcnt        __builtin_popcount
#define all(x)      (x).begin(),(x).end()
#define dbg(x)      cout<<#x"="<<x<<endl
#define uni(x)      x.erase(unique(all(x)),x.end())
#define ub(x,y)     upper_bound(all(x),y)-x.begin()
#define lb(x,y)     lower_bound(all(x),y)-x.begin()
#define rep(i,n)    repl(i,0,n-1)
#define usort(x)    sort(all(x))
#define dsort(x)    sort(all(x),greater<ll>())
#define mkp(x,y)    make_pair(x,y)
#define mmax(x,y)   (x>y?x:y)
#define mmin(x,y)   (x<y?x:y)
#define maxch(x,y)  x=mmax(x,y)
#define minch(x,y)  x=mmin(x,y)
#define exist(x,y)  (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)

ll N,M,R;
Vector r;
DVector mp;
ll dfs(Vector a){
  if(a.size() == R){
    ll cost = 0;
    rep(i,R-1)cost += mp[a[i]-1][a[i+1]-1];
    return cost;
  }else{
    ll cost = INF;
    each(itr,r){
      if(exist(a,itr))continue;
      Vector ta = a;
      ta.pb(itr);
      minch(cost, dfs(ta,tst));
    }
    return cost;
  }
}

int main(){
  cin.sync_with_stdio(false);
  cin >> N >> M >> R;
  r.resize(R);
  mp.resize(N,Vector(N));
  rep(i,R)cin >> r[i];
  rep(i,M){
    ll a, b, c;
    cin >> a >> b >> c;
    mp[a-1][b-1] = c;
    mp[b-1][a-1] = c;
  }
  rep(k,N)rep(i,N)rep(j,N)minch(mp[i][j], mp[i][k]+mp[k][j]);
  cout << dfs(Vector(), set<ll>()) << endl;
}


Compiler output:
a.cc: In function 'll dfs(Vector)':
a.cc:46:26: error: 'tst' was not declared in this scope
   46 |       minch(cost, dfs(ta,tst));
      |                          ^~~
a.cc:25:24: note: in definition of macro 'mmin'
   25 | #define mmin(x,y)   (x<y?x:y)
      |                        ^
a.cc:46:7: note: in expansion of macro 'minch'
   46 |       minch(cost, dfs(ta,tst));
      |       ^~~~~
a.cc: In function 'int main()':
a.cc:65:14: error: too many arguments to function 'll dfs(Vector)'
   65 |   cout << dfs(Vector(), set<ll>()) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:35:4: note: declared here
   35 | ll dfs(Vector a){
      |    ^~~
Language: C++

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
//#define ll long long
int n,m,r;
int G[500][500];
int d[500][500];

vector<int>visit;
ll ans;
 
const ll INF=1000000000;
 
int main(){
cin>>n>>m>>r;
 
ll a,b,c;
visit.resize(r);
rep(i,r){
	cin>>a;
	a--;
	visit[i]=a;
}
 
rep(i,n){
	rep(j,n){
		if(i==j)d[i][j]=0;
		else d[i][j]=INF;
	}
}
 
rep(i,m){
	cin>>a>>b>>c;
	a--;b--;
	cout<<i<<endl;
	if(d[a][b]>c){
	d[a][b]=c;d[b][a]=c;
	}
}
 
rep(k,n){
	rep(i,n){
		rep(j,n)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	}
}
 
ans=100000000000000000;

do{
	ll tmp=0;
	for(int i=1;i<r;i++)tmp+=d[visit[i-1]][visit[i]];
	ans=min(ans,tmp);
}while(next_permutation(visit.begin(),visit.end()));
 
cout<<ans<<endl;
 
 
	return 0;
}

Compiler output:
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:23:1: note: in expansion of macro 'll'
   23 | ll ans;
      | ^~
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:25:7: note: in expansion of macro 'll'
   25 | const ll INF=1000000000;
      |       ^~
a.cc: In function 'int main()':
a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:30:1: note: in expansion of macro 'll'
   30 | ll a,b,c;
      | ^~
a.cc:33:14: error: 'a' was not declared in this scope
   33 |         cin>>a;
      |              ^
a.cc:41:30: error: 'INF' was not declared in this scope
   41 |                 else d[i][j]=INF;
      |                              ^~~
a.cc:46:14: error: 'a' was not declared in this scope
   46 |         cin>>a>>b>>c;
      |              ^
a.cc:46:17: error: 'b' was not declared in this scope
   46 |         cin>>a>>b>>c;
      |                 ^
a.cc:46:20: error: 'c' was not declared in this scope
   46 |         cin>>a>>b>>c;
      |                    ^
a.cc:60:1: error: 'ans' was not declared in this scope; did you mean 'abs'?
   60 | ans=100000000000000000;
      | ^~~
      | abs
a.cc:63:12: error: expected ';' before 'tmp'
   63 |         ll tmp=0;
      |            ^~~
a.cc:64:29: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   64 |         for(int i=1;i<r;i++)tmp+=d[visit[i-1]][visit[i]];
      |                             ^~~
      |                             tm
a.cc:65:21: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   65 |         ans=min(ans,tmp);
      |                     ^~~
      |                     tm
Language: C++

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
//#define ll __int64
#define ll long long
int n,m,r;
int G[500][500];
int d[500][500];

vector<int>visit;
ll ans;
 
const ll INF=1000000000;
 
int main(){
cin>>n>>m>>r;
 
int a,b,c;
rep(i,r){
	cin>>a;
	a--;
	visit.push_back(a);
}
 
rep(i,n){
	rep(j,n)d[i][j]=(i==j)?0:INF;
}
 
rep(i,m){
	cin>>a>>b>>c;
	a--;b--;
	d[a][b]=d[b][a]=c;
}
 
rep(k,n){
	rep(i,n){
		rep(j,n)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	}
}
 
ans=100000000000000000;

do{
	int tmp=0;
	for(int i=1;i<r;i++)tmp+=d[visit[i-1]][visit[i]];
	ans=min(ans,tmp);
}while(next_permutation(visit.begin(),visit.end()));
 
cout<<ans<<endl;
 
 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:16: error: no matching function for call to 'min(long long int&, int&)'
   58 |         ans=min(ans,tmp);
      |             ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:58:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   58 |         ans=min(ans,tmp);
      |             ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:58:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   58 |         ans=min(ans,tmp);
      |             ~~~^~~~~~~~~
Language: C++

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
//#define ll __int64
#define ll long long
int n,m,r;
ll d[500][500];
vector<int>visit;
ll ans;

const ll INF=5000000000;

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

ll a,b,c;
rep(i,r){
	cin>>a;
	a--;
	visit.push_back(a);
}

rep(i,n){
	rep(j,n)d[i][j]=(i==j)?0:INF;
}

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

rep(k,n){
	rep(i,n){
		rep(j,n)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	}
}

ans=INF;
do{
	int tmp=0;
	for(int i=1;i<r;i++)tmp+=d[visit[i-1]][visit[i]];
	ans=min(ans,tmp);
	//rep(i,visit.size())cout<<visit[i]<<" ";cout<<endl;
}while(next_permutation(visit.begin(),visit.end()));

cout<<ans<<endl;


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:16: error: no matching function for call to 'min(long long int&, int&)'
   55 |         ans=min(ans,tmp);
      |             ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:55:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   55 |         ans=min(ans,tmp);
      |             ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:55:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   55 |         ans=min(ans,tmp);
      |             ~~~^~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define INF INT_MAX
#define INFLL _I64_MAX
#define MOD 1000000007
#define PI 3.1415926535
using namespace std;
vector<vector<int>> Warshall_Floyd(vector<vector<int>>cost, int n)
{
	vector<vector<int>> dist; //dist[i][j]はiからjへの最短コスト

							  //初期化
	dist=cost;

	//最短コストの計算
	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]>dist[i][k]+dist[k][j]){
					dist[i][j]=dist[i][k]+dist[k][j];
				}
			}
		}
	}
	return dist;
}

int main(void)
{
	int n, m, rnum, ans=INF, temp;

	cin>>n>>m>>rnum;

	vector<int> r(rnum);

	rep(i, rnum){
		cin>>r[i]; r[i]--;
	}

	vector<vector<int>> cost(n, vector<int>(n, INF)), dist;

	rep(i, m){
		int a, b, c;
		cin>>a>>b>>c;
		cost[a-1][b-1]=c; cost[b-1][a-1]=c;
	}
	rep(i, n){
		cost[i][i]=0;
	}

	dist=Warshall_Floyd(cost, n);

	sort(r.begin(), r.end());

	do{
		temp=0;
		rep(i, rnum-1) temp+=dist[r[i]][r[i+1]];
		if(ans>temp) ans=temp;
	} while(next_permutation(r.begin(), r.end()));

	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'INT_MAX' was not declared in this scope
    8 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:35:29: note: in expansion of macro 'INF'
   35 |         int n, m, rnum, ans=INF, temp;
      |                             ^~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <algorithm>
  +++ |+#include <climits>
    5 | #define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
a.cc:61:17: error: 'temp' was not declared in this scope; did you mean 'tm'?
   61 |                 temp=0;
      |                 ^~~~
      |                 tm
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define INF INT_MAX
#define INFLL _I64_MAX
#define MOD 1000000007
#define PI 3.1415926535
using namespace std;
vector<vector<int>> Warshall_Floyd(vector<vector<int>>cost, int n)
{
	vector<vector<int>> dist; //dist[i][j]はiからjへの最短コスト

	//初期化
	dist=cost;

	//最短コストの計算
	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]>dist[i][k]+dist[k][j]){
					dist[i][j]=dist[i][k]+dist[k][j];
				}
			}
		}
	}
	return dist;
}

int main(void)
{
	int n, m, rnum, ans=INF, temp;

	cin>>n>>m>>rnum;

	vector<int> r(rnum);

	rep(i, rnum){
		cin>>r[i]; r[i]--;
	}

	vector<vector<int>> cost(n, vector<int>(n, INF)), dist;

	rep(i, m){
		int a, b, c;
		cin>>a>>b>>c;
		cost[a-1][b-1]=c; cost[b-1][a-1]=c;
	}
	rep(i, n){
		cost[i][i]=0;
	}

	dist=Warshall_Floyd(cost, n);

	do{
		temp=0;
		rep(i, rnum-1) temp+=dist[r[i]][r[i+1]];
		if(ans>temp) ans=temp;
	}while(next_permutation(r.begin(), r.end()));

	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'INT_MAX' was not declared in this scope
    8 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:35:29: note: in expansion of macro 'INF'
   35 |         int n, m, rnum, ans=INF, temp;
      |                             ^~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <algorithm>
  +++ |+#include <climits>
    5 | #define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
a.cc:59:17: error: 'temp' was not declared in this scope; did you mean 'tm'?
   59 |                 temp=0;
      |                 ^~~~
      |                 tm
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int INF = 100000000
const int N_MAX = 200;

typedef long long ll;

int N;
int M;
int R;


ll d[300][300];

vector<int> r;



int main()
{
	for(int i = 0;i < 300;i++)
	{
		for(int j = 0;j < 300;j++)
		{
			d[i][j] = INF;
		}
	}
	int a,b,c,ri;
	cin >> N >> M >> R;
	for(int i = 0;i < R;i++)
	{
		cin >> ri;
		r.push_back(ri);	
	}
	for(int i = 0;i < M;i++)
	{
		cin >> a >> b >> c;
		d[a][b] = c;
		d[b][a] = c;
	}
	
	for(int i = 1;i <= N;i++)
	{
		for(int j = 1;j <= N;j++)
		{
			for(int k = 1;k <= N;k++)
			{
				d[i][j] = min(d[i][j],d[i][k] + d[k][j]);
			}
		}
	}
	
	ll min_ = 100000000000LL;

	sort(r.begin(),r.end());
	
	do
	{
		ll sum = 0;
		for(int i = 0;i < r.size() - 1;i++)
		{
			sum += d[r[i]][r[i+1]];
		}
		min_ = min(min_,sum);
	} while(next_permutation(r.begin(),r.end()));
	cout << min_ << endl;
	return 0;
}


Compiler output:
a.cc:6:1: error: expected ',' or ';' before 'const'
    6 | const int N_MAX = 200;
      | ^~~~~
Language: C++

#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <typeinfo>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <list>
#include <stack>
#include <set>
typedef long long int ll;
typedef pair<ll, ll> P;
using namespace std;
int main() {
	long long int n, m, r, R[9], d[210][210] = {}, a, b, c, i, j, k, I = 1e9, s;
	cin >> n >> m >> r;
	for (i = 0; i < r; i++)cin >> R[i];
	for (i = 1; i <= n; i++)for (j = i + 1; j <= n; j++)d[i][j] = d[j][i] = I;
	for (i = 0; i < m; i++) {
		cin >> a >> b >> c;
		if (d[a][b] > c)d[a][b] = d[b][a] = c;
	}
	for (k = 1; k <= n; k++)for (i = 1; i <= n; i++)for (j = 1; j <= n; j++)d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
	sort(R, R + r);
	do {
		s = 0;
		for (i = 0; i < r - 1; i++)s += d[R[i]][R[i + 1]];
		I = min(I, s);
	} while (next_permutation(R, R + r));
	cout << I << endl;
	return 0;
}


Compiler output:
a.cc:18:9: error: 'pair' does not name a type
   18 | typedef pair<ll, ll> P;
      |         ^~~~
Language: C++

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int g[205][205];
int index[205];
void floyd(int n)
{
    for(int k=1;k<=n;k++)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                g[i][j]=min(g[i][k]+g[k][j],g[i][j]);
            }
        }
    }
    return ;
}
int main()
{
    int n,m,r;
    cin>>n>>m>>r;
    for(int i=1;i<=r;i++)
        cin>>index[i];
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(i==j) g[i][j]=0;
            else g[i][j]=100005;
        }
    }
    for(int i=1;i<=m;i++)
    {
        int x,y,z;
        scanf("%d%d%d",&x,&y,&z);
        g[x][y]=g[y][x]=z;
    }
    floyd(n);
    long long ans=10000000005;
    do
    {
        long long sum=0;
        for(int i=1;i<=n-1;i++)
        {
            sum+=g[index[i]][index[i+1]];
        }
        ans=min(ans,sum);
    }while(next_permutation(index+1,index+1+r));
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc:7:14: error: 'int index [205]' redeclared as different kind of entity
    7 | int index[205];
      |              ^
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from a.cc:3:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int main()':
a.cc:27:19: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   27 |         cin>>index[i];
      |                   ^
a.cc:49:25: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   49 |             sum+=g[index[i]][index[i+1]];
      |                         ^
a.cc:49:35: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   49 |             sum+=g[index[i]][index[i+1]];
      |                                   ^
a.cc:52:34: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+'
   52 |     }while(next_permutation(index+1,index+1+r));
      |                             ~~~~~^~
a.cc:52:42: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+'
   52 |     }while(next_permutation(index+1,index+1+r));
      |                                     ~~~~~^~
Language: C++

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


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
  int N, M, R;
    cin >> N >> M >> R;
    int r[R];
 
    int A[M], B[M] ,C[N][N] = {};
    for(int i = 0; i < N; i++)
        for(int j = 0; j < N; j++)
            if ( i != j) C[i][j] = 1000000;
    for(int i = 0; i < R; i++) {
        cin >> r[i];
        r[i]--; // ここをdecrementするのを忘れていた。
    }
    for(int i = 0; i < M; i++) {
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
        cin >> C[A[i]][B[i]];
        C[B[i]][A[i]] = C[A[i]][B[i]];
    }
 
    int ans = 1000000000;
 
    for(int k = 0; k < N; k++){
        for(int i = 0; i < N; i++){
            for(int j = 0; j < N; j++){
                    C[i][j] = min(C[i][j], C[i][k] + C[k][j];
            }
        }
    }

    do{
        int _ans = 0;
        for(int i = 0; i < R - 1; i++)  
            _ans += C[r[i]][r[i + 1]];

        if(_ans < ans && _ans) 
            ans = _ans;
    }while(next_permutation(r, r+R));
 
    cout << ans << endl;
 
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:61: error: expected ')' before ';' token
   39 |                     C[i][j] = min(C[i][j], C[i][k] + C[k][j];
      |                                  ~                          ^
      |                                                             )