func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:102400000,102400000 )   #pragma GCC optimize( O2 )   using namespace std;   const int maxn = 1e4 + 123;   int n, k;   int a[maxn];   vector<int> ve[4];   long long sum;   int main(int argc, char const *argv[]) {     std::cin >> n;     for (int i = 0; i < n; i++) {       char s[3];       int val;       std::cin >> s >> val;       int id = 2 * (s[0] -  0 ) + (s[1] -  0 );       ve[id].push_back(val);     }     if (ve[1].size() < ve[2].size()) {       swap(ve[1], ve[2]);     }     for (int i = 0; i <= 3; i++) {       sort(ve[i].begin(), ve[i].end());     }     long long cur = (long long)ve[3].size();     while (ve[3].size() > 0) {       sum += ve[3][(long long)ve[3].size() - 1];       ve[3].pop_back();     }     while (ve[2].size() > 0) {       sum += ve[2][ve[2].size() - 1] + ve[1][(long long)ve[1].size() - 1];       ve[1].pop_back();       ve[2].pop_back();     }     for (int i = 0; i < (int)ve[1].size(); i++) {       ve[0].push_back(ve[1][i]);     }     sort(ve[0].begin(), ve[0].end());     while (cur > 0 && ve[0].size() > 0) {       sum += ve[0][ve[0].size() - 1];       ve[0].pop_back();       cur--;     }     std::cout << sum <<   n ;     return 0;   }   