Language: C++

struct Edge{
    int dst;
    int weight;
    Edge(int dst, int weight): dst(dst), weight(weight) {}
};

struct TmpDist{
    int vertex;
    int dist;
    TmpDist(int vertex, int dist): vertex(vertex), dist(dist) {}
    bool operator< (const TmpDist& right)const{
        return dist > right.dist;
    }
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
const int INFINT = INT_MAX/2;

vector<int> dijkstra(Graph &G, int r){
    int V = G.size();
    vector<int> dist(V, INFINT);
    priority_queue<TmpDist> pq;
    vector<bool> check(V, false);
    TmpDist init(r, 0);
    pq.push(init);
    while(!pq.empty()){
        TmpDist td = pq.top();pq.pop();
        int now = td.vertex;
        if(!check[now]){
            check[now] = true;
            dist[now] = td.dist;
            for (int i=0;i<G[now].size();i++){
                if(dist[G[now][i].dst] > td.dist + G[now][i].weight){
                    TmpDist tdCandidate(G[now][i].dst, td.dist + G[now][i].weight);
                    pq.push(tdCandidate);
                }
            }
        }
    }
    return dist;
}

int main(){
    int V, E, r;
    cin >> V >> E >> r;
    Graph G(V);
    int s, t, w;
    for(int i=0;i<E;i++){
        cin >> s >> t >> w;
        Edge e(t, w);
        G[s].push_back(e);
    }

    vector<int> dist = dijkstra(G, r);
    for (int i=0;i<V;i++){
        if(dist[i] == INFINT) cout << "INF" << endl;
        else cout << dist[i] << endl;
    }
    return 0;
}


Compiler output:
a.cc:16:9: error: 'vector' does not name a type
   16 | typedef vector<Edge> Edges;
      |         ^~~~~~
a.cc:17:9: error: 'vector' does not name a type
   17 | typedef vector<Edges> Graph;
      |         ^~~~~~
a.cc:18:20: error: 'INT_MAX' was not declared in this scope
   18 | const int INFINT = INT_MAX/2;
      |                    ^~~~~~~
a.cc:1:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
  +++ |+#include <climits>
    1 | struct Edge{
a.cc:20:1: error: 'vector' does not name a type
   20 | vector<int> dijkstra(Graph &G, int r){
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:46:5: error: 'cin' was not declared in this scope
   46 |     cin >> V >> E >> r;
      |     ^~~
a.cc:47:5: error: 'Graph' was not declared in this scope
   47 |     Graph G(V);
      |     ^~~~~
a.cc:52:9: error: 'G' was not declared in this scope
   52 |         G[s].push_back(e);
      |         ^
a.cc:55:5: error: 'vector' was not declared in this scope
   55 |     vector<int> dist = dijkstra(G, r);
      |     ^~~~~~
a.cc:55:12: error: expected primary-expression before 'int'
   55 |     vector<int> dist = dijkstra(G, r);
      |            ^~~
a.cc:57:12: error: 'dist' was not declared in this scope
   57 |         if(dist[i] == INFINT) cout << "INF" << endl;
      |            ^~~~
a.cc:57:31: error: 'cout' was not declared in this scope
   57 |         if(dist[i] == INFINT) cout << "INF" << endl;
      |                               ^~~~
a.cc:57:48: error: 'endl' was not declared in this scope
   57 |         if(dist[i] == INFINT) cout << "INF" << endl;
      |                                                ^~~~
a.cc:58:14: error: 'cout' was not declared in this scope
   58 |         else cout << dist[i] << endl;
      |              ^~~~
a.cc:58:33: error: 'endl' was not declared in this scope
   58 |         else cout << dist[i] << endl;
      |                                 ^~~~