criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
using namespace std;
#define i64  long long
#define lint long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define MOD_Q 1e9 + 7
#define MOD_A 998244353

#define int long long

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename T >
vector< T > dijkstra(WeightedGraph< T > &g, int s) {
  const auto INF = numeric_limits< T >::max();
  vector< T > dist(g.size(), INF);

  using Pi = pair< T, int >;
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  dist[s] = 0;
  que.emplace(dist[s], s);
  while(!que.empty()) {
    T cost;
    int idx;
    tie(cost, idx) = que.top();
    que.pop();
    if(dist[idx] < cost) continue;
    for(auto &e : g[idx]) {
      auto next_cost = cost + e.cost;
      if(dist[e.to] <= next_cost) continue;
      dist[e.to] = next_cost;
      que.emplace(dist[e.to], e.to);
    }
  }
  return dist;
}


void solve()
{
 
  int N,L;
  cin>>N>>L;
  WeightedGraph<int> es(N);

  for (int i = 0; i < L; i++)
  {
    int A,B,C;
    cin>>A>>B>>C;
    A--;
    B--;
    es[A].emplace_back(A,B,C);
  }

  for (int i = 1; i < N - 1 ; i++)
  {
    es[i+1].emplace_back(i+1,i,0);
  }

  vector<int> path = dijkstra(es,0);

  if(path[N-1] == I32_MAX) cout<<-1<<endl;
  else if(path.empty()) cout<<-1<<endl;
  else
  {
    cout<<path[N-1]<<endl;
  }
  
  
  

  
 
  return;
}
 
int main(int argc, const char *argv[])
{
 
  solve();
 
  return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc:119:5: warning: first argument of 'int main(long long int, const char**)' should be 'int' [-Wmain]
  119 | int main(int argc, const char *argv[])
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;

vector< vector< pair<int,int> > > to(100005);
ll dist[100005];

int main() {
  int N,M;
  cin >> N >> M;
  REP(i,M) {
    int l,r,c;
    cin >> l >> r >> c;
    l--; r--;
    to[l].emplace_back(r,c);
  }
  REP(i,N-1)
    to[i+1].emplace_back(i,0);

  REP(i,N)
    dist[i] =INF;
  dist[0] = 0;
  // ダイクストラ
  priority_queue< pair<ll, int>, vevtor< pair<ll,int>, greater<pair<ll,int> > q;
  q.push( make_pair(0, 0) );
  while( !q.empty() ) {
    auto v = q.top(); q.pop();
    if ( v.first > dist[v.second] ) continue;
    for ( auto nv: to[v.second] ) {
      if ( dist[nv.first] > dist[v.second] + nv.second ) {
        dist[nv.first] = dist[v.second] + nv.second;
        q.push( make_pair(dist[nv.first], nv.first) );
      }
    }
  }
  ll ans = (dist[N-1] == INF) ? -1 : dist[N-1];
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:34: error: 'vevtor' was not declared in this scope
   27 |   priority_queue< pair<ll, int>, vevtor< pair<ll,int>, greater<pair<ll,int> > q;
      |                                  ^~~~~~
a.cc:27:79: error: template argument 2 is invalid
   27 |   priority_queue< pair<ll, int>, vevtor< pair<ll,int>, greater<pair<ll,int> > q;
      |                                                                               ^
a.cc:27:79: error: template argument 3 is invalid
a.cc:28:3: error: 'q' was not declared in this scope
   28 |   q.push( make_pair(0, 0) );
      |   ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pint pair<int,int>
#define pll pair<ll,ll>
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;

struct edge{int to,cost;};
int V;
vector<edge> G[100010];
ll d[100010];

void dijkstra(int s){
  priority_queue<pint,vector<pint>,greater<pint>> que;
  fill(d,d+V,longinf);
  d[s]=0;
  que.push(pint(0,s));
  ll cnt=0;
  while(!que.empty()){
    cnt++;
    if(cnt>=200020){
      cout << -1 << endl;
      return 0;
    }
    pint p=que.top(); que.pop();
    int v=p.second;
    if(d[v]<p.first)continue;
    rep(i,G[v].size()){
      edge e=G[v][i];
      if(d[e.to]>d[v]+e.cost){
        d[e.to]=d[v]+e.cost;
        que.push(pint(d[e.to],e.to));
      }
    }
  }
}

int main(){
  int n,m;
  cin >> n >> m;
  V=n;
  rep(i,m){
    int x,y,z;
    cin >> x >> y >> z;
    x--,y--;
    G[x].push_back({y,z});
  }
  for(int i=1;i<n;i++){
    G[i].push_back({i-1,0});
  }
  dijkstra(0);
  if(d[n-1]>=longinf)d[n-1]=-1;
  cout << d[n-1] << endl;
return 0;}

Compiler output:
a.cc: In function 'void dijkstra(int)':
a.cc:42:14: error: return-statement with a value, in function returning 'void' [-fpermissive]
   42 |       return 0;
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
#define MAX_N 100000

vll d(MAX_N, LLINF);


struct segTree{
  ll N;
  vll dat;
  void init(ll n){
    N = 1;
    while(N < n)
      N *= 2;

    dat = vll(2*N, INF);
  }

  void update(ll k, ll a){
    k += N-1; //leaf
    dat[k] = a;
    while(k > 0){
      k = (k-1)/2;
      dat[k] = min(dat[k*2+1], dat[k*2+2]);
    }
  }

  ll query(ll a, ll b){
    if(a > b)
      return query(b,a,0,0,N);
    else
      return query(a,b,0,0,N);
  }

  ll query(ll a, ll b, ll k, ll l, ll r){
    if(b <= l || r <= a)
      return LLINF;

    if(a <= l || r <= b)
      return dat[k];
    else{
      ll m = (l+r)/2;
      ll vl = query(a, b, k*2+1, l, m);
      ll vr = query(a, b, k*2+1, m, r);
      return min(vl, vr);
    }
  }
};


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n,m;
  cin >> n >> m;
  vector<pair<pll, ll>> lrc(m);
  REP(i, m){
    cin >> lrc[i].FI.FI >> lrc[i].FI.SE >> lrc[i].SE;
    lrc[i].FI.FI--;
    lrc[i].FI.SE--;
  }
  sort(lrc.begin(), lrc.end());

  segTree seg;
  seg.init(n);
  REP(i, m){
    ll l = lrc[i].FI.FI;
    ll r = lrc[i].FI.SE;
    ll c = lrc[i].SE;

    ll k = seg.query(l, r+1);
    seg.update(r, k);
  }

  ll ans = seg.query(n-1, n);
  if(ans == LLINF)
    cout << -1 << endl;
  else
    cout << ans << endl;
  cout << 

}


Compiler output:
a.cc: In function 'int main()':
a.cc:116:1: error: expected primary-expression before '}' token
  116 | }
      | ^
Language: C++

template<class T>
class SegmentTree {

public:
    /**
     * @param N size
     * @param e identity element
     * @param operation operation for query
     * @param updater operation for update
     */
    SegmentTree(size_t N, T e, function<T(T, T)> operation, function<T(T, T)> updater)
            : e(e), operation(std::move(operation)), updater(move(updater)) {
        n = 1;
        while (n < N) {
            n *= 2;
        }
        data = vector<T>(2 * n - 1, e);
    }

    /**
     * iの値をxに更新
     * @param i index ( 0-indexed )
     * @param x  value
     */
    void update(int i, T x) {
        i += n - 1;
        data[i] = updater(data[i], x);
        while (i > 0) {
            i = (i - 1) / 2;
            data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
        }
    }

    /**
     * [a, b)の区間でクエリを実行
     */
    T query(int a, int b) {
        return query(a, b, 0, 0, n);
    }

    /**
     * 添字でアクセス
     * @param i index ( 0-indexed )
     */
    T operator[](int i) {
        return data[i + n - 1];
    }

private:
    int n;
    vector<T> data;
    T e;
    function<T(T, T)> operation;
    function<T(T, T)> updater;

    T query(int a, int b, int k, int l, int r) {
        // 交差しない
        if (r <= a || b <= l) return e;
        // 区間 [a, b) に l, r が含まれる
        if (a <= l && r <= b) return data[k];
        // 左の子
        T c1 = query(a, b, 2 * k + 1, l, (l + r) / 2);
        // 右の子
        T c2 = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return operation(c1, c2);
    }
};

Compiler output:
a.cc:11:23: error: expected ')' before 'N'
   11 |     SegmentTree(size_t N, T e, function<T(T, T)> operation, function<T(T, T)> updater)
      |                ~      ^~
      |                       )
a.cc:51:5: error: 'vector' does not name a type
   51 |     vector<T> data;
      |     ^~~~~~
a.cc:53:5: error: 'function' does not name a type; did you mean 'union'?
   53 |     function<T(T, T)> operation;
      |     ^~~~~~~~
      |     union
a.cc:54:5: error: 'function' does not name a type; did you mean 'union'?
   54 |     function<T(T, T)> updater;
      |     ^~~~~~~~
      |     union
a.cc: In member function 'void SegmentTree<T>::update(int, T)':
a.cc:27:9: error: 'data' was not declared in this scope
   27 |         data[i] = updater(data[i], x);
      |         ^~~~
a.cc:30:23: error: there are no arguments to 'operation' that depend on a template parameter, so a declaration of 'operation' must be available [-fpermissive]
   30 |             data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
      |                       ^~~~~~~~~
a.cc:30:23: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc: In member function 'T SegmentTree<T>::operator[](int)':
a.cc:46:16: error: 'data' was not declared in this scope
   46 |         return data[i + n - 1];
      |                ^~~~
a.cc: In member function 'T SegmentTree<T>::query(int, int, int, int, int)':
a.cc:60:38: error: 'data' was not declared in this scope
   60 |         if (a <= l && r <= b) return data[k];
      |                                      ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int head[500010],next[500010],ver[500010],edge[500010];
int tot=0;
void add(int x,int y,int z){
	ver[++tot]=y;edge[tot]=z;next[tot]=head[x];head[x]=tot;
}
queue <int> q; 
int n,m,dis[500100],vis[500100];
void spfa(int x){
	memset(dis,0x7ffffff,sizeof(dis));
	dis[x]=0;
	q.push(x);
	vis[x]=1;
	while (!q.empty()){
		int y=q.front();
		q.pop();vis[y]=0;
		for (int i=head[y];i;i=next[i]){
			int s=ver[i],z=edge[i];
			if (dis[s]>abs(dis[y]+z)){
				dis[s]=abs(dis[y]+z);
				if (!vis[s]){
					q.push(s);
					vis[s]=1;				
				}
			}
		}
	}
}
int main(){
	int k;
	
	cin>>n>>m;
	for (int i=1;i<=m;i++){
		int x,y,z;
		cin>>x>>y>>z;
		add(x,y,z);
	}
	
	spfa(1);
	cout<<dis[n]<<endl;
	cout<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void add(int, int, int)':
a.cc:6:34: error: reference to 'next' is ambiguous
    6 |         ver[++tot]=y;edge[tot]=z;next[tot]=head[x];head[x]=tot;
      |                                  ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:3:18: note:                 'int next [500010]'
    3 | int head[500010],next[500010],ver[500010],edge[500010];
      |                  ^~~~
a.cc: In function 'void spfa(int)':
a.cc:18:40: error: reference to 'next' is ambiguous
   18 |                 for (int i=head[y];i;i=next[i]){
      |                                        ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:3:18: note:                 'int next [500010]'
    3 | int head[500010],next[500010],ver[500010],edge[500010];
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int head[500010],next[500010],ver[500010],edge[500010];
int tot=0;
void add(int x,int y,int z){
	ver[++tot]=y;edge[tot]=z;next[tot]=head[x];head[x]=tot;
}
queue <int> q; 
int n,m,dis[500100],vis[500100];
void spfa(int x){
	memset(dis,0x7ffffff,sizeof(dis));
	dis[x]=0;
	q.push(x);
	vis[x]=1;
	while (!q.empty()){
		int y=q.front();
		q.pop();vis[y]=0;
		for (int i=head[y];i;i=next[i]){
			int s=ver[i],z=edge[i];
			if (dis[s]>abs(dis[y]+z)){
				dis[s]=abs(dis[y]+z);
				if (!vis[s]){
					q.push(s);
					vis[s]=1;				
				}
			}
		}
	}
}
int main(){
	int k;
	
	cin>>n>>m>>k;;
	for (int i=1;i<=m;i++){
		int x,y,z;
		cin>>x>>y>>z;
		add(x,y,z);
	}
	
	spfa(k);
	for (int i=1;i<=n;i++){
		cout<<dis[i]<<" ";
	}
	cout<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void add(int, int, int)':
a.cc:6:34: error: reference to 'next' is ambiguous
    6 |         ver[++tot]=y;edge[tot]=z;next[tot]=head[x];head[x]=tot;
      |                                  ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:3:18: note:                 'int next [500010]'
    3 | int head[500010],next[500010],ver[500010],edge[500010];
      |                  ^~~~
a.cc: In function 'void spfa(int)':
a.cc:18:40: error: reference to 'next' is ambiguous
   18 |                 for (int i=head[y];i;i=next[i]){
      |                                        ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:3:18: note:                 'int next [500010]'
    3 | int head[500010],next[500010],ver[500010],edge[500010];
      |                  ^~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<queue>
using namespace std;

#define LL long long

const int CN = 1e5+5;
const LL INF = 0x3f3f3f3f3f3f3f2f;

LL read(){
    LL s = 0,ne = 1; char c = getchar();
    for(;c<'0'||c>'9';c=getchar()) if(c=='-') ne=-1;
    for(;c>='0'&&c<='9';c=getchar()) s=(s<<1)+(s<<3)+c-'0';
    return s*ne;
}

class fs{
  public: int to,nxt; LL di; void init(int t,int n,LL d) {to=t;nxt=n;di=d;}
}E[CN * 51];
int hd[CN],ecnt = 0;
void add(int x,int y,LL z) {E[++ecnt].init(y, hd[x], z); hd[x] = ecnt;}

int n,m;

/* DJ */
class DJ{
  public: int id; LL v; bool operator < (const DJ& a)const {return v >s a.v;}
};
priority_queue<DJ> Q; LL d[CN]; bool vis[CN];
LL SP(int st,int ed){
    memset(vis, 0, sizeof(vis));
    memset(d, 0x3f, sizeof(d));
    Q.push((DJ){st, d[st] = 0});
    while(!Q.empty()){
        int u = Q.top().id; Q.pop();
        for(int k = hd[u]; k; k = E[k].nxt){
            int v = E[k].to;
            if(d[v] > d[u] + E[k].di){
                d[v] = d[u] + E[k].di;
                if(!vis[v]) Q.push((DJ){v, d[v]}),vis[v] = true;
            }
        }
    }
    return d[ed] < INF ? d[ed] : -1;
}

int main()
{
    n = read(); m = read();
    while(m--){
        int u = read(),v = read(); LL c = read();
        add(u, v, c); add(v, u, c);
    }
    for(int i=1;i<n;i++) add(i + 1, i, 0);

    printf("%lld", SP(1, n));
}

Compiler output:
a.cc: In member function 'bool DJ::operator<(const DJ&) const':
a.cc:30:71: error: 's' was not declared in this scope
   30 |   public: int id; LL v; bool operator < (const DJ& a)const {return v >s a.v;}
      |                                                                       ^
a.cc:30:73: error: expected ';' before 'a'
   30 |   public: int id; LL v; bool operator < (const DJ& a)const {return v >s a.v;}
      |                                                                         ^
Language: C++


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>
#include <queue>

using namespace std;

using Graph = vector<vector<int> >;

typedef pair<long long, int> P;

int main()
{
	int INF = 1e9;
	int N,M;

	cin >> N >> M;

	vector<int > Ls(M);
	vector<int > Rs(M);
	vector<int > Cs(M);
	vector<vector <int> > mat_E(N,vector<int>(N,INF) );

	for (int mi = 0; mi < M; mi++) {
		cin >> Ls[mi] >> Rs[mi] >> Cs[mi];
		Ls[mi]--;
		Rs[mi]--;
	}

	for (int mi = 0; mi < M; mi++) {
		for (int li = Ls[mi]; li < Rs[mi]; li++) {
			for (int ri = li + 1; ri <= Rs[mi]; ri++) {
				if (Cs[mi] < mat_E[li][ri]) {
					mat_E[li][ri] = Cs[mi];
					mat_E[ri][li] = Cs[mi];
				}
			}
		}
	}

	vector<long long> dis(N,INF);
	pair<long long,int>;
	priority_queue< P, vector<P>, greater<P> > que;

	dis[0] = 0;
	for(int ni = 0; ni < N; ni++){
		if(mat_E[0][ni] != INF){
			que.push(P(mat_E[0][ni],ni));
		}
	}

	P to;
	while(!que.empty()){
		to = que.top();
		que.pop();
		if (to.first < dis[to.second]) {
			dis[to.second] = to.first;
			for (int ni = 0; ni < N; ni++) {
				if (mat_E[to.second][ni] != INF && dis[ni] == INF) {
					que.push(P(dis[to.second] + mat_E[to.second][ni], ni));
				}
			}
		}
	}
	
	if (dis[N - 1] == INF) dis[N - 1] = -1;
	cout << dis[N-1];


	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:48:9: error: declaration does not declare anything [-fpermissive]
   48 |         pair<long long,int>;
      |         ^~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
// #include "../../cxx-prettyprint/prettyprint.hpp"
 
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

// だれかのWAを直してみる
 
using namespace std;

typedef int long long;
typedef long long ll;
// typedef pair<int, int> P;
 
const ll INF = 1e9;
 
struct edge {
    int to;
    int cost;
};
 
// <最短距離, 頂点の番号>
using P = pair<int, int>;
 
int V;
vector<edge> G[100001];
vector<ll> d(100001);

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d.begin(), d.end(), INF);
    d[s] = 0;
    que.push(P(0, s));
 
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
 
        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}
 
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
// ここに処理を記述
 
	int N, M;
	cin >> N >> M;
 
	V = N+1;
 
	vector<int> L,R,C;
	int l,r,c;
	for(int i=0; i<M; i++){
		cin >> l >> r >> c;
		L.push_back(l);
		R.push_back(r);
		C.push_back(c);
	}
 
	for(int i=N;i>1;i--){
		edge e = {i-1, 0};
		G[i].push_back(e);
	}
	REP(i,M){
		edge e = {R[i], C[i]};
		G[L[i]].push_back(e);
	}
 
	dijkstra(1);
 
	// cout << d << "\n";
 
	cout << setprecision(15);
	
	if(d[N] == INF){
		cout << -1 << "\n";
	}
	else{
		cout << d[N] << "\n";
	}
 
return 0;
}


Compiler output:
a.cc:15:18: error: declaration does not declare anything [-fpermissive]
   15 | typedef int long long;
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>
// #include "../../cxx-prettyprint/prettyprint.hpp"
 
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

// だれかのWAを直してみる
 
using namespace std;
typedef long long ll;
// typedef pair<int, int> P;
typedef int ll;
 
const ll INF = 1e9;
 
struct edge {
    int to;
    int cost;
};
 
// <最短距離, 頂点の番号>
using P = pair<int, int>;
 
int V;
vector<edge> G[100001];
vector<ll> d(100001);

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d.begin(), d.end(), INF);
    d[s] = 0;
    que.push(P(0, s));
 
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
 
        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}
 
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
// ここに処理を記述
 
	int N, M;
	cin >> N >> M;
 
	V = N+1;
 
	vector<int> L,R,C;
	int l,r,c;
	for(int i=0; i<M; i++){
		cin >> l >> r >> c;
		L.push_back(l);
		R.push_back(r);
		C.push_back(c);
	}
 
	for(int i=N;i>1;i--){
		edge e = {i-1, 0};
		G[i].push_back(e);
	}
	REP(i,M){
		edge e = {R[i], C[i]};
		G[L[i]].push_back(e);
	}
 
	dijkstra(1);
 
	// cout << d << "\n";
 
	cout << setprecision(15);
	
	if(d[N] == INF){
		cout << -1 << "\n";
	}
	else{
		cout << d[N] << "\n";
	}
 
return 0;
}


Compiler output:
a.cc:16:13: error: conflicting declaration 'typedef int ll'
   16 | typedef int ll;
      |             ^~
a.cc:14:19: note: previous declaration as 'typedef long long int ll'
   14 | typedef long long ll;
      |                   ^~
Language: C++

#include <bits/stdc++.h>
#include "../../cxx-prettyprint/prettyprint.hpp"

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

using namespace std;
typedef long long ll;
// typedef pair<int, int> P;

const ll INF = 1e18;

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;
vector<edge> G[100000];
ll d[100000];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
// ここに処理を記述

	int N, M;
	cin >> N >> M;

	V = N+1;

	vector<int> L,R,C;
	int l,r,c;
	for(int i=0; i<M; i++){
		cin >> l >> r >> c;
		L.push_back(l);
		R.push_back(r);
		C.push_back(c);
	}

	for(int i=N;i>0;i--){
		edge e = {i-1, 0};
		G[i].push_back(e);
	}
	REP(i,M){
		edge e = {R[i], C[i]};
		G[L[i]].push_back(e);
	}

	dijkstra(1);

	// cout << d << "\n";

	if(d[N] == INF){
		cout << -1 << "\n";
	}
	else{
		cout << d[N] << "\n";
	}

return 0;
}

Compiler output:
a.cc:2:10: fatal error: ../../cxx-prettyprint/prettyprint.hpp: No such file or directory
    2 | #include "../../cxx-prettyprint/prettyprint.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>

def main(void) {
  unsigned int i;
  unsigned int n, m;
  scanf("%d %d", &n, &m);
  unsigned int tail[n + m - 1], head[n + m - 1];
  unsigned int cost[n + m - 1] = {};
  for (i = 0; i < m; i++) {
    scanf("%d %d %d", &tail[i], &head[i], &cost[i]);
    tail[i] -= 1;
    head[i] -= 1;
  }
  for (i = 0; i < n - 1; i++) {
    tail[i + m] = i + 1;
    head[i + m] = i;
  }
  unsigned long dp[n] = {};
  unsigned long inf = -1;
  unsigned int act = 0;
  char unexplr[n] = {};
  for (i = 1; i < n; i++) {
    dp[i] = inf;
    unexplr[i] = 1;
  }
  unsigned long tmp;
  while (unexplr[n - 1]) {
    for (i = 0; i < m + n - 1; i++) {
      to = head[i];
      if (act == tail[i] && unexplr[to]) {
        tmp = dp[act] + cost[i];
        if (tmp < dp[to]) {
          dp[to] = tmp;
        }
      }
    }
    tmp = inf;
    for (i = 0; i < n; i++) {
      if (unexplr[i] && dp[i] < tmp) {
        act = i;
        tmp = dp[i];
      }
    }
    unexplr[act] = 0;
  }
  if (dp[n - 1] < inf) {
    printf("%d\n", dp[n - 1]);
  }
  else {
    printf("-1");
  }
  return 0;
}

Compiler output:
main.c:3:1: error: unknown type name 'def'
    3 | def main(void) {
      | ^~~
main.c: In function 'main':
main.c:29:7: error: 'to' undeclared (first use in this function)
   29 |       to = head[i];
      |       ^~
main.c:29:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <vector>
#include <limits>
#include <functional>

template <class Data, class Operator>
class SegmentTree {
    using DataMerger = std::function<Data(Data, Data)>;
    using Applier = std::function<Data(Operator, Data)>;

private:
    int length;
    std::vector<Data> dat;
    Data dat_id;        // データの単位元
    DataMerger dmerge;  // データをマージする関数
    Applier app;        // データに作用素を適用する関数

    Data query(int ql, int qr, int nidx, int nl, int nr) {
        if (nr <= ql || qr <= nl) return dat_id;
        if (ql <= nl && nr <= qr) return dat[nidx];
        Data vl = query(ql, qr, nidx * 2, nl, (nl + nr) / 2);
        Data vr = query(ql, qr, nidx * 2 + 1, (nl + nr) / 2, nr);
        return dmerge(vl, vr);
    }

public:
    explicit SegmentTree(int N, Data dat_id, DataMerger dmerge, Applier app)
        : length(1), dat_id(dat_id), dmerge(dmerge), app(app) {
        while (length < N) length <<= 1;
        dat.assign(length * 2, dat_id);
    }

    // half-open interval [ql, qr)
    Data query(int ql, int qr) { return query(ql, qr, 1, 0, length); }

    void update(int idx, Operator e) {
        int nidx = idx + length;
        dat[nidx] = app(e, dat[nidx]);
        while (nidx > 0) {
            nidx >>= 1;
            dat[nidx] = dmerge(dat[nidx * 2], dat[nidx * 2 + 1]);
        }
    }
};

using lint = long long;
constexpr lint INF = std::numeric_limits<lint>::max() / 3;

struct Seg {
    int l, r;
    lint c;
};

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

    std::vector<Seg> segs(m);
    for (auto& s : segs) {
        std::cin >> s.l >> s.r >> s.c;
        --s.l, --s.r;
    }

    // 終端でソート
    std::sort(segs.begin(), segs.end(),
              [](Seg a, Seg b) { return a.r < b.r; });

    SegmentTree<lint, lint> seg(
        n, INF,
        [](lint a, lint b) { return std::min(a, b); },
        [](lint e, lint a) { return std::min(e, a); });
    seg.update(0, 0);

    for (auto s : segs) {
        seg.update(s.r, seg.query(s.l, s.r) + s.c);
    }

    lint ans = seg.query(n - 1, n);
    std::cout << (ans == INF ? -1 : ans) << std::endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:65:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   65 |     std::sort(segs.begin(), segs.end(),
      |          ^~~~
      |          qsort
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
using uint = unsigned int;
using ull = unsigned long long;
using ll = long long;
 
int main() {
	
	uint N, M;
	cin >> N >> M;
	
	vector<pair<pair<uint, uint>, uint>> LRC(M);
	uint l, r, c;
	for(uint i=0; i<M; i++) {
		cin >> l >> r >> c;
		auto p = make_pair(l - 1, r - 1);
		LRC[i] = make_pair(p, c);
	}
	
	sort(LRC.begin(), LRC.end());
	
	vector<ll> d(N, -1);
	d[0] = 0;
	
	l = 0;
	r = 0;
	for(uint i=0; i<M; i++) {
		auto LR = LRC[i].first;
		l = LR.first;
		r = LR.second;
		c = LRC[i].second;
		
		if(d[l] == -1) {
			cout << -1;
			return 0;
		}
		
		ll dj = d[l] + c;
		for(uint j=r; j>l; j--) {
			if(d[j] == -1) {
				d[j] = dj;
			} else if (d[j] =< dj) {
				break;
			} else {
				d[j] = dj;
			}
		}
	}
	
	cout << d[N-1];
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:42: error: expected primary-expression before '<' token
   45 |                         } else if (d[j] =< dj) {
      |                                          ^
Language: C++

#include <bits/stdc++.h>
#define int long long
#define inf 100000000000000000
#define f first
#define s second
using namespace std;
int32_t main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n,m;
	cin >> n >> m;
	pair <pair<int,int>,int> v[m];
	for(int i=0;i<m;++i)
		cin >> v[i].f.f >> v[i].s >> v[i].f.s ;
	sort(v,v+m);
	int d[n+1];
	for(int i=1;i<=n;i++)
		d[i]=inf;
	d[1]=0;
	set <int> s;
	s.insert(1);
	s.insert(n);
	for(int i=0;i<m;++i){
		int l=v[i].f.f,r=v[i].s,c=v[i].f.s;
		auto itl,itr,t;
		itr=s.lower_bound(r);
		itl=s.lower_bound(l);
		int x=d[*itl]+c;
		if(x>=d[*itr])
			continue;
		t=--itr;
		while(d[*t]>=x){
			if(t==s.begin()){
				s.erase(t);
				break;
			}
			t--;
			s.erase(itr);
			itr=t;
		}
		s.insert(r);
		d[r]=x;
	}
	// for(int i=1;i<=n;i++)
	// 	cout << d[i] << " ";
	if(d[n]==inf)
		d[n]=-1;
	cout << d[n] << endl;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:25:17: error: declaration of 'auto itl' has no initializer
   25 |                 auto itl,itr,t;
      |                 ^~~~
a.cc:25:17: error: declaration of 'auto itr' has no initializer
a.cc:25:17: error: declaration of 'auto t' has no initializer
Language: C++

#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pll = pair<long, long>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007
#define INF 1e18

int main(){
  int n,m;
  cin >> n >> m;
  vector<vector<pll>> Graph(n);
  rep(i,n-1){
    Graph.at(i+1).push_back(pll(i,0));
  }
  rep(i,m){
    long l,r,c;
    cin >> l >> r >> c;
    Graph.at(l-1).push_back(pll(r-1,c));
  }
  priotiry_queue<pll> que;
  vector<long> dis(n,INF);
  dis.at(0) = 0;
  que.push(pll(0,0));
  while(que.size()){
    pll P = que.top();
    que.pop();
    long v = P.first;
    long d = P.second;
    //cout << v << endl;
    if(d > dis.at(v)) continue;
    //cout << d << " " << dis.at(v) << endl;
    for(pll nP : Graph.at(v)){
      long nv = nP.first;
      long cost = nP.second;
      if(d + cost < dis.at(nv)){
        dis.at(nv) = d + cost;
        que.push(pll(nv,dis.at(nv)));
      }
    }
  }
  //rep(i,n-1) cout << dis.at(i) << endl;
  if(dis.at(n-1) == INF) cout << -1 << endl;
  else cout << dis.at(n-1) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:3: error: 'priotiry_queue' was not declared in this scope
   27 |   priotiry_queue<pll> que;
      |   ^~~~~~~~~~~~~~
a.cc:27:21: error: expected primary-expression before '>' token
   27 |   priotiry_queue<pll> que;
      |                     ^
a.cc:27:23: error: 'que' was not declared in this scope
   27 |   priotiry_queue<pll> que;
      |                       ^~~
Language: C++


#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

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

    int N, M;
    cin >> N >> M;

    vector<map<int, int>> edge(N);
    rep(i, N-1) {
        edge[i+1][i] = 0;
    }

    rep(i, M) {
        int L, R, C;
        cin >> L >> R >> C;
        --L; --R;
        if (edge[L].find(R) == edge[L].end()) {
            edge[L][R] = C;
        } else {
            edge[L][R] = min(C, edge[L][R]);
        }
    }

    vector<bool> visited(N);
    vector<int> costTo(N, INT_MAX);
    costTo[0] = 0;
    priority_queue<pair<int, int>> q;  //! (cost, dest)
    q.push({0, 0});

    while (!q.empty()) {
        auto c = q.top(); q.pop();
        int cost = -c.first; 
        int curr = c.second;
        if (!visited[curr]) {
            visited[curr] = true;
            costTo[curr] = min(cost, costTo[curr]);
            for (auto next: edge[curr]) {
                int nextCost = costTo[curr] + next.second;
                q.push({-nextCost, next.first});
            }
        }
    }

    LL ans = -1;
    if (visited[N-1]) {
        ans = costTo[N-1];
    }
    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:27: error: 'INT_MAX' was not declared in this scope
   49 |     vector<int> costTo(N, INT_MAX);
      |                           ^~~~~~~
a.cc:15:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   14 | #include <utility>
  +++ |+#include <climits>
   15 | #include <limits>
Language: C++


#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

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

    int N, M;
    cin >> N >> M;

    vector<map<int, int>> edge(N);
    rep(i, N-1) {
        edge[i+1][i] = 0;
    }

    rep(i, M) {
        int L, R, C;
        cin >> L >> R >> C;
        --L; --R;
        if (edge[L].find(R) == edge[L].end()) {
            edge[L][R] = C;
        } else {
            edge[L][R] = min(C, edge[L][R]);
        }
    }

    vector<bool> visited(N);
    vector<int> costTo(N, INT_MAX);
    costTo[0] = 0;
    priority_queue<pair<int, int>> q;  //! (cost, dest)
    q.push({0, 0});

    while (!q.empty()) {
        auto c = q.top(); q.pop();
        int cost = -c.first; 
        int curr = c.second;
        if (!visited[curr]) {
            visited[curr] = true;
            costTo[curr] = min(cost, costTo[curr]);
            for (auto next: edge[curr]) {
                int nextCost = costTo[curr] + next.second;
                q.push({-nextCost, next.first});
            }
        }
    }

    LL ans = -1;
    if (visited[N-1]) {
        ans = costTo[N-1];
    }
    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:27: error: 'INT_MAX' was not declared in this scope
   48 |     vector<int> costTo(N, INT_MAX);
      |                           ^~~~~~~
a.cc:15:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   14 | #include <utility>
  +++ |+#include <climits>
   15 |
Language: C++

/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using P = pair<ll, ll>;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const ll INF = 1LL << 60;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> const&P){
    os << P.first;
    os << " ";
    os << P.second;
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
vector<ll> dijkstra(const vector<vector<pair<ll,ll>>>& edge, ll start){
    ll N = edge.size();
    vector<ll> dist(N,INF);
    priority_queue<pair<ll,ll>,vector<pair<ll,ll>>, greater<pair<ll,ll>> > q;
    q.push(mp(0, start));
    vector<bool> visited(N,false);
    
    ll from,d;
    ll to,cost;
    while(!q.empty()){
        tie(d,from) = q.top(); q.pop();
        if (visited[from]) continue;
        visited[from] = true;
        dist[from] = d;
        for(auto e:edge[from]){
            tie(to,cost) = e;
            if (visited[to]) continue;
            q.push(mp(d+cost, to));
        }
    }

    return dist;
}
//fixed<<setprecision(10)<<ans<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    vector<vector<pair<int,int>>> edge(N);
    int l,r,c;
    REP(i,M){
        cin >> l >> r >> c;
        l--;r--;
        edge[l].push_back(mp(r,c)); 
    }
    REP(i,N-1) edge[i+1].push_back(mp(i,0)); //重み0の辺
    auto dist = dijkstra(edge, 0);

    if (dist[N-1]>=INF) cout << -1 << endl;
    else cout << dist[N-1]<< endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:100:26: error: invalid initialization of reference of type 'const std::vector<std::vector<std::pair<long long int, long long int> > >&' from expression of type 'std::vector<std::vector<std::pair<int, int> > >'
  100 |     auto dist = dijkstra(edge, 0);
      |                          ^~~~
a.cc:63:56: note: in passing argument 1 of 'std::vector<long long int> dijkstra(const std::vector<std::vector<std::pair<long long int, long long int> > >&, ll)'
   63 | vector<ll> dijkstra(const vector<vector<pair<ll,ll>>>& edge, ll start){
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
Language: C++

/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using P = pair<ll, ll>;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const ll INF = 1LL << 60;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> const&P){
    os << P.first;
    os << " ";
    os << P.second;
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
vector<ll> dijkstra(vector<vector<pair<int,int>>>& edge, int start){
    int n = edge.size();
    vector<ll> dist(n,INF);
    dist[0]=0;
    priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> pq;
    pq.emplace(0,0);
    while(pq.size()){
        auto p = pq.top();pq.pop();
        if(dist[p.second]<p.first)continue;
        for(auto to: v[p.second]){
            if(dist[to.first]>dist[p.second]+to.second){
                dist[to.first]=dist[p.second]+to.second;
                pq.emplace(dist[to.first],to.first);
            }
        }
    }
    return dist;
}
//fixed<<setprecision(10)<<ans<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    vector<vector<pair<int,int>>> edge(N);
    int l,r,c;
    REP(i,M){
        cin >> l >> r >> c;
        l--;r--;
        edge[l].push_back(mp(r,c)); 
    }
    REP(i,N-1) edge[i+1].push_back(mp(i,0)); //重み0の辺
    auto dist = dijkstra(edge, 0);

    if (dist[N-1]>=inf) cout << -1 << endl;
    else cout << dist[N-1]<< endl;
}


Compiler output:
a.cc: In function 'std::vector<long long int> dijkstra(std::vector<std::vector<std::pair<int, int> > >&, int)':
a.cc:72:22: error: 'v' was not declared in this scope
   72 |         for(auto to: v[p.second]){
      |                      ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <set>
#include <queue>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	int m; cin >> m;
	vector<pair<int,pair<int,ll> > >v;
	for(int i=0;i<m;i++){
		ll l,r,c; cin >> l >> r >> c;
		v.push_back(make_pair(l,make_pair(r,c)));
	}
	sort(v.begin(),v.end());
	for(int i=0;i<n;i++){
		dp[i]=1e15;
	}
	map<int,ll> mp;
	set<int> s;
	s.insert(1);
	s.insert(n);
	mp[1]=0;
	mp[n]=1e15;
	for(int i=0;i<m;i++){
		int k=*(s.upper_bound(v[i].first-1));
		//cout << k << endl;
		if(k==1||(mp[k]<1e15&&mp[k]>0)){
			s.insert(v[i].second.first);
			if(mp[v[i].second.first]==0){
				mp[v[i].second.first]=mp[k]+v[i].second.second;
			}
			else{
				mp[v[i].second.first]=min(mp[v[i].second.first],mp[k]+v[i].second.second);
			}
		}
	}
	//cout << mp[3] << endl;
	if(mp[n]==1e15){
		cout << -1 << endl;
	}
	else{
		cout << mp[n] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: 'dp' was not declared in this scope
   23 |                 dp[i]=1e15;
      |                 ^~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359

#define tMOD 998244353
 vector<ll> v[105000];
 ll ans = 10000000333;
 ll cost[105000][105000]={0};
   ll N,M;

 
  ll ser(ll pre,ll now,ll C,ll cou){

    if(cou>=N-1){
      return 0;
    }
    if(now==0){
      ans =min(ans,C);
      return 0;
    }
    

    for(ll i=0;i<v[now].size();i++){
      if(v[now][i]!=pre)
      ser(now,v[now][i],C+cost[now][v[now][i]],cou+1);
    }
    return 0;
  }



 
int main(){

  cin>>N>>M;
  for(ll i=0;i<N;i++){
    
  }
  ll tmp,tmp1,tmp2;
  for(ll i=0;i<M;i++){
    cin>>tmp>>tmp1>>tmp2;
    tmp--;
    tmp1--;
    for(ll i=tmp;i<=tmp1;i++){
      for(ll j=i;j<=tmp1;j++){
        if(cost[i][j]==0){
          if(i!=j){
        v[i].push_back(j);
        v[j].push_back(i);
          }
        }
        if(cost[i][j]==0||cost[i][j]>tmp2){
          cost[i][j]=tmp2;
          cost[j][i]=tmp2;
        }
      }
    }
  }



ser(-1,N-1,0,0);

if(ans ==10000000333){
  cout<<-1<<endl;
}
cout<<ans<<endl;


 


}


Compiler output:
/tmp/ccp6apQ8.o: in function `ser(long long, long long, long long, long long)':
a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccp6apQ8.o
/tmp/ccp6apQ8.o: in function `main':
a.cc:(.text+0x1a0): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccp6apQ8.o
a.cc:(.text+0x1bc): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccp6apQ8.o
a.cc:(.text+0x1dd): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccp6apQ8.o
a.cc:(.text+0x3d7): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccp6apQ8.o
a.cc:(.text+0x3e8): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccp6apQ8.o
collect2: error: ld returned 1 exit status
Language: C++

#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


const ll INF = 1e18;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

struct Data{
    ll cost;
    int to;
};
bool operator<(const Data& lhs, const Data& rhs){
    if(lhs.cost != rhs.cost)
        return lhs.cost < rhs.cost;
    else{
        return lhs.to > rhs.to;
    }
}


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

    vector<vector<int>> retu(n+1);
    vector<Data> aiueo(n+1);

    vector<Data> dat(m);
    REP(i, m){
        int l, r, c;
        cin >> l >> r >> c;
        l--, r--;
        dat[i] = {r, c};
        retu[l].push_back(i);
        retu[r].push_back(-i);
    }

    set<Data> se;
    set<Data> ng;
    REP(i, n){
        for(auto t: retu[i]){
            if(t > 0){
                se.insert(dat[t]);
            }
            else{
                ng.insert(dat[t]);
            }
        }
        while(!se.empty()){
            auto dd = se.begin();
            if(ng.count(*dd)){
                se.erase(se.begin());
            }
            else
                break;
        }
            aiueo[i] = *(se.begin());
    }

    int now = 0;
    ll cost = 0;
    while(now < n-1){
        auto to = aiueo[now];
        if(to.cost == INF)
{
    cout << -1 << endl;
    return 0;
}
cost += to.cost;
to = to.to;
    }
    cout << cost << endl;
    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:115:9: error: no match for 'operator=' (operand types are 'Data' and 'int')
  115 | to = to.to;
      |         ^~
a.cc:53:8: note: candidate: 'constexpr Data& Data::operator=(const Data&)'
   53 | struct Data{
      |        ^~~~
a.cc:53:8: note:   no known conversion for argument 1 from 'int' to 'const Data&'
a.cc:53:8: note: candidate: 'constexpr Data& Data::operator=(Data&&)'
a.cc:53:8: note:   no known conversion for argument 1 from 'int' to 'Data&&'