func_code_string: #include <bits/stdc++.h>   int a[300004], pos[300004];   using namespace std;   int main() {     int n, temp;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       pos[a[i]] = i;     }     bool flag = false;     for (int i = 1; i <= n && !flag; i++)       for (int j = i + 1; j <= min(n, i + 5) && !flag; j++) {         temp = 2 * a[j] - a[i];         if (temp <= n && temp > 0 && pos[temp] > j) flag = 1;         temp = 2 * a[i] - a[j];         if (temp <= n && temp > 0 && pos[temp] < i) flag = 1;       }     if (flag)       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }   