Language: C++

/*
ID: usaco.t3
TASK: test
LANG: C++14
*/

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _CRT_SECURE_NO_WARNINGS
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define intt long long

#define pii pair<intt,intt>
#define vi vector<intt>
#define vii vector<pii>

#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define IO ios_base::sync_with_stdio(false);cin.tie();
#define endl '\n'

#define wtfis(x) cerr << "at line " << __LINE__ << ": " << #x << " = " << (x) << endl

const intt max3 = 1003;
const intt max4 = 10004;
const intt maxx = 100005;
const intt max6 = 1000006;
const intt max7 = 10000007;

const intt lg4 = 13;
const intt lg5 = 17;
const intt lg6 = 20;

const intt INF = 2LL * 1000000001;
const intt INFLL = 9LL * 1000000000 * 1000000000;
/***************/

intt powmod (intt a, intt b, intt mod) {
    intt res = 1;
    a %= mod;
    for (; b; b >>= 1) {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

intt gcd (intt a, intt b) {
    while (b > 0) {
        intt t = a % b;
        a = b, b = t;
    }
    return a;
}

intt lcm (intt a, intt b) {
    return (a / gcd (a, b)) * b;
}

intt is_prime (intt n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (intt i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/**************************/

const long long MAX = 1000000000000000LL;

struct edge {
  int to;
  int a;
  int b;
  edge() {}
  edge(int to, int a, int b) : to(to), a(a), b(b) {}
};

int n, m, f, s;
long long dis1[maxx], dis2[maxx];
long long res[maxx];
vector <edge> v[maxx];

void bfs1(int node) {
  for (int i = 1; i <= n; i++) {
    dis2[i] = MAX;
  }
  dis2[node] = 0;
  queue <int> Q;
  Q.push(node);
  while (!Q.empty()) {
    int cur = Q.front();
    Q.pop();
    for (edge e : v[cur]) {
      if (dis2[e.to] > dis2[cur] + e.a) {
        dis2[e.to] = dis2[cur] + e.a;
        Q.push(e.to);
      }
    }
  }
}

void bfs2(int node) {
  for (int i = 1; i <= n; i++) {
    dis1[i] = MAX;
  }
  dis1[node] = 0;
  queue<int> Q;
  Q.push(node);
  while (!Q.empty()) {
    int cur = Q.front();
    Q.pop();
    for (edge e : v[cur]) {
      if (dis1[e.to] > dis1[cur] + e.b) {
        dis1[e.to] = dis1[cur] + e.b;
        Q.push(e.to);
      }
    }
  }
}

int main() {
  // freopen("in.txt","r",stdin);
  // freopen("out.txt","w",stdout);
  IO;
  cin >> n >> m >> f >> s;
  int u, v, a, b;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v >> a >> b;
    v[from].pb(edge(to, a, b));
    v[to].pb(edge(from, a, b));
  }
  bfs1(f);
  bfs2(s);
  long long best = MAX;
  for (int i = n; i > 0; i--) {
    best = min(best, dis1[i] + dis2[i]);
    res[i] = best;
  }
  for (int i = 1; i <= n; i++) {
    cout << MAX - res[i] << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:145:7: error: 'from' was not declared in this scope; did you mean 'fromfp'?
  145 |     v[from].pb(edge(to, a, b));
      |       ^~~~
      |       fromfp
a.cc:145:21: error: 'to' was not declared in this scope; did you mean 'tm'?
  145 |     v[from].pb(edge(to, a, b));
      |                     ^~
      |                     tm