func_code_string: #include <bits/stdc++.h>   const int MAX_N = 3e5 + 2;   struct Ant {     int id;     long long pos, speed;     Ant(){};     Ant(int id, long long pos, long long speed) {       this->id = id;       this->pos = pos;       this->speed = speed;     }   };   bool comparePosition(Ant a, Ant b) { return (a.pos < b.pos); }   long long mod(long long x, long long m) { return ((x % m) + m) % m; }   int ans[MAX_N];   std::vector<Ant> startPosition, endPosition;   int main() {     int n;     long long cycleLength, time;     std::cin >> n >> cycleLength >> time;     for (int i = 1; i <= n; i++) {       int pos;       char dir;       std::cin >> pos >> dir;       startPosition.push_back(Ant(i, pos, (dir ==  R ) ? 1 : -1));     }     std::sort(startPosition.begin(), startPosition.end(), comparePosition);     for (int i = 0; i < (int)startPosition.size(); i++)       endPosition.push_back(startPosition[i]);     long long cyclicShift = 0;     for (int i = 0; i < n; i++) cyclicShift += startPosition[i].speed;     cyclicShift = mod(cyclicShift * (time / cycleLength), n);     time %= cycleLength;     for (int i = 0; i < n; i++) {       endPosition[i].pos =           mod((startPosition[i].pos - 1) + time * startPosition[i].speed,               cycleLength) +           1;       if (startPosition[i].speed == 1) {         if (endPosition[i].pos < startPosition[i].pos) cyclicShift++;       } else {         if (endPosition[i].pos > startPosition[i].pos) cyclicShift--;       }     }     cyclicShift = mod(cyclicShift, n);     std::sort(endPosition.begin(), endPosition.end(), comparePosition);     for (int i = 0; i < n; i++) {       endPosition[i].id = startPosition[mod(i - cyclicShift, n)].id;       ans[endPosition[i].id] = endPosition[i].pos;     }     for (int i = 1; i <= n; i++) printf( %d  , ans[i]);     printf(  n );     return 0;   }   