func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int n;   long long int u;   string s;   int q;   int count(long long int number) {     if (!number) return 0;     int result = 0;     while (number % 2 == 0) {       result++;       number >>= 1;     }     return result;   }   long long int solve(long long int start, string s) {     int tmp = count(n + 1) - 1;     for (int i = 0; i < s.size(); ++i) {       int zeros = count(start);       long long int total = ((long long int)1 << (zeros + 1)) - 1;       if (s[i] ==  U ) {         if (zeros < tmp) {           long long int tmp_one = start + (total - 1) / 2 + 1;           long long int tmp_two = start - (total - 1) / 2 - 1;           if (count(tmp_one) == zeros + 1) {             start = tmp_one;           } else             start = tmp_two;         }       } else {         if (s[i] ==  L ) {           if (zeros) {             long long int left = (total - 1) / 2;             start = start - left + ((left - 1) / 2);           }         } else {           if (s[i] ==  R ) {             if (zeros) {               long long int right = (total - 1) / 2;               start = start + (right - 1) / 2 + 1;             }           }         }       }     }     return start;   }   int main() {     cin >> n >> q;     for (int i = 0; i < q; ++i) {       cin >> u >> s;       cout << solve(u, s) << endl;     }     return 0;   }   