func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1010;   const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};   long long k;   int n, m, h[N][N];   bool mark[N][N];   int pre[N * N], sz[N * N];   int find(int x) { return pre[x] = (pre[x] == x ? x : find(pre[x])); }   bool merge(int x, int y) {     int a = find(x), b = find(y);     if (a == b) return false;     if (rand() % 2) swap(a, b);     sz[b] += sz[a];     pre[a] = b;     return true;   }   inline int id(int i, int j) { return i * m + j; }   int res[N][N];   void dfs(int i, int j, int v) {     if (i < 0 || i >= n || j < 0 || j >= m || h[i][j] < v) return;     if (res[i][j] || !k) return;     res[i][j] = v;     k -= v;     for (int d = 0; d < 4; d++) {       int ni = i + di[d], nj = j + dj[d];       dfs(ni, nj, v);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> m >> k;     vector<tuple<int, int, int>> pos;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         pre[id(i, j)] = id(i, j);         sz[id(i, j)] = 1;         cin >> h[i][j];         pos.emplace_back(h[i][j], i, j);       }     sort(pos.rbegin(), pos.rend());     bool good = false;     for (auto p : pos) {       int v, i, j;       tie(v, i, j) = p;       for (int d = 0; d < 4; d++) {         int ni = i + di[d], nj = j + dj[d];         if (ni < 0 || ni >= n || nj < 0 || nj >= m || !mark[ni][nj]) continue;         merge(id(i, j), id(ni, nj));       }       mark[i][j] = true;       if (k % v == 0 && k / v <= sz[find(id(i, j))]) {         dfs(i, j, h[i][j]);         good = true;         break;       }     }     if (good) {       cout <<  YES n ;       for (int i = 0; i < n; i++) {         for (int j = 0; j < m; j++) cout << res[i][j] <<    ;         cout <<   n ;       }     } else       cout <<  NO n ;     return 0;   }   