func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T, class S>   ostream& operator<<(ostream& os, const pair<T, S>& v) {     return os <<  (  << v.first <<  ,   << v.second <<  ) ;   }   template <class T>   ostream& operator<<(ostream& os, const vector<T>& v) {     os <<  [ ;     for (int i = int(0); i <= int((static_cast<int>((v).size())) - 1); ++i) {       if (i) os <<  ,  ;       os << v[i];     }     return os <<  ] ;   }   template <class T>   bool setmax(T& _a, T _b) {     if (_b > _a) {       _a = _b;       return true;     }     return false;   }   template <class T>   bool setmin(T& _a, T _b) {     if (_b < _a) {       _a = _b;       return true;     }     return false;   }   template <class T>   T gcd(T _a, T _b) {     return _b == 0 ? _a : gcd(_b, _a % _b);   }   struct Node {     vector<Node*> ys;     int h = -1;   };   int main() {     int n, k;     cin >> n >> k;     vector<string> ss(n);     for (int i = int(0); i <= int((n)-1); ++i) cin >> ss[i];     sort((ss).begin(), (ss).end());     vector<int> height(n - 1);     for (int i = int(0); i <= int((n - 1) - 1); ++i) {       int j = 0;       while (j < static_cast<int>((ss[i]).size()) &&              j < static_cast<int>((ss[i + 1]).size()) &&              ss[i][j] == ss[i + 1][j]) {         ++j;       }       height[i] = j;     }     const function<Node*(int, int)> build = [&](int l, int r) {       Node* x = new Node();       if (l + 1 == r) return x;       int h = *min_element(height.begin() + l, height.begin() + r - 1);       x->h = h;       int i = l;       for (int j = int(l); j <= int((r)-1); ++j) {         if (j == r - 1 || height[j] == h) {           x->ys.push_back(build(i, j + 1));           i = j + 1;         }       }       return x;     };     Node* root = build(0, n);     const function<vector<int>(Node*)> solve = [&](Node* x) {       if (x->h < 0) return vector<int>{0, 0};       vector<int> ans{0};       for (Node* y : x->ys) {         vector<int> tmp = solve(y);         vector<int> r(static_cast<int>((ans).size()) +                       static_cast<int>((tmp).size()) - 1);         for (int i = int(0); i <= int((static_cast<int>((ans).size())) - 1); ++i)           for (int j = int(0); j <= int((static_cast<int>((tmp).size())) - 1);                ++j) {             setmax(r[i + j], ans[i] + tmp[j] + i * j * x->h);           }         ans = r;       }       if (static_cast<int>((ans).size()) > k + 1) ans.resize(k + 1);       return ans;     };     vector<int> ans = solve(root);     if (k < static_cast<int>((ans).size())) {       cout << ans[k] << endl;     } else {       cout << 0 << endl;     }     return 0;   }   