Language: C++

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

using Vertex = std::uint32_t;
using Weight = std::uint32_t64;
using Graph = std::vector<std::vector<std::pair<Vertex, Weight>>>;

const auto Inf = std::numeric_limits<Weight>::max();
std::vector<Weight> Dijkstra(const Vertex s, const Graph& g)
{
    auto n = g.size();
    auto dist = std::vector<Weight>(n, Inf);
    dist[s] = 0;

    auto comp = [](auto x, auto y) { return x.second > y.second; };
    auto q =
        std::priority_queue<std::pair<Vertex, Weight>, std::vector<std::pair<Vertex, Weight>>, decltype(comp)>(comp);

    auto visited = std::vector<bool>(n, false);
    q.emplace(s, dist[s]);
    while (!q.empty())
    {
        auto v = q.top().first;
        q.pop();

        visited[v] = true;

        for (const auto& node : g[v])
        {
            auto v_n = node.first;
            auto d_n = node.second;
            if (!visited[v_n])
            {
                if (dist[v_n] > dist[v] + d_n)
                {
                    dist[v_n] = dist[v] + d_n;
                    q.emplace(v_n, dist[v_n]);
                }
            }
        }
    }
    return dist;
}
int main()
{
    auto n = Vertex();
    auto m = Vertex();
    auto r = Weight();

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

    auto c = std::vector<Vertex>(r);
    for (Vertex i = 0; i < r; ++i)
    {
        std::cin >> c[i];
        --c[i];
    }

    auto g = Graph(n);
    for (Vertex i = 0; i < m; ++i)
    {
        Vertex a;
        Vertex b;
        Vertex w;

        std::cin >> a >> b >> w;

        g[a - 1].emplace_back(b - 1, w);
        g[b - 1].emplace_back(a - 1, w);
    }

    auto dist_list = std::vector<std::vector<Weight>>();
    dist_list.reserve(r);
    for (Vertex s = 0; s < n; ++s)
    {
        dist_list.emplace_back(Dijkstra(s, g));
    }

    auto result = Weight(Inf);
    do
    {
        auto distance = Weight(0);
        for (Vertex i = 0; i < r - 1; ++i) distance += dist_list[c[i]][c[i + 1]];

        if (distance < result) result = distance;

    } while (std::next_permutation(c.begin(), c.end()));

    std::cout << result << std::endl;

    return 0;
}

Compiler output:
a.cc:6:21: error: 'uint32_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
    6 | using Vertex = std::uint32_t;
      |                     ^~~~~~~~
      |                     wint_t
a.cc:7:21: error: 'uint32_t64' in namespace 'std' does not name a type
    7 | using Weight = std::uint32_t64;
      |                     ^~~~~~~~~~
a.cc:8:49: error: 'Vertex' was not declared in this scope
    8 | using Graph = std::vector<std::vector<std::pair<Vertex, Weight>>>;
      |                                                 ^~~~~~
a.cc:8:57: error: 'Weight' was not declared in this scope
    8 | using Graph = std::vector<std::vector<std::pair<Vertex, Weight>>>;
      |                                                         ^~~~~~
a.cc:8:57: error: template argument 1 is invalid
a.cc:8:57: error: template argument 2 is invalid
a.cc:8:63: error: template argument 1 is invalid
    8 | using Graph = std::vector<std::vector<std::pair<Vertex, Weight>>>;
      |                                                               ^~
a.cc:8:63: error: template argument 2 is invalid
a.cc:8:65: error: template argument 1 is invalid
    8 | using Graph = std::vector<std::vector<std::pair<Vertex, Weight>>>;
      |                                                                 ^
a.cc:8:65: error: template argument 2 is invalid
a.cc:10:23: error: 'numeric_limits' is not a member of 'std'
   10 | const auto Inf = std::numeric_limits<Weight>::max();
      |                       ^~~~~~~~~~~~~~
a.cc:10:38: error: 'Weight' was not declared in this scope
   10 | const auto Inf = std::numeric_limits<Weight>::max();
      |                                      ^~~~~~
a.cc:10:47: error: '::max' has not been declared; did you mean 'std::max'?
   10 | const auto Inf = std::numeric_limits<Weight>::max();
      |                                               ^~~
      |                                               std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:11:13: error: 'Weight' was not declared in this scope
   11 | std::vector<Weight> Dijkstra(const Vertex s, const Graph& g)
      |             ^~~~~~
a.cc:11:19: error: template argument 1 is invalid
   11 | std::vector<Weight> Dijkstra(const Vertex s, const Graph& g)
      |                   ^
a.cc:11:19: error: template argument 2 is invalid
a.cc:11:36: error: 'Vertex' does not name a type
   11 | std::vector<Weight> Dijkstra(const Vertex s, const Graph& g)
      |                                    ^~~~~~
a.cc:11:52: error: 'Graph' does not name a type
   11 | std::vector<Weight> Dijkstra(const Vertex s, const Graph& g)
      |                                                    ^~~~~
a.cc: In function 'int Dijkstra(int, const int&)':
a.cc:13:16: error: request for member 'size' in 'g', which is of non-class type 'const int'
   13 |     auto n = g.size();
      |                ^~~~
a.cc:14:29: error: 'Weight' was not declared in this scope
   14 |     auto dist = std::vector<Weight>(n, Inf);
      |                             ^~~~~~
a.cc:14:35: error: template argument 1 is invalid
   14 |     auto dist = std::vector<Weight>(n, Inf);
      |                                   ^
a.cc:14:35: error: template argument 2 is invalid
a.cc:19:39: error: 'Vertex' was not declared in this scope
   19 |         std::priority_queue<std::pair<Vertex, Weight>, std::vector<std::pair<Vertex, Weight>>, decltype(comp)>(comp);
      |                                       ^~~~~~
a.cc:19:53: error: template argument 1 is invalid
   19 |         std::priority_queue<std::pair<Vertex, Weight>, std::vector<std::pair<Vertex, Weight>>, decltype(comp)>(comp);
      |                                                     ^
a.cc:19:92: error: template argument 1 is invalid
   19 |         std::priority_queue<std::pair<Vertex, Weight>, std::vector<std::pair<Vertex, Weight>>, decltype(comp)>(comp);
      |                                                                                            ^~
a.cc:19:92: error: template argument 2 is invalid
a.cc:19:110: error: template argument 1 is invalid
   19 |         std::priority_queue<std::pair<Vertex, Weight>, std::vector<std::pair<Vertex, Weight>>, decltype(comp)>(comp);
      |                                                                                                              ^
a.cc:19:110: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:48:14: error: 'Vertex' was not declared in this scope
   48 |     auto n = Vertex();
      |              ^~~~~~
a.cc:50:14: error: 'Weight' was not declared in this scope
   50 |     auto r = Weight();
      |              ^~~~~~
a.cc:54:32: error: template argument 2 is invalid
   54 |     auto c = std::vector<Vertex>(r);
      |                                ^
a.cc:55:16: error: expected ';' before 'i'
   55 |     for (Vertex i = 0; i < r; ++i)
      |                ^~
      |                ;
a.cc:55:24: error: 'i' was not declared in this scope
   55 |     for (Vertex i = 0; i < r; ++i)
      |                        ^
a.cc:61:14: error: 'Graph' was not declared in this scope; did you mean 'isgraph'?
   61 |     auto g = Graph(n);
      |              ^~~~~
      |              isgraph
a.cc:62:16: error: expected ';' before 'i'
   62 |     for (Vertex i = 0; i < m; ++i)
      |                ^~
      |                ;
a.cc:62:24: error: 'i' was not declared in this scope
   62 |     for (Vertex i = 0; i < m; ++i)
      |                        ^
a.cc:64:15: error: expected ';' before 'a'
   64 |         Vertex a;
      |               ^~
      |               ;
a.cc:65:15: error: expected ';' before 'b'
   65 |         Vertex b;
      |               ^~
      |               ;
a.cc:66:15: error: expected ';' before 'w'
   66 |         Vertex w;
      |               ^~
      |               ;
a.cc:68:21: error: 'a' was not declared in this scope
   68 |         std::cin >> a >> b >> w;
      |                     ^
a.cc:68:26: error: 'b' was not declared in this scope
   68 |         std::cin >> a >> b >> w;
      |                          ^
a.cc:68:31: error: 'w' was not declared in this scope
   68 |         std::cin >> a >> b >> w;
      |                               ^
a.cc:74:46: error: template argument 2 is invalid
   74 |     auto dist_list = std::vector<std::vector<Weight>>();
      |                                              ^~~~~~
a.cc:74:52: error: template argument 1 is invalid
   74 |     auto dist_list = std::vector<std::vector<Weight>>();
      |                                                    ^~
a.cc:74:52: error: template argument 2 is invalid
a.cc:76:16: error: expected ';' before 's'
   76 |     for (Vertex s = 0; s < n; ++s)
      |                ^~
      |                ;
a.cc:76:24: error: 's' was not declared in this scope
   76 |     for (Vertex s = 0; s < n; ++s)
      |                        ^
a.cc:85:20: error: expected ';' before 'i'
   85 |         for (Vertex i = 0; i < r - 1; ++i) distance += dist_list[c[i]][c[i + 1]];
      |                    ^~
      |                    ;
a.cc:85:28: error: 'i' was not declared in this scope
   85 |         for (Vertex i = 0; i < r - 1; ++i) distance += dist_list[c[i]][c[i + 1]];
      |                            ^