Language: C++

#include <iostream>
#include <vector>
using namespace std;

class Node{
public:
	vector<int> to;
	vector<int> ecost;
	int cost;
	bool done;
};

void find(Node *node, int nodes, int start);

int main(){
	int v, e r;
	cin >> v >> e >> r;

	int s[e], t[e], d[e];
	int i;
	for(i=0 ; i<e; i++){
		cin >> s[i] >> t[i] >> d[i];
	}
	
	Node node[v];
	for(i=0; i<e; i++){
		node[s[i]].to.push_back(t[i]);
		node[s[i]].ecost.push_back(d[i]);
	}

	find(node, v, r);
	for(i=0; i<v; i++){
		if(node[i].cost==-1){ cout << "INF" << endl;}
		else{ cout << node[i].cost << endl; }
	}

	return 0;
}

void find(Node *node, int nodes, int start){
	int i, j;
	for(i=0; i<nodes; i++){
		node[i].done=0;
		node[i].cost=-1;
	}
	node[start].cost=0;
	node[start].done=1;

	for(i=0; i<node[start].to.size(); i++){
		node[node[start].to[i]].cost = node[start].ecost[i];
	}

	bool dflag;
	while(1) {
		j=1;
	    for(i=0; i<nodes; i++){ j *= node[i].done; }
	    if(j) break;

		for(i=0; i<nodes; i++){
			dflag=1;
			if(node[i].done) continue;
			if(node[i].cost==-1) continue;

			for(j=0; j<node[i].to.size(); i++){
				if(node[j].cost == -1){
					node[node[i]].to[j]].cost = node[i].cost+node[i].ecost[j];
					dflag=0;
					continue;
				}
				if(node[i].cost+node[i].ecost[j] < node[node[i].to[j]].cost){
					node[node[i]].to[j]].cost = node[i].cost+node[i].ecost[j];
					dflag=0;
					continue;
				}
			}
			if(dflag) node[i].done=1;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: expected initializer before 'r'
   16 |         int v, e r;
      |                  ^
a.cc:17:21: error: 'e' was not declared in this scope
   17 |         cin >> v >> e >> r;
      |                     ^
a.cc:17:26: error: 'r' was not declared in this scope
   17 |         cin >> v >> e >> r;
      |                          ^
a.cc:22:24: error: 's' was not declared in this scope
   22 |                 cin >> s[i] >> t[i] >> d[i];
      |                        ^
a.cc:22:32: error: 't' was not declared in this scope
   22 |                 cin >> s[i] >> t[i] >> d[i];
      |                                ^
a.cc:22:40: error: 'd' was not declared in this scope
   22 |                 cin >> s[i] >> t[i] >> d[i];
      |                                        ^
a.cc:27:22: error: 's' was not declared in this scope
   27 |                 node[s[i]].to.push_back(t[i]);
      |                      ^
a.cc:27:41: error: 't' was not declared in this scope
   27 |                 node[s[i]].to.push_back(t[i]);
      |                                         ^
a.cc:28:44: error: 'd' was not declared in this scope
   28 |                 node[s[i]].ecost.push_back(d[i]);
      |                                            ^
a.cc: In function 'void find(Node*, int, int)':
a.cc:66:45: error: no match for 'operator[]' (operand types are 'Node*' and 'Node')
   66 |                                         node[node[i]].to[j]].cost = node[i].cost+node[i].ecost[j];
      |                                             ^
a.cc:71:45: error: no match for 'operator[]' (operand types are 'Node*' and 'Node')
   71 |                                         node[node[i]].to[j]].cost = node[i].cost+node[i].ecost[j];
      |                                             ^