func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   long double p[N], k[N];   int par[N];   vector<int> v[N];   bool vstd[N];   void dfs(int node) {     if (vstd[node]) return;     vstd[node] = true;     for (auto u : v[node]) {       if (u != par[node]) {         k[node] += p[u];         par[u] = node;         dfs(u);       }     }     return;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cout << fixed << setprecision(6);     int n;     cin >> n;     long double tmp = 0.0;     for (int i = 0; i < n; i++) {       cin >> p[i];       p[i] = 1.0 - p[i];       tmp += p[i];     }     for (int i = 1; i < n; i++) {       int a, b;       cin >> a >> b;       v[a].push_back(b);       v[b].push_back(a);     }     long double pmt = 0.0;     dfs(0);     for (int i = 0; i < n; i++) pmt += k[i] * p[i];     int q;     cin >> q;     while (q--) {       int node;       cin >> node;       tmp -= p[node];       pmt -= k[node] * p[node];       if (node) {         pmt -= k[par[node]] * p[par[node]];         k[par[node]] -= p[node];       }       cin >> p[node];       p[node] = 1.0 - p[node];       tmp += p[node];       if (node) k[par[node]] += p[node];       pmt += k[node] * p[node];       if (node) pmt += k[par[node]] * p[par[node]];       cout << tmp - pmt <<   n ;     }   }   