func_code_string: #include <bits/stdc++.h>   const long long MOD1 = 998244353, MOD2 = 1000000007;   long long POWER_MOD1[300001], POWER_MOD2[300001];   struct node {     long long hash1_MOD1, hash1_MOD2, hash2_MOD1, hash2_MOD2;     int len;   } T[1048576], single[2] = {(node){0, 0, 0, 0, 1}, (node){1, 1, 1, 1, 1}};   inline node operator+(const node &a, const node &b) {     return (node){(a.hash1_MOD1 + POWER_MOD1[a.len] * b.hash1_MOD1) % MOD1,                   (a.hash1_MOD2 + POWER_MOD2[a.len] * b.hash1_MOD2) % MOD2,                   (b.hash2_MOD1 + POWER_MOD1[b.len] * a.hash2_MOD1) % MOD1,                   (b.hash2_MOD2 + POWER_MOD2[b.len] * a.hash2_MOD2) % MOD2,                   a.len + b.len};   }   int N, a[300001];   node G(int p, int l, int r, int L, int R) {     if (L <= l && r <= R) return T[p];     int m = l + r >> 1;     if (R <= m) return G(p << 1, l, m, L, R);     if (L > m) return G(p << 1 | 1, m + 1, r, L, R);     return G(p << 1, l, m, L, R) + G(p << 1 | 1, m + 1, r, L, R);   }   void P(int x, int w) {     int p = 1, l = 1, r = N;     while (l < r) {       int m = l + r >> 1;       if (x <= m)         p <<= 1, r = m;       else         p = p << 1 | 1, l = m + 1;     }     T[p] = single[w];     while (p >>= 1) T[p] = T[p << 1] + T[p << 1 | 1];   }   void build(int p, int l, int r) {     if (l == r) {       T[p] = single[0];       return;     }     int m = l + r >> 1;     build(p << 1, l, m);     build(p << 1 | 1, m + 1, r);     T[p] = T[p << 1] + T[p << 1 | 1];   }   int main() {     scanf( %d , &N);     POWER_MOD1[0] = POWER_MOD2[0] = 1;     for (int i = 1; i <= N; i++) {       scanf( %d , a + i);       POWER_MOD1[i] = POWER_MOD1[i - 1] * 2 % MOD1;       POWER_MOD2[i] = POWER_MOD2[i - 1] * 2 % MOD2;     }     build(1, 1, N);     for (int i = 1; i <= N; i++) {       int len = std::min(a[i] - 1, N - a[i]);       node H = G(1, 1, N, a[i] - len, a[i] + len);       if (H.hash1_MOD1 != H.hash2_MOD1 || H.hash1_MOD2 != H.hash2_MOD2) {         puts( YES );         return 0;       }       P(a[i], 1);     }     puts( NO );     return 0;   }   