func_code_string: #include <bits/stdc++.h>   int a[100005];   inline int max(int x, int y) { return x > y ? x : y; }   int main() {     int ans = 0, n, Max, Min, Maxpos, Minpos;     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     int l = 1, r = 1;     while (r <= n && a[r] == a[1]) r++;     if (r == n + 1) return !printf( %d , n);     if (a[r] > a[1])       Max = a[r], Maxpos = r, Min = a[1], Minpos = r - 1;     else       Max = a[1], Maxpos = r - 1, Min = a[r], Minpos = r;     while (l <= r && r <= n) {       while (r < n && a[r + 1] >= Min && a[r + 1] <= Max) {         r++;         if (a[r] == Max)           Maxpos = r;         else           Minpos = r;       }       r++;       ans = max(ans, r - l);       if (r > n) break;       if (a[r] > Max) {         l = Minpos + 1;         Min = Max, Minpos = Maxpos;         Max = a[r], Maxpos = r;       }       if (a[r] < Min) {         l = Maxpos + 1;         Max = Min, Maxpos = Minpos;         Min = a[r], Minpos = r;       }     }     printf( %d , ans);   }   