func_code_string: #include <bits/stdc++.h>   using namespace std;   struct qeury {     int a, b, c;   };   const int N = 5000 + 5;   int ans[N][N];   int r[N], cc[N];   int main() {     ios_base ::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n, m, k;     cin >> n >> m >> k;     vector<qeury> q;     int a, b, c;     for (int i = 0; i < k; i++) {       cin >> a >> b >> c;       q.push_back({a, b, c});     }     reverse(q.begin(), q.end());     for (int i = 0; i < q.size(); i++) {       a = q[i].a;       b = q[i].b - 1;       c = q[i].c;       if (a == 1) {         if (!r[b]) {           r[b] = 1;           for (int j = 0; j < m; j++) {             if (!ans[b][j]) {               ans[b][j] = c;             }           }         }       } else {         if (!cc[b]) {           cc[b] = 1;           for (int j = 0; j < n; j++) {             if (!ans[j][b]) {               ans[j][b] = c;             }           }         }       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cout << ans[i][j];         if (j < m - 1) cout <<    ;       }       cout <<   n ;     }   }   