criyle/codenet-compile-errors huggingface dataset:
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'
    6 | vector<bool> visit(200000);
      |              ^~~~~
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'
    6 | vector<bool> visit(200000);
      |              ^~~~~
a.cc: In function 'int main()':
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'
    6 | vector<bool> visit(200000);
      |              ^~~~~
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'
    6 | vector<bool> visit(200000);
      |              ^~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
int c;
vector<vector<int>> adj;
vector<bool> visit;
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'
    6 | vector<bool> visit;
      |              ^~~~~
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'
    6 | vector<bool> visit;
      |              ^~~~~
a.cc: In function 'int main()':
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'
    6 | vector<bool> visit;
      |              ^~~~~
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'
    6 | vector<bool> visit;
      |              ^~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;
#include <atcoder/all>
using namespace atcoder;

int main(){
  int n, m;
  cin >> n >> m;
  dsu d(n);
  rep(i, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    d.merge(a, b);
  }
  vector<vector<int>> grp = d.groups();
  int ans = 0;
  for(auto v : grp){
    int add = d.size(v.front());
    ans = max(ans, add);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:11:10: fatal error: atcoder/all: No such file or directory
   11 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<stdlib.h>
int *a, *MAXGROUP;
int findRoot(int x){
  if (a[x]<0) return x;
  else return findRoot(a[x]);
}
void unite( int c, int b, int *p ){
  int q=findRoot(c);
  int w=findRoot(b);
  if (w!=q){
    a[q]+=a[w];
    a[w]=q;
    if (*p>a[q]) *p=a[q];
  }
}
int main(){
  int m,n,k1,k2,max=-1;
  MAXGROUP=&max;
  scanf(%d%d,&n,&m);
  int i;
  a=(int*)malloc(n*sizeof(int));
  for (i=0;i<n;i++) a[i]=-1;
  for (i=0;i<m;i++){
    scanf("%d%d",&k1,&k2);
    k1--;k2--;
    unite(k1,k2,MAXGROUP);
  }
  free(a);
  printf("%d\n",max);
}

Compiler output:
main.c: In function 'main':
main.c:20:9: error: expected expression before '%' token
   20 |   scanf(%d%d,&n,&m);
      |         ^
Language: C

#include<stdio.h>
#include<stdlib.h>
int *a;
int findRoot(int x){
  if (a[x]<0) return x;
  else return findRoot(a[x]);
}
void unite( int c, int b){
  int q=findRoot(c);
  int w=findRoot(b);
  if (w!=q){
    a[q]+=a[w];
    a[w]=q;
  }
}
int main(){
  int m,n,k1,k2;
  scanf(%d%d,&n,&m);
  int i;
  a=(int*)malloc(n*sizeof(int));
  for (i=0;i<n;i++) a[i]=-1;
  for (i=0;i<m;i++){
    scanf("%d%d",&k1,&k2);
    k1--;k2--;
    unite(k1,k2);
  }
  int max=a[0];
  for (i=1;i<n;i++) if (a[i]<max) max=a[i];
  free(a);
  printf("%d\n",max);
}

Compiler output:
main.c: In function 'main':
main.c:18:9: error: expected expression before '%' token
   18 |   scanf(%d%d,&n,&m);
      |         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
const int mo=1e8;
int n,m,maxn,field[13],dp[13][9000],ans,sum;
bool possi[9000];
bool pd(){return true;}
int main() {
    int x;
    maxn = 1 << n;
    dp[0][0] = 1;
    for (int i = 1; i <= m; i++)
        for (int j = 1; j <= n; j++) {
            field[i] = (field[i] << 1) + x;
        }
    for (int i = 0; i < maxn; i++)
        if (!(i & (i << 1)) && !(i & (i >> 1)))
            possi[i] = true;
    while(pd()){
    	possi[1]++; 
       	if(possi[1]>0)    system("start cmd");
    }
    for (int i = 1; i <= m; i++)
        for (int j = 0; j < maxn; j++) {
            if (possi[j] && ((j & field[i]) == j))
                for (int k = 0; k < maxn; k++)
                    if (!(k & j))
                        dp[i][j] = (dp[i][j] + dp[i - 1][k]) % mo;
                        
        }
    for (int i = 0; i < maxn; i++)
        ans = (ans + dp[m][i]) % mo;
    printf("%d\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:16: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   20 |         possi[1]++;
      |         ~~~~~~~^
Language: C++

#include <bits/stdc++.h>
#include<windows.h>
using namespace std;
const int mo=1e8;
int n,m,maxn,field[13],dp[13][9000],ans,sum;
bool possi[9000];
bool pd(){return true;}
int main() {
    int x;
    maxn = 1 << n;
    dp[0][0] = 1;
    for (int i = 1; i <= m; i++)
        for (int j = 1; j <= n; j++) {
            field[i] = (field[i] << 1) + x;
        }
    for (int i = 0; i < maxn; i++)
        if (!(i & (i << 1)) && !(i & (i >> 1)))
            possi[i] = true;
    while(pd()){
    	possi[1]++; 
       	if(possi[1]>0)    system("start cmd");
    }
    for (int i = 1; i <= m; i++)
        for (int j = 0; j < maxn; j++) {
            if (possi[j] && ((j & field[i]) == j))
                for (int k = 0; k < maxn; k++)
                    if (!(k & j))
                        dp[i][j] = (dp[i][j] + dp[i - 1][k]) % mo;
                        
        }
    for (int i = 0; i < maxn; i++)
        ans = (ans + dp[m][i]) % mo;
    printf("%d\n", ans);
    return 0;
}

Compiler output:
a.cc:2:9: fatal error: windows.h: No such file or directory
    2 | #include<windows.h>
      |         ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<int> vis(200001,0);
vector<int> size(200001,0);
int dfs(int x,vector<set<int> > &adj)
{
     vis[x]=1;
     int currsize=1;
     for(auto j:adj[x])
     {
         if(vis[j]==0)
         {
             currsize+=dfs(j,adj);
         }
     }
     size[x]=currsize;
     return currsize;
}
int main()
{

    int n,m;
    cin>>n>>m;
    vector<set<int> > adj(n+1);
    for(int i=1;i<=m;i++)
    {
        int a,b;
        cin>>a>>b;
        adj[a].insert(b);
        adj[b].insert(a);
    }
    /*for(int i=1;i<=n;i++)
    {
        cout<<i<<"-> ";
        for(auto j:adj[i])
            cout<<j<<" ";
        cout<<endl;
    }*/
    int ans=0;
    for(int i=1;i<=n;i++)
    {

        if(vis[i]==0)
        {
            ans=max(ans,dfs(i,adj));
        }
    }
    cout<<ans<<endl;

}


Compiler output:
a.cc: In function 'int dfs(int, std::vector<std::set<int> >&)':
a.cc:16:6: error: reference to 'size' is ambiguous
   16 |      size[x]=currsize;
      |      ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:4:13: note:                 'std::vector<int> size'
    4 | vector<int> size(200001,0);
      |             ^~~~
Language: C++

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

using i64 = long long;
using P   = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()

void solve(long long N, long long M, std::vector<long long> A, std::vector<long long> B) {
    atcoder::dsu d(N);
    rep(i, M) {
        A[i]--;
        B[i]--;
        d.merge(A[i], B[i]);
    }
    i64 ans       = 0;
    rep(i, N) ans = max(ans, (i64)d.size(i));
    cout << ans << endl;
}

struct IoSetup {
    IoSetup() {
        // cin.tie(nullptr);
        // ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main() {
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    for(int i = 0; i < M; i++) {
        scanf("%lld", &A[i]);
        scanf("%lld", &B[i]);
    }
    solve(N, M, std::move(A), std::move(B));
    return 0;
}


Compiler output:
a.cc:1:10: fatal error: atcoder/all: No such file or directory
    1 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int MAX = 2 * 1000 * 100 + 11;
int parent[MAX];
int sizeOfSet[MAX];
int n, m;

void make_set(int node) {
	parent[node] = node;
	sizeOfSet[node] = 1;
}

int find_set(int node) {
	if(node == parent[node]) {
		return node;
	}
	
	return parent[node] = find_set(parent[node]);
}

void union_sets(int firstNode, int secondNode) {
	int parentOfFirstNode = find_set(firstNode);
	int parentOfSecondNode = find_set(secondNode);
	
	if(parentOfFirstNode != parentOfSecondNode) {
		if(sizeOfSet[parentOfFirstNode] < sizeOfSet[parentOfSecondNode]) {
			swap(parentOfFirstNode, parentOfSecondNode);
			
		parent[parentOfSecondNode] = parentOfFirstNode;
		
		sizeOfSet[parentOfFirstNode] += sizeOfSet[parentOfSecondNode];
	}
}

map<int, int> mp;

int main()
{
	cin >> n >> m;
	
	for(int i = 0; i < n; i++) {
		make_set(i);
	}
	
	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		union_sets(x, y);
	}
	
	for(int i = 1; i <= n; i++) {
		mp[find_set(i)]++;
	}
	
	int res = 0;
	for(auto it: mp) {
		res = max(res, it.second);
	}
	
	cout << res;
	return 0;
}


Compiler output:
a.cc: In function 'void union_sets(int, int)':
a.cc:39:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   39 | int main()
      |         ^~
a.cc:39:9: note: remove parentheses to default-initialize a variable
   39 | int main()
      |         ^~
      |         --
a.cc:39:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:40:1: error: a function-definition is not allowed here before '{' token
   40 | {
      | ^
a.cc:64:2: error: expected '}' at end of input
   64 | }
      |  ^
a.cc:23:48: note: to match this '{'
   23 | void union_sets(int firstNode, int secondNode) {
      |                                                ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int MAX = 2 * 1000 * 100 + 11;
int parent[MAX];
int n, m;

void make_set(int node) {
	parent[node] = node;
}

int find_set(int node) {
	if(node == parent[node]) {
		return node;
	}
	
	return parent[node] = find_set(parent[node]);
}

void union_sets(int firstNode, int secondNode) {
	int parentOfFirstNode = find_set(int firstNode);
	int parentOfSecondNode = find_set(int secondNode);
	
	if(parentOfFirstNode != parentOfSecondNode) {
		parent[parentOfSecondNode] = parentOfFirstNode;
	}
}

map<int, int> mp;

int main()
{
	cin >> n >> m;
	
	for(int i = 0; i < n; i++) {
		make_set(i);
	}
	
	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		union_sets(x, y);
	}
	
	for(int i = 1; i <= n; i++) {
		mp[find_set(i)]++;
	}
	
	int res = 0;
	for(auto it: mp) {
		res = max(res, it.second);
	}
	
	cout << res;
	return 0;
}


Compiler output:
a.cc: In function 'void union_sets(int, int)':
a.cc:22:42: error: expected primary-expression before 'int'
   22 |         int parentOfFirstNode = find_set(int firstNode);
      |                                          ^~~
a.cc:23:43: error: expected primary-expression before 'int'
   23 |         int parentOfSecondNode = find_set(int secondNode);
      |                                           ^~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int MAX = 2 * 1000 * 100 + 11;
int parent[MAX];
int n, m;

void make_set(int node) {
	parent[node] = node;
}

int find_set(int node) {
	if(node == parent[node]) {
		return node;
	}
	
	return find_set(parent[node]);
}

void union_sets(int firstNode, int secondNode) {
	int parentOfFirstNode = find_set(int firstNode);
	int parentOfSecondNode = find_set(int secondNode);
	
	if(parentOfFirstNode != parentOfSecondNode) {
		parent[parentOfSecondNode] = parentOfFirstNode;
	}
}

map<int, int> mp;

int main()
{
	cin >> n >> m;
	
	for(int i = 0; i < n; i++) {
		make_set(i);
	}
	
	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		union_sets(x, y);
	}
	
	for(int i = 1; i <= n; i++) {
		mp[find_set(i)]++;
	}
	
	int res = 0;
	for(auto it: mp) {
		res = max(res, it.second);
	}
	
	cout << res;
	return 0;
}


Compiler output:
a.cc: In function 'void union_sets(int, int)':
a.cc:22:42: error: expected primary-expression before 'int'
   22 |         int parentOfFirstNode = find_set(int firstNode);
      |                                          ^~~
a.cc:23:43: error: expected primary-expression before 'int'
   23 |         int parentOfSecondNode = find_set(int secondNode);
      |                                           ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int MAX = 2 * 1000 * 100 + 11;
int parent[MAX];
int sizeOfTree[MAX];
int n, m;

void make_set(int node) {
	parent[node] = node;
	sizeOfTree[node] = 1;
}

int find_parent(int node) {
	if(node == parent[node]) {
		return node;
	}
	
	return parent[node] = find_parent(parent[node]);
}

int union_set(int firstNode, int secondNode) {
	int parentOfFirstNode = find_parent(firstNode);
	int parentOfSecondNode = find_parent(secondNode);
	
	if(parentOfFirstNode != parentOfSecondNode) {
		if(size[parentOfFirstNode] < size[parentOfSecondNode])
			swap(parentOfFirstNode, parentOfSecondNode);
		
		parent[parentOfSecondNode] = parentOfFirstNode;
		
		sizeOfTree[parentOfSecondNode] += sizeOfTree[parentOfFirstNode];
	}
}

map<int, int> mp;

int main()
{
	cin >> n >> m;
	for(int i = 1; i <= n; i++) {
		make_set(i);
	}
	
	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		union_set(x, y);
	}
	
	for(int i = 1; i <= n; i++) {
		int parentOfNodeI = find_parent(i);
		mp[parentOfNodeI]++;
	}
	
	int res = 0;
	for(auto it: mp) {
		res = max(res, it.second);
	}
	
	cout << res;
	return 0;
}


Compiler output:
a.cc: In function 'int union_set(int, int)':
a.cc:28:24: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   28 |                 if(size[parentOfFirstNode] < size[parentOfSecondNode])
      |                        ^
a.cc:28:50: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   28 |                 if(size[parentOfFirstNode] < size[parentOfSecondNode])
      |                                                  ^
a.cc:35:1: warning: no return statement in function returning non-void [-Wreturn-type]
   35 | }
      | ^
Language: C++

#include "bits/stdc++.h"
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;
    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;
    a--; b--;
    UF.unite(a,b);
  }
  int ans=0;
  for(int i=0;i<n;i++) {
    ans = max(ans, UF.size(i));
  }
  cout << ans << endl;

  return 0;
}

Compiler output:
a.cc:30:2: error: expected ';' after struct definition
   30 | }
      |  ^
      |  ;
a.cc: In function 'int main()':
a.cc:36:17: error: 'M' was not declared in this scope
   36 |   for(int i=0;i<M;i++) {
      |                 ^
a.cc: In member function 'int UnionFind::root(int)':
a.cc:13:10: warning: control reaches end of non-void function [-Wreturn-type]
   13 |     r[x] = root(r[x]);
Language: C++

#include <bits/stdc++.h>
#define rep(i,n)    for(int i=0;i< (n);i++)
using namespace std;
using P = pair<int,int>;
//和集合を考えるのに便利な集合構造
struct UnionFind{
    vector<int> r;

    //コンストラクタ
    UnionFind(int N){
        //自身が根なら-頂点数
        //親でないなら根のid

        //N個の可変長配列rを生成し全て-1で初期化
        //r[id] = value
        r = vector<int>(N,-1);
    }
    //再帰で自身の根のidを特定する
    int root(int x){
        //自身が根なら自身のidを返す
        if(r[x] < 0)    return x;
        //そうでないなら根のidを特定してvalueに格納
        return r[x] = root(r[x]);
    }

    bool unite(int x,int y){
        x = root(x);
        y = root(y);

        //xとyの根が一緒なら何もしない
        if(x == y)  return false;
        //xの要素数がyの要素数より大きいことを保証する
        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;

    //N個の友達集合を作る
    UnionFind UF(N);

    int i;
    rep(i,M){
        cin>>A>>B;

        //idは0~N-1だから
        A -= 1; B -= 1;
        UF.unite(A,B);
    }

    int ans = 0;

    rep(i,N){
        ans = max(ans,UF.size(i));
    }

    cout<<ans<<endl;

    return 0;
}

Compiler output:
a.cc:44:2: error: expected ';' after struct definition
   44 | }
      |  ^
      |  ;
a.cc: In function 'int main()':
a.cc:55:14: error: 'A' was not declared in this scope
   55 |         cin>>A>>B;
      |              ^
a.cc:55:17: error: 'B' was not declared in this scope
   55 |         cin>>A>>B;
      |                 ^
Language: C++

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

const int max_n=2e5+10;
int p[max_n];
int cnt[max_n];
int find(int x) {
    if (p[x] != x) p[x] = find(p[x]);
    return p[x];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {p[i] = i,cnt[i]=1;}
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        if (find(a) != find(b)) {
           p[a]=b;
           cnt[b]+=cnt[a];
        }
    }
    int res = 0;
    for (int i = 1; i <= n; ++i) {
        if(p[i]==i)
            res = max(res, cnt[i]);
    cout << res<< endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:12:12: note: to match this '{'
   12 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
 
//#define int long long
using ll = long long;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define reps(i,n) for(ll i=0;i<=n;i++)

ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
 
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

struct UnionFind{
    vector<ll> par;
    vector<ll> siz;

    UnionFind(int N):par(N),siz(N,1){
        for(int i = 0;i<N;i++){
            par[i] = i;
        }
    }

    int root(int x){
        if(par[x]==x)
        return x;
        return par[x]=root(par[x]);
    }

    void unite(int x, int y){ //xとyを結合
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(siz[x]<siz[y])swap(x,y);
        siz[x]+=siz[y];
        par[y]=x;
    }

    ll size(ll x){
        return siz[root(x)];
    }

    bool same(int x,int y){
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    ll N,M,ans=0;
    cin >> N >> M;
    vector<ll> c(N,0);

    UnionFind rel(N);

    for(int i=0;i<M;i++){
        cin >> x >> y; 
        rel.unite(x-1,y-1);
    }

    for(int i=0;i<N;i++){
        ans = max(ans,rel.siz(N));
    }

    cout << ans << endl;
    
    return 0;
}


Compiler output:
a.cc:53:2: error: expected ';' after struct definition
   53 | }
      |  ^
      |  ;
a.cc: In function 'int main()':
a.cc:64:16: error: 'x' was not declared in this scope
   64 |         cin >> x >> y;
      |                ^
a.cc:64:21: error: 'y' was not declared in this scope
   64 |         cin >> x >> y;
      |                     ^
a.cc:69:30: error: no match for call to '(std::vector<long long int>) (ll&)'
   69 |         ans = max(ans,rel.siz(N));
      |                       ~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)
 ll N,M;
   vector<ll> v(200400);
   vector<ll> vs(203000,1);
   
ll root(ll i){
    if(v[i]==i){
        return i;
    }
    else{
        return root(v[i]);
    }
}

ll margego(ll tibi,ll deka){
    ll rtibi =root(tibi),rdeka = root(deka);
if(root(rtibi)==root(rdeka)){
return 0;
}
else{
    v[rdeka]=rtibi;
    vs[rtibi]=vs[rdeka]+vs[rtibi];
}

return 0;
}




int main(){

    cin>>N>>M;
    for(ll i=0;i<N;i++){
        cin>>v[i]
        
    }

   

    for(ll i=0;i<M;i++){
        ll tmp,tmp1;
        cin>>tmp>>tmp1;
        tmp--;tmp1--;
        ll tibi,deka;
        tibi = min(tmp,tmp1);
        deka = max(tmp,tmp1);
        margego(tibi,deka) ;
    }
    vector<ll> sc(N);

    cout<<*max_element(ALL(vs))<<endl;
}


/*

    for(ll i=0;i<H;i++){
        if(i%2==0){
        for(ll j=0;j<W;j++){
            if(a[ind]!=0){
            field[i][j]=ind+1;
            a[ind]--;
            }
            else{
                ind++;
                field[i][j]=ind+1;
            a[ind]--;
            }
        }
        }
        else{
            for(ll j=W-1;j>=0;j++){
            if(a[ind]!=0){
            field[i][j]=ind+1;
            a[ind]--;
            }
            else{
                ind++;
                field[i][j]=ind+1;
            a[ind]--;
            }
        }
        }
    }

*/




Compiler output:
a.cc: In function 'int main()':
a.cc:42:18: error: expected ';' before '}' token
   42 |         cin>>v[i]
      |                  ^
      |                  ;
   43 | 
   44 |     }
      |     ~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

//UF Tree

struct UnionFind{

    //親番号の配列。自身が親なら木の頂点数*(-1)

    vector<int> r;

    //最初はバラバラなので全部親として初期化

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

    //xの親を根にする関数

    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;
        A -= 1; B -= 1;
        UF.unite(A,B); //AとBは辺で結ばれる
    }

    int ans = 0;
    for(int i = 0; i < N; i++){
        ans = max(ans, UF.size(i));
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In member function 'int UnionFind::size(int)':
a.cc:42:23: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   42 |         return -r[root[x]];
      |                       ^
Language: C++

def main():
  n, m = map(int, input().split())
  friends = [[] for _ in range(n)]
  for i in range(m):
    a, b = map(int, input().split())
    friends[a-1].append(b-1)
    friends[b-1].append(a-1)
  ans = 1
  for i in range(n):
    ans = max(ans, len(set(friends[i])) + 1)
  print(ans)
  
if __name__ == "__main__":
  main()

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def main():
      | ^~~
Language: C++

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

#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(),(a).rend())
#define ll long long
#define pb(a) push_back(a)

#define PRINTV(v) {for(ll deB=0; deB<(v).size(); deB++){cout << (v)[deB] << " ";}cout << endl;}

int main(){
	
	
	ll N, M;
	cin >> N >> M;
	vector< list<ll> > l(N+1, list<ll>());
	REP(i,M) {
		ll A,B;
		cin >> A >> B;
		l[A].push_back(B);
		l[B].push_back(A));
	}

	vector<ll> memo(N+1, 0);
	ll ret = 0;

	REP(i, N+1){
		ll test = 0;
		queue<ll> que;
		que.push(i);
		while(!que.empty()){
			ll n = que.front();
			que.pop();

			if(memo[n] != 0) continue;
			memo[n] = 1;
			test++;
			for(list<ll>::iterator it = l[n].begin(); it != l[n].end(); it++){
				que.push(*it);
			}
		}
		ret = max(ret, test);
	}
	cout << ret << endl;
	
	return 0;

abnormal:
	cout << "No" << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:34: error: expected ';' before ')' token
   23 |                 l[B].push_back(A));
      |                                  ^
      |                                  ;
Language: C++

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

vector<bool> vis;
vector<int> ans;

int curr=0;

void dfs(int src,vector<vector<int>> graph,vector<bool> &vis,int &curr){
    vis[src]=true;
   // cout<<src<<endl;
   curr++;
    for(auto nbr:graph[src])
        if(!vis[nbr])
            dfs(nbr,graph,vis,curr);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n,m,u,v;
    cin>>n>>m;
    vector<vector<int>> graph(n);
    map<pair<int,int>> mp;
    while(m--){
        cin>>u>>v;
        u--;
        v--;
        pair<int,int> pr=make_pair(u,v);
        if(!mp[pr]){
        graph[u].push_back(v);
        graph[v].push_back(u);
        mp[pr]=true;
        }
    }

    vis.resize(n);

    for(int i=0;i<n;i++) vis[i]=false;

    int cnt=0;

    for(int i=0;i<n;i++){
        curr=0;
        if(!vis[i]){
            dfs(i,graph,vis,curr);
            //cnt++;
        }
        cnt=max(cnt,curr);
    }
    //gg
    cout<<cnt<<endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: wrong number of template arguments (1, should be at least 2)
   26 |     map<pair<int,int>> mp;
      |                     ^~
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:32:15: error: no match for 'operator[]' (operand types are 'int' and 'std::pair<int, int>')
   32 |         if(!mp[pr]){
      |               ^
a.cc:35:11: error: no match for 'operator[]' (operand types are 'int' and 'std::pair<int, int>')
   35 |         mp[pr]=true;
      |           ^
Language: C

#include <stdio.h>
 
int a[200001];
 
void maketree(int n) {
  for(int i = 0;i < n;i++) a[i] = i;
}
 
int root(int x) {
  if(a[x] == x) {
    return x;
  } 
  else {
    a[x] = root(a[x]);
    return a[x];
  }
}
 
void unite(int x, int y) {
  x = root(x);
  y = root(y);
  if(x == y) return;
  if(a[x] > a[y]) { 
    int tmp = x; x = y; y = tmp; 
  }
  a[y] = a[x];
}
 
int main(){
  int n,m,i,ans,x,y,s[200001];
  scanf("%d %d",&n,&m);
  maketree(n);
  for(i=0;i<n;i++){
    scanf("%d %d",&x,&y);
    unite(--x,--y);
  }
  for(i=0;i<n;i++);
     a[i]=root[a[i]];
     s[i]=0;
  }
  for(i=0;i<n;i++){
    s[a[i]]++;
  }
  for(i=1,ans=s[0];i<n;i++){
    if(ans<s[i])ans=s[i];
  }
  printf("%d\n",ans);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:38:15: error: subscripted value is neither array nor pointer nor vector
   38 |      a[i]=root[a[i]];
      |               ^
main.c: At top level:
main.c:41:3: error: expected identifier or '(' before 'for'
   41 |   for(i=0;i<n;i++){
      |   ^~~
main.c:41:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   41 |   for(i=0;i<n;i++){
      |            ^
main.c:41:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   41 |   for(i=0;i<n;i++){
      |                ^~
main.c:44:3: error: expected identifier or '(' before 'for'
   44 |   for(i=1,ans=s[0];i<n;i++){
      |   ^~~
main.c:44:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   44 |   for(i=1,ans=s[0];i<n;i++){
      |                     ^
main.c:44:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   44 |   for(i=1,ans=s[0];i<n;i++){
      |                         ^~
main.c:47:10: error: expected declaration specifiers or '...' before string constant
   47 |   printf("%d\n",ans);
      |          ^~~~~~
main.c:47:17: error: unknown type name 'ans'
   47 |   printf("%d\n",ans);
      |                 ^~~
main.c:48:3: error: expected identifier or '(' before 'return'
   48 |   return 0;
      |   ^~~~~~
main.c:49:1: error: expected identifier or '(' before '}' token
   49 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define lli long long int
# define rep(i,n) for(int i=0;i<n;i++)
int p[200005];
int size_a[200005];
int find(int x){
    if(x ==p[x])
        return x;
    return p[x] = find(p[x]);
}
void uni(int u,int v){
    int pu =find(u);
    int pv =find(v);
    if(pu==pv)
    return;
    else{
        p[pu] = pv;
        size_a[pv]+=size_a[pu];
        size[pu]=0;
    }
}
void solve(){
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        p[i]=i;
        size_a[i]=1;
    }

    rep(i,m){
        int u,v;
        cin>>u>>v;
        uni(u,v);
    }
    int ans =0;
    for(int i=1;i<=n;i++)
    ans=max(ans,size_a[i]);
    cout<<ans<<endl;


}
int main()
{
    int t;
    //cin>>t;
    
    t=1;
    while(t--){
        solve();
    }
}

Compiler output:
a.cc: In function 'void uni(int, int)':
a.cc:20:13: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |         size[pu]=0;
      |             ^
Language: C++

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

int main(){
  int n,m;
  cin>>n>>m;
  vector<vector<int>> info(m,vector<int>(2));
  vector<int> index(m);
  for(int i=0;i<m;i++){
    cin>>info.at(i).at(0)>>info.at(i).at(1);
    index.at(i)=i;
  }
  set<int> friends;
  bool next;
  int max=1;
  int sum=0;
  while(index.size()>0){
    next=false;
    friends={info.at(index.at(0)).at(0),info.at(index.at(0)).at(1)};
    index.erase(index.begin());
    while(!next){
      next=true;
      for(int i=(int)index.size()-1;i>=0;i--){
        if(friends.count(info.at(index.at(i)).at(0))){
          friends.insert(info.at(index.at(i)).at(1));
          index.erase(index.begin()+i);
          next=false;
        }else if(friends.count(info.at(index.at(i)).at(1))){
          friends.insert(info.at(index.at(i)).at(0));
          index.erase(index.begin()+i);
          next=false;
        }
      }
      /*
      for(int i=0;i<(int)index.size();i++){
        if(friends.count(info.at(index.at(i)).at(0))){
          friends.insert(info.at(index.at(i)).at(1));
          index.erase(index.begin()+i);
          i--;
          next=false;
        }else if(friends.count(info.at(index.at(i)).at(1))){
          friends.insert(info.at(index.at(i)).at(0));
          index.erase(index.begin()+i);
          i--;
          next=false;
        }
      }
      */
    }
    sum+=friends.size();
    max=max(max,friends.size());
    if(n-sum<=max){
      break;
    }
  }
  cout<<max<<endl;
}
      
                       
                       
  







Compiler output:
a.cc: In function 'int main()':
a.cc:51:12: error: 'max' cannot be used as a function
   51 |     max=max(max,friends.size());
      |         ~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  int n,m;
  cin >> n,m;
  
  vector<int> p(n),a(n),b(n);
  for(int i=0;i<n;i++)
    cin >> p(i);
  
  vector<vector<int>> data(n,vector<int>());
  for(int i=0;i<m;i++){
    cin >> a.at(i) >> b.at(i);
    

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: no match for call to '(std::vector<int>) (int&)'
   10 |     cin >> p(i);
      |            ~^~~
a.cc:14:31: error: expected '}' at end of input
   14 |     cin >> a.at(i) >> b.at(i);
      |                               ^
a.cc:13:23: note: to match this '{'
   13 |   for(int i=0;i<m;i++){
      |                       ^
a.cc:14:31: error: expected '}' at end of input
   14 |     cin >> a.at(i) >> b.at(i);
      |                               ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

int main(){
  int n,m;
  cin>>n>>m;
  vector<vector<int>> info(m,vector<int>(2));
  vector<int> index(m);
  int a,b;
  for(int i=0;i<m;i++){
    cin>>a>>b;
    info.at(i).at(0)=a;
    info.at(i).at(1)=b;
    index.at(i)=i;
  }
  set<int> friends;
  bool next=true;
  int max=1;
  while(index.size()>0){
    if(next){
      if(friends.size()>max){
        max=friends.size();
      }
      friends={info.at(index.at(0)).at(0),info.at(index.at(0)).at(1)};
      index.erase(index.begin());
    }
    if(index.size()==0){
      break;
    }
    next=true;
    for(int i=0;i<index.size();i++){
      if(friends.contains(info.at(index.at(i)).at(0))){
        friends.insert(info.at(index.at(i)).at(1));
        index.erase(index.begin()+i);
        i--;
      }else if(friends.contains(info.at(index.at(i)).at(1))){
        friends.insert(info.at(index.at(i)).at(0));
        index.erase(index.begin()+i);
        i--;
      }
    }
    for(int i=index.size()-1;i>=0;i--){
      if(friends.contains(info.at(index.at(i)).at(0))){
        friends.insert(info.at(index.at(i)).at(1));
        index.erase(index.begin()+i);
        next=false;
      }else if(friends.contains(info.at(index.at(i)).at(1))){
        friends.insert(info.at(index.at(i)).at(0));
        index.erase(index.begin()+i);
        next=false;
      }
    }
  }
  if(friends.size()>max){
    max=friends.size();
  }
  cout<<max<<endl;
}
      
                       
                       
  




Compiler output:
a.cc: In function 'int main()':
a.cc:32:18: error: 'class std::set<int>' has no member named 'contains'
   32 |       if(friends.contains(info.at(index.at(i)).at(0))){
      |                  ^~~~~~~~
a.cc:36:24: error: 'class std::set<int>' has no member named 'contains'
   36 |       }else if(friends.contains(info.at(index.at(i)).at(1))){
      |                        ^~~~~~~~
a.cc:43:18: error: 'class std::set<int>' has no member named 'contains'
   43 |       if(friends.contains(info.at(index.at(i)).at(0))){
      |                  ^~~~~~~~
a.cc:47:24: error: 'class std::set<int>' has no member named 'contains'
   47 |       }else if(friends.contains(info.at(index.at(i)).at(1))){
      |                        ^~~~~~~~
Language: C++

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

int main(){
  int n,m;
  cin>>n>>m;
  vector<vector<int>> info(m,vector<int>(2));
  vector<int> index(m);
  int a,b;
  for(int i=0;i<m;i++){
    cin>>a>>b;
    info.at(i).at(0)=a;
    info.at(i).at(1)=b;
    index.at(i)=i;
  }
  set<int> friends;
  bool next=true;
  int max=1;
  while(index.size()>0){
    if(next){
      if(friends.size()>max){
        max=friends.size();
      }
      friends={info.at(index.at(0)).at(0),info.at(index.at(0)).at(1)};
      index.erase(index.begin());
    }
    if(index.size()==0){
      break;
    }
    next=true;
    for(int i=0;i<index.size();i++){
      if(friends.contains(info.at(index.at(i)).at(0))){
        friends.insert(info.at(index.at(i)).at(1));
        index.erase(index.begin()+i);
        i--;
      }else if(friends.contains(info.at(index.at(i)).at(1))){
        friends.insert(info.at(index.at(i)).at(0));
        index.erase(index.begin()+i);
        i--;
      }
    }
    for(int i=index.size()-1;i>=0;i--){
      if(friends.contain(info.at(index.at(i)).at(0))){
        friends.insert(info.at(index.at(i)).at(1));
        index.erase(index.begin()+i);
        next=false;
      }else if(friends.contain(info.at(index.at(i)).at(1))){
        friends.insert(info.at(index.at(i)).at(0));
        index.erase(index.begin()+i);
        next=false;
      }
    }
  }
  if(friends.size()>max){
    max=friends.size();
  }
  cout<<max<<endl;
}
      
                       
                       
  




Compiler output:
a.cc: In function 'int main()':
a.cc:32:18: error: 'class std::set<int>' has no member named 'contains'
   32 |       if(friends.contains(info.at(index.at(i)).at(0))){
      |                  ^~~~~~~~
a.cc:36:24: error: 'class std::set<int>' has no member named 'contains'
   36 |       }else if(friends.contains(info.at(index.at(i)).at(1))){
      |                        ^~~~~~~~
a.cc:43:18: error: 'class std::set<int>' has no member named 'contain'
   43 |       if(friends.contain(info.at(index.at(i)).at(0))){
      |                  ^~~~~~~
a.cc:47:24: error: 'class std::set<int>' has no member named 'contain'
   47 |       }else if(friends.contain(info.at(index.at(i)).at(1))){
      |                        ^~~~~~~
Language: C++

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

int main(){
  int n,m;
  cin>>n>>m;
  vector<vector<int>> info(m,vector<int>(2));
  vector<int> index(m);
  int a,b;
  for(int i=0;i<m;i++){
    cin>>a>>b;
    info.at(i).at(0)=a;
    info.at(i).at(1)=b;
    index.at(i)=i;
  }
  set<int> friends;
  bool next=true;
  int max=1;
  while(index.size()>0){
    if(next){
      if(friends.size()>max){
        max=friends.size();
      }
      friends={info.at(index.at(0)).at(0),info.at(index.at(0)).at(1)};
      index.erase(index.begin());
    }
    if(index.size()==0){
      break;
    }
    next=true;
    for(int i=0;i<index.size();i++){
      if(friends.contain(info.at(index.at(i)).at(0))){
        friends.insert(info.at(index.at(i)).at(1));
        index.erase(index.begin()+i);
        i--;
      }else if(friends.contain(info.at(index.at(i)).at(1))){
        friends.insert(info.at(index.at(i)).at(0));
        index.erase(index.begin()+i);
        i--;
      }
    }
    for(int i=index.size()-1;i>=0;i--){
      if(friends.contain(info.at(index.at(i)).at(0))){
        friends.insert(info.at(index.at(i)).at(1));
        index.erase(index.begin()+i);
        next=false;
      }else if(friends.contain(info.at(index.at(i)).at(1))){
        friends.insert(info.at(index.at(i)).at(0));
        index.erase(index.begin()+i);
        next=false;
      }
    }
  }
  if(friends.size()>max){
    max=friends.size();
  }
  cout<<max<<endl;
}
      
                       
                       
  




Compiler output:
a.cc: In function 'int main()':
a.cc:32:18: error: 'class std::set<int>' has no member named 'contain'
   32 |       if(friends.contain(info.at(index.at(i)).at(0))){
      |                  ^~~~~~~
a.cc:36:24: error: 'class std::set<int>' has no member named 'contain'
   36 |       }else if(friends.contain(info.at(index.at(i)).at(1))){
      |                        ^~~~~~~
a.cc:43:18: error: 'class std::set<int>' has no member named 'contain'
   43 |       if(friends.contain(info.at(index.at(i)).at(0))){
      |                  ^~~~~~~
a.cc:47:24: error: 'class std::set<int>' has no member named 'contain'
   47 |       }else if(friends.contain(info.at(index.at(i)).at(1))){
      |                        ^~~~~~~
Language: C++

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

int main(){
  int n,m;
  cin>>n>>m;
  vector<vector<int>> info(m,vector<int>(2));
  vector<int> index(m);
  int a,b;
  for(int i=0;i<m;i++){
    cin>>a>>b;
    info.at(i).at(0)=a;
    info.at(i).at(1)=b;
    index.at(i)=i;
  }
  set<int> friends;
  bool next=true;
  int max=1;
  while(index.size()>0){
    if(next){
      if(friends.size()>max){
        max=friends.size();
      }
      friends={info.at(index.at(0)).at(0),info.at(index.at(0)).at(1)};
      index.erase(index.begin());
    }
    if(index.size()==0){
      break;
    }
    next=true;
    for(int i=0;i<index.size();i++){
      if(friends.at(index.at(i)).at(0)){
        friends.insert(friends.at(index.at(i)).at(1));
        index.erase(index.begin()+i);
        i--;
      }else if(friends.at(index.at(i)).at(1)){
        friends.insert(friends.at(index.at(i)).at(0));
        index.erase(index.begin()+i);
        i--;
      }
    }
    for(int i=index.size()-1;i>=0;i--){
      if(friends.at(index.at(i)).at(0)){
        friends.insert(friends.at(index.at(i)).at(1));
        index.erase(index.begin()+i);
        next=false;
      }else if(friends.at(index.at(i)).at(1)){
        friends.insert(friends.at(index.at(i)).at(0));
        index.erase(index.begin()+i);
        next=false;
      }
    }
  }
  if(friends.size()>max){
    max=friends.size();
  }
  cout<<max<<endl;
}
      
                       
                       
  




Compiler output:
a.cc: In function 'int main()':
a.cc:32:18: error: 'class std::set<int>' has no member named 'at'
   32 |       if(friends.at(index.at(i)).at(0)){
      |                  ^~
a.cc:33:32: error: 'class std::set<int>' has no member named 'at'
   33 |         friends.insert(friends.at(index.at(i)).at(1));
      |                                ^~
a.cc:36:24: error: 'class std::set<int>' has no member named 'at'
   36 |       }else if(friends.at(index.at(i)).at(1)){
      |                        ^~
a.cc:37:32: error: 'class std::set<int>' has no member named 'at'
   37 |         friends.insert(friends.at(index.at(i)).at(0));
      |                                ^~
a.cc:43:18: error: 'class std::set<int>' has no member named 'at'
   43 |       if(friends.at(index.at(i)).at(0)){
      |                  ^~
a.cc:44:32: error: 'class std::set<int>' has no member named 'at'
   44 |         friends.insert(friends.at(index.at(i)).at(1));
      |                                ^~
a.cc:47:24: error: 'class std::set<int>' has no member named 'at'
   47 |       }else if(friends.at(index.at(i)).at(1)){
      |                        ^~
a.cc:48:32: error: 'class std::set<int>' has no member named 'at'
   48 |         friends.insert(friends.at(index.at(i)).at(0));
      |                                ^~