[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
v = vector of long integers of size 1100
visited = array of boolean values of length 1100
let ans be a long integer with ans = 0
let edges be a long integer with edges = 0
let edge be a long integer with edge = 0
let dfs be a long integer function that accepts long integer values x, parentu
    visited[x] is equal to true
    let n be a long integer with n = 1
    edges = edges + length of v[x]
    for long integer i = 0 to length of v[x] exclusive,
        if not visited[v[x][i]], n = n + depth first search of v[x][i], x
    end of the block
    return the value of n
end of the block
define the main function
    let n, m, k, x, y be long integers
    read n, m, k
    home = vector of long integers
    for long integer i = 0 to k exclusive
        read x
        push to back x in home
    end of the block
    for long integer i = 0 to m exclusive
        read x, y
        push to back y in v[x]
        push to back x in v[y]
    end of the block
    let sum be a long integer with sum = 0
    let num be a long integer with num = 0
    for long integer i = 0 to k exclusive
        if not visited[home[i]]
            edges is equal to 0
            let node be a long integer with node is equal to depth first search of home[i], 0
            edges is equal to edges / 2
            increment edge by edges
            num is equal to maximum of num and node
            ans is equal to ans + ((node - 1) * (node)) / 2 - edges
            increment sum by node
        end of the block
    end of the block
    ans is equal to ans + (n - sum) * num
    ans is equal to ans + ((n - sum - 1) * (n - sum)) / 2 - (m - edge)
    print ans and newline
end of the block

[CODE]:

vector<long long int> v[1100];
bool visited[1100];
long long int ans = 0;
long long int edges = 0;
long long int edge = 0;
long long int dfs(long long int x, long long int parent) {
    visited[x] = true;
    long long int n = 1;
    edges += v[x].size();
    for (long long int i = 0; i < v[x].size(); i++) {
        if (!visited[v[x][i]]) n += dfs(v[x][i], x);
    }
    return n;
}
int main() {
    long long int n, m, k, x, y;
    cin >> n >> m >> k;
    vector<long long int> home;
    for (long long int i = 0; i < k; i++) {
        cin >> x;
        home.push_back(x);
    }
    for (long long int i = 0; i < m; i++) {
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    long long int sum = 0;
    long long int num = 0;
    for (long long int i = 0; i < k; i++) {
        if (!visited[home[i]]) {
            edges = 0;
            long long int node = dfs(home[i], 0);
            edges /= 2;
            edge += edges;
            num = max(num, node);
            ans += ((node - 1) * (node)) / 2 - edges;
            sum += node;
        }
    }
    ans += (n - sum) * num;
    ans += ((n - sum - 1) * (n - sum)) / 2 - (m - edge);
    cout << ans << endl;
}