func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 300000 + 10;   int n, a[MAXN], p[MAXN];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i], p[a[i]] = i;     for (int i = 0; i < n; i++) {       for (int j = min(i + 100, n - 1); j > i; j--) {         int nx = 2 * a[j] - a[i], nxt = 2 * a[i] - a[j];         if (nx > 0 && nx <= n && p[nx] > j) return cout <<  YES  << endl, 0;         if (nxt > 0 && nxt <= n && p[nxt] < i) return cout <<  YES  << endl, 0;       }     }     cout <<  NO  << endl;     return 0;   }   