func_code_string: #include <bits/stdc++.h>   #pragma GCC target( fma )   #pragma GCC optimize( unroll-loops,-Ofast )   using namespace std;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   long long a[500005];   int n;   set<long long> buck[1000];   long long c[1000];   void fix(int v) {     int l = v * 700;     int r = (v + 1) * 700;     r = min(r, n);     buck[v].clear();     for (int i = l; i < r; ++i) {       a[i] += c[v];       buck[v].insert(a[i]);     }     c[v] = 0;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int q;     cin >> n >> q;     for (int i = 0; i < n; i++) {       cin >> a[i];       buck[i / 700].insert(a[i]);     }     while (q--) {       int t, l, r, x;       cin >> t;       if (t == 1) {         cin >> l >> r >> x;         --l;         --r;         if (l / 700 == r / 700) {           for (int i = l; i <= r; i++) a[i] += x;           fix(r / 700);           continue;         }         if (l % 700 != 0) {           for (; l % 700 != 0; ++l) {             a[l] += x;           }           fix(l / 700 - 1);         }         l /= 700;         if (r % 700 != 700 - 1) {           for (; r % 700 != 700 - 1; --r) {             a[r] += x;           }           fix(r / 700 + 1);         }         r /= 700;         for (; l <= r; l++) c[l] += x;       } else {         cin >> x;         l = r = -1;         for (int i = 0; i <= n / 700; ++i) {           if (buck[i].count(x - c[i])) {             for (int j = i * 700; 1; ++j) {               if (a[j] == x - c[i]) {                 l = j;                 break;               }             }             break;           }         }         for (int i = n / 700; i >= 0; --i) {           if (buck[i].count(x - c[i])) {             for (int j = i * 700 + 700 - 1; 1; --j) {               if (a[j] == x - c[i]) {                 r = j;                 break;               }             }             break;           }         }         if (l == -1) {           cout << -1 <<   n ;         } else {           cout << r - l <<   n ;         }       }     }   }   