func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = (int)1e9;   const double INF = 1e12, EPS = 1e-9;   const int B = 2000;   const int dy[] = {-1, 0, 1, 0}, dx[] = {0, -1, 0, 1};   int h, w, q;   int qs[100000][4];   char in[100010][12], dir[256];   int dp[100010 * 12], vis[100010][12];   inline int to(int y, int x) {     int &res = dp[y * 12 + x];     if (res != -1) return res;     if (y == 0 || x == 0 || x == w + 1) return res = y * 12 + x;     res = -2;     int d = dir[in[y][x]];     return res = to(y + dy[d], x + dx[d]);   }   int main() {     dir[ < ] = 1;     dir[ ^ ] = 0;     dir[ > ] = 3;     scanf( %d%d%d , &h, &w, &q);     for (int i = 0; i < (int)h; i++) scanf( %s , in[i + 1] + 1);     for (int i = 0; i < (int)q; i++) {       char c, d;       int y, x;       scanf(  %c%d%d , &c, &y, &x);       qs[i][0] = c ==  A ;       qs[i][1] = y;       qs[i][2] = x;       if (c ==  C ) {         scanf(  %c , &d);         qs[i][3] = d;       }     }     memset(vis, -1, sizeof(vis));     for (int it = 0; it < (int)q; it++) {       if (it % B == 0) {         memset(dp, -1, sizeof(dp));         for (int i = it; i < it + B && i < q; i++)           if (qs[i][0] == 0) {             int y = qs[i][1], x = qs[i][2];             dp[y * 12 + x] = y * 12 + x;           }       }       int y = qs[it][1], x = qs[it][2];       if (!qs[it][0]) {         in[y][x] = (char)qs[it][3];         continue;       }       while (1) {         if (x == 0 || x == w + 1 || y == 0) {           printf( %d %d n , y, x);           break;         }         if (vis[y][x] == it) {           puts( -1 -1 );           break;         }         vis[y][x] = it;         int ny = to(y, x), nx;         if (ny < 0) {           puts( -1 -1 );           break;         }         nx = ny % 12;         ny /= 12;         if (nx == 0 || nx == w + 1 || ny == 0) {           printf( %d %d n , ny, nx);           break;         }         int d = dir[in[ny][nx]];         y = ny + dy[d];         x = nx + dx[d];       }     }     return 0;   }   