Language: C++

#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;
using namespace std;

#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl

ll n, cnt, ans, a, b, c, dist[ohara], tmp, tmpp, m, h, w, x, y, sum, pos, k, vertex[ohara],id[ohara];
ld doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge
{
    ll from, to;
};
vector<edge> g[ohara];
vector<edge> di_g[ohara];
unordered_map<ll, ll> used;
map<pair<ll, ll>, ll> hen;

//-------------------------↓↓↓↓↓↓------------------------

struct UnionFind
{
    std::vector<int> data;

    UnionFind(int n)
    {
        data.assign(n, -1);
    }

    void unite(int x, int y)
    {
        x = find(x);
        y = find(y);
        if (x == y)
            return;
        if (data[x] > data[y])
            std::swap(x, y);
        data[x] += data[y];
        data[y] = x;
    }

    int find(int k)
    {
        if (data[k] < 0)
            return k;
        return data[k] = find(data[k]);
    }

    bool same(int x, int y)
    {
        return find(x) == find(y);
    }
};

void dijkstra(ll s)
{
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> que;
    fill(dist, dist 2*ohara, LINF);
    dist[s] = 0;
    que.push({0LL, s});
    while (!que.empty())
    {
        pair<ll, ll> p = que.top();
        que.pop();
        ll v = p.second;
        if (dist[v] < p.first)
            continue;
        rep(i, Size(di_g[v]))
        {
            edge e = di_g[v][i];
            if (dist[e.from] > dist[v] + e.to)
            {
                dist[e.from] = dist[v] + e.to;
                que.push({dist[e.from], e.from});
            }
        }
    }
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> n >> m;
    UnionFind uf(n);
    rep(i, m)
    {
        cin >> a >> b >> c;
        a--;
        b--;
        g[c].push_back({a, b});
    }
    tmp = n;
    rrep(com, 1, 1000001)
    {
        if (Size(g[com]) == 0)
            continue;
        unordered_map<ll, ll> syutugen;
        unordered_map<ll, ll> aluse;
        rep(j, Size(g[com]))
        {
            uf.unite(g[com][j].from, g[com][j].to);
            vertex[g[com][j].from]=vertex[g[com][j].to]=-1;
        }
        rep(j, Size(g[com]))
        {
            ll gr;
            gr = uf.find((g[com][j].from));
            if (vertex[gr]==-1){
            {
                vertex[gr] = tmp++;
            }
            if (aluse[g[com][j].from] == 0)
            {
                if (hen[{g[com][j].from, vertex[gr]}] == 0)
                {
                    di_g[g[com][j].from].push_back({vertex[gr], 1LL});
                }
                if (hen[{vertex[gr], g[com][j].from}] == 0)
                {
                    di_g[vertex[gr]].push_back({g[com][j].from, 1LL});
                }
                //cout << g[com][j].from << " " << vertex[gr] << "\n";
                hen[{g[com][j].from, vertex[gr]}] = 1;
                hen[{vertex[gr], g[com][j].from}] = 1;
                aluse[g[com][j].from] = 1;
            }

            // RE;
            //Cout(g[com][j].to);
            gr = uf.find((g[com][j].to));
            if (vertex[gr] == -1)
            {
                vertex[gr] = tmp++;
            }
            if (aluse[g[com][j].to] == 0)
            {
                if (hen[{g[com][j].to, vertex[gr]}] == 0)
                {
                    di_g[g[com][j].to].push_back({vertex[gr], 1LL});
                }
                if (hen[{vertex[gr], g[com][j].to}] == 0)
                {
                    di_g[vertex[gr]].push_back({g[com][j].to, 1LL});
                }
                hen[{g[com][j].to, vertex[gr]}] = 1;
                hen[{vertex[gr], g[com][j].to}] = 1;
                //cout << g[com][j].to << " " << vertex[gr] << "\n";
                //aluse[g[com][j].to] = 1;
            }
        }
    }
    }
    //rep(i,n)Cout(vertex[uf.find(i)]);
    dijkstra(0LL);
    //rep(i, n * 2 + 1) Cout(dist[i]);
    if (uf.find(0LL) == uf.find(n - 1))
    {
        Cout(dist[n - 1] / 2);
    }
    else
    {
        Cout(-1);
    }
    return 0;
}


Compiler output:
a.cc: In function 'void dijkstra(ll)':
a.cc:71:20: error: expected ')' before numeric constant
   71 |     fill(dist, dist 2*ohara, LINF);
      |         ~          ^~
      |                    )