<commit_before><commit_msg>BZOJ 1015<commit_after>#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cassert>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

const int MAXN=4E5+10;

int n,m,k,a[MAXN],ans[MAXN],fa[MAXN],tans;
bool ban[MAXN];
vector<int> v[MAXN];

int find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);}

bool merge(int x,int y)
{
    x=find(x);y=find(y);
    if(x==y) return 0;
    fa[x]=y;
    return 1;
}

int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) fa[i]=i;
    for(int i=1,x,y;i<=m;i++) scanf("%d%d",&x,&y),++x,++y,v[x].push_back(y),v[y].push_back(x);
    scanf("%d",&k);tans=n-k;
    for(int i=1;i<=k;i++) scanf("%d",&a[i]),ban[++a[i]]=1;
    for(int i=1;i<=n;i++)
        if(!ban[i])
            for(int j=0;j<v[i].size();j++)
                if(!ban[v[i][j]]) tans-=merge(i,v[i][j]);
    for(int i=k;i;i--)
    {
        ans[i]=tans;ban[a[i]]=0;
        for(int j=0;j<v[a[i]].size();j++)
            if(!ban[v[a[i]][j]]) tans-=merge(a[i],v[a[i]][j]);
        ++tans;
    }
    ans[0]=tans;
    for(int i=0;i<=k;i++) printf("%d\n",ans[i]);
    #ifdef LOCAL
        system("pause");
    #endif
}
{'fraction_non_alphanumeric': 0.2698412698412698, 'fraction_numerical': 0.015117157974300832, 'mean_word_length': 4.171875, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7005216', 'n_tokens_mistral': 648, 'n_tokens_neox': 635, 'n_words': 86}