func_code_string: #include <bits/stdc++.h>   using namespace std;   const long double PI = 3.141592653589793238462643383279;   const long double EPS = 1e-6;   const int INF = 1e9 + 7;   const long long MOD = INF;   const long long maxn = 5e5 + 2;   const long long HASH_MODS[] = {1000000007333, 1000000009367, 1000000075747,                                  1000000158923, 1000000203119};   int n, m;   int num[maxn];   int f[maxn];   int child[maxn];   int tin[maxn];   int tout[maxn];   int cnt = 0;   int timer;   string s;   vector<pair<int, int> > hsh[maxn];   void add_edge(int a, int b) {     child[++cnt] = b;     num[cnt] = f[a];     f[a] = cnt;   }   void dfs(int v, int h) {     tin[v] = ++timer;     hsh[h].push_back({timer, hsh[h].back().second ^ (1 << (s[v] -  a ))});     for (int e = f[v]; e; e = num[e]) {       dfs(child[e], h + 1);     }     tout[v] = ++timer;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     cin >> n >> m;     for (int i = (0); i < (n); ++i) hsh[i].resize(1);     for (int i = (1); i < (n); ++i) {       int t;       cin >> t;       add_edge(t - 1, i);     }     cin >> s;     dfs(0, 0);     while (m--) {       int v, h;       cin >> v >> h;       v--;       h--;       int l = lower_bound(hsh[h].begin(), hsh[h].end(), make_pair(tin[v], -1)) -               hsh[h].begin() - 1;       int r = lower_bound(hsh[h].begin(), hsh[h].end(), make_pair(tout[v], -1)) -               hsh[h].begin() - 1;       int t = hsh[h][r].second ^ hsh[h][l].second;       bool ok = t - (t & -t);       if (!ok)         cout <<  Yes n ;       else         cout <<  No n ;     }   }   