func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> a, b, e;   char s[5];   long long ans;   int c;   int main() {     int n, f;     scanf( %d , &n);     while (n--) {       scanf( %s %d , &s, &f);       if (s[0] ==  0  && s[1] ==  1 )         a.push_back(f);       else if (s[0] ==  1  && s[1] ==  0 )         b.push_back(f);       else if (s[0] ==  0  && s[1] ==  0 )         e.push_back(f);       else {         c++;         ans += f;       }     }     int temp = c + 2 * min((int)a.size(), (int)b.size());     c += min((int)a.size(), (int)b.size());     if (!a.empty()) sort(a.rbegin(), a.rend());     if (!b.empty()) sort(b.rbegin(), b.rend());     for (int i = 0; i < min((int)a.size(), (int)b.size()); ++i) {       ans += a[i];       ans += b[i];     }     if (a.size() > b.size()) {       for (int i = min(a.size(), b.size()); i < a.size(); ++i) e.push_back(a[i]);     } else if (b.size() > a.size()) {       for (int i = min(a.size(), b.size()); i < b.size(); ++i) e.push_back(b[i]);     }     if (!e.empty()) sort(e.rbegin(), e.rend());     for (int i = 0; i < e.size(); ++i) {       if (((temp + 2) / 2) <= c) {         ans += e[i];         temp++;       }     }     printf( %lld , ans);     return 0;   }   