Language: C++

#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> bool chmin(T &a,T b) {if(a>b) {a=b; return true;} return false;}
#define itn int
#define fi first
#define se second
#define intmax numeric_limits<int>::max()
#define llmax numeric_limits<ll>::max():
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sortt(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;
const ll lnf=1ll<<60;

int prevv[100010]; //頂点の最大数
struct edge{
  int to;
  ll cost;
};

vector<ll> dijkstra(int n,vector<vector<edge> > G,int s){
  fill(prevv,prevv+n,-1);
  priority_queue<pll,vector<pll>,greater<pll> > que;
  vector<ll> dist(n,lnf);
  dist[s]=0;
  que.push(pii(0,s));
  while(!que.empty()){
    ll cost; int v;
    tie(cost,v)=que.top();
    que.pop();
    if(dist[v]<cost) continue;
    for(int i=0;i<G[v].size();i++){
      edge e=G[v][i];
      ll nc=e.cost;
      int nv=e.to;
      if(dist[nv]>dist[v]+nc){
        dist[nv]=dist[v]+nc;
        prevv[nv]=v;
        que.push(pii(dist[nv],nv));
      }
    }
  }
  return dist;
}

//頂点への最短路
vector<int> get_path(int t){
  vector<int> path(0);
  for(;t!=-1;t=prevv[t]) path.push_back(t);
  reverse(path.begin(),path.end());
  return path;
}

int main(){
  int n,m; cin >> n >> m;
  vector<vector<edge> > g(n,vector<edge>(0));
  rep(i,n-1){
    g[i+1].emplace_back((i,0));
  }
  rep(i,m){
    int l,r; ll c;
    cin >> l >> r >> c;
    l--; r--;
    g[l].emplace_back((r,c));
  }
  vector<ll> dist=dijkstra(n,g,0);
  ll ans=dist[n-1];
  if(ans==lnf) cout << -1 << endl;
  else cout << dist[n-1] << endl;
}

Compiler output:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33,
                 from /usr/include/c++/14/bits/allocator.h:46,
                 from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = edge; _Args = {int}; _Tp = edge]':
/usr/include/c++/14/bits/alloc_traits.h:575:17:   required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = edge; _Args = {int}; _Tp = edge; allocator_type = std::allocator<edge>]'
  575 |           __a.construct(__p, std::forward<_Args>(__args)...);
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:117:30:   required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int}; _Tp = edge; _Alloc = std::allocator<edge>; reference = edge&]'
  117 |             _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  118 |                                      std::forward<_Args>(__args)...);
      |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:70:24:   required from here
   70 |     g[i+1].emplace_back((i,0));
      |     ~~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/new_allocator.h:191:11: error: no matching function for call to 'edge::edge(int)'
  191 |         { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:28:8: note: candidate: 'edge::edge()'
   28 | struct edge{
      |        ^~~~
a.cc:28:8: note:   candidate expects 0 arguments, 1 provided
a.cc:28:8: note: candidate: 'constexpr edge::edge(const edge&)'
a.cc:28:8: note:   no known conversion for argument 1 from 'int' to 'const edge&'
a.cc:28:8: note: candidate: 'constexpr edge::edge(edge&&)'
a.cc:28:8: note:   no known conversion for argument 1 from 'int' to 'edge&&'
/usr/include/c++/14/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = edge; _Args = {long long int&}; _Tp = edge]':
/usr/include/c++/14/bits/alloc_traits.h:575:17:   required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = edge; _Args = {long long int&}; _Tp = edge; allocator_type = std::allocator<edge>]'
  575 |           __a.construct(__p, std::forward<_Args>(__args)...);
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:117:30:   required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {long long int&}; _Tp = edge; _Alloc = std::allocator<edge>; reference = edge&]'
  117 |             _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  118 |                                      std::forward<_Args>(__args)...);
      |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:76:22:   required from here
   76 |     g[l].emplace_back((r,c));
      |     ~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/new_allocator.h:191:11: error: no matching function for call to 'edge::edge(long long int&)'
  191 |         { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:28:8: note: candidate: 'edge::edge()'
   28 | struct edge{
      |        ^~~~
a.cc:28:8: note:   candidate expects 0 arguments, 1 provided
a.cc:28:8: note: candidate: 'constexpr edge::edge(const edge&)'
a.cc:28:8: note:   no known conversion for argument 1 from 'long long int' to 'const edge&'
a.cc:28:8: note: candidate: 'constexpr edge::edge(edge&&)'
a.cc:28:8: note:   no known conversion for argument 1 from 'long long int' to 'edge&&'