func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 7;   map<int, int> l, r;   int a[maxn << 1];   int sum[maxn << 1];   int main() {     int t;     cin >> t;     while (t--) {       l.clear();       r.clear();       int n;       cin >> n;       for (int i = 1; i <= 2 * n; i++) cin >> a[i];       for (int i = 1; i <= 2 * n; i++) {         a[i] = (a[i] == 2 ? 1 : -1);       }       for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];       sum[2 * n + 1] = 0;       for (int i = 2 * n; i >= n + 1; i--) sum[i] = sum[i + 1] + a[i];       r[0] = 2 * n + 1;       l[0] = 0;       for (int i = 1; i <= n; i++) l[sum[i]] = max(l[sum[i]], i);       for (int i = 2 * n; i >= n + 1; i--)         r[sum[i]] ? r[sum[i]] = min(r[sum[i]], i) : r[sum[i]] = i;       int ans = 2 * n;       for (int i = 0; i <= n; i++) {         if (!r[-sum[i]]) continue;         ans = min(r[-sum[i]] - l[sum[i]] - 1, ans);       }       for (int i = 2 * n + 1; i >= n + 1; i--) {         if (!l[-sum[i]] && sum[i]) continue;         ans = min(ans, r[sum[i]] - l[-sum[i]] - 1);       }       cout << ans << endl;     }     return 0;     ;   }   