Language: C++

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef pair<int,P> tuple;

#define INF 1e9

int d[100000];
vector<P> e[100000];

int main() {
    int n, m;
    cin >> n >> m;

    REP(i,m){
        int p, q, c;
        scanf("%d %d %d", &p, &q, &c);
        p--;
        q--;
        e[p].push_back(make_pair(q, c));
        e[q].push_back(make_pair(p, c));
    }

    REP(i,n) d[i] = INF;

    d[0] = 0;
    priority_queue<tuple,vector<tuple>,greater<tuple> > pq;
    pq.push(make_pair(0,make_pair(0,0)));
    while (!pq.empty() && d[n-1] == INF){
        tuple a = pq.top();
        pq.pop();
        int dist = a.first;
        int now = a.second.first;
        int c = a.second.second;
        if(d[now] < dist) continue;
        REP(i,e[now].size()){
            P ne = e[now][i];
            int next = ne.first, cc = ne.second;
            int cost = (c != cc);
            if (d[next]>d[now]+cost){
                d[next]=d[now]+cost;
                pq.push(make_pair(d[next],make_pair(next,cc)));
            }
        }
    }

    if (d[n-1] == INF) cout << -1 << endl;
    else cout << d[n-1] << endl;


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:38: error: template argument 1 is invalid
   49 |     priority_queue<tuple,vector<tuple>,greater<tuple> > pq;
      |                                      ^
a.cc:49:38: error: template argument 2 is invalid
a.cc:49:53: error: template argument 1 is invalid
   49 |     priority_queue<tuple,vector<tuple>,greater<tuple> > pq;
      |                                                     ^
a.cc:49:55: error: template argument 1 is invalid
   49 |     priority_queue<tuple,vector<tuple>,greater<tuple> > pq;
      |                                                       ^
a.cc:49:55: error: template argument 2 is invalid
a.cc:49:55: error: template argument 3 is invalid
a.cc:50:8: error: request for member 'push' in 'pq', which is of non-class type 'int'
   50 |     pq.push(make_pair(0,make_pair(0,0)));
      |        ^~~~
a.cc:51:16: error: request for member 'empty' in 'pq', which is of non-class type 'int'
   51 |     while (!pq.empty() && d[n-1] == INF){
      |                ^~~~~
a.cc:52:9: error: reference to 'tuple' is ambiguous
   52 |         tuple a = pq.top();
      |         ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple'
   92 |     class tuple;
      |           ^~~~~
a.cc:26:21: note:                 'typedef struct std::pair<int, std::pair<int, int> > tuple'
   26 | typedef pair<int,P> tuple;
      |                     ^~~~~
a.cc:53:12: error: request for member 'pop' in 'pq', which is of non-class type 'int'
   53 |         pq.pop();
      |            ^~~
a.cc:54:20: error: 'a' was not declared in this scope
   54 |         int dist = a.first;
      |                    ^
a.cc:64:20: error: request for member 'push' in 'pq', which is of non-class type 'int'
   64 |                 pq.push(make_pair(d[next],make_pair(next,cc)));
      |                    ^~~~