criyle/codenet-compile-errors huggingface dataset:
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];
2
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:10:1: error: expected unqualified-id before numeric constant
   10 | 2
      | ^
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:42:1: error: 'dfs' was not declared in this scope
   42 | dfs (1 , -1 ,0);
      | ^~~
a.cc:43:10: warning: unknown escape sequence: '\040'
   43 | printf ( " % d \ n " , res );
      |          ^~~~~~~~~~~
Language: C

#include <stdlib.h>
#include <stdio.h>
int main()
{
int map[250][250];
int n,m,i,start,end,len;
int r;
int togoto[10];
int tobecho[10];
int a,b,c,d,e,f,g,h;
int minlen;
int totallen;
for(i=0;i<10;i++)
tobecho[i] = 0;
scanf("%d",&n);
scanf("%d",&m);
scanf("%d",&r);
for(i=0;i<r;i++)
scanf("%d",&togoto[i]);
for(i=0;i<m;i++)
{
scanf("%d",&start);
scanf("%d",&end);
scanf("%d",&len);
map[start][end] = len;
map[end][start] = len;
}
totallen = 0;
minlen = 5555555;
for(a=0;a<r;a++)
{
tobecho[a] = 1;
if(r>1)
    for(b=0;b<r;b++)
{
    if(tobecho[b]!=1)
  {
    tobecho[b] = 1;
    totallen += map[b][a];
  }
if(r>2)
    for(c=0;c<r;c++)
{
    if(tobecho[c]!=1)
  {
    tobecho[c] = 1;
    totallen += map[b][c];
  }
if(r>3)
    for(d=0;d<r;d++)
{
    if(tobecho[d]!=1)
  {
    tobecho[d] = 1;
    totallen += map[c][d];
  }
if(r>4)
    for(e=0;e<r;e++)
{
    if(tobecho[e]!=1)
  {
    tobecho[e] = 1;
    totallen += map[e][d];
  }
if(r>5)
    for(f=0;f<r;f++)
{
    if(tobecho[f]!=1)
  {
    tobecho[f] = 1;
    totallen += map[e][f];
  }
if(r>6)
    for(g=0;g<r;g++)
{
    if(tobecho[g]!=1)
  {
    tobecho[g] = 1;
    totallen += map[g][f];
  }
if(r>7)
    for(h=0;h<r;h++)
{
    if(tobecho[h]!=1)
  {
    tobecho[h] = 1;
    totallen += map[h][g];
  }
}}}}}}}
if (totallen<minlen)
minlen = totallen;
 
 
}
printf("%d",minlen);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:92:1: error: stray '\302' in program
   92 | <U+00A0>
      | ^~~~~~~~
main.c:93:1: error: stray '\302' in program
   93 | <U+00A0>
      | ^~~~~~~~
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];
2
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 <stdlib.h>
#include <stdio.h>
int main()
{
int map[250][250];
int n,m,i,start,end,len;
int togoto[10];
int tobecho[10];
int a,b,c,d,e,f,g,h;
int minlen;
int totallen;
for(i=0;i<10;i++)
tobecho[i] = 0;
scanf("%d",&n);
scanf("%d",&m);
scanf("%d",&r);
for(i=0;i<r;i++)
scanf("%d",&togoto[i]);
for(i=0;i<m;i++)
{
scanf("%d",&start);
scanf("%d",&end);
scanf("%d",&len);
map[start][end] = len;
map[end][start] = len;
}
totallen = 0;
minlen = 5555555;
for(a=0;a<r;a++)
{
tobecho[a] = 1;
if(r>1)
    for(b=0;b<r;b++)
{
    if(tobecho[b]!=1)
  {
    tobecho[b] = 1;
    totallen += map[b][a];
  }
if(r>2)
    for(c=0;c<r;c++)
{
    if(tobecho[c]!=1)
  {
    tobecho[c] = 1;
    totallen += map[b][c];
  }
if(r>3)
    for(d=0;d<r;d++)
{
    if(tobecho[d]!=1)
  {
    tobecho[d] = 1;
    totallen += map[c][d];
  }
if(r>4)
    for(e=0;e<r;e++)
{
    if(tobecho[e]!=1)
  {
    tobecho[e] = 1;
    totallen += map[e][d];
  }
if(r>5)
    for(f=0;f<r;f++)
{
    if(tobecho[f]!=1)
  {
    tobecho[f] = 1;
    totallen += map[e][f];
  }
if(r>6)
    for(g=0;g<r;g++)
{
    if(tobecho[g]!=1)
  {
    tobecho[g] = 1;
    totallen += map[g][f];
  }
if(r>7)
    for(h=0;h<r;h++)
{
    if(tobecho[h]!=1)
  {
    tobecho[h] = 1;
    totallen += map[h][g];
  }
}}}}}}}
if (totallen<minlen)
minlen = totallen;
 
 
}
printf("%d",minlen);
return 0;
}

Compiler output:
a.cc:91:1: error: extended character   is not valid in an identifier
   91 |  
      | ^
a.cc:92:1: error: extended character   is not valid in an identifier
   92 |  
      | ^
a.cc: In function 'int main()':
a.cc:16:13: error: 'r' was not declared in this scope
   16 | scanf("%d",&r);
      |             ^
a.cc:91:1: error: '\U000000a0' was not declared in this scope
   91 |  
      | ^
Language: C++

include <stdlib.h>
include <stdio.h>
int main()
{
int map[250][250];
int n,m,i,start,end,len;
int togoto[10];
int tobecho[10];
int a,b,c,d,e,f,g,h;
int minlen;
int totallen;
for(i=0;i<10;i++)
tobecho[i] = 0;
scanf("%d",&n);
scanf("%d",&m);
scanf("%d",&r);
for(i=0;i<r;i++)
scanf("%d",&togoto[i]);
for(i=0;i<m;i++)
{
scanf("%d",&start);
scanf("%d",&end);
scanf("%d",&len);
map[start][end] = len;
map[end][start] = len;
}
totallen = 0;
minlen = 5555555;
for(a=0;a<r;a++)
{
tobecho[a] = 1;
if(r>1)
    for(b=0;b<r;b++)
{
    if(tobecho[b]!=1)
  {
    tobecho[b] = 1;
    totallen += map[b][a];
  }
if(r>2)
    for(c=0;c<r;c++)
{
    if(tobecho[c]!=1)
  {
    tobecho[c] = 1;
    totallen += map[b][c];
  }
if(r>3)
    for(d=0;d<r;d++)
{
    if(tobecho[d]!=1)
  {
    tobecho[d] = 1;
    totallen += map[c][d];
  }
if(r>4)
    for(e=0;e<r;e++)
{
    if(tobecho[e]!=1)
  {
    tobecho[e] = 1;
    totallen += map[e][d];
  }
if(r>5)
    for(f=0;f<r;f++)
{
    if(tobecho[f]!=1)
  {
    tobecho[f] = 1;
    totallen += map[e][f];
  }
if(r>6)
    for(g=0;g<r;g++)
{
    if(tobecho[g]!=1)
  {
    tobecho[g] = 1;
    totallen += map[g][f];
  }
if(r>7)
    for(h=0;h<r;h++)
{
    if(tobecho[h]!=1)
  {
    tobecho[h] = 1;
    totallen += map[h][g];
  }
}}}}}}}
if (totallen<minlen)
minlen = totallen;
 
 
}
printf("%d",minlen);
return 0;
}

Compiler output:
a.cc:91:1: error: extended character   is not valid in an identifier
   91 |  
      | ^
a.cc:92:1: error: extended character   is not valid in an identifier
   92 |  
      | ^
a.cc:1:1: error: 'include' does not name a type
    1 | include <stdlib.h>
      | ^~~~~~~
Language: C++

#include <stdlib.h>
#include <stdio.h>
int main()
{
int map[250][250];
int togoto[10];
int tobecho[10];
int a,b,c,d,e,f,g,h;
int minlen;
int totallen;
for(i=0;i<10;i++)
tobecho[i] = 0;
scanf("%d",&n);
scanf("%d",&m);
scanf("%d",&r);
for(i=0;i<r;i++)
scanf("%d",&togoto[i]);
for(i=0;i<m;i++)
{
scanf("%d",&start);
scanf("%d",&end);
scanf("%d",&len);
map[start][end] = len;
map[end][start] = len;
}
totallen = 0;
minlen = 5555555;
for(a=0;a<r;a++)
{
tobecho[a] = 1;
if(r>1)
    for(b=0;b<r;b++)
{
    if(tobecho[b]!=1)
  {
    tobecho[b] = 1;
    totallen += map[b][a];
  }
if(r>2)
    for(c=0;c<r;c++)
{
    if(tobecho[c]!=1)
  {
    tobecho[c] = 1;
    totallen += map[b][c];
  }
if(r>3)
    for(d=0;d<r;d++)
{
    if(tobecho[d]!=1)
  {
    tobecho[d] = 1;
    totallen += map[c][d];
  }
if(r>4)
    for(e=0;e<r;e++)
{
    if(tobecho[e]!=1)
  {
    tobecho[e] = 1;
    totallen += map[e][d];
  }
if(r>5)
    for(f=0;f<r;f++)
{
    if(tobecho[f]!=1)
  {
    tobecho[f] = 1;
    totallen += map[e][f];
  }
if(r>6)
    for(g=0;g<r;g++)
{
    if(tobecho[g]!=1)
  {
    tobecho[g] = 1;
    totallen += map[g][f];
  }
if(r>7)
    for(h=0;h<r;h++)
{
    if(tobecho[h]!=1)
  {
    tobecho[h] = 1;
    totallen += map[h][g];
  }
}}}}}}}
if (totallen<minlen)
minlen = totallen;
 
 
}
printf("%d",minlen);
return 0;
}

Compiler output:
a.cc:90:1: error: extended character   is not valid in an identifier
   90 |  
      | ^
a.cc:91:1: error: extended character   is not valid in an identifier
   91 |  
      | ^
a.cc: In function 'int main()':
a.cc:11:5: error: 'i' was not declared in this scope
   11 | for(i=0;i<10;i++)
      |     ^
a.cc:13:13: error: 'n' was not declared in this scope
   13 | scanf("%d",&n);
      |             ^
a.cc:14:13: error: 'm' was not declared in this scope
   14 | scanf("%d",&m);
      |             ^
a.cc:15:13: error: 'r' was not declared in this scope
   15 | scanf("%d",&r);
      |             ^
a.cc:16:5: error: 'i' was not declared in this scope
   16 | for(i=0;i<r;i++)
      |     ^
a.cc:18:5: error: 'i' was not declared in this scope
   18 | for(i=0;i<m;i++)
      |     ^
a.cc:20:13: error: 'start' was not declared in this scope
   20 | scanf("%d",&start);
      |             ^~~~~
a.cc:21:13: error: 'end' was not declared in this scope
   21 | scanf("%d",&end);
      |             ^~~
a.cc:22:13: error: 'len' was not declared in this scope
   22 | scanf("%d",&len);
      |             ^~~
a.cc:90:1: error: '\U000000a0' was not declared in this scope
   90 |  
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 207
#define INF (ll)1e12
int n,m,r;
ll dist[MAX][MAX];

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

// void display(){
// 	for(int i=1;i<=n;i++){
// 		for(int j=1;j<=n;j++)
// 			cout << dist[i][j] << " ";
// 		cout << endl;
// 	}
// }

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)dist[i][j]=INF;
			else dist[i][j]=0; 
	int nodes[r];

	for(int i=0; i<r; i++)scanf("%d",nodes+i);


	for(int i=0; i<m; i++){
		int a,b;
		ll c;
		scanf("%d %d %lld",&a,&b,&c);
		dist[a][b]=min(dist[a][b],c);
		dist[b][a]=min(dist[b][a],c);
	}
	fw();
	ll res=(ll)1e18;
	// cout << "SP\n";
	// display();
	// cout << "\n";

	sort(nodes,nodes+r);
	do{
		ll s=0;
		// cout << "Perm : ";
		// for(int i=0; i<r; i++)cout << nodes[i] << " ";
		// cout << endl;

		for(int i=1; i<r; i++)s+=dist[nodes[i-1]][nodes[i]];
		res=min(res,s);
	}while(next_permutation(nodes,nodes+r));
	printf("%lld\n",res);
}

Compiler output:
a.cc: In function 'void fw()':
a.cc:13:38: error: 'i' was not declared in this scope
   13 |                                 dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
      |                                      ^
Language: C++

#include<iostream>
#include<fstream>
#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 i = 0; i < n; i++) for(int j = 0; j < n; j++) for(int k = 0; k < n; k++) p[i][j] = min(p[i][j], p[i][k] + p[k][j]);

  long long ans = 100000000000;

  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:35:22: error: 'l' was not declared in this scope
   35 |   for(int i = 0; i < l; i++) {
      |                      ^
Language: C++

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

long long f(int &p[200][200] , long long n)
{
	for (size_t k = 0; k < n; k++) {
		for (size_t i = 0; i < n; i++) {
			for (size_t j = 0; j < n; j++) {
				p[i][j] = std::min(p[i][j], p[i][k] + p[k][j]);
			}
		}
	}
	return 0;
}


int main()
{
	long long n, m, r;

	std::cin >> n >> m >> r;

	std::vector<long long > v(r);

	for (size_t i = 0; i < r; i++) {
		std::cin >> v[i];
		v[i]--;
	}

	int p[200][200];
	for (size_t i = 0; i < 200; i++) {
		for (size_t j = 0; j < 200; j++) {
			p[i][j] = 10000000000;
		}
	}
	//std::vector<std::vector<long long > > p(n, std::vector<long long>(n, 10000000000000000));

	for (size_t i = 0; i < m; i++) {
		long long a, b, c;

		std::cin >> a >> b >> c;
		a--;
		b--;
		p[a][b] = c;
		p[b][a] = c;
	}

	f(p, n);

	std::string s;

	for (size_t i = 0; i < r; i++) {
		s += std::to_string(v[i]);
	}

	std::sort(s.begin(), s.end());

	long long ans = 100000000000000000;
	do {
		long long calc = 0;
		for (size_t i = 0; i < s.size() - 1; i++) {
			calc += p[s[i] - '0'][s[i + 1] - '0'];
		}
		ans = std::min(ans, calc);
	} while (std::next_permutation(s.begin(), s.end()));

	std::cout << ans << std::endl;

	return 0;
}

Compiler output:
a.cc:15:18: error: declaration of 'p' as array of references
   15 | long long f(int &p[200][200] , long long n)
      |                  ^
a.cc:15:29: error: expected ')' before ',' token
   15 | long long f(int &p[200][200] , long long n)
      |            ~                ^~
      |                             )
a.cc:15:32: error: expected unqualified-id before 'long'
   15 | long long f(int &p[200][200] , long long n)
      |                                ^~~~
a.cc: In function 'int main()':
a.cc:44:35: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   44 |                         p[i][j] = 10000000000;
      |                                   ^~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;
int main(void){
    int N, M, R;
    cin >> N >> M >> R;
    int r[8];
    cin >> r[0] >> r[1] >> r[2] >> r[3] >> r[4] >> r[5] >> r[6] >> r[7];
    int A[20000], B[20000], C[20000];
    int roads[200][200];
    int from, to;
    for( int i = 0; i < M; ++i ){
        cin >> A[i] >> B[i] >> C[i];
        if( A[i] > B[i] ){
            from = B[i];
            to = A[i];
        }else{
            to = B[i];
            from = A[i];
        }
        roads[to][from] = 
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: expected primary-expression before '}' token
   21 |     }
      |     ^
Language: C++

include <stdlib.h>
include <stdio.h>
int main()
{
int map[250][250];
int togoto[10];
int tobecho[10];
int a,b,c,d,e,f,g,h;
int minlen;
int totallen;
for(i=0;i<10;i++)
tobecho[i] = 0;
scanf("%d",&n);
scanf("%d",&m);
scanf("%d",&r);
for(i=0;i<r;i++)
scanf("%d",&togoto[i]);
for(i=0;i<m;i++)
{
scanf("%d",&start);
scanf("%d",&end);
scanf("%d",&len);
map[start][end] = len;
map[end][start] = len;
}
totallen = 0;
minlen = 5555555;
for(a=0;a<r;a++)
{
tobecho[a] = 1;
if(r>1)
    for(b=0;b<r;b++)
{
    if(tobecho[b]!=1)
  {
    tobecho[b] = 1;
    totallen += map[b][a];
  }
if(r>2)
    for(c=0;c<r;c++)
{
    if(tobecho[c]!=1)
  {
    tobecho[c] = 1;
    totallen += map[b][c];
  }
if(r>3)
    for(d=0;d<r;d++)
{
    if(tobecho[d]!=1)
  {
    tobecho[d] = 1;
    totallen += map[c][d];
  }
if(r>4)
    for(e=0;e<r;e++)
{
    if(tobecho[e]!=1)
  {
    tobecho[e] = 1;
    totallen += map[e][d];
  }
if(r>5)
    for(f=0;f<r;f++)
{
    if(tobecho[f]!=1)
  {
    tobecho[f] = 1;
    totallen += map[e][f];
  }
if(r>6)
    for(g=0;g<r;g++)
{
    if(tobecho[g]!=1)
  {
    tobecho[g] = 1;
    totallen += map[g][f];
  }
if(r>7)
    for(h=0;h<r;h++)
{
    if(tobecho[h]!=1)
  {
    tobecho[h] = 1;
    totallen += map[h][g];
  }
}}}}}}}
if (totallen<minlen)
minlen = totallen;


}
printf("%d",minlen);
return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <stdlib.h>
      | ^~~~~~~
Language: C++

#include<cstdio>
#include<iostream>
using namespace std;
 
int n,m,r;
int dis[500][500],R[500];
int u,v,w;
bool a[500],alive[500];
 
int main(){
	scanf("%d%d%d",&n,&m,&r);
 
	for (int i=1;i<=r;i++){
		scanf("%d",&u);
		R[i]=u;
		alive[u]=true;	a[u]=true;
	}
	 	
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			dis[i][j]=100000000;
 
	for (int i=1;i<=m;i++){
		scanf("%d%d%d",&u,&v,&w);
		dis[u][v]=w;
		dis[v][u]=w;
	}
	
	for (int k=1;k<=n;k++)
	 for (int i=1;i<=n;i++)
	  for (int j=1;j<=n;j++)
	   if (i!=j && i!=k && j!=k && dis[i][j]>dis[i][k]+dis[k][j])
	    dis[i][j]=dis[j][i]=dis[i][k]+dis[k][j];
  	  
	int ans=100000000;
	int first,flag,now,location,little;
	
	for (int k=1;k<=r;k++)
	{ 
		flag=1; now=0;
		
		first=R[k]; a[first]=false;
		
		while (flag==1){
			little=200000000; flag=0;
			for (int i=1;i<=r;i++)
			 if (a[R[i]] && dis[first][R[i]]!=100000000 && little>dis[first][R[i]])
			  {
			  	little=dis[first][R[i]];
			  	location=R[i];
			  	flag=1;
			  }
			if (flag==1){
				now+=little;
				first=location;
				a[first]=false;
			}
		}
	
		if (now<ans) ans=now;
			
		for (int i=1;i<=r;i++)
		 a[R[i]]=alive[R[i]];
		 
	}
	cout<<ans<<endl;
	
	return 0;
}

Compiler output:
a.cc:4:1: error: extended character   is not valid in an identifier
    4 |  
      | ^
a.cc:9:1: error: extended character   is not valid in an identifier
    9 |  
      | ^
a.cc:22:1: error: extended character   is not valid in an identifier
   22 |  
      | ^
a.cc:4:1: error: '\U000000a0' does not name a type
    4 |  
      | ^
a.cc:9:1: error: '\U000000a0' does not name a type
    9 |  
      | ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>
#include <limits>
#include <queue>
#include <iomanip>
#include <deque>
#include <stack>
#include <cstdio>
#include <cmath>
#include <complex.h>
#include <cstdio>
#include <random>
#include <chrono>
#include <numeric>
#include <cassert>
#include <iso646.h>
#include <exception>
#include <stdexcept>

using namespace std;

typedef long long i64;

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

#ifndef ONLINE_JUDGE
	FILE *stream;
	freopen_s(&stream, "input.txt", "r", stdin);
	// freopen_s(&stream, "output.txt", "w", stdout);
#endif

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

    int target_cities[8];
    for (int i = 0; i < r; i++)
        cin >> target_cities[i];

    const i64 inf = 1e9;
    i64 dist[201][201] = {};
    for (int v = 1; v <= n; v++)
        for (int u = 1; u <= n; u++)
            if (u != v)
                dist[u][v] = inf;

    for (int i = 0; i < m; i++)
    {
        int u, v, c;
        cin >> u >> v >> c;

        dist[u][v] = c;
        dist[v][u] = c;
    }

    for (int k = 1; k <= n; k++)
        for (int v = 1; v <= n; v++)
            for (int u = 1; u <= n; u++)
                if (dist[v][u] > dist[v][k] + dist[k][u])
                    dist[v][u] = dist[v][k] + dist[k][u];

    sort(target_cities, target_cities + r);

    i64 min_dist = 1e18;
    do
    {
        i64 cur_dist = 0;
        for (int i = 0; i + 1 < r; i++)
        {
            const int u = target_cities[i];
            const int v = target_cities[i + 1];

            cur_dist += dist[u][v];
        }

        min_dist = min(min_dist, cur_dist);

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

    cout << min_dist;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: 'freopen_s' was not declared in this scope; did you mean 'freopen64'?
   37 |         freopen_s(&stream, "input.txt", "r", stdin);
      |         ^~~~~~~~~
      |         freopen64
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,m,r;
long long MX=1000000000;
int a[100009];
int pa[10009];
int DSU(int a)
{
if(pa[a]==a)return a;
return pa[a]=DSU(pa[a]);
}
pair<int,pair<int, int > > b[100009];
vector<pair<int,int > > v[10009];
int bfs(int a,int b)
{
    set<pair<int ,int > > ss;
    int dis[100009];
    ss.clear();
    int vis[100009];
    memset(dis,0,sizeof(dis));
    memset(vis,0,sizeof(dis));
    int s=a,t=b;
    for (int i=1;i<=n;i++){
        dis[i]=MX;
    ss.insert(make_pair(MX,i));
    }
    dis[s]=0;
    ss.erase(make_pair(MX,s));
    ss.insert(make_pair(0,s));
    while(true)
    {
        int x=s;
        vis[x]=true;
        for (int i=0;i<v[x].size();++i)
        {
            int to=v[x][i].first;
            if (vis[to]==false)
            {
                if (dis[to]>dis[x]+v[x][i].second)
                {
                    ss.erase(make_pair(dis[to],to));
                    ss.insert(make_pair(dis[x]+v[x][i].second,to));
                    dis[to]=dis[x]+v[x][i].second;
                }
            }
        }
        if (ss.empty()==true)
            break;
        pair<int,int> sel=*ss.begin();
        ss.erase(ss.begin());
        if (sel.second==t)
            break;
        else
            s=sel.second;
    }
    return dis[t];
}
int main()
{
    cin>>n>>m>>r;
    for(int i=0;i<r;i++)
        cin>>a[i];
    for(int i=0;i<m;i++)
    {
        int x,y,z;
        cin>>x>>y>>z;
        v[x].push_back(make_pair(y,z));
        v[y].push_back(make_pair(x,z));
    }
    int u=0;
    for(int i=0;i<r;i++)
    {
        for(int j=i+1;j<r;j++)
        {
            int x=a[i],y=a[j];
            b[u].second.first=x;
            b[u].second.second=y;
            b[u].first=bfs(a[i],a[j]);
            u++;
        }
    }
    sort(b,b+u);
    for(int i=1;i<=n;i++)
        pa[i]=i;
    long long ans1=0;
    for(int i=0;i<u;i++)
    {
        long long x=b[i].second.first,y=b[i].second.second,z=b[i].first;
        x=DSU(x);
        y=DSU(y);
        if(pa[x]==pa[y])continue;
        pa[x]=pa[y];
        ans1+=z;
    }
    if(ans>20000000)
    {
        ii:;goto ii;
        
    }
    cout<<ans1;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:95:8: error: 'ans' was not declared in this scope; did you mean 'ans1'?
   95 |     if(ans>20000000)
      |        ^~~
      |        ans1
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int 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 1e9
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
int d[200][200];
signed main(){
    for(int i=0;i<200;i++)for(int j=0;j<200;j++)d[i][j]=INF;
    int n,m,r;
    cin>>n>>m>>r;
    vi vec;
    for(int i=0;i<r;i++){
        int t;
        cin>>t;
        t--;
        vec.pb(t);
    }
    for(int i=0;i<m;i++){
        int a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        d[a][b]=c;
        d[b][a]=c;
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
    sort(all)
    int ans=INF;
    do{
        int cnt=0;
        for(int i=1;i<r;i++){
            cnt+=d[vec[i]][vec[i-1]];
        }
        ans=min(ans,cnt);
    }while(next_permutation(all(vec)));
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:10: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   39 |     sort(all)
      |          ^~~
      |          std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
a.cc:46:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   46 |         ans=min(ans,cnt);
      |         ^~~
      |         abs
a.cc:48:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   48 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl


using ll = long long;
const ll mod = LLONG_MAX;

int dp[1024][210];
int n,m,R;
int solve(int st){
  for(int S=0;S<1<<n;S++){
    fill(dp[S],dp[S]+n,INF);
  }
  dp[(1<<n)-1][st]=0;
  for(int v=0;v<n;v++){
    int (int u=0;u<R;u++){
      if(!(S>>r[u] & 1)){
        dp[S][v]=min(dp[S][v],dp[S|1<<r[u]][r[u]]+d[v][r[u]]);
      }
    }
  }
  return dp[0][0];

}

int main(){
  cin>>n>>m>>R;
  rep(i,n)cin>>r[i];

  int ans=INF;
  for(int i=0;i<R;i++){
    ans=min(ans,solve(r[i]));
  }
  cout<<ans<<endl;

}


Compiler output:
a.cc: In function 'int solve(int)':
a.cc:5:13: error: 'mugen' was not declared in this scope
    5 | #define INF mugen
      |             ^~~~~
a.cc:16:24: note: in expansion of macro 'INF'
   16 |     fill(dp[S],dp[S]+n,INF);
      |                        ^~~
a.cc:20:5: error: expected primary-expression before 'int'
   20 |     int (int u=0;u<R;u++){
      |     ^~~
a.cc:20:18: error: 'u' was not declared in this scope
   20 |     int (int u=0;u<R;u++){
      |                  ^
a.cc: In function 'int main()':
a.cc:32:16: error: 'r' was not declared in this scope
   32 |   rep(i,n)cin>>r[i];
      |                ^
a.cc:5:13: error: 'mugen' was not declared in this scope
    5 | #define INF mugen
      |             ^~~~~
a.cc:34:11: note: in expansion of macro 'INF'
   34 |   int ans=INF;
      |           ^~~
a.cc:36:23: error: 'r' was not declared in this scope
   36 |     ans=min(ans,solve(r[i]));
      |                       ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int maxn=202;
const int inf=0x3f3f3f3f;

int dis[maxn][maxn],rt[maxn],vis[maxn];
int n,m,r;

floyd() {
	for (int k=1; k<=n; ++k)
		for (int i=1; i<=n; ++i)
			for (int j=1; j<=n; ++j)
				if (i!=j)
					dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
}

int dfs(int x,int rs) {
	vis[x]=1;
	if (rs==0)
		return 0;
	int mn=inf,nxt;
	for (int i=1; i<=n; ++i)
		if (i!=x && rt[i] && !vis[i] && dis[x][i]<mn) {
			mn=dis[x][i];
			nxt=i;
		}
	vis[nxt]=1;
	return mn+dfs(nxt,rs-1);
}

int main() {
	cin>>n>>m>>r;
	for (int i=1,a; i<=r; ++i) {
		cin>>a;
		rt[a]=1;
	}
	memset(dis,inf,sizeof(dis));
	for (int i=1,a,b,c; i<=m; ++i) {
		cin>>a>>b>>c;
		dis[a][b]=dis[b][a]=min(dis[a][b],c);
	}
	floyd();
	int tmp=0,ans=inf;
	for (int i=1; i<=n; ++i)
		if (rt[i]) {
			memset(vis,0,sizeof(vis));
			ans=min(ans,dfs(i,r-1));
		}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:11:1: error: ISO C++ forbids declaration of 'floyd' with no type [-fpermissive]
   11 | floyd() {
      | ^~~~~
a.cc: In function 'int floyd()':
a.cc:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
   17 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl


using ll = long long;
const ll mod = LLONG_MAX;

int dp[1024][210];
int n,m,R;
int solve(int st){
  for(int S=0;S<1<<n;S++){
    fill(dp[S],sp[S]+n,INF);
  }
  dp[(1<<n)-1][st]=0;
  for(int v=0;v<n;v++){
    int (int u=0;u<R;u++){
      if(!(S>>r[u] & 1)){
        dp[S][v]=min(dp[S][v],dp[S|1<<r[u]][r[u]]+d[v][r[u]]);
      }
    }
  }
  return dp[0][0];

}

int main(){
  cin>>n>>m>>R;
  rep(i,n)cin>>r[i];

  int ans=INF;
  for(int i=0;i<R;i++){
    ans=min(ans,solve(r[i]));
  }
  cout<<ans<<endl;

}


Compiler output:
a.cc: In function 'int solve(int)':
a.cc:16:16: error: 'sp' was not declared in this scope; did you mean 'st'?
   16 |     fill(dp[S],sp[S]+n,INF);
      |                ^~
      |                st
a.cc:5:13: error: 'mugen' was not declared in this scope
    5 | #define INF mugen
      |             ^~~~~
a.cc:16:24: note: in expansion of macro 'INF'
   16 |     fill(dp[S],sp[S]+n,INF);
      |                        ^~~
a.cc:20:5: error: expected primary-expression before 'int'
   20 |     int (int u=0;u<R;u++){
      |     ^~~
a.cc:20:18: error: 'u' was not declared in this scope
   20 |     int (int u=0;u<R;u++){
      |                  ^
a.cc: In function 'int main()':
a.cc:32:16: error: 'r' was not declared in this scope
   32 |   rep(i,n)cin>>r[i];
      |                ^
a.cc:5:13: error: 'mugen' was not declared in this scope
    5 | #define INF mugen
      |             ^~~~~
a.cc:34:11: note: in expansion of macro 'INF'
   34 |   int ans=INF;
      |           ^~~
a.cc:36:23: error: 'r' was not declared in this scope
   36 |     ans=min(ans,solve(r[i]));
      |                       ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int maxn=202;
const int inf=0x3f3f3f3f;

int mp[maxn][maxn],dis[maxn][maxn],rt[maxn],vis[maxn];
int n,m,r;

inline floyd() {
	memcpy(dis,mp,sizeof(dis));
	for (int k=1; k<=n; ++k)
		for (int i=1; i<=n; ++i)
			for (int j=1; j<=n; ++j)
				if (i!=j)
					dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
}

inline int dfs(int x,int rs) {
	vis[x]=1;
	if (rs==0)
		return 0;
	int mn=inf,nxt;
	for (int i=1; i<=n; ++i)
		if (i!=x && rt[i] && !vis[i] && dis[x][i]<mn) {
			mn=dis[x][i];
			nxt=i;
		}
	vis[nxt]=1;
	return mn+dfs(nxt,rs-1);
}

int main() {
	scanf("%d%d%d",&n,&m,&r);
	for (int i=1,a; i<=r; ++i) {
		scanf("%d",&a);
		rt[a]=1;
	}
	memset(mp,inf,sizeof(mp));
	for (int i=1,a,b,c; i<=m; ++i) {
		scanf("%d%d%d",&a,&b,&c);
		mp[a][b]=mp[b][a]=min(mp[a][b],c);
	}
	floyd();
	int tmp=0,ans=inf;
	for (int i=1; i<=n; ++i)
		if (rt[i]) {
			memset(vis,0,sizeof(vis));
			ans=min(ans,dfs(i,r-1));
		}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc:11:8: error: ISO C++ forbids declaration of 'floyd' with no type [-fpermissive]
   11 | inline floyd() {
      |        ^~~~~
a.cc: In function 'int floyd()':
a.cc:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
   18 | }
      | ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <map>

using namespace std;

#define MOD 1000000007
#define INF 2147483647
#define ll long long

#define MAX_V 300

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


	ll d[MAX_V][MAX_V];
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			if (i == j) { d[i][j] = 0; }
			else { d[i][j] = INF; }
		}
	}
	for (int i = 1; i <= M; i++) {
		int a, b, c;
		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++) {
				if (d[i][j] > d[i][k] + d[k][j]) {
					d[i][j] = d[i][k] + d[k][j]);
				}
			}
		}
	}
	
	ll res = INF;
	do {
		ll tmp = 0;
		for (int i = 0; i < R-1; i++) {
			tmp += d[r[i]][r[i + 1]];
		}
		if (res > tmp) {
			res = tmp;
		}
	} while (next_permutation(r.begin(), r.end()));

	cout << res << endl;

	return (0);
}

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

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

int main()
{
    long long N, M, R;
    cin >> N >> M >> R;
    vector<long long> r(R), A(M), B(M), C(M);
    REP (i, R) {
        cin >> r[i];
        r[i]--;
    }
    REP (i, M) {
        cin >> A[i] >> B[i] >> C[i];
        A[i]--;
        B[i]--;
    }

    vector<vector<long long> > distance(N, vector<long long>(N, INT_MAX));

    REP (i, N) {
        distance[i][i] = 0;
    }
    REP (i, M) {
        distance[A[i]][B[i]] = C[i];
        distance[B[i]][A[i]] = C[i];
    }
    REP (i, N) {
        REP (j, N) {
            REP (k, N) {
                distance[j][k] = min(distance[j][k], distance[j][i] + distance[i][k]);
            }
        }
    }
    long long ans = LLONG_MAX;
    sort(r.begin().r.end());
    do {
        long long tmp = 0;
        REP (i, R - 1) {
            tmp += distance[r[i]][r[i + 1]];
        }
        ans = min(ans, tmp);
    } while (next_permutation(r.begin(), r.end()));
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:20: error: 'std::vector<long long int>::iterator' has no member named 'r'
   38 |     sort(r.begin().r.end());
      |                    ^
Language: C++

#include<iostream>
#include<vector>

using namespace std;

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

int INF = 10e8;
int n, m, r;
int rlist[8];
int d[200][200];
int w[8][8];

struct edge{
    int u, v, cost;
};

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
          src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

int pr[1<<8][8];
Weight best[1<<8][8];

void buildPath(int S, int i, vector<int> &path) {
  if (!S) return;
  buildPath(S^(1<<i), pr[S][i], path);
  path.push_back(i);
}



int main(){
    cin >> n >> m >> r;
    
    REP(i, r) cin >> rlist[i];
    REP(i, r) rlist[i] -= 1;
    
    REP(i, n) REP(j, n) d[i][j] = INF;
    REP(i, m){
        int a, b, c;
        cin >> a >> b >> c;
        a = a-1; b = b-1;
        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]);
            }
        }
    }

    REP(i, r) REP(j, r) w[i][j] = INF;
    REP(i, r){
        w[i][(i+1)%r] = d[rlist[i]][rlist[(i+1)%r]];
        w[(i+1)%r][i] = w[i][(i+1)%r];
        // cout << w[i][(i+1)%r] << " " << rlist[i] << " " << rlist[(i+1)%r] << endl;
    }

  int output = INF;
  REP(s, 8){
      vector<int> path;
      int N = 1 << r;
      REP(S,N) REP(i,n) best[S][i] = INF;
      best[1<<s][s] = 0;
      REP(S,N) REP(i,n) if (S&(1<<i)) REP(j,n)
        if (best[S|(1<<j)][j] > best[S][i] + w[i][j])
          best[S|(1<<j)][j] = best[S][i] + w[i][j],
          pr[S|(1<<j)][j] = i;
      int t = min_element(best[N-1], best[N-1]+n) - best[N-1];
      path.clear(); buildPath(N-1, t, path);
      output = min(output, best[N-1][t]);
  }
  cout << output << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:86:15: error: 'min_element' was not declared in this scope
   86 |       int t = min_element(best[N-1], best[N-1]+n) - best[N-1];
      |               ^~~~~~~~~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define ll long long
int main(int argc, char const *argv[])
{
  ll n, m, r;
  cin >> n >> m >> r;

  ll perm[r];
  for(ll i = 1; i <= r; i++)
    cin >> perm[i-1];

  ll graph[n+1][n+1];

  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++)
      if(i == j){
        graph[i][j] = 0;continue;
      }
      graph[i][j] = LLONG_MAX;
  }


  for(int i = 1; i <= m; i++){
    ll x,y,z;
    cin >> x >> y >> z;

    graph[x][y] = z;
    graph[y][x] = z;
  }


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

  ll ans = 0;
sort(perm, perm+r);
  for(int i = 0; i +1 < r; i++){
    ans += graph[perm[i]][perm[i+1]];
  }

  ll global_min = LLONG_MAX;
  global_min = min(global_min, ans);

  while(next_permutation(perm, perm+r)){
    ans = 0;
    for(int i = 0; i+1 < r; i++){
      ans += graph[perm[i]][perm[i+1]];
    }
    global_min = min(global_min, ans);
  }
ans = 0;
  for(int i = 0; i +1 < r; i++){
    ans += graph[perm[i]][perm[i+1]];
  }
  global_min = min(global_min, ans);

  cout << global_min;
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:20:16: error: 'j' was not declared in this scope
   20 |       graph[i][j] = LLONG_MAX;
      |                ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
  int N, M, R;
  cin >> N >> M >> R;
  vector<int> r(R, 0);
  for (int i = 0; i < R; ++i) {
    cin >> r[i];
    --r[i];
  }
  vector<vector<int>> road(M, vector<int>(M, 100001));
  for (int i = 0; i < M; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    --a; --b;
    road[a][b] = road[b][a] = c;
  }

  for (int k = 0; k < M; ++k) {
    for (int i = 0; i < M; ++i) {
      for (int j = i + 1; j < M; ++j) {
        int c = road[i][k] + road[k][j];
        if (c < road[i][j]) road[i][j] = road[j][i] = c;
      }
    }
  }

  cout << 0 << endl;
  return;

  sort(r.begin(), r.end());
  int min_cost = 0;
  do {
    int cost = 0;
    for (int i = 1; i < R; ++i) cost += road[r[i-1]][r[i]];
    if (min_cost == 0 or min_cost > cost) min_cost = cost;
  } while(next_permutation(r.begin(), r.end()));

  cout << min_cost << endl;

  return 0;
}

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

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>

using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
int N,M,R;
vector <int > r;
vector <vector <int> > d;




int main()
{

	cin >> N >> M >> R;

	r.resize(R);
	REP(i,R){
		cin >> r[i];
	}
	d.resize(N);
	REP(i,N){
		d[i].resize(N);
		REP(j,N){
			if(i==j)
				d[i][j] = 0;
			else
				d[i][j] = INT_MAX;
		}
	}

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

	REP(k,N){
		REP(i,N){
			REP(j,N){
				d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
			}
		}
	}
	/*
	REP(i,N){
		REP(j,N){
			cout << d[i][j] << " ";
		}
		cout << endl;
	}*/

    int maxans = INT_MAX;
    do {
    	int ans = 0;
    	REP(i,R-1){
    		ans += d[r[i]-1][r[i+1]-1];
    	}
    	maxans = min(ans,maxans);
    } while( next_permutation(r.begin(), r.end()) );     // 次の順列を生成

	cout << maxans;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:38:43: error: 'INT_MAX' was not declared in this scope
   38 |                                 d[i][j] = INT_MAX;
      |                                           ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <functional>
  +++ |+#include <climits>
    6 | 
a.cc:64:18: error: 'INT_MAX' was not declared in this scope
   64 |     int maxans = INT_MAX;
      |                  ^~~~~~~
a.cc:64:18: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <tuple>
using namespace std;


int main() {
    int f[200][200];
    int c[8];
    int n, m, r;
    cin>>n>>m>>r;
    for (int i=0; i<r; i++) cin>>c[i], c[i]--;
    for (int i=0; i<n; i++) for (int j=0; j<n; j++) f[i][j] = INT_MAX;
    for (int i=0; i<m; i++) {
        int a, b, d;
        cin>>a>>b>>d;
        f[a-1][b-1] = f[b-1][a-1] = d;
    }
    for (int k=0; k<n; k++) {
        for (int i=0; i<n; i++) {
            for (int j=0; j<n; j++) {
                if (f[i][k] < INT_MAX && f[k][j] < INT_MAX && f[i][k] + f[k][j] < f[i][j]) f[i][j] = f[i][k] + f[k][j];
            }
        }
    }
    vector<int> p(r);
    for (int i=0; i<r; i++) p[i] = i;
    int ans = -1;
    do {
        int t = 0;
        for (int i=1; i<r; i++) {
            int from = c[p[i-1]], to = c[p[i]];
            t += f[from][to];
        }
        if (ans == -1 || t < ans) ans = t;
    } while (next_permutation(p.begin(), p.end()));
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:63: error: 'INT_MAX' was not declared in this scope
   34 |     for (int i=0; i<n; i++) for (int j=0; j<n; j++) f[i][j] = INT_MAX;
      |                                                               ^~~~~~~
a.cc:24:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   23 | #include <random>
  +++ |+#include <climits>
   24 | #include <tuple>
a.cc:43:31: error: 'INT_MAX' was not declared in this scope
   43 |                 if (f[i][k] < INT_MAX && f[k][j] < INT_MAX && f[i][k] + f[k][j] < f[i][j]) f[i][j] = f[i][k] + f[k][j];
      |                               ^~~~~~~
a.cc:43:31: 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;
#define MAX 207
#define INF (ll)1e18
int n,m,r;
ll dist[MAX][MAX];

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

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)dist[i][j]=INF;
	int nodes[r];

	for(int i=0; i<r; i++)scanf("%d",nodes+i);


	for(int i=0; i<m; i++){
		int a,b;
		ll c;
		scanf("%d %d %lld",&a,&b,&c);
		dist[a][b]=c;
		dist[b][a]=c;
	}
	fw();
	ll res=INF;
	sort(nodes,nodes+r);
	do{
		ll s=0;
		for(int i=1; i<r; i++)s+=dist[nodes[i-1]][nodes[i]];
		res=min(res,s);
	}while(next_permutation(nodes,nodes+r));
	printf("%lld\n",res);
}a

Compiler output:
a.cc:40:2: error: 'a' does not name a type
   40 | }a
      |  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long dp[210][210],a[210][210];
long long t[9][9],v[9],g[9],vis[9],n,ans=1000100100,r;
void dfs(int m)
{
    if(m==r)
    {
        int mn=0;
        for(int i=1;i<r;i++)
        {
            mn+=dp[g[i]][g[i-1]];
        }
        ans=min(ans,mn);
        return;
    }
    for(int i=0;i<r;i++)
    {
        if(vis[v[i]])continue;
        vis[i]=1;
        g[m]=v[i];
        dfs(m+1);
        vis[i]=0;
    }
}
int main()
{
    cin.tie(0);ios_base::sync_with_stdio(false);
    int m,x,y,z;
    cin>>n>>m>>r;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
        dp[i][j]=1000100000;
    for(int i=0;i<r;i++)cin>>v[i];
    while(m--)
    {
        cin>>x>>y>>z;
        a[x][y]=a[y][x]=z;
        dp[x][y]=dp[y][x]=z;
    }
    for(int k=1;k<=n;k++)
    for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++)
    dp[i][j]=min(dp[i][k]+dp[k][j],dp[i][j]);
    dfs(0);
    cout<<ans<<endl;
return 0;
}



Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:14:16: error: no matching function for call to 'min(long long int&, int&)'
   14 |         ans=min(ans,mn);
      |             ~~~^~~~~~~~
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:14:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   14 |         ans=min(ans,mn);
      |             ~~~^~~~~~~~
/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:14:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   14 |         ans=min(ans,mn);
      |             ~~~^~~~~~~~