func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 55, MAXM = 20020;   int n, m, k, acc[MAXN][MAXM], dp[MAXN][MAXM], ans;   struct no {     int beg, end, mid, mx, lz;     no *l, *r;     no(int beg, int end)         : beg(beg), end(end), mid((beg + end) >> 1), mx(0), lz(0) {       if (beg != end) l = new no(beg, mid), r = new no(mid + 1, end);     }     void refresh() {       if (!lz) return;       mx += lz;       if (beg != end) l->lz += lz, r->lz += lz;       lz = 0;     }     void upd(int a, int b, int inc) {       refresh();       if (end < a || b < beg) return;       if (a <= beg && end <= b) return lz += inc, refresh();       l->upd(a, b, inc), r->upd(a, b, inc);       mx = max(l->mx, r->mx);     }     void set(int pos, int val) {       refresh();       if (beg == end) return void(mx = val);       (pos <= mid ? l : r)->set(pos, val);       mx = max(l->mx, r->mx);     }     int get(int a, int b) {       refresh();       if (end < a || b < beg) return 0;       if (a <= beg && end <= b) return mx;       return max(l->get(a, b), r->get(a, b));     }     void print() {       refresh();       if (beg == end) return printf( %d  , mx), void();       l->print(), r->print();     }   };   int main() {     scanf( %d %d %d , &n, &m, &k);     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= m; ++j)         scanf( %d , &acc[i][j]), acc[i][j] += acc[i][j - 1];     no seg(1, m - k + 1);     for (int i = n; i >= 1; --i) {       for (int j = 1; j <= k; ++j)         seg.upd(1, j, -(acc[i + 1][j] - acc[i + 1][j - 1]));       for (int j = 1; j <= m - k + 1; ++j) {         int aux = acc[i][j + k - 1] - acc[i][j - 1] + acc[i + 1][j + k - 1] -                   acc[i + 1][j - 1];         if (i == n) {           dp[i][j] = aux;           continue;         }         dp[i][j] = max(dp[i][j], seg.get(j - k + 1, j + k - 1));         if (j > k) dp[i][j] = max(dp[i][j], seg.get(1, j - k));         if (j + k <= m - k + 1)           dp[i][j] = max(dp[i][j], seg.get(j + k, m - k + 1));         dp[i][j] += aux;         seg.upd(max(1, j - k + 1), j, (acc[i + 1][j] - acc[i + 1][j - 1]));         seg.upd(j + 1, j + k, -(acc[i + 1][j + k] - acc[i + 1][j + k - 1]));       }       for (int j = 1; j <= m - k + 1; ++j) seg.set(j, dp[i][j]);     }     printf( %d n , seg.get(1, m - k + 1));   }   