Language: C++

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)
const int INF = (1<<30);
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

class HOGE{
  public:
    ll index;
    ll value;
    HOGE(ll index, ll value){
      this->index = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "index : " << index << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

class Dijkstra{
  //Dijkstra algorithm
  //calculation time complexity: O(|W| log |V|)
  //useful without negative cost
  private:
    struct edge { ll to, cost; };
    typedef pair<ll, ll> P; //first is the shortest distance, second is the number of vertex

    ll V, E;
    vector<ll> d;
    vector<ll> prev;
    vector<vector<edge> > G;

  public:
    Dijkstra(ll V, vector<ll> From, vector<ll> To, vector<ll> Cost){
      //num of vertex
      this->V = V;
      d.resize(V, INT_MAX);
      prev.resize(V, -1);
      E = From.size();
      if(To.size() != E || Cost.size() != E){
        fprintf(stderr, "Sizes are different, %d %d %d\n", From.size(), To.size(), Cost.size());
        exit(0);
      }
      G.resize(V);
      for(ll i=0; i<E; ++i){
        edge tmp_forward = {To[i], Cost[i]};
        G[From[i]].push_back(tmp_forward);
      }
      return;
    };

    ~Dijkstra(void){
      return;
    };

    //calculate shortest path from s vertex to others
    void shortest_path(ll s){
      priority_queue<P, vector<P>, greater<P> > que;
      for(ll i=0; i<V; ++i) d[i] = INT_MAX;
      d[s] = 0;
      que.push(P(0, s));

      while(!que.empty()){
        P p = que.top(); que.pop();
        ll v = p.second;
        if(d[v] < p.first) continue;
        for(ll 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;
            prev[e.to] = v;
            que.push(P(d[e.to], e.to));
          }
        }
      }
      return;
    };

    ll get_distance(ll vertex){
      return d[vertex];
    };

    //shortest path to vertex t
    vector<ll> get_path(ll t){
      vector<ll> path;
      for(; t!=-1; t=prev[t]){
        path.push_back(t);
      }
      reverse(path.begin(), path.end());
      return path;
    };
};


int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll n, m, s, t;
  cin >> n >> m >> s >> t;
  vector<ll> u(2*m), v(2*m), a(2*m), b(2*m);
  rep(i, 0, m){
    cin >> u[i] >> v[i] >> a[i] >> b[i];
    u[i] -= 1;
    v[i] -= 1;
    u[i+m] = v[i];
    v[i+m] = u[i];
    a[i+m] = a[i];
    b[i+m] = b[i];
  }

  ll initial = 1;
  rep(i, 0, 15){
    initial *= 10;
  }

  Dijkstra D1(n, u, v, a);
  Dijkstra D2(n, u, v, b);

  D1.shortest_path(s-1);
  D2.shortest_path(t-1);

  vector<ll> shortest1(n);
  vector<ll> shortest2(n);

  rep(i, 0, n){
    shortest1[i] = D1.get_distance(i);
    shortest2[i] = D2.get_distance(i);
  }

  vector<ll> ans(n);
  ans[n-1] = shortest1[n-1]+shortest2[n-1];
  rep(i, 1, n){
    ans[n-1-i] = min(ans[n-i], shortest1[n-1-i] + shortest2[n-1-i]);
  }

  rep(i, 0, n){
    cout << initial - ans[i] << "\n";
  }

  return 0;
}


Compiler output:
a.cc: In constructor 'Dijkstra::Dijkstra(ll, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>)':
a.cc:91:19: error: 'INT_MAX' was not declared in this scope
   91 |       d.resize(V, INT_MAX);
      |                   ^~~~~~~
a.cc:10:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    9 | #include<functional>
  +++ |+#include <climits>
   10 | 
a.cc: In member function 'void Dijkstra::shortest_path(ll)':
a.cc:113:36: error: 'INT_MAX' was not declared in this scope
  113 |       for(ll i=0; i<V; ++i) d[i] = INT_MAX;
      |                                    ^~~~~~~
a.cc:113:36: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'