Language: C++

#include<algorithm>
#include<queue>
#include<climits>
#include<map>
#include<set>

#define pb push_back
#define all(a) (a).begin(),(a).end()
#define f first
#define s second

#define MAX_V 6000
#define INF (1<<29)

using namespace std;

struct edge{
  int to,cost;
  edge(int to,int cost):to(to),cost(cost){};
};

struct State{
  int d,c,id;
  State(int d,int c,int id):d(d),c(c),id(id){};
  bool operator < (const State &p)const{
    return d>p.d;
  };
};

vector<edge>G[MAX_V];
set<int>st;
int d[MAX_V][2001];

int dijkstra(int s,int g,int cap){

  priority_queue<State>que;
  que.push(State(0,cap*10,s));
  fill(d[0],d[MAX_V],INF);
  d[s][cap*10]=0;

  while(!que.empty()){
    State now=que.top();
    que.pop();

    if(now.d>d[now.id][now.c])continue;
    if(now.id==g)return now.d;
    if(st.count(now.id))now.c=cap*10;

    d[now.id][now.c]=now.d;

    for(int i=0;i<G[now.id].size();i++){
      int c=G[now.id][i].cost;
      if(now.c-c>=0)
        que.push(State(now.d+c,now.c-c,G[now.id][i].to));
    }
  }
  return -1;
}

map<string,int>id;
vector<string>v,from,to;
vector<int>cost;
int main(void){

  int n,m,c;
  while(cin >> n >> m >> c,n|m|c){

    string s,dst,f,t;
    v.clear();
    from.clear();
    to.clear();
    cost.clear();
    int in;

    cin >> s >> dst;
    v.pb(s),v.pb(dst);

    for(int i=0;i<n;i++){
      cin >> f >> t >> in;
      from.pb(f),to.pb(t),cost.pb(in);
      v.pb(f),v.pb(t);
    }
    sort(all(v));
    v.erase(unique(all(v)),v.end());

    map<string,int>id;
    for(int i=0;i<v.size();i++)id[v[i]]=i;
    for(int i=0;i<v.size();i++)G[i].clear();
    for(int i=0;i<n;i++){
      G[id[from[i]]].pb(edge(id[to[i]],cost[i]));
      G[id[to[i]]].pb(edge(id[from[i]],cost[i]));
    }

    string a;
    st.clear();
    for(int i=0;i<m;i++){
      cin >> a;
      if(id.count(a))st.insert(id[a]);
    }

    cout << dijkstra(id[s],id[dst],c) << endl;
  }

  return 0;
}

Compiler output:
a.cc:60:5: error: 'string' was not declared in this scope
   60 | map<string,int>id;
      |     ^~~~~~
a.cc:6:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    5 | #include<set>
  +++ |+#include <string>
    6 | 
a.cc:60:15: error: template argument 1 is invalid
   60 | map<string,int>id;
      |               ^
a.cc:60:15: error: template argument 3 is invalid
a.cc:60:15: error: template argument 4 is invalid
a.cc:61:8: error: 'string' was not declared in this scope
   61 | vector<string>v,from,to;
      |        ^~~~~~
a.cc:61:8: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:61:14: error: template argument 1 is invalid
   61 | vector<string>v,from,to;
      |              ^
a.cc:61:14: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:66:9: error: 'cin' was not declared in this scope
   66 |   while(cin >> n >> m >> c,n|m|c){
      |         ^~~
a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #include<set>
  +++ |+#include <iostream>
    6 | 
a.cc:68:5: error: 'string' was not declared in this scope
   68 |     string s,dst,f,t;
      |     ^~~~~~
a.cc:68:5: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:69:7: error: request for member 'clear' in 'v', which is of non-class type 'int'
   69 |     v.clear();
      |       ^~~~~
a.cc:70:10: error: request for member 'clear' in 'from', which is of non-class type 'int'
   70 |     from.clear();
      |          ^~~~~
a.cc:71:8: error: request for member 'clear' in 'to', which is of non-class type 'int'
   71 |     to.clear();
      |        ^~~~~
a.cc:10:11: error: 'second' was not declared in this scope
   10 | #define s second
      |           ^~~~~~
a.cc:75:12: note: in expansion of macro 's'
   75 |     cin >> s >> dst;
      |            ^
a.cc:75:17: error: 'dst' was not declared in this scope; did you mean 'st'?
   75 |     cin >> s >> dst;
      |                 ^~~
      |                 st
a.cc:7:12: error: request for member 'push_back' in 'v', which is of non-class type 'int'
    7 | #define pb push_back
      |            ^~~~~~~~~
a.cc:76:7: note: in expansion of macro 'pb'
   76 |     v.pb(s),v.pb(dst);
      |       ^~
a.cc:7:12: error: request for member 'push_back' in 'v', which is of non-class type 'int'
    7 | #define pb push_back
      |            ^~~~~~~~~
a.cc:76:15: note: in expansion of macro 'pb'
   76 |     v.pb(s),v.pb(dst);
      |               ^~
a.cc:9:11: error: 'first' was not declared in this scope
    9 | #define f first
      |           ^~~~~
a.cc:79:14: note: in expansion of macro 'f'
   79 |       cin >> f >> t >> in;
      |              ^
a.cc:79:19: error: 't' was not declared in this scope
   79 |       cin >> f >> t >> in;
      |                   ^
a.cc:7:12: error: request for member 'push_back' in 'from', which is of non-class type 'int'
    7 | #define pb push_back
      |            ^~~~~~~~~
a.cc:80:12: note: in expansion of macro 'pb'
   80 |       from.pb(f),to.pb(t),cost.pb(in);
      |            ^~
a.cc:7:12: error: request for member 'push_back' in 'to', which is of non-class type 'int'
    7 | #define pb push_back
      |            ^~~~~~~~~
a.cc:80:21: note: in expansion of macro 'pb'
   80 |       from.pb(f),to.pb(t),cost.pb(in);
      |                     ^~
a.cc:7:12: error: request for member 'push_back' in 'v', which is of non-class type 'int'
    7 | #define pb push_back
      |            ^~~~~~~~~
a.cc:81:9: note: in expansion of macro 'pb'
   81 |       v.pb(f),v.pb(t);
      |         ^~
a.cc:7:12: error: request for member 'push_back' in 'v', which is of non-class type 'int'
    7 | #define pb push_back
      |            ^~~~~~~~~
a.cc:81:17: note: in expansion of macro 'pb'
   81 |       v.pb(f),v.pb(t);
      |                 ^~
a.cc:8:20: error: request for member 'begin' in 'v', which is of non-class type 'int'
    8 | #define all(a) (a).begin(),(a).end()
      |                    ^~~~~
a.cc:83:10: note: in expansion of macro 'all'
   83 |     sort(all(v));
      |          ^~~
a.cc:8:32: error: request for member 'end' in 'v', which is of non-class type 'int'
    8 | #define all(a) (a).begin(),(a).end()
      |                                ^~~
a.cc:83:10: note: in expansion of macro 'all'
   83 |     sort(all(v));
      |          ^~~
a.cc:84:7: error: request for member 'erase' in 'v', which is of non-class type 'int'
   84 |     v.erase(unique(all(v)),v.end());
      |       ^~~~~
a.cc:8:20: error: request for member 'begin' in 'v', which is of non-class type 'int'
    8 | #define all(a) (a).begin(),(a).end()
      |                    ^~~~~
a.cc:84:20: note: in expansion of macro 'all'
   84 |     v.erase(unique(all(v)),v.end());
      |                    ^~~
a.cc:8:32: error: request for member 'end' in 'v', which is of non-class type 'int'
    8 | #define all(a) (a).begin(),(a).end()
      |                                ^~~
a.cc:84:20: note: in expansion of macro 'all'
   84 |     v.erase(unique(all(v)),v.end());
      |                    ^~~
a.cc:84:30: error: request for member 'end' in 'v', which is of non-class type 'int'
   84 |     v.erase(unique(all(v)),v.end());
      |                              ^~~
a.cc:86:19: error: template argument 3 is invalid
   86 |     map<string,int>id;
      |                   ^
a.cc:86:19: error: template argument 4 is invalid
a.cc:87:21: error: request for member 'size' in 'v', which is of non-class type 'int'
   87 |     for(int i=0;i<v.size();i++)id[v[i]]=i;
      |                     ^~~~
a.cc:87:36: error: invalid types 'int[int]' for array subscript
   87 |     for(int i=0;i<v.size();i++)id[v[i]]=i;
      |                                    ^
a.cc:88:21: error: request for member 'size' in 'v', which is of non-class type 'int'
   88 |     for(int i=0;i<v.size();i++)G[i].clear();
      |                     ^~~~
a.cc:90:16: error: invalid types 'int[int]' for array subscript
   90 |       G[id[from[i]]].pb(edge(id[to[i]],cost[i]));
      |                ^
a.cc:90:35: error: invalid types 'int[int]' for array subscript
   90 |       G[id[from[i]]].pb(edge(id[to[i]],cost[i]));
      |                                   ^
a.cc:91:14: error: invalid types 'int[int]' for array subscript
   91 |       G[id[to[i]]].pb(edge(id[from[i]],cost[i]));
      |              ^
a.cc:91:35: error: invalid types 'int[int]' for array subscript
   91 |       G[id[to[i]]].pb(edge(id[from[i]],cost[i]));
      |                                   ^
a.cc:94:11: error: expected ';' before 'a'
   94 |     string a;
      |           ^~
      |           ;
a.cc:97:14: error: 'a' was not declared in this scope
   97 |       cin >> a;
      |              ^
a.cc:98:13: error: request for member 'count' in 'id', which is of non-class type 'int'
   98 |       if(id.count(a))st.insert(id[a]);
      |             ^~~~~
a.cc:101:5: error: 'cout' was not declared in this scope
  101 |     cout << dijkstra(id[s],id[dst],c) << endl;
      |     ^~~~
a.cc:101:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:101:42: error: 'endl' was not declared in this scope
  101 |     cout << dijkstra(id[s],id[dst],c) << endl;
      |                                          ^~~~
a.cc:6:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    5 | #include<set>
  +++ |+#include <ostream>
    6 |