Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n,m;
  cin>>n>>m;
  vector<vector<int>> f(m);
  map<int> s;
  vector<set<int>> result;
  int a,b;
  bool contain;
  for(int i=0;i<m;i++){
    cin>>a>>b;
    f.at(i).at(0)=a;
    f.at(i).at(1)=b;
    s.insert(i);
  }
  bool add=true;
  while(s.size()>0){
    if(add){
      auto i=s.begin();
      result.push_back({f.at(*i).at(0),f.at(*i).at(1)});
      s.erase(i);
    }
    add=true;
    for(auto i=s.begin();i!=s.end();i++){
      if(result.at(result.size()-1).count(f.at(*i).at(0))){
        result.at(result.size()-1).insert(f.at(*i).at(1));
        add=false;
      }else if(result.at(result.size()-1).count(f.at(*i).at(1))){
        result.at(result.size()-1).insert(f.at(*i).at(0));
        add=false;
      }
    }
  }
  int max=0;
  for(int i=0;i<(int)result.size();i++){
    if((int)result.at(i).size()>max){
      max=reuslt.at(i).size();
    }
  }
  cout<<max<<endl;
}
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: wrong number of template arguments (1, should be at least 2)
    8 |   map<int> s;
      |          ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:16:7: error: request for member 'insert' in 's', which is of non-class type 'int'
   16 |     s.insert(i);
      |       ^~~~~~
a.cc:19:11: error: request for member 'size' in 's', which is of non-class type 'int'
   19 |   while(s.size()>0){
      |           ^~~~
a.cc:21:16: error: request for member 'begin' in 's', which is of non-class type 'int'
   21 |       auto i=s.begin();
      |                ^~~~~
a.cc:22:23: error: no matching function for call to 'std::vector<std::set<int> >::push_back(<brace-enclosed initializer list>)'
   22 |       result.push_back({f.at(*i).at(0),f.at(*i).at(1)});
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::set<int>; _Alloc = std::allocator<std::set<int> >; value_type = std::set<int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::set<int> >::value_type&' {aka 'const std::set<int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::set<int>; _Alloc = std::allocator<std::set<int> >; value_type = std::set<int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::set<int> >::value_type&&' {aka 'std::set<int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:23:9: error: request for member 'erase' in 's', which is of non-class type 'int'
   23 |       s.erase(i);
      |         ^~~~~
a.cc:26:18: error: request for member 'begin' in 's', which is of non-class type 'int'
   26 |     for(auto i=s.begin();i!=s.end();i++){
      |                  ^~~~~
a.cc:26:31: error: request for member 'end' in 's', which is of non-class type 'int'
   26 |     for(auto i=s.begin();i!=s.end();i++){
      |                               ^~~
a.cc:39:11: error: 'reuslt' was not declared in this scope; did you mean 'result'?
   39 |       max=reuslt.at(i).size();
      |           ^~~~~~
      |           result