func_code_string: #include <bits/stdc++.h>   using namespace std;   long long Set(long long N, long long pos) { return N = N | (1 << pos); }   long long reset(long long N, long long pos) { return N = N & ~(1 << pos); }   bool check(long long N, long long pos) { return (bool)(N & (1 << pos)); }   void CI(long long &_x) { scanf( %I64d , &_x); }   void CO(long long &_x) { cout << _x; }   template <typename T>   void getarray(T a[], long long n) {     for (long long i = 0; i < n; i++) cin >> a[i];   }   template <typename T>   void prLLIarray(T a[], long long n) {     for (long long i = 0; i < n - 1; i++) cout << a[i] <<    ;     cout << a[n - 1] << endl;   }   const double EPS = 1e-9;   const long long INF = 0x7f7f7f7f;   long long dr8[8] = {1, -1, 0, 0, 1, -1, -1, 1};   long long dc8[8] = {0, 0, -1, 1, 1, 1, -1, -1};   long long dr4[4] = {0, 0, 1, -1};   long long dc4[4] = {-1, 1, 0, 0};   long long kn8r[8] = {1, 2, 2, 1, -1, -2, -2, -1};   long long kn8c[8] = {2, 1, -1, -2, -2, -1, 1, 2};   char grid[155][155];   int main() {     vector<pair<int, int> > V;     int n, m;     cin >> n >> m;     int last;     for (int i = 0; i < n; i++) {       int mini = 1 << 30, maxi = -1;       for (int j = 0; j < m; j++) {         cin >> grid[i][j];         if (grid[i][j] ==  W ) {           last = i;           mini = min(mini, j);           maxi = max(maxi, j);         }       }       V.push_back(make_pair(mini, maxi));     }     int ans = 0, pos_x = 0, pos_y = 0;     for (int i = 0; i <= last; i++) {       int dir = i % 2;       if (dir == 0) {         int mm = pos_y;         mm = max(mm, V[i].second);         if (i < last) mm = max(mm, V[i + 1].second);         ans += mm - pos_y + 1;         pos_y = mm;       } else {         int mm = pos_y;         mm = min(mm, V[i].first);         if (i < last) mm = min(mm, V[i + 1].first);         ans += (pos_y - mm) + 1;         pos_y = mm;       }     }     cout << max(ans - 1, 0) <<   n ;   }   