func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long inf = 1e9;   const long long base = 1e9 + 7;   const int N = 5e3 + 2;   int n, m, k;   int a[N][N];   pair<int, int> h[N], c[N];   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cin >> n >> m >> k;     long long x, y, z;     for (int i = (1), b_ = (k); i <= b_; ++i) {       cin >> x >> y >> z;       if (x == 1) {         h[y].first = z;         h[y].second = i;       } else {         c[y].first = z;         c[y].second = i;       }     }     for (int i = (1), b_ = (n); i <= b_; ++i) {       for (int j = (1), b_ = (m); j <= b_; ++j) {         if (h[i].second == 0 && c[j].second == 0)           cout << 0 <<    ;         else if (h[i].second > c[j].second)           cout << h[i].first <<    ;         else           cout << c[j].first <<    ;       }       cout << endl;     }     return 0;   }   