func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long maxn = 300000;   const long long inf = 1LL << 60;   struct edge {     long long from, to, dist;     edge(long long u, long long v, long long d) : from(u), to(v), dist(d) {}   };   struct HeapNode {     long long d;     long long u;     HeapNode(long long a, long long b) : d(a), u(b) {}     bool operator<(const HeapNode &rhs) const { return d > rhs.d; }   };   struct Dijkstra {     int n, m;     vector<edge> edges;     vector<int> G[maxn];     bool done[maxn];     long long d[maxn];     int p[maxn];     void init(int n) {       this->n = n;       for (int i = 0; i < n; ++i) G[i].clear();       edges.clear();     }     void add_edge(int from, int to, long long dist) {       edges.push_back(edge(from, to, dist));       m = edges.size();       G[from].push_back(m - 1);     }     void dijkstra(int s) {       priority_queue<HeapNode> Q;       for (int i = 0; i < n; ++i) d[i] = inf;       d[s] = 0;       Q.push(HeapNode(0, s));       memset(done, 0, sizeof(done));       while (!Q.empty()) {         HeapNode x = Q.top();         Q.pop();         int u = x.u;         if (done[u]) continue;         done[u] = true;         for (unsigned i = 0; i < G[u].size(); ++i) {           edge &e = edges[G[u][i]];           if (d[e.to] > d[u] + e.dist) {             d[e.to] = d[u] + e.dist;             p[e.to] = G[u][i];             Q.push(HeapNode(d[e.to], e.to));           }         }       }     }   } graph;   int main() {     int n, m;     scanf( %d %d , &n, &m);     graph.init(n + 10);     const int s = n + 5;     for (int i = 0; i < m; ++i) {       long long x, y, w;       scanf( %lld %lld %lld , &x, &y, &w);       graph.add_edge(x, y, w * 2);       graph.add_edge(y, x, w * 2);     }     for (int i = 1; i <= n; ++i) {       long long a;       scanf( %lld , &a);       graph.add_edge(s, i, a);     }     graph.dijkstra(s);     for (int i = 1; i <= n; ++i) printf( %lld  , graph.d[i]);     printf(  n );     return 0;   }   