func_code_string: #include <bits/stdc++.h>   const int N = 2e5;   using namespace std;   const int SIZE = 26;   int tot = 0, sub = 0;   struct node {     node* next[SIZE];     int strings;     int tin, tout;     node() {       for (int i = 0; i < SIZE; i++) {         next[i] = nullptr;       }       tin = 0;       tout = 0;       strings = 0;     }   };   void add(struct node* root, string key) {     struct node* cur_v = root;     for (size_t i = 0; i < key.length(); i++) {       char c = key[i];       if (cur_v->next[c -  a ] == nullptr) {         cur_v->next[c -  a ] = new node();       }       cur_v = cur_v->next[c -  a ];     }     cur_v->strings++;   }   int t[4 * N + 1], mx_id[4 * N + 1];   void pull(int v) {     if (t[2 * v] > t[2 * v + 1]) {       t[v] = t[2 * v];       mx_id[v] = mx_id[2 * v];     } else {       t[v] = t[2 * v + 1];       mx_id[v] = mx_id[2 * v + 1];     }   }   void upd(int v, int tl, int tr, int id, int x) {     if (tl == tr) {       t[v] = x;       mx_id[v] = id;       return;     }     int tm = (tl + tr) >> 1;     if (id <= tm) {       upd(2 * v, tl, tm, id, x);     } else {       upd(2 * v + 1, tm + 1, tr, id, x);     }     pull(v);   }   int pos = -1;   int mx = 0;   void calc(int v, int tl, int tr, int L, int R) {     if (tl == L && tr == R) {       if (mx < t[v]) {         mx = t[v];         pos = mx_id[v];       }       return;     }     int tm = (tl + tr) >> 1;     if (R <= tm) {       calc(2 * v, tl, tm, L, R);     } else if (L > tm) {       calc(2 * v + 1, tm + 1, tr, L, R);     } else {       calc(2 * v, tl, tm, L, tm);       calc(2 * v + 1, tm + 1, tr, tm + 1, R);     }   }   int t1, t2;   void dfs(struct node* v, int d = 0) {     t1++;     v->tin = t1;     if (v->strings > 0) {       upd(1, 1, N, t1, d);     }     for (int i = 0; i < SIZE; i++) {       if (v->next[i] == nullptr) {         continue;       }       dfs(v->next[i], d + 1);     }     if (d < 1) {       return;     }     v->tout = t1;     if (v->strings == 0) {       mx = 0;       pos = 0;       calc(1, 1, N, v->tin, v->tout);       upd(1, 1, N, pos, 0);       upd(1, 1, N, v->tin, d);       sub += mx - d;     }   }   char buf[N];   int main() {     int n;     scanf( %d , &n);     string s;     node* t = new node();     for (int i = 1; i <= n; i++) {       scanf( %s , buf);       s = buf;       int sz = s.size();       tot += sz;       add(t, s);     }     dfs(t);     printf( %d n , tot - sub);   }   