func_code_string: #include <bits/stdc++.h>   using namespace std;   long long A[100005], Nr[100005], Viz[100005];   vector<pair<long long, long long> > V[100005];   long long n;   long long ans;   long long DFSNR(long long x) {     long long nrc = 1;     Viz[x] = 1;     for (auto i : V[x])       if (!Viz[i.first]) {         nrc += DFSNR(i.first);       }     Nr[x] = nrc;     return nrc;   }   void DFS(long long x, long long dist) {     if (A[x] < dist) {       ans += Nr[x];       return;     }     Viz[x] = 1;     for (auto i : V[x])       if (!Viz[i.first]) {         DFS(i.first, max(dist + i.second, i.second));       }   }   int main() {     cin >> n;     for (long long i = 1; i <= n; i++) cin >> A[i];     for (long long i = 1; i < n; i++) {       long long x, y;       cin >> x >> y;       V[x].push_back({i + 1, y});       V[i + 1].push_back({x, y});     }     DFSNR(1);     memset(Viz, 0, sizeof(Viz));     DFS(1, 0);     cout << ans;     return 0;   }   