Language: C++

#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
//template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

typedef vv<int> Graph;
ll INF=1123456789;
int n,m,e,s,t,r;
int fun(int v,int s,int r){return (v<<e) + s + (n<<e)*r;}
void add_edge(Graph &h,int a,int b,int st,int R,vector<int> &eve){
  if(R==r-1){
    if(b==s)
      if(eve[a]>=0){
	h[fun(a,st,R)].pb(fun(0,st|(1<<eve[a]),0));
      }else{
	h[fun(a,st,R)].pb(fun(0,st,0));
      }
    return;
  }else if(R<r-1){
    if(eve[a]>=0){
      h[fun(a,st,R)].pb(fun(b,st|(1<<eve[a]),(b==s?0:R+1)));
    }else{
      h[fun(a,st,R)].pb(fun(b,st,(b==s?0:R+1)));
    }
  }
}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int i,j,k;
  cin>>n>>m>>e>>s>>t>>r;
  r;
  Graph g(n);
  int a,b,c;
  rep(i,m){
    cin>>a>>b;
    if(b)g[a].pb(b);
    if(a)g[b].pb(a);
  }
  vector<int> as(e),bs(e),eve(n,-1);
  rep(i,e){
    cin>>as[i]>>bs[i]>>c;
    eve[c]=i;
  }//cout<<eve<<endl;
  rep(i,n)if(i)
    g[i].pb(0);
  Graph h((n<<e)*r);
  rep(i,1<<e){
    rep(j,n){
      rep(k,r)
	for(int v:g[j])
	  add_edge(h,j,v,i,k,eve);
    }
    rep(j,e){
      rep(k,r)
	if(i>>j&1){
	  add_edge(h,as[j],bs[j],i,k,eve);
	  add_edge(h,bs[j],as[j],i,k,eve);
	}
    }
  }
  ll re=INF;
  queue<int> que;
  vector<int> d((n<<e)*r,INF);
  int v;
  que.push(s<<e);
  d[s<<e]=0;
  while(!que.empty()){
    v=que.front(); que.pop();
    // cout<<v<<","<<d.size()<<endl;
    for(int vv:h[v])
      if(d[vv]>d[v]+1){
	d[vv]=d[v]+1;
	que.push(vv);
	if( ((vv%(n<<e))>>e) == t){
	  re=d[vv];
	  cout<<d[vv]<<endl;
	  return 0;
	}
      }
  }
  /*  rep(i,r){
    rep(j,n){
      rep(k,1<<e)cout<<d[fun(j,k,i)]<<" ";
      cout<<endl;
    }cout<<"----"<<endl;
  }
  rep(i,r)rep(j,1<<e)
  cout<<pii(fun(t,j,i),(fun(t,j,i)%(n<<e))>>e)<<d[fun(t,j,i)]<<endl;*/
  cout<<re<<endl;
  return 0;
}

Compiler output:
a.cc:41:9: error: 'vv' does not name a type
   41 | typedef vv<int> Graph;
      |         ^~
a.cc:45:6: error: variable or field 'add_edge' declared void
   45 | void add_edge(Graph &h,int a,int b,int st,int R,vector<int> &eve){
      |      ^~~~~~~~
a.cc:45:15: error: 'Graph' was not declared in this scope; did you mean 'isgraph'?
   45 | void add_edge(Graph &h,int a,int b,int st,int R,vector<int> &eve){
      |               ^~~~~
      |               isgraph
a.cc:45:22: error: 'h' was not declared in this scope
   45 | void add_edge(Graph &h,int a,int b,int st,int R,vector<int> &eve){
      |                      ^
a.cc:45:24: error: expected primary-expression before 'int'
   45 | void add_edge(Graph &h,int a,int b,int st,int R,vector<int> &eve){
      |                        ^~~
a.cc:45:30: error: expected primary-expression before 'int'
   45 | void add_edge(Graph &h,int a,int b,int st,int R,vector<int> &eve){
      |                              ^~~
a.cc:45:36: error: expected primary-expression before 'int'
   45 | void add_edge(Graph &h,int a,int b,int st,int R,vector<int> &eve){
      |                                    ^~~
a.cc:45:43: error: expected primary-expression before 'int'
   45 | void add_edge(Graph &h,int a,int b,int st,int R,vector<int> &eve){
      |                                           ^~~
a.cc:45:61: error: expected primary-expression before '&' token
   45 | void add_edge(Graph &h,int a,int b,int st,int R,vector<int> &eve){
      |                                                             ^
a.cc:45:62: error: 'eve' was not declared in this scope
   45 | void add_edge(Graph &h,int a,int b,int st,int R,vector<int> &eve){
      |                                                              ^~~
a.cc: In function 'int main()':
a.cc:69:3: error: 'Graph' was not declared in this scope; did you mean 'isgraph'?
   69 |   Graph g(n);
      |   ^~~~~
      |   isgraph
a.cc:73:10: error: 'g' was not declared in this scope
   73 |     if(b)g[a].pb(b);
      |          ^
a.cc:74:10: error: 'g' was not declared in this scope
   74 |     if(a)g[b].pb(a);
      |          ^
a.cc:82:5: error: 'g' was not declared in this scope
   82 |     g[i].pb(0);
      |     ^
a.cc:83:8: error: expected ';' before 'h'
   83 |   Graph h((n<<e)*r);
      |        ^~
      |        ;
a.cc:87:19: error: 'g' was not declared in this scope
   87 |         for(int v:g[j])
      |                   ^
a.cc:88:20: error: 'h' was not declared in this scope
   88 |           add_edge(h,j,v,i,k,eve);
      |                    ^
a.cc:88:11: error: 'add_edge' was not declared in this scope
   88 |           add_edge(h,j,v,i,k,eve);
      |           ^~~~~~~~
a.cc:93:20: error: 'h' was not declared in this scope
   93 |           add_edge(h,as[j],bs[j],i,k,eve);
      |                    ^
a.cc:93:11: error: 'add_edge' was not declared in this scope
   93 |           add_edge(h,as[j],bs[j],i,k,eve);
      |           ^~~~~~~~
a.cc:107:16: error: 'h' was not declared in this scope
  107 |     for(int vv:h[v])
      |                ^