Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<climits>
#include<map>
#include<set>
#include<string>

#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;
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());

    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:66:16: error: redefinition of 'std::map<std::__cxx11::basic_string<char>, int> id'
   66 | map<string,int>id;
      |                ^~
a.cc:63:16: note: 'std::map<std::__cxx11::basic_string<char>, int> id' previously declared here
   63 | map<string,int>id;
      |                ^~
a.cc:67:15: error: redefinition of 'std::vector<std::__cxx11::basic_string<char> > v'
   67 | vector<string>v,from,to;
      |               ^
a.cc:64:15: note: 'std::vector<std::__cxx11::basic_string<char> > v' previously declared here
   64 | vector<string>v,from,to;
      |               ^
a.cc:67:17: error: redefinition of 'std::vector<std::__cxx11::basic_string<char> > from'
   67 | vector<string>v,from,to;
      |                 ^~~~
a.cc:64:17: note: 'std::vector<std::__cxx11::basic_string<char> > from' previously declared here
   64 | vector<string>v,from,to;
      |                 ^~~~
a.cc:67:22: error: redefinition of 'std::vector<std::__cxx11::basic_string<char> > to'
   67 | vector<string>v,from,to;
      |                      ^~
a.cc:64:22: note: 'std::vector<std::__cxx11::basic_string<char> > to' previously declared here
   64 | vector<string>v,from,to;
      |                      ^~
a.cc:68:12: error: redefinition of 'std::vector<int> cost'
   68 | vector<int>cost;
      |            ^~~~
a.cc:65:12: note: 'std::vector<int> cost' previously declared here
   65 | vector<int>cost;
      |            ^~~~