func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   void OUT(T x, int n) {     for (int i = 0; i < n; ++i) cout << x[i] <<    ;     cout << endl;   }   template <class T>   void OUT(T x, int n, int m) {     for (int i = 1; i <= n; ++i) OUT(x[i], m);     cout << endl;   }   template <class T>   void checkmod(T& a, T m) {     a = (a % m + m) % m;   }   inline long long mod(long long x, long long y) {     return x - floor(1.0 * x / y + 1e-8) * y;   }   const int maxn = 50005, INF = 0x7fffffff;   int n, m;   int p[105];   char name[105][35];   int c[105], Count = 0;   char s[35];   bool comp(int a, int b) { return a > b; }   int main() {     int i, j, k, t, T, x, y, sum, index;     scanf( %d%d , &n, &m);     for (i = 0; i < n; i++) scanf( %d , p + i);     sort(p, p + n);     for (i = 1; i <= m; i++) {       scanf( %s , s);       for (j = 0; j < Count; j++) {         if (strcmp(s, name[j]) == 0) {           c[j]++;           break;         }       }       if (j == Count) c[Count]++, strcpy(name[Count++], s);     }     sort(c, c + Count, comp);     int minp = 0, maxp = 0;     for (i = 0; i < Count; i++) {       minp += p[i] * c[i];     }     for (i = 0; i < Count; i++) {       maxp += p[n - i - 1] * c[i];     }     printf( %d %d n , minp, maxp);     return 0;   }   