func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   const long double eps = 1e-7;   const int inf = 1000000010;   const long long INF = 10000000000000010LL;   const int mod = 1000000007;   const int MAXN = 200010, LOG = 20;   int n, m, k, u, v, x, y, t, a, b;   long long A[MAXN];   int par[MAXN][LOG];   long long dist[MAXN][LOG];   int ans[MAXN];   vector<int> G[MAXN];   void dfs(int node) {     for (int i = 1; i < LOG; i++) par[node][i] = par[par[node][i - 1]][i - 1];     for (int i = 1; i < LOG; i++)       dist[node][i] =           min(1ll * inf, dist[par[node][i - 1]][i - 1] + dist[node][i - 1]);     for (int v : G[node]) {       dfs(v);       ans[node] += ans[v];     }     ans[par[node][0]]++;     long long v = node, tmp = A[node];     for (int i = LOG - 1; i >= 0; i--)       if (dist[v][i] <= tmp) {         tmp -= dist[v][i];         v = par[v][i];       }     v = par[v][0];     ans[v]--;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 1; i <= n; i++) cin >> A[i];     for (int i = 2; i <= n; i++) {       cin >> par[i][0] >> dist[i][0];       G[par[i][0]].push_back(i);     }     par[1][0] = 0;     dfs(1);     for (int i = 1; i <= n; i++) cout << ans[i] <<    ;     return 0;   }   