#include<bits/stdc++.h>
using namespace std;
int n;
class Graph{
map<int,list > m;
public:
Graph()
{
}
void addNode(int u,int v,int bidir=true)
{
m[u].push_back(v);
if(bidir)
{
m[v].push_back(u);
}
}
int dfsUtil(int src,bool *visited,int *count,int &ans)
{
visited[src]=true;
count[src]=1;
for(auto x:m[src])
{
if(!visited[x])
{
count[src]+=dfsUtil(x,visited,count,ans);
int num=count[src];
if(num-1>n-num && n-num>0)
ans++;
}
}
return count[src];
}
int dfs()
{
bool visited[n+1]{0};
int count[n+1]{0};
int ans=0;
dfsUtil(1,visited,count,ans);
return ans;
}
};
int main()
{
Graph g;
int m;
cin>>n>>m;
while(m–)
{
int x,y;
cin>>x>>y;
g.addNode(x,y);
}
cout<<g.dfs();
}
what is error in this code?