func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cout.setf(ios::fixed);     cout.precision(20);     int T;     cin >> T;     while (T--) {       int n;       cin >> n;       n *= 2;       vector<int> a(n);       for (int &x : a) {         cin >> x;       }       map<int, int> left, right;       map<int, bool> was;       int red = 0, blue = 0;       int res = n;       for (int i = n - 1; i >= n / 2; i--) {         int toEat = n / 2 - (n - i);         red += (a[i] == 1);         blue += (a[i] == 2);         right[red - blue] = toEat;         was[red - blue] = true;         if (i == n / 2 && red == blue) {           res = min(res, n / 2);         }         if (red == blue) {           res = min(res, n / 2 + toEat);         }       }       red = blue = 0;       for (int i = 0; i < n / 2; i++) {         int toEat = n / 2 - i - 1;         red += (a[i] == 1);         blue += (a[i] == 2);         if (red == blue) {           res = min(res, n / 2 + toEat);         }         if (was[blue - red]) {           res = min(res, toEat + right[blue - red]);         }         if (i == n / 2 - 1 && red == blue) {           res = min(res, n / 2);         }       }       cout << res <<   n ;     }   }   