func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 520;   int dp[maxn][maxn];   char mp[maxn][maxn];   int h, w, q;   int main() {     cin >> h >> w;     for (int i = 1; i <= h; i++)       for (int j = 1; j <= w; j++) cin >> mp[i][j];     for (int i = 2; i <= w; i++) {       if (mp[1][i] ==  .  && mp[1][i - 1] ==  . )         dp[1][i] = dp[1][i - 1] + 1;       else         dp[1][i] = dp[1][i - 1];     }     for (int i = 2; i <= h; i++) {       if (mp[i][1] ==  .  && mp[i - 1][1] ==  . )         dp[i][1] = dp[i - 1][1] + 1;       else         dp[i][1] = dp[i - 1][1];     }     for (int i = 2; i <= h; i++) {       for (int j = 2; j <= w; j++) {         dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];         if (mp[i][j] ==  .  && mp[i - 1][j] ==  . ) dp[i][j]++;         if (mp[i][j] ==  .  && mp[i][j - 1] ==  . ) dp[i][j]++;       }     }     cin >> q;     int x1, y1, x2, y2;     for (int k = 0; k < q; k++) {       cin >> x1 >> y1 >> x2 >> y2;       int res = 0;       res = dp[x2][y2] - dp[x1 - 1][y2] - dp[x2][y1 - 1] + dp[x1 - 1][y1 - 1];       if (x1 > 1) {         for (int i = y2; i >= y1; i--)           if (mp[x1][i] ==  .  && mp[x1 - 1][i] ==  . ) res--;       }       if (y1 > 1) {         for (int i = x2; i >= x1; i--)           if (mp[i][y1] ==  .  && mp[i][y1 - 1] ==  . ) res--;       }       cout << res << endl;     }     return ~~(0 - 0);   }   