Language: C++

#include <bits/stdc++.h>

using namespace std;
int c;
vector<vector<int>> adj[200000];
vector<bool> visit[200000];
void dfs(int i)
{
    c++;
    visit[i] = true;
    for (int j : adj[i]) {
        if (!visit[j]) dfs(j);
    }
}
int main()
{
    int n, m;
    cin >> n >> m;
    adj.resize(n);
    visit.resize(n, false);
    int x,y;
    for (int i=0; i<m; i++) {
        cin>>x>>y;
        adj[--x].push_back(--y);
        adj[y].push_back(x);
    }
    int res = 0;
    for (int i=0; i<n; i++) {
        c = 0;
        if (!visit[i]) dfs(i);
        res = max(res, c);
    }
    cout << res << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:10:5: error: reference to 'visit' is ambiguous
   10 |     visit[i] = true;
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:14: note:                 'std::vector<bool> visit [200000]'
    6 | vector<bool> visit[200000];
      |              ^~~~~
a.cc:11:23: error: cannot convert 'std::vector<int>' to 'int' in initialization
   11 |     for (int j : adj[i]) {
      |                       ^
a.cc:12:14: error: reference to 'visit' is ambiguous
   12 |         if (!visit[j]) dfs(j);
      |              ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:14: note:                 'std::vector<bool> visit [200000]'
    6 | vector<bool> visit[200000];
      |              ^~~~~
a.cc: In function 'int main()':
a.cc:19:9: error: request for member 'resize' in 'adj', which is of non-class type 'std::vector<std::vector<int> > [200000]'
   19 |     adj.resize(n);
      |         ^~~~~~
a.cc:20:5: error: reference to 'visit' is ambiguous
   20 |     visit.resize(n, false);
      |     ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:14: note:                 'std::vector<bool> visit [200000]'
    6 | vector<bool> visit[200000];
      |              ^~~~~
a.cc:24:27: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
   24 |         adj[--x].push_back(--y);
      |         ~~~~~~~~~~~~~~~~~~^~~~~
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::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<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 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<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::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<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 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:25:25: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
   25 |         adj[y].push_back(x);
      |         ~~~~~~~~~~~~~~~~^~~
/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::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<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 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<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::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<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 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:30:14: error: reference to 'visit' is ambiguous
   30 |         if (!visit[i]) dfs(i);
      |              ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:14: note:                 'std::vector<bool> visit [200000]'
    6 | vector<bool> visit[200000];
      |              ^~~~~