func_code_string: #include <bits/stdc++.h>   using namespace std;   char grid[2010][2010];   bool vis[2010][2010];   int dx[] = {0, 0, 1, -1};   int dy[] = {-1, 1, 0, 0};   bool valid(int x, int y, int n, int m) {     if (x == n || y == m || x == -1 || y == -1 || vis[x][y] ||         grid[x][y] ==  * ) {       return 0;     }     return 1;   }   int main() {     int n, m;     int sr, sc;     int x, y;     scanf( %d%d%d%d%d%d , &n, &m, &sr, &sc, &x, &y);     sr--, sc--;     for (int i = 0; i < n; i++) {       scanf( %s , grid[i]);     }     int ans = 0;     queue<pair<pair<int, int>, pair<int, int> > > q[2];     int curQ = 0, nxtQ = 1;     q[curQ].push(make_pair(make_pair(sr, sc), make_pair(x, y)));     while (q[curQ].size()) {       while (q[curQ].size()) {         pair<pair<int, int>, pair<int, int> > cur = q[curQ].front();         q[curQ].pop();         int curX = cur.first.first;         int curY = cur.first.second;         int rem[] = {cur.second.first, cur.second.second};         if (valid(curX, curY, n, m) == 0) {           continue;         }         ans++;         vis[curX][curY] = 1;         for (int i = 0; i < 4; i++) {           if (i < 2) {             if (rem[i] == 0) continue;             rem[i]--;             q[nxtQ].push(make_pair(make_pair(curX + dx[i], curY + dy[i]),                                    make_pair(rem[0], rem[1])));             rem[i]++;           } else {             q[curQ].push(make_pair(make_pair(curX + dx[i], curY + dy[i]),                                    make_pair(rem[0], rem[1])));           }         }       }       curQ = !curQ;       nxtQ = !nxtQ;     }     printf( %d n , ans);     return 0;   }   