func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5 + 100;   vector<int> G[MAXN];   map<int, int> cnt;   bool vis[MAXN];   int sz;   int cN, c[MAXN], b[MAXN];   int dp[MAXN];   void dfs(int u) {     vis[u] = true;     sz++;     for (int i = 0; i < G[u].size(); i++) {       int v = G[u][i];       if (!vis[v]) dfs(v);     }   }   inline int smin(int &a, int b) { return a = min(a, b); }   bool lucky(int x) {     while (x) {       if (x % 10 != 7 && x % 10 != 4) return false;       x /= 10;     }     return true;   }   int main() {     ios::sync_with_stdio(false);     cout.tie(0);     cin.tie(0);     int n, m;     cin >> n >> m;     for (int i = 0; i < m; i++) {       int a, b;       cin >> a >> b;       a--;       b--;       G[a].push_back(b);       G[b].push_back(a);     }     for (int u = 0; u < n; u++)       if (!vis[u]) {         sz = 0;         dfs(u);         cnt[sz]++;       }     for (map<int, int>::iterator iter = cnt.begin(); iter != cnt.end(); iter++) {       int x = iter->first, pw = 1;       int temp = iter->second;       while (temp >= pw) {         c[cN++] = x * pw, b[cN - 1] = pw, temp -= pw;         pw *= 2;       }       if (temp) {         c[cN++] = x * temp;         b[cN - 1] = temp;       }     }     fill(dp, dp + MAXN, -1u / 4);     dp[0] = 0;     for (int i = 0; i < cN; i++) {       int val = c[i];       for (int j = MAXN - 1; j >= 0; j--)         if (val + j < MAXN) smin(dp[j + val], dp[j] + b[i]);     }     int ans = -1u / 4;     for (int i = 1; i < MAXN; i++)       if (lucky(i)) smin(ans, dp[i]);     cout << (ans < MAXN ? ans - 1 : -1) << endl;   }   