func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, k;   pair<string, int> A[11];   int main() {     scanf( %i , &n);     for (int i = 0; i < 7; i++) A[i].second = 2e7;     for (int i = 0; i < n; i++) {       string s;       int p;       cin >> p >> s;       sort(s.begin(), s.end());       if (s ==  ABC )         A[0] = make_pair(s, min(A[0].second, p));       else if (s ==  AB )         A[1] = make_pair(s, min(A[1].second, p));       else if (s ==  AC )         A[2] = make_pair(s, min(A[2].second, p));       else if (s ==  BC )         A[3] = make_pair(s, min(A[3].second, p));       else if (s ==  A )         A[4] = make_pair(s, min(A[4].second, p));       else if (s ==  B )         A[5] = make_pair(s, min(A[5].second, p));       else if (s ==  C )         A[6] = make_pair(s, min(A[6].second, p));     }     int ans = 2e7;     for (int i = 0; i < 1 << 7; i++) {       int occ[3] = {0};       int cost = 0;       for (int j = 0; j < 7; j++) {         if (i & 1 << j) {           for (int k = 0; k < A[j].first.size(); k++) occ[A[j].first[k] -  A ]++;           cost += A[j].second;         }       }       if (occ[0] && occ[1] && occ[2]) ans = min(cost, ans);     }     printf( %i n , ans == 2e7 ? -1 : ans);   }   