func_code_string: #include <bits/stdc++.h>   using namespace std;   void FREOPEN() {}   inline double Time() { return (clock() * 1.0) / CLOCKS_PER_SEC; }   const int N = (int)200500, inf = (int)2e9, MOD = (int)1e9 + 7, alph = 26, C = 9;   char CH[N];   const long long INF = (long long)1e18;   const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};   const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};   pair<int, int> t[C][N * 4];   int non[N], a[N];   void build(int w, int v, int l, int r) {     t[w][v] = {inf, inf};     if (l == r) return;     int mid = (l + r) / 2;     build(w, v + v, l, mid);     build(w, v + v + 1, mid + 1, r);   }   pair<int, int> comb(pair<int, int> f, pair<int, int> s) {     pair<int, int> ret = f;     if (ret.first > s.first) {       ret.second = ret.first;       ret.first = s.first;       if (ret.second > s.second) ret.second = s.second;     } else if (ret.second > s.first)       ret.second = s.first;     return ret;   }   void upd(int w, int v, int l, int r, int p, int x) {     if (l == r) {       if (x == 1)         t[w][v] = {a[l], inf};       else         t[w][v] = {inf, inf};       return;     }     int mid = (l + r) / 2;     if (p <= mid)       upd(w, v + v, l, mid, p, x);     else       upd(w, v + v + 1, mid + 1, r, p, x);     t[w][v] = comb(t[w][v + v], t[w][v + v + 1]);   }   pair<int, int> get(int w, int v, int l, int r, int L, int R) {     if (L > R || l > R || r < L) return {inf, inf};     if (L <= l && R >= r) return t[w][v];     int mid = (l + r) / 2;     return comb(get(w, v + v, l, mid, L, R), get(w, v + v + 1, mid + 1, r, L, R));   }   int calc(int l, int r, int n) {     int ret = inf;     for (int k = 0; k < C; k++) {       pair<int, int> now = get(k, 1, 1, n, l, r);       if (now.first != inf && now.second != inf)         ret = min(ret, now.first + now.second);     }     if (ret == inf) ret = -1;     return ret;   }   int main() {     FREOPEN();     int n, m;     scanf( %d %d , &n, &m);     for (int k = 0; k < C; k++) build(k, 1, 1, n);     for (int i = 1; i <= n; i++) {       scanf( %d  , &a[i]);       int x = a[i];       for (int k = 0; k < C && x; k++) {         if (x % 10 > 0) {           non[i] |= (1 << k);         }         x /= 10;       }       for (int k = 0; k < C; k++) {         if (non[i] & (1 << k)) upd(k, 1, 1, n, i, 1);       }     }     for (int i = 1; i <= m; i++) {       int ty;       scanf( %d  , &ty);       if (ty == 1) {         int p, x;         scanf( %d %d , &p, &x);         for (int k = 0; k < C; k++) {           if (non[p] & (1 << k)) upd(k, 1, 1, n, p, 0);         }         a[p] = x;         non[p] = 0;         for (int k = 0; k < C && x; k++) {           if (x % 10 > 0) {             non[p] |= (1 << k);           }           x /= 10;         }         for (int k = 0; k < C; k++) {           if (non[p] & (1 << k)) upd(k, 1, 1, n, p, 1);         }       } else {         int lef, rig;         scanf( %d %d , &lef, &rig);         printf( %d n , calc(lef, rig, n));       }     }     return 0;   }   