stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



ll n, m;

vector <ll> adjlist[200010];



int main() {

	cin>>n>>m;

	ll x, y;

	set < pair<ll, ll> > s;

	for (int i=0; i<m; i++) {

		cin>>x>>y;

		if (x>y) swap(x, y);

		if (s.count(make_pair(x, y))==0) {

			adjlist[x].push_back(y);

			adjlist[y].push_back(x);

			s.insert(make_pair(x, y));

		}

	}

	ll ans=0, temp=0;

	bool vis[n+1];

	memset(vis, 0, sizeof(vis));

	for (int i=1; i<=n; i++) {

		if (!vis[i]) {

			ans=max(temp, ans);

			temp=0;

			queue <ll> q;

			vis[i]=1;

			q.push(i);

			while (!q.empty()) {

				temp++;

				for (auto j: adjlist[q.front()]) {

					if (!vis[j]) {

						vis[j]=1;

						q.push(j);

					}

				}

				q.pop();

			}

		}

	}

	ans=max(temp, ans);

	cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 6.536897631026346x):
#include <bits/stdc++.h>

using namespace std;



const int MAXN=2*1e5+10;

const int MOD=1e9+7;



int pre[MAXN];

int nodenum[MAXN];



int Find(int a){

    if(pre[a]!=a)

        pre[a]=Find(pre[a]);

    return pre[a];

}



void join(int x,int y) {

    int fx=Find(x),fy=Find(y);

    if(fx!=fy){

        pre[fy]=fx;

        nodenum[fx]+=nodenum[fy];

    }

    else return;

}



int main() {

    int n,m,a,b,ans=0;

    scanf("%d%d",&n,&m);

    for(int i=1;i<=n;i++) pre[i]=i,nodenum[i]=1;

    for(int i=1;i<=m;i++){

        scanf("%d%d",&a,&b);

        join(a,b);

    }

    for(int i=1;i<=n;i++){

        if(pre[i]==i){

            ans=max(nodenum[i],ans);

        }

    }

    cout<<ans<<endl;

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



ll n, m;

vector <ll> adjlist[200010];



int main() {

	cin>>n>>m;

	ll x, y;

	set < pair<ll, ll> > s;

	for (int i=0; i<m; i++) {

		cin>>x>>y;

		if (x>y) swap(x, y);

		if (s.count(make_pair(x, y))==0) {

			adjlist[x].push_back(y);

			adjlist[y].push_back(x);

			s.insert(make_pair(x, y));

		}

	}

	ll ans=0, temp=0;

	bool vis[n+1];

	memset(vis, 0, sizeof(vis));

	for (int i=1; i<=n; i++) {

		if (!vis[i]) {

			ans=max(temp, ans);

			temp=0;

			queue <ll> q;

			vis[i]=1;

			q.push(i);

			while (!q.empty()) {

				temp++;

				for (auto j: adjlist[q.front()]) {

					if (!vis[j]) {

						vis[j]=1;

						q.push(j);

					}

				}

				q.pop();

			}

		}

	}

	ans=max(temp, ans);

	cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 6.3853100305364725x):
#include <bits/stdc++.h>

#define ff first

#define ss second

#define ll long long

#define ld long double

#define pb push_back

#define eb emplace_back

#define mp make_pair

#define mt make_tuple

#define pii pair<int, int>

#define vi vector<int>

#define vl vector<ll>

#define vii vector<pii>

#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define endl '\n'

#define teto(a, b) ((a+b-1)/(b))

#define all(x) x.begin(), x.end()

#define forn(i, n) for(int i = 0; i < (int)n; i++)

#define forne(i, a, b) for(int i = a; i <= b; i++)

#define dbg(msg, var) cerr << msg << " " << var << endl;



using namespace std;



const int MAX = 200010;

const int MOD = 1000000007;

const int INF = 1e8;

const ll LLINF = 0x3f3f3f3f3f3f3f3f;

const ld EPS = 1e-7;



// End Template //



struct DSU {

    int n;

    vi parent, size;



    DSU(int n) {

        this->n = n;

        parent.assign(n+1, 0);

        size.assign(n+1, 1);



        for(int i=0;i<=n;i++)

            parent[i] = i;

    }



    int find(int v) {

        if(v==parent[v])

            return v;

        return parent[v]=find(parent[v]);

    }



    void join(int a, int b) {

        a = find(a);

        b = find(b);

        if(a!=b) {

            if(size[a]<size[b])

                swap(a, b);



            parent[b]=a;

            size[a]+=size[b];

        }

    }

};



int main()

{sws;



    int n, m, a, b;

    cin >> n >> m;

    DSU dsu(n+1);



    for(int i=0;i<m;i++){

        cin >> a >> b;

        dsu.join(a, b);

    }



    int ans = 0;

    for(int i=1;i<=n;i++){

        ans = max(ans, dsu.size[dsu.find(i)]);

    }



    cout << ans << endl;





    return 0;

    

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



ll n, m;

vector <ll> adjlist[200010];



int main() {

	cin>>n>>m;

	ll x, y;

	set < pair<ll, ll> > s;

	for (int i=0; i<m; i++) {

		cin>>x>>y;

		if (x>y) swap(x, y);

		if (s.count(make_pair(x, y))==0) {

			adjlist[x].push_back(y);

			adjlist[y].push_back(x);

			s.insert(make_pair(x, y));

		}

	}

	ll ans=0, temp=0;

	bool vis[n+1];

	memset(vis, 0, sizeof(vis));

	for (int i=1; i<=n; i++) {

		if (!vis[i]) {

			ans=max(temp, ans);

			temp=0;

			queue <ll> q;

			vis[i]=1;

			q.push(i);

			while (!q.empty()) {

				temp++;

				for (auto j: adjlist[q.front()]) {

					if (!vis[j]) {

						vis[j]=1;

						q.push(j);

					}

				}

				q.pop();

			}

		}

	}

	ans=max(temp, ans);

	cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 3.569317152657974x):
#include<bits/stdc++.h>

using namespace std;



int n,m;

int pre[200050];

int b[200050] = {0};



void init()

{

	for(int i = 0;i<=200050;++i)

	    pre[i] = i;

}



int find(int x)

{

	if(x == pre[x]) return x;

	int root = find(pre[x]);//压缩路径 

	return pre[x] = root;

}



void join(int x,int y)

{

	int fx = find(x),fy = find(y);

	

	if(fx != fy){

		pre[fx] = fy;

	}

}



int main()

{

    ios::sync_with_stdio(false);

    cin.tie(0);

    init();

	int n,m;

	cin>>n>>m;

	for(int i = 1;i<=m;++i){

		int x,y;

		cin>>x>>y;

		join(x,y);

		

//		for(int i = 1;i<=n;++i){

//			cout<<pre[i]<<" ";

//		}

//		cout<<endl;

	}

	for(int i = 1;i<=n;++i){

		b[find(i)]++;

	}

	int maxn = 0;

	for(int i = 1;i<=n;++i)

	    if(b[i]>maxn) maxn = b[i];

	    

	cout<<maxn<<endl;

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



ll n, m;

vector <ll> adjlist[200010];



int main() {

	cin>>n>>m;

	ll x, y;

	set < pair<ll, ll> > s;

	for (int i=0; i<m; i++) {

		cin>>x>>y;

		if (x>y) swap(x, y);

		if (s.count(make_pair(x, y))==0) {

			adjlist[x].push_back(y);

			adjlist[y].push_back(x);

			s.insert(make_pair(x, y));

		}

	}

	ll ans=0, temp=0;

	bool vis[n+1];

	memset(vis, 0, sizeof(vis));

	for (int i=1; i<=n; i++) {

		if (!vis[i]) {

			ans=max(temp, ans);

			temp=0;

			queue <ll> q;

			vis[i]=1;

			q.push(i);

			while (!q.empty()) {

				temp++;

				for (auto j: adjlist[q.front()]) {

					if (!vis[j]) {

						vis[j]=1;

						q.push(j);

					}

				}

				q.pop();

			}

		}

	}

	ans=max(temp, ans);

	cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 6.400846273388077x):
#include<bits/stdc++.h>

using namespace std;

#define IO ios::sync_with_stdio(false),cin.tie(0);

#define ll long long

#define inf 0x3f3f3f3f

const int N=2e5+5;

//set<string>b;

//set<string>::iterator it;

int f[N],c[N];

int getfa(int u)

{

	return f[u]==u?u:f[u]=getfa(f[u]);

}

void merge(int u,int v)

{

	int f1,f2;

	f1=getfa(u);f2=getfa(v);

	if(f1!=f2) f[f2]=f1;

}

int main()

{

	IO;

	int n,m,i,u,v,ans=0;

	cin>>n>>m;

	for(i=1;i<=n;i++) f[i]=i;

	for(i=1;i<=m;i++)

	{

		cin>>u>>v;

		merge(u,v);

	}

	for(i=1;i<=n;i++)

	{

		c[getfa(i)]++;

	}

	for(i=1;i<=n;i++)

	{

		ans=max(ans,c[i]);

	}

	cout<<ans<<endl;

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int n,m;

int pre[200050];

int b[200050] = {0};



void init()

{

	for(int i = 0;i<=200050;++i)

	    pre[i] = i;

}



int find(int x)

{

	if(x == pre[x]) return x;

	int root = find(pre[x]);//压缩路径 

	return pre[x] = root;

}



void join(int x,int y)

{

	int fx = find(x),fy = find(y);

	

	if(fx != fy){

		pre[fx] = fy;

	}

}



int main()

{

    ios::sync_with_stdio(false);

    cin.tie(0);

    init();

	int n,m;

	cin>>n>>m;

	for(int i = 1;i<=m;++i){

		int x,y;

		cin>>x>>y;

		join(x,y);

		

//		for(int i = 1;i<=n;++i){

//			cout<<pre[i]<<" ";

//		}

//		cout<<endl;

	}

	for(int i = 1;i<=n;++i){

		b[find(i)]++;

	}

	int maxn = 0;

	for(int i = 1;i<=n;++i)

	    if(b[i]>maxn) maxn = b[i];

	    

	cout<<maxn<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.7932971489018676x):
#include<bits/stdc++.h>

using namespace std;

#define IO ios::sync_with_stdio(false),cin.tie(0);

#define ll long long

#define inf 0x3f3f3f3f

const int N=2e5+5;

//set<string>b;

//set<string>::iterator it;

int f[N],c[N];

int getfa(int u)

{

	return f[u]==u?u:f[u]=getfa(f[u]);

}

void merge(int u,int v)

{

	int f1,f2;

	f1=getfa(u);f2=getfa(v);

	if(f1!=f2) f[f2]=f1;

}

int main()

{

	IO;

	int n,m,i,u,v,ans=0;

	cin>>n>>m;

	for(i=1;i<=n;i++) f[i]=i;

	for(i=1;i<=m;i++)

	{

		cin>>u>>v;

		merge(u,v);

	}

	for(i=1;i<=n;i++)

	{

		c[getfa(i)]++;

	}

	for(i=1;i<=n;i++)

	{

		ans=max(ans,c[i]);

	}

	cout<<ans<<endl;

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;

using   ll=long long;



#define fast            ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)



#define endl            "\n"

#define pb              push_back

#define mp              make_pair

#define F               first

#define S               second

#define int             long long int

#define pll                pair<int , int>



#define ALL(v)          v.begin(),v.end()

#define ALLR(v)         v.rbegin(),v.rend()

#define pii             3.14159265358979323

#define inf             LLONG_MAX

#define ones(x)         __builtin_popcount(x)

#define fill(a,b)       memset(a,b,sizeof(a))

#define mod             1000000007

#define hell            998244353

const int maxn = 2e5 + 1;



vector<vector<int>> a(maxn);



int tot;



int vis[maxn];



void dfs(int u) {

	vis[u] = 1;

	

	tot++;

	

	for(auto v : a[u]) {

		if(!vis[v])  {

			dfs(v);

		}

	}

}



void solve()

{

	int n , m;

	

	cin >> n >> m;

	

	for(int i = 0; i < m; ++i) {

		int x , y;

		

		cin >> x >> y;

		

		a[x].pb(y);

		a[y].pb(x);

	}

	

	int ans = 0;

	

	for(int i = 1; i <= n; ++i) {

		if(!vis[i]) {

			tot = 0;

			

			dfs(i);

			

			//cout << i <<" " << tot << endl;

			

			ans = max(ans , tot);

		}

	}

	

	cout << ans;

}



signed main() {

    fast;



    int t = 1;

   

    //cin >> t;



    while(t--) {

        solve();

    }



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 6.441011599558722x):
#include<bits/stdc++.h>

using namespace std;



#define ll long long int

#define pi 3.141592653589793238

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define mod 1000000007

int val=0,ans=INT_MIN;

void dfs(int node,vector<vector<int>> &adj,vector<bool> &visited)

{

    visited[node]=true;

    val++;

    for(auto u:adj[node])

        if(!visited[u])

            dfs(u,adj,visited);

}

int main(){

	fast;

    int n,m;

    cin>>n>>m;

    vector<vector<int>> adj(n+1);

    vector<bool> visited(n+1,false);

    for(int i=0;i<m;i++)

    {

        int a,b;

        cin>>a>>b;

        adj[a].push_back(b);

        adj[b].push_back(a);

    }

    for(int i=1;i<=n;i++)

    {

        val=0;

        if(!visited[i])

           dfs(i,adj,visited);

        ans=max(ans,val);

    }

    cout<<ans;

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



const int MAX = 2 * pow(10, 5);

const int VISITED = 1;

const int UNVISITED = 0;

int color[MAX];

vector<vector<int>> G(MAX); //connected list G



int dfs(int r){

  stack<int> S;

  S.push(r);

  int num = 1;

  color[r] = VISITED;

  while(!S.empty()){

    int u = S.top();

    S.pop();

    for(int i = 0; i < G[u].size(); i++){

      int v = G[u][i];

      if(color[v] == UNVISITED){

        color[v] = VISITED;

        S.push(v);

        num += 1;

      }

    }

  }

  return num;

}







int main(){

  int N;

  int M;

  cin >> N >> M;

  vector<int> A(M);

  vector<int> B(M);

  for(int i = 0; i < M; i++){

    cin >> A[i]>> B[i];

  }

  

  for(int i = 0; i < M; i++){

    G[A[i] - 1].push_back(B[i] - 1);

    G[B[i] - 1].push_back(A[i] - 1);

  }

  

  for(int i = 0; i < N; i++){

    sort(G[i].begin(), G[i].end());

    color[i] = UNVISITED;

  }

  

  int ans = 0;

  for(int i = 0; i < N; i++){

    if(color[i] == UNVISITED){

      ans = max(ans, dfs(i));

    }

  }

  cout << ans << endl;

  

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 6.505689575143446x):
#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;



struct UnionFind {

  vector<int> r;

  

  UnionFind(int N){

    r = vector<int>(N, -1);

  }

  

  int root(int x){

    if(r[x] < 0) return x;

    return r[x] = root(r[x]);

  }

  

  bool unite(int x, int y){

    x = root(x);

    y = root(y);

    if(x == y) return false;

    if(r[x] > r[y]) swap(x, y);

    r[x] += r[y];

    r[y] = x;

    return true;

  }

  

  int size(int x){

    return -r[root(x)];

  }

};



int main(){

  int N, M;

  cin >> N >> M;

  

  UnionFind UF(N);

  for(int i = 0; i < M; i++){

    int A, B;

    cin >> A >> B;

    UF.unite(A - 1, B - 1);

  }

  int ans = 0;

  for(int i = 0; i < N; i++){

    ans = max(ans, UF.size(i));

  }

  cout << ans << endl;

  

  return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (n); ++i)

vector<int> p(200000);

vector<int> sz(200000);





int find(int x)

{

    while (p[x] != x) {

        p[x] = p[p[x]];

        x = p[x];

    }

    return x;

}



void merge(int x, int y)

{

    int a = find(x);

    int b = find(y);

    if (a == b) return;

    if (sz[a] < sz[b]) {

        p[a] = b;

        sz[b] += sz[a];

    } else {

        p[b] = a;

        sz[a] += sz[b];

    }

}



int main()

{

    int n, m;

    cin >> n >> m;

    rep(i, n) {

        p[i] = i;

        sz[i] = 1;

    }

    rep(i, m) {

        int x, y;

        cin >> x >> y;

        merge(x-1, y-1);

    }

    int ans = 0;

    vector<int> counter(n);

    rep(i, n) counter[find(p[i])]++;

    rep(i, n) ans = max(counter[i], ans);

    cout << ans << endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.626695491075194x):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using P = pair<int, int>;

#define rep(i, n) for(int i = 0; i < (n); ++i)



struct UnionFind {

    vector<int> d;

    UnionFind(int n=0):d(n,-1){}

    int find(int x) {

        if (d[x] < 0) return x;

        return d[x] = find(d[x]);

    }

    bool unite(int x, int y) {

        x = find(x); y = find(y);

        if (x == y) return false;

        if (d[x] > d[y]) swap(x, y);

        d[x] += d[y];

        d[y] = x;

        return true;

    }

    bool same(int x, int y) {return find(x) == find(y);}

    int size(int x) {return -d[find(x)];}

};



int main()

{

    int n, m;

    cin >> n >> m;

    UnionFind uf(n);

    rep(i,m) {

        int a, b;

        cin >> a >> b;

        --a; --b;

        uf.unite(a, b);

    }

    int ans = 0;

    rep(i,n) ans = max(ans, uf.size(i));

    cout << ans << endl;

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <vector>

using namespace std;

const int MAX_N = 200001;

int n, m;

vector<int> G[MAX_N]; //隣接リスト;

bool used[MAX_N]; //訪問済みかどうか



int dfs(int v) {

  used[v] = true;

  int sum = 1;

  for (int i = 0; i < G[v].size(); i++) {

    if (!used[G[v][i]]) {

      sum += dfs(G[v][i]);

    }

  }

  return sum;

}



int main() {

  cin >> n >> m;

  for (int i = 0; i < m; i++) {

    int a, b;

    cin >> a >> b;

    //辺を張る

    G[a].push_back(b);

    G[b].push_back(a);

  }

  

  // 全てを点を試す

  int ans = 0;

  int res = 0;

  for (int i = 0; i < n; i++) {

    res = dfs(i);

    ans = max(ans, res);

  }

  

  cout << ans;

}

// Faster C++ solution for the same problem (measured speedup: 6.4700337206340715x):
#include <iostream>

#include <vector>

using namespace std;



int n, m;



struct UnionFind {

  vector<int> r;

  UnionFind(int N) {

    r = vector<int>(N, -1);

  }

  

  int root(int x) {

    if (r[x] < 0) return x;

    return r[x] = root(r[x]);

  }

 

  bool unite(int x, int y) {

    x = root(x);

    y = root(y);

    if (x == y) return false;

    if (r[x] > r[y]) swap(x, y);

    r[x] += r[y];

    r[y] = x;

    return true;

  }

  

  int size(int x) {

    return -r[root(x)];

  }

};



int main() {

  cin >> n >> m;

  UnionFind UF(n);

  for (int i = 0; i < m; i++) {

    int A, B;

    cin >> A >> B;

    UF.unite(A, B);

  }

  

  int ans = 0;

  for (int i = 0; i < n; i++) {

    ans = max(ans, UF.size(i));

  }

  cout << ans;

}
// Slower C++ solution:
#include <iostream>

#include <vector>

using namespace std;



const int MAX_N = 200000;

int n, m;

vector<vector<int>> G(MAX_N); //隣接リスト

bool used[MAX_N]; // 訪問済みかどうか



int dfs(int v) {

  used[v] = true;

  

  int d = 1;

  for (int i = 0; i < G[v].size(); i++) {

    int next = G[v][i];

    if (!used[next]) {

      d += dfs(next);

    }

  }

  return d;

}



int main() {

  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);

  }

  

  int ans = 0;

  for (int i = 0; i < n; i++) {

    int d = dfs(i);

    ans = max(ans, d);

  }

  

  cout << ans;

}

// Faster C++ solution for the same problem (measured speedup: 6.567614951222316x):
#include <iostream>

#include <vector>

using namespace std;



int n, m;



struct UnionFind {

  vector<int> r;

  UnionFind(int N) {

    r = vector<int>(N, -1);

  }

  

  int root(int x) {

    if (r[x] < 0) return x;

    return r[x] = root(r[x]);

  }

 

  bool unite(int x, int y) {

    x = root(x);

    y = root(y);

    if (x == y) return false;

    if (r[x] > r[y]) swap(x, y);

    r[x] += r[y];

    r[y] = x;

    return true;

  }

  

  int size(int x) {

    return -r[root(x)];

  }

};



int main() {

  cin >> n >> m;

  UnionFind UF(n);

  for (int i = 0; i < m; i++) {

    int A, B;

    cin >> A >> B;

    UF.unite(A, B);

  }

  

  int ans = 0;

  for (int i = 0; i < n; i++) {

    ans = max(ans, UF.size(i));

  }

  cout << ans;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int cnt;

vector<vector<int>> G(3e5);

vector<int> seen(3e5,false);



void dfs(int u) {

  seen[u]=true;

  cnt++;

  for(int next:G[u]) if(seen[next]==false) dfs(next);

}



int main() {

  int n,m; cin>>n>>m;

  int a,b,ans=0;

  for(int i=0;i<m;i++) {

    cin>>a>>b;

    G[a].push_back(b);

    G[b].push_back(a);

  }

  for(int i=1;i<=n;i++) {

    if(seen[i]==false) {

      cnt=0;

      dfs(i);

    }

    ans=max(ans,cnt);

  }

  cout<<ans<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 1.1424421263411328x):
#include<bits/stdc++.h>

using namespace std;



vector<vector<int>> G(3e5);

vector<bool> seen(3e5,false);

int cnt;



void bfs(int r) {

  queue<int> Q;

  Q.push(r);

  seen[r]=true;

  int u;

  while(!Q.empty()) {

    u=Q.front();

    Q.pop();

    cnt++;

    for(int next:G[u]) {

      if(seen[next]==false) {

        seen[next]=true;

        Q.push(next);

      }

    }

  }

}



int main() {

  int n,m; cin>>n>>m;

  int a,b,ans=0;

  for(int i=0;i<m;i++) {

    cin>>a>>b;

    G[a].push_back(b);

    G[b].push_back(a);

  }

  for(int i=1;i<=n;i++) {

    if(seen[i]==false) {

      cnt=0;

      bfs(i);

      ans=max(ans,cnt);

    }

  }

  cout<<ans<<endl;

}
// Slower C++ solution:
//#include<bits/stdc++.h>

#include<cstdio>

#include<cstring>

#include<algorithm>

#include<iostream>

#include<stdlib.h>

#include<queue>

#include<map>

#include<vector>

#include<cmath>

#include<fstream>

#include <set>

//freopen(".in","r",stdin);

//freopen(".out","w",stdout);

//freopen("input.txt","r",stdin);

//freopen("output.txt","w",stdout);

const int  MAXN =2e5+10;

const int mod = 1e9 + 7;

const long long INF = 0x7f7f7f7f7f7f7f7f;

const int inf= 0x3f3f3f3f;

#define eps 1e-8

#define PI 3.1415926535898

#define lowbit(x) (x&(-x))

using namespace std ;

//getline(cin,s);

//set<ll>::iterator it;

//map<int,int>::iterator it;

//unordered_map

typedef long long ll;

int vis[MAXN],dist[MAXN];

vector<int>ve[MAXN];

void dfs(int now)

{

	if(vis[now]) return ;

	vis[now]=1;

	for(int i=0;i<ve[now].size();i++)

	{

		int ne=ve[now][i];

		if(!vis[ne])

		{

			dfs(ne);

			dist[now]+=dist[ne];

		}

	}

	return ;

}

int main()

{

	int n,m,ans=0;

	scanf("%d %d",&n,&m);

	for(int i=1;i<=n;i++) dist[i]=1;

	while(m--)

	{

		int x,y;

		scanf("%d %d",&x,&y);

		ve[x].push_back(y);

		ve[y].push_back(x);

	}

	for(int i=1;i<=n;i++)

	{

		if(!vis[i])

		{

		    dfs(i);

		    ans=max(ans,dist[i]);

		} 

	}

	printf("%d\n",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 6.5293337162327045x):
//#include<bits/stdc++.h>

#include<cstdio>

#include<cstring>

#include<algorithm>

#include<iostream>

#include<stdlib.h>

#include<queue>

#include<map>

#include<vector>

#include<cmath>

#include<fstream>

#include <set>

//freopen(".in","r",stdin);

//freopen(".out","w",stdout);

//freopen("input.txt","r",stdin);

//freopen("output.txt","w",stdout);

const int  MAXN =2e5+10;

const int mod = 1e9 + 7;

const long long INF = 0x7f7f7f7f7f7f7f7f;

const int inf= 0x3f3f3f3f;

#define eps 1e-8

#define PI 3.1415926535898

#define lowbit(x) (x&(-x))

using namespace std ;

//getline(cin,s);

//set<ll>::iterator it;

//map<int,int>::iterator it;

//unordered_map

typedef long long ll;

//已AC 尝试去并查集 

int father[MAXN];

int need[MAXN];

int Find(int x)

{

	return x==father[x] ? x : father[x]= Find(father[x]);

}

int main()

{

	int n,m;

	scanf("%d %d",&n,&m);

	for(int i=1;i<=n;i++) father[i]=i,need[i]=1;

	while(m--)

	{

		int a,b;

		scanf("%d %d",&a,&b);

		int x=Find(a),y=Find(b);

		if(x!=y)

		{

			father[x]=y;

			need[y]+=need[x];

		}

	}

	int ans=0;

	for(int i=1;i<=n;i++)

	{

		ans=max(ans,need[i]);

	}

	//for(int i=1;i<=n;i++) printf("need: %d\n",need[i]);

	printf("%d\n",ans);

	return 0;

}