func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   using maxpq = priority_queue<T, vector<T>, greater<T>>;   template <typename T>   using minpq = priority_queue<T>;   int n, TOT;   string a[305];   int HASH[305], len[305], p[100005];   inline int add(int a, int b) {     long long c = a + b;     if (c >= 1000000007) c -= 1000000007;     return c;   }   inline int sub(int a, int b) {     int c = a - b;     if (c < 0) c += 1000000007;     return c;   }   inline int mul(int a, int b) { return (a * 1ll * b) % 1000000007; }   int power(int a, int b, int m = 1000000007) {     int res = 1;     while (b > 0) {       if (b & 1) res = mul(res, a);       a = mul(a, a);       b >>= 1;     }     return res;   }   inline int Fermat(int a, int p = 1000000007) { return power(a, p - 2, p); }   inline int Div(int a, int b) { return mul(a, Fermat(b)); }   int base = 128;   inline int h(char c) { return c; }   inline int hsh(string s) {     int t = 0;     for (int i = (0); i < (s.size()); i++) {       t = mul(t, base);       t = add(t, h(s[i]));     }     return t;   }   int ans = 0;   vector<pair<int, int>> adj[305];   void pre() {     p[0] = 1;     for (int i = (1); i < (100005); i++) {       p[i] = mul(p[i - 1], base);     }   }   void solve() {     for (int l = (1); l < (n + 1); l++) {       for (int i = (0); i < (n - l + 1); i++) {         int j = i + l - 1;         int t = HASH[i], tot = len[i];         for (int k = (i + 1); k < (j + 1); k++) {           t = mul(t, p[len[k] + 1]);           t = add(t, mul(h(   ), p[len[k]]));           t = add(t, HASH[k]);           tot = tot + len[k] + 1;         }         adj[l].push_back({t, tot});       }     }     for (int l = (1); l < (n); l++) {       for (int i = (0); i < (n - l + 1); i++) {         bool b = 0;         int tmp = TOT;         for (int j = (i + l); j < (n - l + 1); j++) {           if (adj[l][i].first != adj[l][j].first ||               adj[l][j].second != adj[l][j].second)             continue;           tmp += -adj[l][i].second + l;           if (b == 0) b = 1, tmp += -adj[l][i].second + l;           j += l - 1;         }         ans = min(ans, tmp);       }     }   }   int main() {     clock_t clk = clock();     cerr <<  I will return... n ;     cin >> n;     for (int i = (0); i < (n); i++)       cin >> a[i], len[i] = a[i].size(), TOT += len[i], HASH[i] = hsh(a[i]);     TOT += n - 1;     ans = TOT;     pre();     solve();     cout << ans <<   n ;     cerr <<  ...don t you ever hang your head. n ;     cerr <<  Time (in ms):   << double(clock() - clk) * 1000.0 / CLOCKS_PER_SEC          <<   n ;   }   