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

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int inf = 1001001001;
const ll INF = 1e;

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

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

  vector<vector<ll>> g(n, vector<ll> (n,INF));

  // self roop
  rep(i,n){
    g[i][i] = 0;
   }
  
  rep(i,m){
      ll a, b, c;
      cin >> a >> b >> c;
      a--; b--;
      g[a][b] = min(g[a][b],c);
      g[b][a] = min(g[b][a],c);
  }

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

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

  ll ans = INF;

  do {
      ll sum = 0;
      rep(i,r-1){
        sum += g[R[i]][R[i+1]];
      }
      ans = min(ans,sum);
    }while(next_permutation(R.begin(), R.end()));
  cout << ans << endl;
}


Compiler output:
a.cc:7:16: error: exponent has no digits
    7 | const ll INF = 1e;
      |                ^~
Language: C++

#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  int n,m,r;
  cin>>n>>m>>r;
  int p[r];
  for(int i=0;i<r;i++{
    cin>>p[i];
  }
  int d[n][n];
  for(int i=0;i<n;i++{
    for(int j=0;j<n;j++{
      d[i][j]=100000000;
    }
  }
  for(int i=0;i<n;i++) d[i][i]=0;
  for(int i=0;i<m;i++){
    int a,b,c;
    cin>>a>>b>>c;
    d[a][b]=min(d[a][b],c);
    d[b][a]=d[a][b];
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      for(int k=0;k<n;k++{
        d[j][k]=min(d[j][k],d[j][i]+d[i][k]);
      }
    }
  }
  sort(p,p+r);
  int ans=1000000000;
  do{
    int temp=0;
    for(int i=0;i<r-1;i++){
      temp+=d[p[i]][p[i+1]];
    }
    ans=min(temp,ans);
  }while(next_permutation(p.begin(),p.end()));
  cout<<ans<<endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:28:22: error: expected ')' before '{' token
   28 |   for(int i=0;i<r;i++{
      |      ~               ^
      |                      )
a.cc:32:22: error: expected ')' before '{' token
   32 |   for(int i=0;i<n;i++{
      |      ~               ^
      |                      )
a.cc:33:24: error: expected ')' before '{' token
   33 |     for(int j=0;j<n;j++{
      |        ~               ^
      |                        )
a.cc:46:26: error: expected ')' before '{' token
   46 |       for(int k=0;k<n;k++{
      |          ~               ^
      |                          )
a.cc:59:29: error: request for member 'begin' in 'p', which is of non-class type 'int [r]'
   59 |   }while(next_permutation(p.begin(),p.end()));
      |                             ^~~~~
a.cc:59:39: error: request for member 'end' in 'p', which is of non-class type 'int [r]'
   59 |   }while(next_permutation(p.begin(),p.end()));
      |                                       ^~~
Language: C

#include<stdio.h>
#define inf 100000000L
long int d[201][201],l[8],u[8],n,m,r,min;
void df(int c,int o,int e){
  if(c==r){if(min>e)min=e;return;}
  for(int i=0;i<r;i++)if(!u[i]){u[i]=1;dfs(c+1,i,e+d[l[o]][l[i]]);u[i]=0;}
}
int main(){
  long int i,j,k,x,y,z;
  scanf("%ld%ld%ld",&n,&m,&r);n++;
  for(i=0;i<r;i++){scanf("%ld",&l[i]);u[i]=0;}
  for(i=0;i<m;i++){scanf("%ld%ld%ld",&x,&y,&z);d[x][y]=d[y][x]=z;}
  for(i=1;i<n;i++)d[i][i]=0;
  for(i=1;i<n;i++)for(j=1;j<n;j++)for(k=1;k<n;k++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
  min=inf;for(i=0;i<r;i++)df(1,i,0);
  printf("%ld",min);
}


Compiler output:
main.c: In function 'df':
main.c:6:40: error: implicit declaration of function 'dfs'; did you mean 'df'? [-Wimplicit-function-declaration]
    6 |   for(int i=0;i<r;i++)if(!u[i]){u[i]=1;dfs(c+1,i,e+d[l[o]][l[i]]);u[i]=0;}
      |                                        ^~~
      |                                        df
Language: C++

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const ll INF = 1ll << 60;

// O(N^3)
// return value: whether the graph has negative loop
bool warshall_floyd(vector<vector<ll>> &adj) {
    int n = adj.size();
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j]);
            }
        }
    }
    for (int i = 0; i < n; i++) {
        if (adj[i][i] < 0) return false;
    }
    return true;
}

// verified
//   http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_C&lang=jp
void AOJ_GRL_1_C() {
    int V, E;
    cin >> V >> E;
    vector<vector<ll>> adj(V, vector<ll>(V, INF));
    for (int i = 0; i < V; i++) adj[i][i] = 0;
    for (int i = 0; i < E; i++) {
        int s, t; ll d;
        cin >> s >> t >> d;
        adj[s][t] = d;
    }
    bool negative_loop = warshall_floyd(adj);
    if (!negative_loop) {
        cout << "NEGATIVE CYCLE" << '\n';
        return;
    }
    for (int i = 0; i < V; i++) {
        for (int j = 0; j < V; j++) {
            if (j) cout << ' ';
            if (adj[i][j] == INF) cout << "INF";
            else cout << adj[i][j];
        }
        cout << '\n';
    }
}

// verified
//  https://atcoder.jp/contests/abc073/tasks/abc073_d
#include <algorithm>
void AtCoder_2017_9_9_D() {
    int n, m, r, a, b; ll c;
    cin >> n >> m >> r;
    vector<int> rs(r);
    for (int i = 0; i < r; i++) { cin >> rs[i]; rs[i]--; }
    vector<vector<ll>> adj(n, vector<ll>(n, INF));
    for (int i = 0; i < n; i++) adj[i][i] = 0;
    for (int i = 0; i < m; i++) {
        cin >> a >> b >> c;
        a--; b--;
        if (c < adj[a][b]) adj[a][b] = adj[b][a] = c;
    }
    warshall_floyd(adj);
    ll ans = 0;
    for (int i = 1; i < r; i++) {
        if (adj[rs[i - 1][i]] == INF) {
            ans = INF;
            break;
        }
        ans += adj[rs[i - 1]][rs[i]];
    }
    while (next_permutation(rs.begin(), rs.end())) {
        ll tmp = 0;
        for (int i = 1; i < r; i++) {
            if (adj[rs[i - 1][i]] == INF) {
                tmp = INF;
                break;
            }
            tmp += adj[rs[i - 1]][rs[i]];
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

int main() {
    // AOJ_GRL_1_C();
    AtCoder_2017_9_9_D();
    return 0;
}

Compiler output:
a.cc: In function 'void AtCoder_2017_9_9_D()':
a.cc:69:26: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   69 |         if (adj[rs[i - 1][i]] == INF) {
      |                          ^
a.cc:78:30: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   78 |             if (adj[rs[i - 1][i]] == INF) {
      |                              ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const ll INF = 1ll << 60;

// O(N^3)
// return value: whether the graph has negative loop
bool warshall_floyd(vector<vector<ll>> &adj) {
    int n = adj.size();
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (adj[i][k] == INF || adj[k][j] == INF) continue;
                adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j]);
            }
        }
    }
    for (int i = 0; i < n; i++) {
        if (adj[i][i] < 0) return false;
    }
    return true;
}

// verified
//   http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_C&lang=jp
void AOJ_GRL_1_C() {
    int V, E;
    cin >> V >> E;
    vector<vector<ll>> adj(V, vector<ll>(V, INF));
    for (int i = 0; i < V; i++) adj[i][i] = 0;
    for (int i = 0; i < E; i++) {
        int s, t; ll d;
        cin >> s >> t >> d;
        adj[s][t] = d;
    }
    bool negative_loop = warshall_floyd(adj);
    if (!negative_loop) {
        cout << "NEGATIVE CYCLE" << '\n';
        return;
    }
    for (int i = 0; i < V; i++) {
        for (int j = 0; j < V; j++) {
            if (j) cout << ' ';
            if (adj[i][j] == INF) cout << "INF";
            else cout << adj[i][j];
        }
        cout << '\n';
    }
}

void AtCoder_2017_9_9_D() {
    int n, m, r;
    cin >> n >> m >> r;
    vector<int> rs(r);
    for (int i = 0; i < r; i++) {cin >> rs[i]; rs[i]--;}
    vector<vector<ll>> adj(n, vector<ll>(n));
    for (int i = 0; i < n; i++) adj[i][i] = 0;
    for (int i = 0; i < m; i++) {
        int a, b; ll c;
        cin >> a >> b >> c;
        a--; b--;
        adj[a][b] = adj[b][a] = c;
    }
    warshall_floyd(adj);
    ll ans = INF;
    do {
        ll tmp = 0;
        for (int i = 0; i < r - 1; i++) tmp += adj[rs[i + 1]][rs[i]];
        ans = min(ans, tmp);
    } while (next_permutation(rs.begin(), rs.end()));
    cout << ans << endl;
}

int main() {
    // AOJ_GRL_1_C();
    AtCoder_2017_9_9_D();
    return 0;
}

Compiler output:
a.cc: In function 'void AtCoder_2017_9_9_D()':
a.cc:71:14: error: 'next_permutation' was not declared in this scope
   71 |     } while (next_permutation(rs.begin(), rs.end()));
      |              ^~~~~~~~~~~~~~~~
Language: C++

#include <vector>
#include <iostream>
#include <algorithm>
#include <climits>

using namespace std;
const long long INF = 1LL << 31) - 1;

//dist table
long long graph[210][210];


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

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


    //init
    for(int i=0; i<N; ++i){
        for(int j=0; j<N; ++j){
            if(i == j){
                graph[i][j] = 0;
            }else{
                graph[i][j] = INF;
            }
        }
    }


    for(int i=0; i<M; ++i){
        long long A, B, C;
        cin >> A >> B >> C;
        A--; B--;
        graph[A][B] = min(C, graph[A][B]);
        graph[B][A] = min(C, graph[B][A]);
    }

    //warshall_floyd
    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]);
            }
        }
    }

    long long ans = INF;
    do{
        long long tmp = 0;
        for(int i=0; i<visit_towns.size()-1; ++i){
            tmp += graph[visit_towns[i]][visit_towns[i+1]];
        }
        ans = min(ans, tmp);

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

    cout << ans << endl;
}

Compiler output:
a.cc:7:32: error: expected ',' or ';' before ')' token
    7 | const long long INF = 1LL << 31) - 1;
      |                                ^
Language: C++

#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;
const int INF = INT_MAX;

//dist table
int graph[210][210];


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

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


    //init
    for(int i=0; i<N; ++i){
        for(int j=0; j<N; ++j){
            if(i == j){
                graph[i][j] = 0;
            }else{
                graph[i][j] = INF;
            }
        }
    }


    for(int i=0; i<M; ++i){
        int A, B, C;
        cin >> A >> B >> C;
        A--; B--;
        graph[A][B] = min(C, graph[A][B]);
        graph[B][A] = min(C, graph[B][A]);
    }

    //warshall_floyd
    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]);
            }
        }
    }

    long long ans = INF;
    do{
        long long tmp = 0;
        for(int i=0; i<visit_towns.size()-1; ++i){
            tmp += graph[visit_towns[i]][visit_towns[i+1]];
        }
        ans = min(ans, tmp);

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

    cout << ans << endl;
}

Compiler output:
a.cc:6:17: error: 'INT_MAX' was not declared in this scope
    6 | const int INF = INT_MAX;
      |                 ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define ld long double
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
void wf(vector<vector<ll>> &k){
  int n=k.size();//存在しない辺をinfで渡す
  rep(k,n)rep(i,n)rep(j,n)k[i][j]=min(k[i][j],k[i][o]+k[o][j]);
  //rep(i,n)rep(j,n)rep(o,n)k[i][j]=min(k[i][j],k[i][o]+k[o][j]);
}
int main(){
  int n,m,r;
  cin >> n >> m >> r;
  vector<int> u(r,0);
  rep(i,r){
    int y;
    cin >> y;
    y--;
    u[i]=y;
  }
  vector<vector<ll>> k(n,vector<ll>(n,100000000000000000));
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    ll c;
    cin >> c;
    k[a][b]=c;
    k[b][a]=c;
  }
  wf(k);
  //rep(i,n)rep(j,n)cout << k[i][j] << endl;
  int a[r];
  rep(i,r)a[i]=i;
  ll ans=2000000000000000000;
  do {
   //cout << a[0] << a[1] << a[2] << ans << endl;
    ll p=0;
    rep(i,r-1){
      //cout << k.at(u[a[i]]).at(u[a[i+1]]) << u[a[i]] << u[a[i+1]] << endl;
      p+=k.at(u[a[i]]).at(u[a[i+1]]);
    }
    if(p<0){
      while(true){
        p++;
      }
    }
    ans=min(ans,p);
  } while(next_permutation(a, a + r));
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'void wf(std::vector<std::vector<long long int> >&)':
a.cc:13:28: error: invalid types 'int[int]' for array subscript
   13 |   rep(k,n)rep(i,n)rep(j,n)k[i][j]=min(k[i][j],k[i][o]+k[o][j]);
      |                            ^
a.cc:13:40: error: invalid types 'int[int]' for array subscript
   13 |   rep(k,n)rep(i,n)rep(j,n)k[i][j]=min(k[i][j],k[i][o]+k[o][j]);
      |                                        ^
a.cc:13:48: error: invalid types 'int[int]' for array subscript
   13 |   rep(k,n)rep(i,n)rep(j,n)k[i][j]=min(k[i][j],k[i][o]+k[o][j]);
      |                                                ^
a.cc:13:52: error: 'o' was not declared in this scope
   13 |   rep(k,n)rep(i,n)rep(j,n)k[i][j]=min(k[i][j],k[i][o]+k[o][j]);
      |                                                    ^
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,m,r;
    cin>>n>>m>>r;
    vi rarr;
    ll d[n+3][n+3];
    for(int i=0;i<r;i++){
        int k;
        cin>>k;
        rarr.pb(k);
    }
    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=0;i<m;i++){
        int a,b,c;
        cin>>a>>b>>c;
        if(d[a][b]>c){
            d[a][b]=c;
            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];
                }
            }
        }
    }
    ll ans=inf;
    sort(r.begin(), r.end());
    do {
        ll count=0;
        for(int i=0;i<r-1;i++){
            count+=d[rarr[i]][rarr[i+1]];
        }
        if(count<ans)
            ans=count;

    }while(next_permutation(rarr.begin(),rarr.end()));
   
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:65:12: error: request for member 'begin' in 'r', which is of non-class type 'int'
   65 |     sort(r.begin(), r.end());
      |            ^~~~~
a.cc:65:23: error: request for member 'end' in 'r', which is of non-class type 'int'
   65 |     sort(r.begin(), r.end());
      |                       ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std ;
# define INF (1 < <29)
int N ,M , R ;
int d [201][201];
int r [9];
int A ,B , C ;
int res ;
bool used [9];
void dfs ( int c , int las , int dist )
{
if ( c == R +1)
{
if ( res > dist ) res = dist ;
return ;
}
for ( int i =1; i <= R ; i ++) if (! used [ i ])
{
used [ i ]= true ;
if ( las == -1) dfs ( c +1 ,i ,0);
else dfs ( c +1 ,i , dist + d [ r [ las ]][ r [ i ]]);
used [ i ]= false ;
}
}
int main ()
{
scanf ( " % d % d % d " ,&N ,& M ,& R );
for ( int i =1; i <= N ; i ++) for ( int j =1; j <= N ; j ++) if ( i != j ) d [ i ][ j ]= INF ;
for ( int i =1; i <= R ; i ++) scanf ( " % d " ,& r [ i ]);
for ( int i =1; i <= M ; i ++)
{
scanf ( " % d % d % d " ,&A ,& B ,& C );
if ( d [ A ][ B ] > C ) d [ A ][ B ]= d [ B ][ A ]= C ;
}
for ( int k =1; k <= N ; k ++)
for ( int i =1; i <= N ; i ++)
for ( int j =1; j <= N ; j ++)
if ( d [ i ][ j ] > d [ i ][ k ]+ d [ k ][ j ])
d[ i ][ j ]= d [ i ][ k ]+ d [ k ][ j ];
res = INF ;
dfs (1 , -1 ,0);
printf ( " % d \ n " , res );
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:19: error: expected primary-expression before '<' token
    3 | # define INF (1 < <29)
      |                   ^
a.cc:28:91: note: in expansion of macro 'INF'
   28 | for ( int i =1; i <= N ; i ++) for ( int j =1; j <= N ; j ++) if ( i != j ) d [ i ][ j ]= INF ;
      |                                                                                           ^~~
a.cc:3:19: error: expected primary-expression before '<' token
    3 | # define INF (1 < <29)
      |                   ^
a.cc:40:7: note: in expansion of macro 'INF'
   40 | res = INF ;
      |       ^~~
a.cc:42:10: warning: unknown escape sequence: '\040'
   42 | printf ( " % d \ n " , res );
      |          ^~~~~~~~~~~
Language: C++

#include <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];
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; did you mean 'ffs'?
   42 | dfs (1 , -1 ,0);
      | ^~~
      | ffs
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];
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:
main.c:1:11: fatal error:  cstdio : No such file or directory
    1 | # include < cstdio >
      |           ^~~~~~~~~~
compilation terminated.
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:11: fatal error:  cstdio : No such file or directory
    1 | # include < cstdio >
      |           ^~~~~~~~~~
compilation terminated.
Language: C++

#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

typedef vector<vector<int>> Graph;

void warhsall_floyd(Graph& G) {
    for (int k = 0; k < G.size(); k++) {
        for (int i = 0; i < G.size(); i++) {
            if (G[i][k] == INF) {
                continue;
            }
            for (int j = 0; j < G.size(); j++) {
                if (G[k][j] == INF) {
                    continue;
                }
                G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
            }
        }
    }
}

const int INF = 1e9;
const long long LINF = 1e18;

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

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

    Graph G(N, vector<int>(N, INF));
    for (int  i = 0; i < M; i++) {
        int A, B, C;
        cin >> A >> B >> C;
        --A;
        --B;
        G[A][B] = C;
        G[B][A] = C;
    }

    warhsall_floyd(G);

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

    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'void warhsall_floyd(Graph&)':
a.cc:22:28: error: 'INF' was not declared in this scope
   22 |             if (G[i][k] == INF) {
      |                            ^~~
a.cc:26:32: error: 'INF' was not declared in this scope
   26 |                 if (G[k][j] == INF) {
      |                                ^~~
Language: C++

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>

long long dist[204][204];

int main(){
  int N, M, R;
  scanf("%d", &N);
  scanf("%d", &M);
  scanf("%d", &R);
  std::vector<int > r(R);
  for (int i=0; i<R; i++){
    scanf("%d", &r[i]);
  }
  std::vector<int > A(M), B(M), C(M);
  std::vector<std::pair<int, int> > edge[204];
  for (int i=0; i<204; i++){
    for (int j=0; j<204; j++){
      dist[i][j]=1e18;
    }
    dist[i][i]=0;
  }
  for (int i=0; i<M; i++){
    scanf("%d", &A[i]);
    scanf("%d", &B[i]);
    scanf("%d", &C[i]);
    edge[A[i]].push_back(std::make_pair(B[i], C[i]));
    edge[B[i]].push_back(std::make_pair(A[i], C[i]));
    dist[A[i]][B[i]]=C[i];
    dist[B[i]][A[i]]=C[i];
  }
  for (int k=1; k<=N; k++){
    for (int i=1; i<=N; i++){
      for (int j=1; j<=N; j++){
	dist[i][j]=std::min(dist[i][j], dist[i][k]+dist[k][j]);
      }
    }
  }
  /* for (int i=1; i<=N; i++){
    for (int j=1; j<=N; j++){
      printf("dist[%d][%d]=%lld\n", i, j, dist[i][j]);
    }
    }*/
  
  int array[R];
  std::sort(r.begin(), e.end());
  for (int i=0; i<R; i++){
    array[i]=r[i];
  }
  //printf("==========\n");
  long long ans = 1e18;
  do {
    long long d=0;
    bool ng=false;
    for (int i=0; i<R-1; i++){
      //printf("dist[%d][%d]=%lld\n", array[i], array[i+1], dist[array[i]][array[i+1]]);
      d += dist[array[i]][array[i+1]];
    }
    ans = std::min(ans, d);
  } while (std::next_permutation(array, array+R));
  std::cout << ans << std::endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:24: error: 'e' was not declared in this scope
   58 |   std::sort(r.begin(), e.end());
      |                        ^
Language: C++

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>

long long dist[204][204];

int main(){
  int N, M, R;
  scanf("%d", &N);
  scanf("%d", &M);
  scanf("%d", &R);
  std::vector<int > r(R);
  for (int i=0; i<R; i++){
    scanf("%d", &r[i]);
  }
  std::vector<int > A(M), B(M), C(M);
  std::vector<std::pair<int, int> > edge[204];
  for (int i=0; i<204; i++){
    for (int j=0; j<204; j++){
      dist[i][j]=1e18;
    }
    dist[i][i]=0;
  }
  for (int i=0; i<M; i++){
    scanf("%d", &A[i]);
    scanf("%d", &B[i]);
    scanf("%d", &C[i]);
    edge[A[i]].push_back(std::make_pair(B[i], C[i]));
    edge[B[i]].push_back(std::make_pair(A[i], C[i]));
    dist[A[i]][B[i]]=C[i];
    dist[B[i]][A[i]]=C[i];
  }
  for (int k=1; k<=N; k++){
    for (int i=1; i<=N; i++){
      for (int j=1; j<=N; j++){
	dist[i][j]=std::min(dist[i][j], dist[i][k]+dist[k][j]);
      }
    }
  }
  /* for (int i=1; i<=N; i++){
    for (int j=1; j<=N; j++){
      printf("dist[%d][%d]=%lld\n", i, j, dist[i][j]);
    }
    }*/
  
  int array[R];
  std::sort(r.bein(), e.end());
  for (int i=0; i<R; i++){
    array[i]=r[i];
  }
  //printf("==========\n");
  long long ans = 1e18;
  do {
    long long d=0;
    bool ng=false;
    for (int i=0; i<R-1; i++){
      //printf("dist[%d][%d]=%lld\n", array[i], array[i+1], dist[array[i]][array[i+1]]);
      d += dist[array[i]][array[i+1]];
    }
    ans = std::min(ans, d);
  } while (std::next_permutation(array, array+R));
  std::cout << ans << std::endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:15: error: 'class std::vector<int>' has no member named 'bein'; did you mean 'begin'?
   58 |   std::sort(r.bein(), e.end());
      |               ^~~~
      |               begin
a.cc:58:23: error: 'e' was not declared in this scope
   58 |   std::sort(r.bein(), e.end());
      |                       ^
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:11: fatal error:  cstdio : No such file or directory
    1 | # include < cstdio >
      |           ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1e+9 + 5;
const int MAX = 205;
/* global variables */
vector<vector<ll> > d(MAX, vector<ll>(MAX, INF));
/* function */
void floyd() {
    for (int k = 0; k < MAX; k++) {
        for (int i = 0; i < MAX; i++) {
            if (d[i][k] == INF) continue;
            for (int j = 0; j < MAX; j++) {
                if (d[k][j] == INF) continue;
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}
/* main */
int main(){
    ll N, M, R, a, b, c;
    cin >> N >> M >> R;
    vector<ll> r(R);
    sort(r.begin(), r.end());
    for (int i = 0; i < R; i++) {cin >> r[i];, r[i]--;}
    for (int i = 0; i < M; i++) {
        cin >> a >> b >> c;
        a--, b--;
        d[a][b] = c; d[b][a] = c;
    }

    floyd();

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

    cout << ans << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:46: error: expected primary-expression before ',' token
   29 |     for (int i = 0; i < R; i++) {cin >> r[i];, r[i]--;}
      |                                              ^
Language: C++

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

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
struct edge{
  ll to, cost;
};
ll n,m,r;
const ll INF = 1e18;
const int max_n = 1e4;
ll d[max_n][max_n]={INF};
int main(){
  cin >> n >> m >> r;
  vector<ll> v(r);
  for(int i=0 ; i<r ; i++){
    cin >> v[i];
    v[i]--;
  }
  for(int i=0 ; i<n ; i++){
    d[i][i] = 0;
  }
  for(int i=0 ; i<m ; i++){
    ll x,y,z; cin >> x >> y >> z;
    --x;  --y;
    d[x][y] = d[y][x] = z;
  }
  for(int k=0 ; k<n ; k++){
    for(int i=0 ; i<n ; i++){
      for(int j=0 ; j<n ; j++){
        d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
      }
    }
  }
  ll mid = INF;
  do{
    ll kd = 0;
    for(int i=0 ; i+1<r ; i++){
      kd += d[v[i]][v[i+1]];
    }
    mid = min(mid, kd);
  }while(next_permutation(v.begin(), v.end()));
  cout << mid << endl;
  return 0;
}


Compiler output:
g++: internal compiler error: File size limit exceeded signal terminated program as
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See <file:///usr/share/doc/gcc-14/README.Bugs> for instructions.
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,m,r;
  cin>>n>>m>>R;
  vll r(R);
  rep(i,R){
    cin>>r[i];
  }
  vvll t(n,vll(n,INF));
  rep(i,m){
    ll a,b,c;
    cin>>a>>b>>c;
    a--;
    b--;
    t[a][b]=c;
    t[b][a]=c;
  }
  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        t[i][j]=min(t[i][j],t[i][k]+t[k][j]);
      }
    }
  }
  vll f(R);
  rep(i,R) f[i]=i;
  ll ans=INF;
  do{
    ll cu=0;
    for(int i=0;i<R-1;i++){
      cu+=t[f[i]][f[i+1]];
    }
    ans=min(ans,cu);
  }while(next_permutation(f.begin(), f.end()));
  COUT(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:14: error: 'R' was not declared in this scope
   44 |   cin>>n>>m>>R;
      |              ^
a.cc:45:7: error: conflicting declaration 'vll r'
   45 |   vll r(R);
      |       ^
a.cc:43:10: note: previous declaration as 'long long int r'
   43 |   ll n,m,r;
      |          ^
a.cc:47:11: error: invalid types 'long long int[long long int]' for array subscript
   47 |     cin>>r[i];
      |           ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <utility>
#include <cstdio>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)

#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:28:575: error: expected '}' at end of input
   28 | 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);
      |                                                                                                                                                                                                                      ~                                                                                                                                                                                                                                                                                                                                                                        ^
Language: C++

#include <bits/stdc++.h>

using ll = long long;

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define INF (1 << 29)

using namespace std;

//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);
 

void solve() {
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r(R);
    int dis[N+1][N+1];
    REP(i, R) {
        cin >> r[i];
    }
    REP(i, N){
        REP(j, N){
            dis[i+1][j+1] = INF
        }
    }
    REP(i, M){
        int a, b, c;
        cin >> a >> b >> c;
        dis[a][b] = c;
        dis[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(dis[i][j] > dis[i][k] + dis[k][j]) dis[i][j] = dis[i][k] + dis[k][j];
            }
        }
    }

    sort(r.begin(), r.end());
    ll ans = INF
    do {
        ll subAns = 0ll;
        REP(i, R-1){
            subAns += (ll)dis[r[i]][r[i+1]];
        }
        ans = min(ans, subAns);
    } while(next_permutation(r.begin(), r.end()));
    cout << ans << endl;
}
 
int main() {
    solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:27:9: error: expected ';' before '}' token
   27 |         }
      |         ^
a.cc:47:5: error: expected ',' or ';' before 'do'
   47 |     do {
      |     ^~
Language: C++


using ll = long long;

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

using namespace std;

//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);
 

void solve() {
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r(R);
    int dis[N+1][N+1];
    REP(i, R) {
        cin >> r[i];
    }
    REP(i, N){
        REP(j, N){
            dis[i+1][j+1] = 200000000;
        }
    }
    REP(i, M){
        int a, b, c;
        cin >> a >> b >> c;
        dis[a][b] = c;
        dis[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(dis[i][j] > dis[i][k] + dis[k][j]) dis[i][j] = dis[i][k] + dis[k][j];
            }
        }
    }

    int ans = 20000000;
    do {
        int subAns = 0;
        REP(i, R-1){
            subAns += dis[r[i]][r[i+1]];
        }
        ans = min(ans, subAns);
    } while(next_permutation(r.begin(), r.end()));
    cout << ans << endl;
}
 
int main() {
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:16:5: error: 'cin' was not declared in this scope
   16 |     cin >> N >> M >> R;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | 
a.cc:17:5: error: 'vector' was not declared in this scope
   17 |     vector<int> r(R);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | 
a.cc:17:12: error: expected primary-expression before 'int'
   17 |     vector<int> r(R);
      |            ^~~
a.cc:20:16: error: 'r' was not declared in this scope
   20 |         cin >> r[i];
      |                ^
a.cc:47:27: error: 'r' was not declared in this scope
   47 |             subAns += dis[r[i]][r[i+1]];
      |                           ^
a.cc:49:15: error: 'min' was not declared in this scope
   49 |         ans = min(ans, subAns);
      |               ^~~
a.cc:50:30: error: 'r' was not declared in this scope
   50 |     } while(next_permutation(r.begin(), r.end()));
      |                              ^
a.cc:50:13: error: 'next_permutation' was not declared in this scope
   50 |     } while(next_permutation(r.begin(), r.end()));
      |             ^~~~~~~~~~~~~~~~
a.cc:51:5: error: 'cout' was not declared in this scope
   51 |     cout << ans << endl;
      |     ^~~~
a.cc:51:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:51:20: error: 'endl' was not declared in this scope
   51 |     cout << ans << endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 |
Language: Java


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

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

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

		result = Integer.MAX_VALUE;
		for(int i=0;i<R;i++) {
			int st=cities.remove(0);
			result = Math.min(result,  search(st,cities,0));
			cities.add(st);
		}


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


	public static int search (int now, ArrayList<Integer> toVisit) {
		int opt = Integer.MAX_VALUE;
		if(toVisit.size()==0) return 0;
		for(int i=0;i<toVisit.size();i++) {
			int v=toVisit.remove(0);
			opt = Math.min(opt,search(v,toVisit)+dist[now][v]);
			toVisit.add(v);
		}
		return opt;
	}
}

class edge {
	int cost;

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

Compiler output:
Main.java:47: error: method search in class Main cannot be applied to given types;
			result = Math.min(result,  search(st,cities,0));
			                           ^
  required: int,ArrayList<Integer>
  found:    int,ArrayList<Integer>,int
  reason: actual and formal argument lists differ in length
1 error
Language: C++

#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

int n,m,r;
int d[210][210]; 
int ra[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[ra[las]][ra[i]]); 
      used[i]=false; 
     
    }
}

int main(){

  cin >> n >> m >> r;
  
  for(int i=0;i<r;i++)
    cin >> ra[i];
    
for(int i=0;i<m;i++){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--,b[i]--;
     
  }
  
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i==j){
      dist[i][j] = 0;
      }
      else{
        dist[i][j] = 1000000007;
      }
    }
  }
  
  
  for(int i=0;i<m;i++){
    
      dist[a[i]][b[i]] = min(dist[a[i]][b[i]],c[i]);
    dist[b[i]][a[i]] = min(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]);
      }
    }
  }
 
  res = 1000000007;
  dfs(1,-1,0);
  
  cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:12: error: 'a' was not declared in this scope
   38 |     cin >> a[i] >> b[i] >> c[i];
      |            ^
a.cc:38:20: error: 'b' was not declared in this scope
   38 |     cin >> a[i] >> b[i] >> c[i];
      |                    ^
a.cc:38:28: error: 'c' was not declared in this scope
   38 |     cin >> a[i] >> b[i] >> c[i];
      |                            ^
a.cc:46:7: error: 'dist' was not declared in this scope
   46 |       dist[i][j] = 0;
      |       ^~~~
a.cc:49:9: error: 'dist' was not declared in this scope
   49 |         dist[i][j] = 1000000007;
      |         ^~~~
a.cc:57:7: error: 'dist' was not declared in this scope
   57 |       dist[a[i]][b[i]] = min(dist[a[i]][b[i]],c[i]);
      |       ^~~~
a.cc:57:12: error: 'a' was not declared in this scope
   57 |       dist[a[i]][b[i]] = min(dist[a[i]][b[i]],c[i]);
      |            ^
a.cc:57:18: error: 'b' was not declared in this scope
   57 |       dist[a[i]][b[i]] = min(dist[a[i]][b[i]],c[i]);
      |                  ^
a.cc:57:47: error: 'c' was not declared in this scope
   57 |       dist[a[i]][b[i]] = min(dist[a[i]][b[i]],c[i]);
      |                                               ^
a.cc:66:9: error: 'dist' was not declared in this scope
   66 |         dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      |         ^~~~
Language: Java

package abc073;

import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class ProblemD {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt(), m = scanner.nextInt(), q = scanner.nextInt();
			// 町と町の間の移動最短距離
			int[][] d = new int[n][n];
			IntStream.range(0, n).forEach(i -> {
				Arrays.fill(d[i], Integer.MAX_VALUE >> 1);
				d[i][i] = 0;
			});
			int[] r = new int[q];
			IntStream.range(0, q).forEach(i -> r[i] = scanner.nextInt() - 1);
			IntStream.range(0, m).forEach(i -> {
				int a = scanner.nextInt() - 1;
				int b = scanner.nextInt() - 1;
				int c = scanner.nextInt();
				d[a][b] = d[b][a] = c;
			});
			warshallFloyd(d, n);
			System.out.println(getResult(d, r, -1, new boolean[q], 1));
		}
	}

	/**
	 * 町と町の間の移動最短距離をワーシャル–フロイド法で計算する
	 * 
	 * @param d 町と町の間の移動最短距離の配列
	 * @param n 町の数
	 */
	private static void warshallFloyd(int[][] d, int n) {
		IntStream.range(0, n).forEach(i -> IntStream.range(0, n)
				.forEach(j -> IntStream.range(0, n).forEach(k -> d[i][j] = Math.min(d[i][j], d[i][k] + d[k][j]))));
	}

	/**
	 * 解説通りに実装したメソッド
	 * 
	 * @param d       町と町の最短距離の配列
	 * @param r       訪ねる町の配列
	 * @param prev    直前に訪ねた町（存在しないときは-1）
	 * @param visited 町が訪ねたかどうかの配列
	 * @param depth   訪ねた町の数
	 * @return 訪ねる町をすべて訪ねたときの移動距離
	 */
	private static long getResult(final int[][] d, final int[] r, int prev, boolean[] visited, int depth) {
		if (depth > r.length) {
			return 0L;
		}
		long result = Integer.MAX_VALUE;
		for (int i = 0; i < r.length; i++) {
			if (!visited[i]) {
				visited[i] = true;
				if (-1 == prev) {
					result = Math.min(result, getResult(d, r, i, visited, depth + 1));
				} else {
					result = Math.min(result, getResult(d, r, i, visited, depth + 1) + d[r[prev]][r[i]]);
				}
				visited[i] = false;
			}
		}
		return result;
	}
}


Compiler output:
Main.java:7: error: class ProblemD is public, should be declared in a file named ProblemD.java
public class ProblemD {
       ^
1 error