Language: C++

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

using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> T;

vector<P> edge[105];
int n, m, l, k, a, h;
bool recover[105];
dist[105][105];

void dijkstra(int s){
	for(int i = 0;i < 105;i++)
		for(int j = 0;j < 105;j++)
			dist[i][j] = INF;
	dist[s][m] = 0;
	priority_queue<T, vector<T>, greater<T> > pq;
	pq.push(T(0, P(s, m)));
	while(!pq.empty()){
		T tmp = pq.top();pq.pop();
		int d = tmp.first, from = tmp.second.first, blood = tmp.second.second;
		if(dist[from][blood] < d)continue;
		for(int i = 0;i < edge[from].size();i++){
			int to = edge[from][i].first, r = edge[from][i].second;
			if(r > blood)continue;
			if(dist[to][blood - r] <= d + r)conitnue;
			dist[to][blood - r] = d + r;
			pq.push(T(dist[to][blood - r], P(to, blood - r)));
		}
		if(blood < m && recover[from]){
			if(dist[from][blood + 1] <= d + 1)continue;
			dist[from][blood + 1] = d + 1;
			pq.push(T(dist[from][blood + 1], P(from, blood + 1)));
		}
	}
}

int main(){
	while(cin >> n >> m >> l >> k >> a >> h, n){
		fill(recover, recover + 105, false);
		for(int i = 0;i < 105;i++)edge[i].clear();
		for(int i = 0;i < l;i++){
			cin >>t;
			recover[t] = true;
		}
		for(int i = 0;i < k;i++){
			cin >> x >> y >> t;
			edge[x].push_back(P(y, t));
			edge[y].push_back(P(x, t));
		}
		dijkstra(a);
		int res = INF;
		for(int i = 0;i < 105;i++){
			res = min(res, dist[h][i]);
		}
		if(res == INF)cout <<"help!" << endl;
		cout << res << endl;	
	}
	return 0;
}

Compiler output:
a.cc:15:1: error: 'dist' does not name a type
   15 | dist[105][105];
      | ^~~~
a.cc: In function 'void dijkstra(int)':
a.cc:20:25: error: 'dist' was not declared in this scope
   20 |                         dist[i][j] = INF;
      |                         ^~~~
a.cc:20:38: error: 'INF' was not declared in this scope
   20 |                         dist[i][j] = INF;
      |                                      ^~~
a.cc:21:9: error: 'dist' was not declared in this scope
   21 |         dist[s][m] = 0;
      |         ^~~~
a.cc:31:57: error: 'conitnue' was not declared in this scope
   31 |                         if(dist[to][blood - r] <= d + r)conitnue;
      |                                                         ^~~~~~~~
a.cc: In function 'int main()':
a.cc:48:31: error: 't' was not declared in this scope
   48 |                         cin >>t;
      |                               ^
a.cc:52:32: error: 'x' was not declared in this scope
   52 |                         cin >> x >> y >> t;
      |                                ^
a.cc:52:37: error: 'y' was not declared in this scope
   52 |                         cin >> x >> y >> t;
      |                                     ^
a.cc:52:42: error: 't' was not declared in this scope
   52 |                         cin >> x >> y >> t;
      |                                          ^
a.cc:57:27: error: 'INF' was not declared in this scope
   57 |                 int res = INF;
      |                           ^~~
a.cc:59:40: error: 'dist' was not declared in this scope
   59 |                         res = min(res, dist[h][i]);
      |                                        ^~~~