Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
typedef long long ll;
typedef #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
typedef long long ll;
typedef unsigned int uint;
using namespace std;
const int INF = 1000000007;

struct edge {
    int to;
    int cost;
};

typedef pair <int, int> P;
int V, E, R;
int r[10];
vector <edge> G[100000];
int d[100000];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P>> q;
    fill(d, d+V, INF);
    d[s] = 0;
    q.push(P(0, s));

    while (!q.empty()) {
        P p = q.top();
        q.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                q.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cin >> V >> E >> R;
    for (int i = 0; i < R; i++) {
        cin >> r[i];
        r[i]--;
    }
    for (int i = 0; i < E; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        edge e1 = {b, c};
        edge e2 = {a, c};
        G[a].push_back(e1);
        G[b].push_back(e2);
    }

    int r2[R][R];
    for (int i = 0; i < R; i++) {
        for (int j = 0; j < R; j++) {
            if (i == j) continue;
            dijkstra(r[i]);
            r2[r[i]][r[j]] = r2[r[i]][r[j]] = d[r[j]];
        }
    }

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

    cout << ans;
    return 0;
} int uint;
using namespace std;
const int INF = 1000000007;

struct edge {
    int to;
    int cost;
};

typedef pair <int, int> P;
int V, E, R;
int r[10];
vector <edge> G[100000];
int d[100000];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P>> q;
    fill(d, d+V, INF);
    d[s] = 0;
    q.push(P(0, s));

    while (!q.empty()) {
        P p = q.top();
        q.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                q.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cin >> V >> E >> R;
    for (int i = 0; i < R; i++) {
        cin >> r[i];
        r[i]--;
    }
    for (int i = 0; i < E; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        edge e1 = {b, c};
        edge e2 = {a, c};
        G[a].push_back(e1);
        G[b].push_back(e2);
    }

    int ans = INF;
    do {
        int tmp = 0;
        for (int i = 0; i < R - 1; i++) {
            dijkstra(r[i]);
            tmp += d[r[i+1]];
            //cout << "r[i] = " << r[i] << " r[i+1] = " << r[i+1] << " d = " << d[r[i+1]] << endl;
        }
        ans = min(ans, tmp);
    } while (next_permutation(r, r+R));

    cout << ans;
    return 0;
}

Compiler output:
a.cc:8:9: error: stray '#' in program
    8 | typedef #include <iostream>
      |         ^
a.cc:8:10: error: 'include' does not name a type
    8 | typedef #include <iostream>
      |          ^~~~~~~
a.cc:89:7: error: 'int uint' redeclared as different kind of entity
   89 | } int uint;
      |       ^~~~
a.cc:15:22: note: previous declaration 'typedef unsigned int uint'
   15 | typedef unsigned int uint;
      |                      ^~~~
a.cc:91:11: error: redefinition of 'const int INF'
   91 | const int INF = 1000000007;
      |           ^~~
a.cc:17:11: note: 'const int INF' previously defined here
   17 | const int INF = 1000000007;
      |           ^~~
a.cc:93:8: error: redefinition of 'struct edge'
   93 | struct edge {
      |        ^~~~
a.cc:19:8: note: previous definition of 'struct edge'
   19 | struct edge {
      |        ^~~~
a.cc:99:5: error: redefinition of 'int V'
   99 | int V, E, R;
      |     ^
a.cc:25:5: note: 'int V' previously declared here
   25 | int V, E, R;
      |     ^
a.cc:99:8: error: redefinition of 'int E'
   99 | int V, E, R;
      |        ^
a.cc:25:8: note: 'int E' previously declared here
   25 | int V, E, R;
      |        ^
a.cc:99:11: error: redefinition of 'int R'
   99 | int V, E, R;
      |           ^
a.cc:25:11: note: 'int R' previously declared here
   25 | int V, E, R;
      |           ^
a.cc:100:5: error: redefinition of 'int r [10]'
  100 | int r[10];
      |     ^
a.cc:26:5: note: 'int r [10]' previously declared here
   26 | int r[10];
      |     ^
a.cc:101:15: error: redefinition of 'std::vector<edge> G [100000]'
  101 | vector <edge> G[100000];
      |               ^
a.cc:27:15: note: 'std::vector<edge> G [100000]' previously declared here
   27 | vector <edge> G[100000];
      |               ^
a.cc:102:5: error: redefinition of 'int d [100000]'
  102 | int d[100000];
      |     ^
a.cc:28:5: note: 'int d [100000]' previously declared here
   28 | int d[100000];
      |     ^
a.cc:104:6: error: redefinition of 'void dijkstra(int)'
  104 | void dijkstra(int s) {
      |      ^~~~~~~~
a.cc:30:6: note: 'void dijkstra(int)' previously defined here
   30 | void dijkstra(int s) {
      |      ^~~~~~~~
a.cc:125:5: error: redefinition of 'int main()'
  125 | int main() {
      |     ^~~~
a.cc:51:5: note: 'int main()' previously defined here
   51 | int main() {
      |     ^~~~