func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXP = 1e5;   long long int n, s, p, q, x, sell[MAXP + 5] = {0}, buy[MAXP + 5] = {0};   char d;   vector<pair<long long int, long long int> > ansell;   int main() {     cin >> n >> s;     for (int i = 0; i < n; i++) {       cin >> d >> p >> q;       if (d ==  S )         sell[p] += q;       else         buy[p] += q;     }     x = 0;     for (int i = 0; i <= MAXP; i++) {       if (x == s) break;       if (sell[i]) {         ansell.push_back(make_pair(i, sell[i]));         x++;       }     }     for (int i = ((int(ansell.size()))) - 1; i >= 0; i--)       cout <<  S   << ansell[i].first <<     << ansell[i].second << endl;     x = 0;     for (int i = MAXP; i >= 0; i--) {       if (x == s) break;       if (buy[i]) {         cout <<  B   << i <<     << buy[i] << endl;         x++;       }     }     return 0;   }   