func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 100100, SQRT = 320, MAXM = 13;   int N, M, Q;   pair<int, int> up[MAXN][MAXM];   pair<int, int> jump[MAXN][MAXM];   char grid[MAXN][MAXM];   bool bounded(int x, int y) { return 1 <= x && x <= N && 1 <= y && y <= M; }   bool bounded(pair<int, int> p) { return bounded(p.first, p.second); }   pair<int, int> getup(int x, int y) {     pair<int, int> &ref = up[x][y];     if (ref.first != -2) {       return ref;     }     if (!bounded(x, y)) {       return ref = pair<int, int>(x, y);     }     if (grid[x][y] ==  ^ ) {       return ref = pair<int, int>(x - 1, y);     } else if (grid[x][y] ==  < ) {       return ref = (grid[x][y - 1] ==  >  ? pair<int, int>(-1, -1)                                           : getup(x, y - 1));     } else {       return ref = (grid[x][y + 1] ==  <  ? pair<int, int>(-1, -1)                                           : getup(x, y + 1));     }   }   void calcjump(int i) {     if (i % SQRT == 1) {       copy_n(up[i] + 1, M, jump[i] + 1);     } else {       for (int j = 1; j <= M; j++) {         pair<int, int> p = up[i][j];         jump[i][j] = bounded(p) ? jump[p.first][p.second] : p;       }     }   }   int main() {     if (fopen( input.txt ,  r )) {       freopen( input.txt ,  r , stdin);     }     ios_base::sync_with_stdio(false);     scanf( %d %d %d n , &N, &M, &Q);     for (int i = 1; i <= N; i++) {       gets(grid[i] + 1);       fill_n(up[i], M + 2, pair<int, int>(-2, -2));     }     for (int i = 0; i <= N; i++) {       for (int j = 0; j <= M + 1; j++) {         getup(i, j);       }     }     for (int i = 1; i <= N; i++) {       calcjump(i);     }     char ch;     for (int x, y; Q--;) {       scanf( %c %d %d , &ch, &x, &y);       if (ch ==  A ) {         pair<int, int> p(x, y);         while (bounded(p)) {           p = jump[p.first][p.second];         }         printf( %d %d n , p.first, p.second);       } else {         scanf(  %c , &ch);         grid[x][y] = ch;         fill_n(up[x] + 1, M, pair<int, int>(-2, -2));         for (int j = 1; j <= M; j++) {           getup(x, j);         }         for (calcjump(x++); x <= N && x % SQRT != 1; x++) {           calcjump(x);         }       }       getchar();     }   }   