func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<long int, long int>> adj[100001];   bool visit[100001] = {};   long int val[100001];   long int ans = 0;   void dfs(long int node, long int w) {     if (w > val[node]) {       return;     }     ans++;     for (long int i = 0; i < (int)adj[node].size(); i++) {       dfs(adj[node][i].first, max(w + adj[node][i].second, (long int)0));     }     return;   }   int main() {     long int n;     cin >> n;     for (long int i = 1; i <= n; i++) cin >> val[i];     for (long int i = 1; i <= n - 1; i++) {       long int x, y;       cin >> x >> y;       adj[x].push_back(make_pair(i + 1, y));     }     dfs(1, 0);     cout << n - ans << endl;   }   