func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   const int maxt = 1 << 20;   int p[maxn], t[maxn];   bool vis[maxn], cut[maxn];   long long x[maxn], l[maxn], cal[maxn], bit1[maxt], bit2[maxt];   vector<int> son[maxn];   void dfs1(int u, long long rem) {     rem -= l[u] << 1;     for (int i = t[u]; i < maxt; i += (i & -i))       bit1[i] += x[u], bit2[i] += x[u] * t[u];     if (rem > 0) {       int l = 0, r = maxt - 1;       long long sum = 0;       for (int i = r; i; i -= (i & -i)) cal[u] += bit1[i], sum += bit2[i];       if (sum > rem) {         while (r - l ^ 1) {           int mid = l + r >> 1;           sum = 0;           for (int i = mid; i; i -= (i & -i)) sum += bit2[i];           if (sum > rem)             r = mid;           else             l = mid;         }         cal[u] = sum = 0;         for (int i = l; i; i -= (i & -i)) cal[u] += bit1[i], sum += bit2[i];         cal[u] += (rem - sum) / r;       }     }     for (auto v : son[u]) dfs1(v, rem);     for (int i = t[u]; i < maxt; i += (i & -i))       bit1[i] -= x[u], bit2[i] -= x[u] * t[u];   }   long long dfs2(int u) {     long long max1 = 0, max2 = 0;     for (auto v : son[u]) {       long long temp = dfs2(v);       if (max2 < temp) max2 = temp;       if (max1 < max2) swap(max1, max2);     }     return max(max2, cal[u]);   }   int main() {     int n;     long long T;     cin >> n >> T;     for (int i = 1; i <= n; ++i) cin >> x[i];     for (int i = 1; i <= n; ++i) cin >> t[i];     for (int i = 2; i <= n; ++i) {       cin >> p[i] >> l[i];       son[p[i]].push_back(i);     }     dfs1(1, T);     son[1].push_back(0);     cal[0] = 0x3f3f3f3f3f3f3f3f;     cout << dfs2(1) << endl;   }   