func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 41;   int n, m, q, cs;   char a[N][N];   int s[N][N];   int dp[N][N][N][N];   int main() {     memset(dp, 0, sizeof(int) * N * N * N * N);     cin >> n >> m >> q;     for (int i = 0; i < n; ++i) {       cin.ignore();       for (int j = 0; j < m; ++j) {         cin >> a[i + 1][j + 1];       }     }     for (int i = 1; i <= n; ++i) {       s[i][0] = 0;       for (int j = 1; j <= m; ++j) {         s[i][j] = (a[i][j] ==  0  ? s[i][j - 1] + 1 : 0);       }     }     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         for (int k = i; k <= n; ++k) {           for (int l = j; l <= m; ++l) {             dp[i][j][k][l] =                 dp[i][j][k - 1][l] + dp[i][j][k][l - 1] - dp[i][j][k - 1][l - 1];             int mn = l - j + 1;             for (int i1 = k; i1 >= i; --i1) {               mn = min(mn, s[i1][l]);               dp[i][j][k][l] += mn;             }             if (dp[i][j][k][l] < 0)               return cout << i <<     << j <<     << k <<     << l, 0;           }         }       }     }     for (int i = 0; i < q; ++i) {       int a, b, c, d;       cin >> a >> b >> c >> d;       cout << dp[a][b][c][d] << endl;     }   }   