func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T0, typename T1>   std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) {     for (typename map<T0, T1>::const_iterator p = v.begin(); p != v.end(); p++) {       os << p->first <<  :   << p->second <<    ;     }     return os;   }   template <typename T0, typename T1>   std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) {     os << v.first <<  :   << v.second <<    ;     return os;   }   template <typename T>   std::ostream& operator<<(std::ostream& os, const vector<T>& v) {     for (int i = 0; i < (int)v.size(); i++) {       os << v[i] <<    ;     }     return os;   }   template <typename T>   std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) {     for (int i = 0; i < (int)v.size(); i++) {       os << v[i] << endl;     }     return os;   }   template <typename T>   std::ostream& operator<<(std::ostream& os, const set<T>& v) {     vector<T> tmp(v.begin(), v.end());     os << tmp;     return os;   }   template <typename T>   std::ostream& operator<<(std::ostream& os, const deque<T>& v) {     vector<T> tmp(v.begin(), v.end());     os << tmp;     return os;   }   int main() {     long long N, W, H;     while (cin >> H >> W) {       vector<string> w(H);       for (int y = 0, _n = (H); (y) < (int)_n; ++y) cin >> w[y];       vector<vector<long long> > tb(H, vector<long long>(W));       vector<vector<long long> > tbX(H, vector<long long>(W));       vector<vector<long long> > tbY(H, vector<long long>(W));       for (int y = 0, _n = (H); (y) < (int)_n; ++y)         for (int x = 0, _n = (W); (x) < (int)_n; ++x) {           {             long long v = 0;             if (0 <= y - 1) v += tb[y - 1][x];             if (0 <= y - 1 && w[y - 1][x] ==  .  && w[y][x] ==  . ) v++;             if (0 <= x - 1) v += tb[y][x - 1];             if (0 <= x - 1 && w[y][x - 1] ==  .  && w[y][x] ==  . ) v++;             if (0 <= x - 1 && 0 <= y - 1) v -= tb[y - 1][x - 1];             tb[y][x] = v;           }           {             long long v = 0;             if (0 <= x - 1) v += tbY[y][x - 1];             if (0 <= y - 1 && w[y - 1][x] ==  .  && w[y][x] ==  . ) v++;             tbY[y][x] = v;           }           {             long long v = 0;             if (0 <= y - 1) v += tbX[y - 1][x];             if (0 <= x - 1 && w[y][x - 1] ==  .  && w[y][x] ==  . ) v++;             tbX[y][x] = v;           }         }       cin >> N;       for (int i = 0, _n = (N); (i) < (int)_n; ++i) {         long long y1, x1, y2, x2;         cin >> y1 >> x1 >> y2 >> x2;         y1--;         x1--;         y2--;         x2--;         long long v = tb[y2][x2];         if (0 <= y1 - 1) v -= tb[y1 - 1][x2];         {           long long vv = tbY[y1][x2];           if (0 <= x1 - 1) vv -= tbY[y1][x1 - 1];           v -= vv;         }         if (0 <= x1 - 1) v -= tb[y2][x1 - 1];         {           long long vv = tbX[y2][x1];           if (0 <= y1 - 1) vv -= tbX[y1 - 1][x1];           v -= vv;         }         if (0 <= x1 - 1 && 0 <= y1 - 1) v += tb[y1 - 1][x1 - 1];         cout << v << endl;       }     }     return 0;   }   