func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long inf = 4e18;   long long ver[305][305], hor[305][305], ver2[305][305], hor2[305][305];   int con[305][305];   pair<pair<int, int>, pair<int, int> > ans;   long long dif = inf, cur, a, b;   int main(void) {     memset(ver, 0, sizeof(ver));     memset(hor, 0, sizeof(hor));     memset(ver2, 0, sizeof(ver2));     memset(hor2, 0, sizeof(hor2));     int n, m, t, i, j, k, l, r, mid, it;     int eq, asc, des;     scanf( %d %d %d , &n, &m, &t);     scanf( %d %d %d , &eq, &asc, &des);     for ((i) = (1); (i) <= (n); ++(i)) {       for ((j) = (1); (j) <= (m); ++(j)) {         scanf( %d , &con[i][j]);         if (j > 1) {           hor[i][j] = hor[i][j - 1];           hor2[i][j] = hor2[i][j - 1];           if (con[i][j] == con[i][j - 1]) {             hor[i][j] += eq;             hor2[i][j] += eq;           } else if (con[i][j - 1] < con[i][j]) {             hor[i][j] += asc;             hor2[i][j] += des;           } else {             hor[i][j] += des;             hor2[i][j] += asc;           }         }         if (i > 1) {           ver[i][j] = ver[i - 1][j];           ver2[i][j] = ver2[i - 1][j];           if (con[i][j] == con[i - 1][j]) {             ver[i][j] += eq;             ver2[i][j] += eq;           } else if (con[i - 1][j] < con[i][j]) {             ver[i][j] += asc;             ver2[i][j] += des;           } else {             ver[i][j] += des;             ver2[i][j] += asc;           }         }       }     }     for ((i) = (1); (i) <= (n - 2); ++(i)) {       for ((j) = (1); (j) <= (m - 2); ++(j)) {         for ((k) = (i + 2); (k) <= (n); ++(k)) {           l = j + 2;           r = m;           while (l < r) {             mid = (l + r + 1) / 2;             a = hor[i][mid] - hor[i][j] + hor2[k][mid] - hor2[k][j];             b = ver2[k][j] - ver2[i][j] + ver[k][mid] - ver[i][mid];             cur = a + b;             if (cur < t)               l = mid;             else               r = mid - 1;           }           for ((it) = (l - 3); (it) <= (l + 3); ++(it)) {             if (it < j + 2)               continue;             else if (m < it)               break;             a = hor[i][it] - hor[i][j] + hor2[k][it] - hor2[k][j];             b = ver2[k][j] - ver2[i][j] + ver[k][it] - ver[i][it];             cur = a + b;             if (abs(cur - t) <= dif) {               dif = abs(cur - t);               ans = make_pair(make_pair(i, j), make_pair(k, it));               if (dif == 0) goto PRINT;             }           }         }       }     }   PRINT:;     printf( %d %d %d %d n , ans.first.first, ans.first.second, ans.second.first,            ans.second.second);     return 0;   }   