func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 0x3fffffff;   const int inf = -INF;   const int N = 100005;   const int M = 2005;   const int mod = 1000000007;   const double pi = acos(-1.0);   int mp1[N], mp2[N];   int main() {     int n, m;     int d, p;     char s[2];     scanf( %d %d , &n, &m);     memset(mp1, 0, sizeof(mp1));     memset(mp2, 0, sizeof(mp2));     for (int i = 1; i <= n; i++) {       scanf( %s %d %d , &s, &p, &d);       if (s[0] ==  S )         mp1[p] += d;       else         mp2[p] += d;     }     int k = 0, t = 0;     for (int it = 0; it < N, t < m; it++) {       if (it > 100000) break;       if (mp1[it] > 0) t++, k = it;     }     for (int j = k; j >= 0; j--)       if (mp1[j] > 0) printf( S %d %d n , j, mp1[j]);     t = 0;     for (int it = N; it >= 0 && t < m; it--) {       if (mp2[it] > 0) printf( B %d %d n , it, mp2[it]), t++;     }   }   