Language: C++

#include<bits/stdc++.h>
#define INF 0x3f3f3f3f

using namespace std;

const int N = 11111;
const int M= 2e5+5;

using namespace std;

typedef long long ll;

int head[M],tot;
ll d[M];//到个点的距离；
bool vis[M];//1表示访问过，0表示没有访问过； 

struct Edge
{
   int next;
   int to;
   ll dis;
}edge[M*2];


void dij(int u)
{
   memset(vis,0,sizeof(vis));
   d[u] = 0;
   priority_queue<node> Q;
   
   Q.push({u,0});
   
  node tmp;
  
  while(Q.size()){
     tmp = Q.top();
     Q.pop();
     int x = tmp.id;
     if(vis[x]) 
	   continue;
	   
    for(int i = head[x];~i;i = edge[i].next){
       int y = edge[i].to;
        ll dis = edge[i].dis;
         if(d[y] > d[x] +dis){
           d[y] = d[x] + dis;
               Q.push({y,d[y]});
             }
       }
   }
}
void init(int n)
{
         memset(head,-1,sizeof(head));
         tot = 0;
         for(int i = 1;i <= n;++i)
		    d[i] = INF;
}
int main()
{
    int n,m;
    cin>>n>>m;
    init(n);
    int u,v;ll dis;
    for(int i = 1;i <= n;++i){
          add(i,i - 1,0);
          }
    for(int i = 1;i <= m;++i){
          cin>>u >> v>>dis;
          add(u,v,dis);
       }
         dij(1);
         if(d[n] == INF) cout<<-1<<endl;
         else cout<<d[n]<<endl;
}

Compiler output:
a.cc: In function 'void dij(int)':
a.cc:29:19: error: 'node' was not declared in this scope
   29 |    priority_queue<node> Q;
      |                   ^~~~
a.cc:29:23: error: template argument 1 is invalid
   29 |    priority_queue<node> Q;
      |                       ^
a.cc:29:23: error: template argument 2 is invalid
a.cc:29:23: error: template argument 3 is invalid
a.cc:31:6: error: request for member 'push' in 'Q', which is of non-class type 'int'
   31 |    Q.push({u,0});
      |      ^~~~
a.cc:33:7: error: expected ';' before 'tmp'
   33 |   node tmp;
      |       ^~~~
      |       ;
a.cc:35:11: error: request for member 'size' in 'Q', which is of non-class type 'int'
   35 |   while(Q.size()){
      |           ^~~~
a.cc:36:6: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   36 |      tmp = Q.top();
      |      ^~~
      |      tm
a.cc:36:14: error: request for member 'top' in 'Q', which is of non-class type 'int'
   36 |      tmp = Q.top();
      |              ^~~
a.cc:37:8: error: request for member 'pop' in 'Q', which is of non-class type 'int'
   37 |      Q.pop();
      |        ^~~
a.cc:47:18: error: request for member 'push' in 'Q', which is of non-class type 'int'
   47 |                Q.push({y,d[y]});
      |                  ^~~~
a.cc: In function 'int main()':
a.cc:66:11: error: 'add' was not declared in this scope; did you mean 'std::filesystem::perm_options::add'?
   66 |           add(i,i - 1,0);
      |           ^~~
      |           std::filesystem::perm_options::add
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:219:7: note: 'std::filesystem::perm_options::add' declared here
  219 |       add       = 0x2,
      |       ^~~
a.cc:70:11: error: 'add' was not declared in this scope; did you mean 'std::filesystem::perm_options::add'?
   70 |           add(u,v,dis);
      |           ^~~
      |           std::filesystem::perm_options::add
/usr/include/c++/14/bits/fs_fwd.h:219:7: note: 'std::filesystem::perm_options::add' declared here
  219 |       add       = 0x2,
      |       ^~~