func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 1 << 30;   vector<int> w, cn, c, d, p;   vector<bool> used;   int find(int x) { return (p[x] == x ? x : p[x] = find(p[x])); }   void un(int x, int y) {     x = find(x);     y = find(y);     if (rand() & 1)       p[x] = y;     else       p[y] = x;   }   int main() {     int n, m;     scanf( %d %d , &n, &m);     used.resize(n, false);     cn.resize(n + 1, 0);     p.resize(n);     for (int i = 0; i < n; ++i) p[i] = i;     int a, b, comp = n;     for (int i = 0; i < m; ++i) {       scanf( %d%d , &a, &b);       a--;       b--;       if (find(a) != find(b)) un(a, b), comp--;     }     for (int i = 0; i < n; ++i) cn[find(p[i])]++;     for (int i = 0; i < n; ++i)       if (cn[i] > 0) c.push_back(cn[i]);     cn.assign(n + 1, 0);     for (int i = 0; i < c.size(); ++i) ++cn[c[i]];     c.clear();     for (int i = 0; i < cn.size(); ++i)       if (cn[i] > 0) {         int st = 1;         while (cn[i] >= st) {           c.push_back(st);           w.push_back(st * i);           cn[i] -= st;           st *= 2;         }         if (cn[i] > 0) {           c.push_back(cn[i]);           w.push_back(cn[i] * i);         }       }     int N = c.size();     d.resize(n + 1, INF);     d[0] = 0;     for (int i = 1; i <= N; ++i)       for (int j = n; j >= w[i - 1]; --j)         if (d[j - w[i - 1]] + c[i - 1] < d[j]) d[j] = d[j - w[i - 1]] + c[i - 1];     int ans = INF, tmp;     for (int i = 4; i <= n; ++i) {       if (ans <= d[i]) continue;       tmp = i;       bool good = true;       while (tmp > 0 && good) {         if (!(tmp % 10 == 4 || tmp % 10 == 7)) good = false;         tmp /= 10;       }       if (good) ans = d[i];     }     printf( %d , (ans < INF ? ans - 1 : -1));     return 0;   }   