func_code_string: #include <bits/stdc++.h>   using namespace std;   long long arr[1002][1002];   long long store[2][1000002];   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long n, m, k, p;     cin >> n >> m >> k >> p;     for (long long i = 1; i <= n; i++)       for (long long j = 1; j <= m; j++) cin >> arr[i][j];     multiset<long long> s1, s2;     for (long long i = 1; i <= n; i++) {       long long s = 0;       for (long long j = 1; j <= m; j++) s += arr[i][j];       s1.insert(s);     }     for (long long i = 1; i <= m; i++) {       long long s = 0;       for (long long j = 1; j <= n; j++) s += arr[j][i];       s2.insert(s);     }     for (long long i = 1; i <= k; i++) {       long long a = *s1.rbegin();       store[0][i] += store[0][i - 1] + a;       s1.erase(s1.find(a));       s1.insert(a - m * p);       a = *s2.rbegin();       store[1][i] += store[1][i - 1] + a;       s2.erase(s2.find(a));       s2.insert(a - n * p);     }     long long maxi = -1e18;     for (long long i = 0; i <= k; i++)       maxi = max(maxi, store[0][i] + store[1][k - i] - i * (k - i) * p);     cout << maxi;   }   