func_code_string: #include <bits/stdc++.h>   const int MAX = 1e3 + 5;   using namespace std;   int edge, mx, ans, seen[MAX], a, n, m, k, spec[MAX], check[MAX][MAX];   vector<int> adj[MAX];   vector<int> cur;   void dfs(int node) {     if (seen[node] == 1) return;     seen[node] = 1;     cur.push_back(node);     for (int i = int(0); i <= int(adj[node].size() - 1); i++) dfs(adj[node][i]);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> n >> m >> k;     for (int i = int(1); i <= int(k); i++) cin >> a, spec[a] = 1;     for (int i = int(1); i <= int(m); i++) {       int u, v;       cin >> u >> v;       adj[u].push_back(v);       adj[v].push_back(u);       check[u][v] = check[v][u] = 1;     }     for (int i = int(1); i <= int(n); i++)       if (spec[i] == 1) {         dfs(i);         mx = max(int(cur.size()), mx);         int comb = (cur.size() == 1 ? 0 : (cur.size() * (cur.size() - 1) / 2));         for (int i = int(0); i <= int(cur.size() - 1); i++) {           for (int j = int(i + 1); j <= int(cur.size() - 1); j++)             edge += check[cur[i]][cur[j]];         }         ans += comb - edge;         cur.clear();         edge = 0;       }     for (int i = int(1); i <= int(n); i++) {       if (seen[i] == 1) continue;       dfs(i);       int comb = (cur.size() == 1 ? 0 : (cur.size() * (cur.size() - 1) / 2));       for (int i = int(0); i <= int(cur.size() - 1); i++) {         for (int j = int(i + 1); j <= int(cur.size() - 1); j++)           edge += check[cur[i]][cur[j]];       }       ans += comb - edge;       ans += mx * int(cur.size());       mx += cur.size();       cur.clear();       edge = 0;     }     cout << ans <<   n ;     return 0;   }   