func_code_string: #include <bits/stdc++.h>   using namespace std;   long long srw[1000], scol[1000];   long long rows[1000001], cols[1000001];   int main() {     int x, n, m, k, p, y, i, j;     scanf( %d%d%d%d , &n, &m, &k, &p);     for (i = 0; i < n; i++)       for (j = 0; j < m; j++) {         scanf( %d , &x);         srw[i] += x;         scol[j] += x;       }     multiset<long long, greater<long long> > rsm, csm;     multiset<long long, greater<long long> >::iterator it;     for (i = 0; i < n; i++) rsm.insert(srw[i]);     for (j = 0; j < m; j++) csm.insert(scol[j]);     for (i = 1; i <= k; i++) {       it = rsm.begin();       long long val = *it;       rsm.erase(it);       rsm.insert(val - p * m);       rows[i] = rows[i - 1] + val;       it = csm.begin();       val = *it;       csm.erase(it);       csm.insert(val - p * n);       cols[i] = cols[i - 1] + val;     }     long long ans = -99999999999999999;     for (i = 0; i <= k; i++)       ans = max(ans, cols[i] + rows[k - i] - 1LL * (k - i) * i * p);     printf( %I64d , ans);     return 0;   }   