func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, q;   string s;   int main() {     cin >> n >> q;     while (q--) {       vector<pair<long long, long long> > v;       long long x, l = 1, r = n, cur = n / 2 + 1;       cin >> x >> s;       while (cur != x) {         v.push_back({l, r});         if (x < cur) {           r = cur - 1;           cur = (l + r) / 2;         } else {           l = cur + 1;           cur = (l + r) / 2;         }       }       for (int i = 0; i < s.size(); i++) {         if (s[i] ==  U ) {           if (!v.empty()) {             l = v.back().first, r = v.back().second;             cur = (l + r) / 2;             v.pop_back();           }         }         if (s[i] ==  L ) {           if (l != r) {             v.push_back({l, r});             r = cur - 1;             cur = (l + r) / 2;           }         }         if (s[i] ==  R ) {           if (l != r) {             v.push_back({l, r});             l = cur + 1;             cur = (l + r) / 2;           }         }       }       cout << cur << endl;     }   }   