Language: C++

/*
?????????: Shortest Path - Single Source Shortest Path
URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A&lang=jp
?????°
19:42 Dijkstra????????????????????§?????£????????????
19:50 ??????????§???????????????????
19:59 ??????????????????????§??????????????????¢??¨??????????????¢?????§???????????????
//?????\
18:57 ???????????????????????§?????????INF??????????????? 
*/

#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <set>
using namespace std;
#define INF (numeric_limits<int>::max())
typedef pair<int, int> crumb;
set<int> distance_unsure;

int distance_[100000];
//cost[from][to]
int cost[100000][100000];

int cost_t(int i, int j) // ??¨??¨???INF??§?????????????????¨???????????????????????§??????????????????
{
	if(cost[i][j] >= 16) {
		return cost[i][j] - 16;
	} else {
		return INF;
	}
}

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

	

	for(int i=0;i<e;i++) {
		int s,t,d;
		cin >> s >> t >> d;
		cost[s][t] = d + 16; // ??¨??¨???INF??§?????????????????¨???????????????????????§??????????????????
	}



	for(int i=0; i<v;i++) {
		distance_unsure.insert(i);
		distance_[i] = INF;
	}
	priority_queue<crumb, vector<crumb>, greater<crumb> >Q;

	distance_[r] = 0;
	Q.push(crumb(0,r));
	distance_unsure.erase(r);

	while(!(distance_unsure.empty())){
		crumb u = Q.top(); Q.pop();

		distance_unsure.erase(u.second);
		for(int i=0; i<v; i++) {
			if(cost_t(u.second,i) != INF) {
				distance_[i] = min(distance_[i], u.first + cost_t(u.second,i));
				Q.push(crumb(distance_[i],i));
			}
		}
	}

	for(int i=0;i<v;i++){
		cout << distance_[i] << endl;
	}


	
}

Compiler output:
a.cc: In function 'int cost_t(int, int)':
a.cc:18:14: error: 'numeric_limits' was not declared in this scope
   18 | #define INF (numeric_limits<int>::max())
      |              ^~~~~~~~~~~~~~
a.cc:31:24: note: in expansion of macro 'INF'
   31 |                 return INF;
      |                        ^~~
a.cc:18:29: error: expected primary-expression before 'int'
   18 | #define INF (numeric_limits<int>::max())
      |                             ^~~
a.cc:31:24: note: in expansion of macro 'INF'
   31 |                 return INF;
      |                        ^~~
a.cc:18:29: error: expected ')' before 'int'
   18 | #define INF (numeric_limits<int>::max())
      |             ~               ^~~
a.cc:31:24: note: in expansion of macro 'INF'
   31 |                 return INF;
      |                        ^~~
a.cc: In function 'int main()':
a.cc:18:14: error: 'numeric_limits' was not declared in this scope
   18 | #define INF (numeric_limits<int>::max())
      |              ^~~~~~~~~~~~~~
a.cc:52:32: note: in expansion of macro 'INF'
   52 |                 distance_[i] = INF;
      |                                ^~~
a.cc:18:29: error: expected primary-expression before 'int'
   18 | #define INF (numeric_limits<int>::max())
      |                             ^~~
a.cc:52:32: note: in expansion of macro 'INF'
   52 |                 distance_[i] = INF;
      |                                ^~~
a.cc:18:29: error: expected ')' before 'int'
   18 | #define INF (numeric_limits<int>::max())
      |             ~               ^~~
a.cc:52:32: note: in expansion of macro 'INF'
   52 |                 distance_[i] = INF;
      |                                ^~~
a.cc:18:14: error: 'numeric_limits' was not declared in this scope
   18 | #define INF (numeric_limits<int>::max())
      |              ^~~~~~~~~~~~~~
a.cc:65:50: note: in expansion of macro 'INF'
   65 |                         if(cost_t(u.second,i) != INF) {
      |                                                  ^~~
a.cc:18:29: error: expected primary-expression before 'int'
   18 | #define INF (numeric_limits<int>::max())
      |                             ^~~
a.cc:65:50: note: in expansion of macro 'INF'
   65 |                         if(cost_t(u.second,i) != INF) {
      |                                                  ^~~
a.cc:18:29: error: expected ')' before 'int'
   18 | #define INF (numeric_limits<int>::max())
      |             ~               ^~~
a.cc:65:50: note: in expansion of macro 'INF'
   65 |                         if(cost_t(u.second,i) != INF) {
      |                                                  ^~~
a.cc:68:26: error: expected ')' before '}' token
   68 |                         }
      |                          ^
      |                          )
   69 |                 }
      |                 ~         
a.cc:65:27: note: to match this '('
   65 |                         if(cost_t(u.second,i) != INF) {
      |                           ^
a.cc:69:17: error: expected primary-expression before '}' token
   69 |                 }
      |                 ^