func_code_string: #include <bits/stdc++.h>   #pragma optimization_level 3   #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math,O3 )   using namespace std;   mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());   int inf = INT32_MAX;   struct Node {     Node *l = 0, *r = 0;     vector<int> m1, m2;     Node(Node *a, Node *b) {       m1 = vector<int>(9);       m2 = vector<int>(9);       l = a, r = b;       for (int q = 0; q < 9; q++) m1[q] = min(l->m1[q], r->m1[q]);       for (int q = 0; q < 9; q++)         m2[q] = min(max(l->m1[q], r->m1[q]), min(l->m2[q], r->m2[q]));     }     Node(Node *a, Node *b, int c) {       m1 = vector<int>(9);       m2 = vector<int>(9, inf);       l = a, r = b;       for (int q = 0, v = c; q < 9; q++, c /= 10) m1[q] = c % 10 ? v : inf;     }   };   Node *build(int l, int r, vector<int> &m) {     if (l == r) return new Node(0, 0, m[l - 1]);     int md = (l + r) / 2;     return new Node(build(l, md, m), build(md + 1, r, m));   }   pair<int, int> que(int l, int r, int l1, int r1, Node *n, int c) {     if (l == l1 && r == r1) return {n->m1[c], n->m2[c]};     int md = (l1 + r1) / 2;     if (r <= md) return que(l, r, l1, md, n->l, c);     if (l > md) return que(l, r, md + 1, r1, n->r, c);     pair<int, int> p1 = que(l, md, l1, md, n->l, c);     pair<int, int> p2 = que(md + 1, r, md + 1, r1, n->r, c);     return {min(p1.first, p2.first),             min(max(p1.first, p2.first), min(p1.second, p2.second))};   }   void upd(int l, int r, int p, Node *n, int v) {     if (l == r) {       for (int q = 0, c = v; q < 9; q++, v /= 10) n->m1[q] = v % 10 ? c : inf;       return;     }     int md = (l + r) / 2;     if (p <= md)       upd(l, md, p, n->l, v);     else       upd(md + 1, r, p, n->r, v);     for (int q = 0; q < 9; q++) n->m1[q] = min(n->l->m1[q], n->r->m1[q]);     for (int q = 0; q < 9; q++)       n->m2[q] =           min(max(n->l->m1[q], n->r->m1[q]), min(n->l->m2[q], n->r->m2[q]));   }   int a, z;   vector<int> m;   int main() {     cin.tie(0);     cout.tie(0);     cin.sync_with_stdio(0);     cout.sync_with_stdio(0);     ;     cin >> a >> z;     m = vector<int>(a);     for (int q = 0; q < a; q++) cin >> m[q];     Node *n = build(1, a, m);     for (; z; z--) {       int t, x, y;       cin >> t >> x >> y;       if (t == 1)         upd(1, a, x, n, y);       else {         int o = inf;         for (int q = 0; q < 9; q++) {           pair<int, int> p = que(x, y, 1, a, n, q);           if (p.second == inf) continue;           o = min(o, p.first + p.second);         }         cout << (o == inf ? -1 : o) <<   n ;       }     }   }   