func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   using v2d = vector<vector<T> >;   template <class T>   bool uin(T &a, T b) {     return a > b ? (a = b, true) : false;   }   template <class T>   bool uax(T &a, T b) {     return a < b ? (a = b, true) : false;   }   mt19937 rng(chrono::system_clock::now().time_since_epoch().count());   const int maxN = 2e5 + 10;   int n, q;   vector<int> adj[maxN];   int t[maxN], in[maxN], out[maxN], f[maxN * 4], lazy[maxN * 4], mp[maxN];   int L, R;   void dfs(int u) {     in[u] = ++in[0];     mp[in[u]] = u;     for (auto &v : adj[u]) {       dfs(v);     }     out[u] = in[0];   }   void build(int x, int lo, int hi) {     if (lo == hi) {       f[x] = t[mp[lo]];       return;     }     int mid = (lo + hi) / 2;     build(x * 2, lo, mid);     build(x * 2 + 1, mid + 1, hi);     f[x] = f[x * 2] + f[x * 2 + 1];   }   void down(int x, int lo, int hi) {     int t = lazy[x];     lazy[x] = 0;     if (t & 1) {       int mid = (lo + hi) / 2;       ++lazy[x * 2];       f[x * 2] = mid - lo + 1 - f[x * 2];       ++lazy[x * 2 + 1];       f[x * 2 + 1] = hi - mid - f[x * 2 + 1];     }   }   void update(int x, int lo, int hi) {     if (lo > R || hi < L) {       return;     }     if (lo >= L && hi <= R) {       f[x] = hi - lo + 1 - f[x];       ++lazy[x];       return;     }     down(x, lo, hi);     int mid = (lo + hi) / 2;     update(x * 2, lo, mid);     update(x * 2 + 1, mid + 1, hi);     f[x] = f[x * 2] + f[x * 2 + 1];   }   int query(int x, int lo, int hi) {     if (lo > R || hi < L) {       return 0;     }     if (lo >= L && hi <= R) {       return f[x];     }     int mid = (lo + hi) / 2;     down(x, lo, hi);     return query(x * 2, lo, mid) + query(x * 2 + 1, mid + 1, hi);   }   void solve() {     cin >> n;     for (int i = (int)(2); i <= (int)(n); ++i) {       int p;       cin >> p;       adj[p].emplace_back(i);     }     for (int i = 1; i <= (int)(n); ++i) {       cin >> t[i];     }     dfs(1);     build(1, 1, n);     cin >> q;     while (q--) {       string task;       int v;       cin >> task >> v;       if (task ==  get ) {         L = in[v], R = out[v];         cout << query(1, 1, n) <<   n ;       } else {         L = in[v], R = out[v];         update(1, 1, n);       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int T = 1;     while (T--) {       solve();     }     return 0;   }   