Language: C++

#include <iostream>
#include <vector>
#include <queue>
#define REP(i,n) for(int i=0;i<n;i++)

struct edge{
    int to;
    long long cost;
};

using namespace std;

//ダイクストラで多用する型
typedef pair<long long, int> P;//(その頂点までの距離,頂点)として使う。

vector<edge> G[300'010];//頂点iから出る辺の配列G[i]の配列。
int dist[300'010];//特定の頂点から各頂点への距離が格納される。
bool used[300'010];//dijkstra実行中に、頂点iまでの距離を確定したかどうかを持つ。

void dijkstra(int v){//vは始点。
    //以下のリンクでpriority_queueの使い方を参照
    //http://shirokurostone.hatenablog.com/entry/20110522/1306052844
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, v));
    while(!que.empty()){
        P top = que.top();
        que.pop();
        int u = top.second;
        long long d = top.first;
        //cout << u << ' ' << d << endl;
        if(used[u]) continue;
        dist[u] = d;
        used[u] = true;
        for(int i = 0; i < G[u].size(); i++){
            if(!used[G[u][i].to]){
                que.push(P(d+G[u][i].cost, G[u][i].to));
                //cout << G[u][i].to << ' ' <<  d+G[u][i].cost << endl;
            }
        }
    }
}

int main(){
    int n,m;
    cin >> n >> m;
    int u,v;
    int s,t;
    REP(i,m){
        cin>>u>>v;
        u--;v--;
        REP(j,3){
          G[u+j*n].push_back(v+((j+1)%3)*n);
          G[v+((j+1)%3)*n].push_back(u+j*n);
        }
    }
    cin>>s>>t;
    s--;t--;
    dijkstra(s);
    if(used[t]){
      cout<<dist[t]/3<<endl;
    }else{
      cout<<-1<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:29: error: no matching function for call to 'std::vector<edge>::push_back(int)'
   52 |           G[u+j*n].push_back(v+((j+1)%3)*n);
      |           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = edge; _Alloc = std::allocator<edge>; value_type = edge]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'int' to 'const std::vector<edge>::value_type&' {aka 'const edge&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = edge; _Alloc = std::allocator<edge>; value_type = edge]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'int' to 'std::vector<edge>::value_type&&' {aka 'edge&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:53:37: error: no matching function for call to 'std::vector<edge>::push_back(int)'
   53 |           G[v+((j+1)%3)*n].push_back(u+j*n);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = edge; _Alloc = std::allocator<edge>; value_type = edge]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'int' to 'const std::vector<edge>::value_type&' {aka 'const edge&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = edge; _Alloc = std::allocator<edge>; value_type = edge]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'int' to 'std::vector<edge>::value_type&&' {aka 'edge&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~