func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   inline T sqr(T x) {     return x * x;   }   const int maxn = 1000;   int n, m, val;   char s[maxn][maxn];   int f[maxn][maxn];   int sum[maxn][maxn];   long long res;   int main() {     for (int i = 0; i < int(maxn); i++)       for (int j = 0; j < int(maxn); j++) {         s[i][j] = 0;         f[i][j] = 0;         sum[i][j] = 0;       }     cin >> n >> m >> val;     for (int i = int(1); i < int(n + 1); i++)       for (int j = int(1); j < int(m + 1); j++) cin >> s[i][j];     for (int i = int(1); i < int(n + 1); i++)       for (int j = int(1); j < int(m + 1); j++) {         if (s[i][j] ==  1  && s[i - 1][j] ==  1  && s[i + 1][j] ==  1  &&             s[i][j - 1] ==  1  && s[i][j + 1] ==  1 )           f[i + 1][j + 1] = 1;       }     for (int i = int(1); i < int(n + 1); i++)       for (int j = int(1); j < int(m + 1); j++) {         sum[i][j] = (sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1]) + f[i][j];       }     for (int i = int(1); i < int(n); i++)       for (int j = int(1); j < int(m); j++) {         for (int k = int(1); k < int(m - j + 2); k++) {           int l = i + 1, r = n + 1, cur;           while (l < r - 1) {             cur = (l + r) >> 1;             if (sum[cur][j + k - 1] - sum[cur][j + 1] - sum[i + 1][j + k - 1] +                     sum[i + 1][j + 1] <                 val)               l = cur;             else               r = cur;           }           res += n - l;         }       }     cout << res << endl;   }   