[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]:
fa = integer array of size 202002
sum = integer array of size 202002
c = integer array of size 202002
in function max with arguments of integer a and integer b that returns an integer
    if a > b
        return a
    else
        return b
end of the block
in function findfa with arguments integer x that returns an integer
    if fa[x] is x
        return x
    else
        return the result of calling findfa with argument of fa[x]
end of the block
in function joint with argument integer x and integer y that returns nothing
    rx = integer = the result of calling findfa with argument of x
    ry = integer = the result of calling findfa with argument of y
    if rx is not ry
        fa[rx] = ry
        sum[ry] = sum[ry] + sum[rx]
    end of the block
end of the block
vis = boolean array of size 202002
vec = integer vector
define the main function
    n, m, k = integer
    read n, m, k
    clear all elements of vec
    for i = 0 to n inclusive
        fa[i] = i
        sum[i] = 1
    end of the block
    for i = 0 to k exclusive, then read c[i]
    x, y = integers
    for i = 0 to m exclusive
        read x, y
        call join with arguments of x and y
    end of the block
    set all elements of vis to 0
    for i = 0 to k exclusive, vis[the result of calling findfa with argument c[i] = 1
    mx = integer = -1
    ans = long long = 0
    for i = 1 to n inclusive
        if fa[i] is i
            if vis[i] is 1
                mx = the bigger value between mx and sum[i]
            else
                push back the values of vec and insert a new element of sum[i] at the end of vec
            ans = ans + sum[i] * (sum[i] - 1) / 2
        end of the block
    end of the block
    sz = integer = size of vec
    for i = 0 to sz exclusive
        for j = i + 1 to sz exclusive, then ans = ans + vec[i] * vec[j]
        ans = ans + vec[i] * mx
    end of the block
    ans = ans - m
    print ans
    return to indicate successful execution
end of the block

[CODE]:

int fa[202002];
int sum[202002];
int c[202002];
int max(int a, int b) {
    if (a > b)
        return a;
    else
        return b;
}
int findfa(int x) {
    if (fa[x] == x)
        return x;
    else
        return findfa(fa[x]);
}
void joint(int x, int y) {
    int rx = findfa(x);
    int ry = findfa(y);
    if (rx != ry) {
        fa[rx] = ry;
        sum[ry] += sum[rx];
    }
}
bool vis[202002];
vector<int> vec;
int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vec.clear();
    for (int i = 0; i <= n; i++) {
        fa[i] = i;
        sum[i] = 1;
    }
    for (int i = 0; i < k; i++) cin >> c[i];
    int x, y;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        joint(x, y);
    }
    memset(vis, 0, sizeof(vis));
    for (int i = 0; i < k; i++) vis[findfa(c[i])] = 1;
    int mx = -1;
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        if (fa[i] == i) {
            if (vis[i] == 1)
                mx = max(mx, sum[i]);
            else
                vec.push_back(sum[i]);
            ans += sum[i] * (sum[i] - 1) / 2;
        }
    }
    int sz = vec.size();
    for (int i = 0; i < sz; i++) {
        for (int j = i + 1; j < sz; j++) { ans += vec[i] * vec[j]; }
        ans += vec[i] * mx;
    }
    ans -= m;
    cout << ans << endl;
    return 0;
}