func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 5010, inf = 0x7fffffff;   bool has[maxn][maxn], flag = 0;   int sum[maxn][maxn], n, m, l[10], r[10], req;   long long ans;   void init() {     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         sum[i][j] =             sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + (has[i][j] == 1);   }   int calculate(int x1, int y1, int x2, int y2) {     return sum[x2][y2] - sum[x1][y2] - sum[x2][y1] + sum[x1][y1];   }   void work(int up, int down, int left, int right, bool dir) {     if (left == right || up == down) return;     if (left + 1 == right && up + 1 == down) {       ans += calculate(up, left, down, right) == req;       return;     }     if (dir == 0) {       int mid = (left + right) >> 1;       work(up, down, left, mid, dir ^ 1);       work(up, down, mid, right, dir ^ 1);       for (int i = up; i < down; i++) {         l[0] = r[0] = mid;         for (int k = 1; k <= req + 1; k++) l[k] = left, r[k] = right;         for (int j = i + 1; j <= down; j++) {           for (int k = 1; k <= req + 1; k++)             while (calculate(i, l[k], j, mid) >= k) l[k]++;           for (int k = 1; k <= req + 1; k++)             while (calculate(i, mid, j, r[k]) >= k) r[k]--;           for (int k = 0; k <= req; k++)             ans += (l[k] - l[k + 1]) * (r[req - k + 1] - r[req - k]);         }       }     } else {       int mid = (up + down) >> 1;       work(up, mid, left, right, dir ^ 1);       work(mid, down, left, right, dir ^ 1);       for (int i = left; i < right; i++) {         l[0] = r[0] = mid;         for (int k = 1; k <= req + 1; k++) l[k] = up, r[k] = down;         for (int j = i + 1; j <= right; j++) {           for (int k = 1; k <= req + 1; k++)             while (calculate(l[k], i, mid, j) >= k) l[k]++;           for (int k = 1; k <= req + 1; k++)             while (calculate(mid, i, r[k], j) >= k) r[k]--;           for (int k = 0; k <= req; k++)             ans += (l[k] - l[k + 1]) * (r[req - k + 1] - r[req - k]);         }       }     }   }   int main() {     while (scanf( %d%d%d , &n, &m, &req) == 3) {       memset(has, 0, sizeof(has));       ans = 0;       for (int i = 1; i <= n; i++)         for (int j = 1; j <= m; j++) scanf( %1d , &has[i][j]);       init();       work(0, n, 0, m, n < m);       printf( %I64d n , ans);     }     return 0;   }   