func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long n, i, maxx = 2, s = 1, k = 1;     cin >> n;     vector<int> a(n);     for (i = 0; i < n; i++) cin >> a[i];     a.push_back(0);     for (i = 0; i < n; i++) {       if (i > 0 && s > 1 && a[i] == 1 && a[i - 1] == 2) s = 1;       if (i > 0 && k > 1 && a[i] == 2 && a[i - 1] == 1) k = 1;       if (a[i] == 1 && a[i + 1] == 1)         s += 1;       else if (min(k, s) * 2 > maxx)         maxx = min(k, s) * 2;       if (a[i] == 2 && a[i + 1] == 2)         k += 1;       else if (min(k, s) * 2 > maxx)         maxx = min(k, s) * 2;     }     cout << maxx;   }   