func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1000;   const int MAX = 100000 + 100;   const int inf = 999999999;   const int p1 = 104393321, p2 = 104393329;   int n, m;   int par[MAX], sizeofcom[MAX], size[MAX], a[MAX], b[MAX], d[MAX];   bool lucky(int x) {     while (x > 0) {       if (x % 10 == 7 || x % 10 == 4)         x /= 10;       else         return false;     }     return true;   }   int find(int k) {     if (par[k] == k)       return k;     else       par[k] = find(par[k]);     return par[k];   }   int main() {     ios::sync_with_stdio(0);     cin >> n >> m;     for (int i = (0); i < int(n); ++i) par[i] = i;     int x, y;     for (int i = (0); i < int(m); ++i) {       cin >> x >> y;       x--;       y--;       par[find(x)] = find(y);     }     for (int i = (0); i < int(n); ++i) sizeofcom[find(i)]++;     for (int i = (0); i < int(n + 1); ++i) size[sizeofcom[i]]++;     for (int i = (1); i < int(n + 1); ++i)       if (lucky(i) && size[i]) {         cout << 0 << endl;         return 0;       }     int sz = 0;     for (int i = (1); i < int(n + 1); ++i) {       int tmp = 1;       while (tmp <= size[i]) {         a[sz] = tmp * i;         b[sz++] = tmp;         size[i] -= tmp;         tmp *= 2;       }       if (size[i]) {         a[sz] = size[i] * i;         b[sz++] = size[i];       }     }     int ans = inf;     for (int i = (1); i < int(n + 1); ++i) d[i] = inf;     d[a[0]] = 1;     for (int j = (1); j < int(sz); ++j) {       for (int i = (n); i > int(0); --i) {         if (a[j] <= i) d[i] = min(d[i], d[i - a[j]] + b[j]);         if (lucky(i) && d[i] != inf) ans = min(ans, d[i]);       }     }     if (ans == inf)       cout << -1 << endl;     else       cout << ans - 1 << endl;     return 0;   }   