func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long maxn = 3e5 + 30;   long long N, M, T, X[maxn], ans[maxn], shift;   char W[maxn];   vector<pair<long long, long long> > v;   vector<long long> last;   int main() {     cin >> N >> M >> T;     for (long long i = 1; i <= N; i++) {       scanf( %lld %c , &X[i], &W[i]);       v.push_back(pair<long long, long long>(X[i], i));       W[i] = W[i] ==  L  ? -1 : 1;     }     for (long long i = 1; i <= N; i++) {       long long a = (X[i] + T * W[i]), plus = 0;       if (W[i] == -1) {         a = a <= 0 ? (-a) / M + 1 : 0;       } else         plus = -(!(a % M)), a /= M;       shift += W[i] * a + plus;     }     T %= M;     for (long long i = 1; i <= N; i++) {       long long a = X[i] + T * W[i] + M;       a = (a - 1) % M + 1;       last.push_back(a);     }     sort(v.begin(), v.end());     sort(last.begin(), last.end());     if (shift) shift = shift / abs(shift) * (abs(shift) % N);     long long beg = ((-shift + N + 1) - 1) % N + 1;     long long j = 0;     for (long long i = beg - 1; i < N; i++) ans[v[i].second] = last[j++];     for (long long i = 0; i < beg - 1; i++) ans[v[i].second] = last[j++];     for (long long i = 1; i <= N; i++) printf( %lld  , ans[i]);     return 0;   }   