Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;
typedef complex<double> P;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1.0e-9

int d[111][111];
int c[111];
vector<vector<PII> > g;

//AOJ2021
int main(){
	int n,m,l,k,a,h;
	while(cin>>n>>m>>l>>k>>a>>h, n){
		memset(d, -1, sizeof(d));
		memset(c, 0, sizeof(c));
		g=vector<vector<PII> >(n);
		REP(i,l){
			int tmp;
			cin>>tmp;
			c[tmp]=1;
		}
		REP(i,k){
			int x,y,t;
			scanf("%d%d%d", &x, &y, &t);
			g[x].PB(MP(y, t));
			g[y].PB(MP(x, t));
		}
		priority_queue<TIII, vector<TIII>, greater<TIII> > q;
		q.push(MT(0, a, m));
		int flag = 0;
		while(!q.empty()){
			TIII tmp = q.top();
			q.pop();
			int t=tmp.T1;
			int x=tmp.T2;
			int z=tmp.T3;
			if(d[x][z]!=-1)continue;
			d[x][z]=t;
			if(x==h){
				cout<<t<<endl;
				flag = 1;
				break;
			}
			REP(i,g[x].size()){
				if(z>=g[x][i].second){
					int nz=z-g[x][i].second

Compiler output:
a.cc: In function 'int main()':
a.cc:107:64: error: expected ',' or ';' at end of input
  107 |                                         int nz=z-g[x][i].second
      |                                                                ^
a.cc:107:64: error: expected '}' at end of input
a.cc:106:54: note: to match this '{'
  106 |                                 if(z>=g[x][i].second){
      |                                                      ^
a.cc:107:64: error: expected '}' at end of input
  107 |                                         int nz=z-g[x][i].second
      |                                                                ^
a.cc:105:43: note: to match this '{'
  105 |                         REP(i,g[x].size()){
      |                                           ^
a.cc:107:64: error: expected '}' at end of input
  107 |                                         int nz=z-g[x][i].second
      |                                                                ^
a.cc:92:34: note: to match this '{'
   92 |                 while(!q.empty()){
      |                                  ^
a.cc:107:64: error: expected '}' at end of input
  107 |                                         int nz=z-g[x][i].second
      |                                                                ^
a.cc:74:40: note: to match this '{'
   74 |         while(cin>>n>>m>>l>>k>>a>>h, n){
      |                                        ^
a.cc:107:64: error: expected '}' at end of input
  107 |                                         int nz=z-g[x][i].second
      |                                                                ^
a.cc:72:11: note: to match this '{'
   72 | int main(){
      |           ^