Language: C++

#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

struct edge {ll to, company;};

int main(){
    ll N, M; cin >> N >> M;
    vector<edge> ed[N];
    REP(i, M){
        ll p, q, c; cin >> p >> q >> c; p--; q--;
        ed[p].pb({q, c});
        ed[q].pb({p, c});
    }
    
    vl dist(N, LINF); dist[0] = 1;
    priority_queue<pair<ll, PL>> pq;
    for(auto e : ed[0]){
        pq.push({-1, {0, e.company}});
    }
    bool visit(N, false);
    while(!pq.empty()){
        auto tmp = pq.top(); pq.pop();
        ll cur_cost = -tmp.ff; ll cur_ver = tmp.ss.ff; ll cur_company = tmp.ss.ss;
        if(visit[cur_ver]) continue;
        visit[cur_ver] = true;
        
        for(auto e : ed[cur_ver]){
            if(e.company == cur_company){
                if(dist[e.to] > dist[cur_ver]){
                    dist[e.to] = cur_cost;
                    pq.push({-dist[e.to], {e.to, e.company}});
                }
            }
            else{
                if(dist[e.to] > dist[cur_ver] + 1){
                    dist[e.to] = cur_cost+1;
                    pq.push({-dist[e.to], {e.to, e.company}});
                }
            }
        }
    }
    cout << (dist[N-1] == LINF ? -1 : dist[N-1]) << endl;
    
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:80:24: error: expression list treated as compound expression in initializer [-fpermissive]
   80 |     bool visit(N, false);
      |                        ^
a.cc:84:17: error: invalid types 'bool[ll {aka long long int}]' for array subscript
   84 |         if(visit[cur_ver]) continue;
      |                 ^
a.cc:85:14: error: invalid types 'bool[ll {aka long long int}]' for array subscript
   85 |         visit[cur_ver] = true;
      |              ^