func_code_string: #include <bits/stdc++.h>   using namespace std;   map<char, int> tile = {       { + , 15},     { - , 8 + 2},  { | , 1 + 4},  { ^ , 1},       { v , 4},      { > , 2},      { < , 8},      { L , 15 - 8},       { R , 15 - 2}, { U , 15 - 1}, { D , 15 - 4}, { * , 0},   };   int n, m, xt, yt, xm, ym;   vector<string> laby;   bool ok(char t, int d, int l, int x, int y) {     if (x < 0 || x >= n) return false;     if (y < 0 || y >= m) return false;     int t1 = tile[t],         t2 = ((((((((tile[laby[x][y]]) << 1) & 15) + ((tile[laby[x][y]]) >> 3)))                 << 1) &                15) +               ((((((tile[laby[x][y]]) << 1) & 15) + ((tile[laby[x][y]]) >> 3))) >>                3));     for (__typeof(l) _i = 0; _i < (l); ++_i) {       t1 = ((((t1) << 1) & 15) + ((t1) >> 3));       t2 = ((((t2) << 1) & 15) + ((t2) >> 3));     }     return t1 & t2 & d;   }   int main() {     cin >> n >> m;     laby.resize(n);     for (__typeof(n) i = 0; i < n; ++i) cin >> laby[i];     cin >> xt >> yt >> xm >> ym;     xt--, yt--, xm--, ym--;     vector<bool> seen(n * m * 4);     deque<pair<int, int>> q = {{0, ((0) * n * m + (xt)*m + yt)}};     while (q.size()) {       pair<int, int> p = q.front();       q.pop_front();       int t = p.first, pos = p.second;       if (seen[pos]) continue;       seen[pos] = true;       int l = pos / n / m, y = pos % m, x = pos / m % n;       if (x == xm && y == ym) {         cout << t << endl;         return 0;       }       q.push_back({t + 1, ((l + 1 & 3) * n * m + (x)*m + y)});       if (ok(laby[x][y], 1, l, x - 1, y)) {         q.push_back({t + 1, ((l)*n * m + (x - 1) * m + y)});       }       if (ok(laby[x][y], 4, l, x + 1, y)) {         q.push_back({t + 1, ((l)*n * m + (x + 1) * m + y)});       }       if (ok(laby[x][y], 8, l, x, y - 1)) {         q.push_back({t + 1, ((l)*n * m + (x)*m + y - 1)});       }       if (ok(laby[x][y], 2, l, x, y + 1)) {         q.push_back({t + 1, ((l)*n * m + (x)*m + y + 1)});       }     }     cout << -1 << endl;     return 0;   }   