Language: C++

#include <bits/stdc++.h>

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

struct SegmentTreeRMQ {
    vector<ll> data;
    int N;
    
    SegmentTreeRMQ(vector<ll> v) {
        int n = v.size();
        N = 1; while(N < n) N *= 2;
        data.resize(2 * N - 1, numeric_limits<ll>::max());

        for(int i = 0; i < n; i++) {
            data[i + N - 1] = v[i];
        }
        for(int i = N - 2; i >= 0; i--) {
            data[i] = min(data[i * 2 + 1], data[i * 2 + 2]);
        }
    }

    void update(int x, ll val) {
        x += N - 1;
        data[x] = val;
        while(x > 0) {
            x = (x - 1) / 2;
            data[x] = min(data[2 * x + 1], data[2 * x + 2]);
        }
    }

    ll getmin(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = N;
        if (r <= a || b <= l) return numeric_limits<ll>::max();
        if (a <= l && r <= b) return data[k];
        ll val_l = getmin(a, b, 2 * k + 1, l, (l + r) / 2);
        ll val_r = getmin(a, b, 2 * k + 2, (l + r) / 2, r);
        return min(val_l, val_r);
    }
};


struct Edge {
    int to, c, d;
};

vector<int> B;
vector<int> L;
vector<int> R;
vector<int> depth;

void dfs1(int v, int p, vector<vector<Edge>> &G, int d = 0) {
    L[v] = B.size();
    B.push_back(v);
    depth.push_back(d);

    for (int i = 0; i < G[v].size(); i++) {
        if (G[v][i].to == p) continue;
        dfs1(G[v][i].to, v, G, d + 1);
    }
    B.push_back(v);
    depth.push_back(d);
    R[v] = B.size();
}



void dfs1(int v, int p, vector<vector<Edge>> &G, int d = 0) {
    B.push_back(v);
    depth.push_back(d);
    for (int i = 0; i < G[v].size(); i++) {
        if (G[v][i].to == p) continue;
        dfs1(G[v][i].to, v, G, d + 1);
    }
    B.push_back(v);
    depth.push_back(d);
}

vector<map<int, ll>> cnt;
vector<map<int, ll>> sum;

void dfs2(int v, int p, vector<vector<Edge>> &G) {
    for (int i = 0; i < G[v].size(); i++) {
        if (G[v][i].to == p) continue;
        cnt[v][G[v][i].c]++;
        sum[v][G[v][i].c] += G[v][i].d;
        dfs2(G[v][i].to, v, G);
    }
}


void solve() {
    int N, Q;
    cin >> N >> Q;
    L.resize(N);
    R.resize(N);
    cnt.resize(N);
    sum.resize(N);
    vector<vector<Edge>> G(N);

    for (int i = 0; i < N; i++) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--, b--;
        G[a].push_back({b, c, d});
        G[b].push_back({a, c, d});
    }

    dfs1(0, -1, G);

    vector<ll> data(B.size());
    for (int i = 0; i < B.size(); i++) {
        data[i] = depth[i] * 1e9 + B[i];

    }

    SegmentTreeRMQ seg = SegmentTreeRMQ(data);
    for (int q = 0; q < Q; q++) {
        int x, y, u, v;
        cin >> x >> y >> u >> v;
        5000兆円ほしい
        // calc LCA and update diff
    }


}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Compiler output:
a.cc:78:6: error: redefinition of 'void dfs1(int, int, std::vector<std::vector<Edge> >&, int)'
   78 | void dfs1(int v, int p, vector<vector<Edge>> &G, int d = 0) {
      |      ^~~~
a.cc:62:6: note: 'void dfs1(int, int, std::vector<std::vector<Edge> >&, int)' previously defined here
   62 | void dfs1(int v, int p, vector<vector<Edge>> &G, int d = 0) {
      |      ^~~~
a.cc: In function 'void solve()':
a.cc:131:9: error: unable to find numeric literal operator 'operator""\U00005146\U00005186\U0000307b\U00003057\U00003044'
  131 |         5000兆円ほしい
      |         ^~~~~~~~~~~~~~