criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
#include<map>
#include<set>
using namespace std;
int conSize(int n, int m, vector<vector<int>> g, int begin, vector<int> &color) {
	if (color[begin] == 1) return 0;
	int size = 1;
	color[begin] = 1;
	for (int i = 0; i < g[begin].size(); i++) {
		size += conSize(n, m, g, g[begin][i], color);
	}
	return size;
}
int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> g(n, vector<int>());
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		g[a - 1].push_back(b - 1);
		g[b - 1].push_back(a - 1);
	}
	int bridge = 0;
	vector<int> color(n, 0);
	int iniSize = conSize(n, m, g, 0, color);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < g[i].size(); j++) {
			vector<vector<int>> g2 = g;
			int deleteEdgeNode1 = i;
			int deleteEdgeNode2 = g2[i][j];
			for (auto it = g2[deleteEdgeNode2].begin(); it != g2[deleteEdgeNode2].end();) {
				if (*it == deleteEdgeNode1) it = g2[deleteEdgeNode2].erase(it);
				else ++it;
			}
			g2[i].erase(g2[i].begin() + j);
			int newSize = conSize(n, m, g2, 0, vector<int>(n, 0));
			if (newSize != iniSize)bridge++;
		}
	}
	cout << bridge/2;
	return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:47:60: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
   47 |                         int newSize = conSize(n, m, g2, 0, vector<int>(n, 0));
      |                                                            ^~~~~~~~~~~~~~~~~
a.cc:15:74: note:   initializing argument 5 of 'int conSize(int, int, std::vector<std::vector<int> >, int, std::vector<int>&)'
   15 | int conSize(int n, int m, vector<vector<int>> g, int begin, vector<int> &color) {
      |                                                             ~~~~~~~~~~~~~^~~~~
Language: C

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int N=100;
vector<int>G[N];
int dis[N][N];
int cnt;
void  dfs(int x,int p)
{
    if(G[x].size()>2)
        return ;
    for(int i=0;i<G[x].size();i++)
    {
        int y=G[x][i];
        if(y!=p&&!dis[x][y])
        {
            cnt++;
            dis[x][y]=dis[y][x]=1;
            dfs(y,x);
        }
    }
    return ;
}
int main()
{
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<60;i++)
        G[i].clear();
    cnt=0;
    memset(dis,0,sizeof dis);
    while(m--)
    {
        int a,b;
        cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for(int i=1;i<=n;i++)
    {
        if(G[i].size()==1)
        {
            int m=G[i][0];
            if(!dis[i][m])
            {
                cnt++;
                dis[i][m]=dis[m][i]=1;
                dfs(m,i);
            }
        }
    }
    cout<<cnt<<endl;
    return 0;

}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<vector>
#include<cstdio>

using namespace std;

bool visited[50];
vector<int> v[50];

void DFS(pair<int,int> forbidden,int node)
{
    if(visited[node])
        return;

    visited[node] = true;
    for(int i = 0;i < v[node].size();i++) {
        if((forbidden.first == node && forbidden.second == v[node][i]) ||
                (forbidden.second == node && forbidden.first == v[node][i]))
            continue;

        DFS(forbidden,v[node][i]);
    }

    return;
}

int Bridge(int n,vector<pair<int,int> > &edge)
{
    int count = 0;

    for(int i = 0;i < edge.size();i++)
    {
        DFS(edge[i],0);
        for(int j =0;j < n;j++)
            if(visited[j] == false) {
                count++;
                break;
            }

        memset(visited,false,50);
    }

    return count;
}

int main(void)
{
    int n,m;

    cin>>n>>m;

    vector<pair<int,int> > edge;

    memset(visited,false,50);

    for(int i = 0;i < m;i++) {
        int a,b;
        cin>>a>>b;
        a--,b--;
        v[a].push_back(b);
        v[b].push_back(a);

        pair<int,int> temp;
        temp.first = a;
        temp.second = b;
        edge.push_back(temp);
    }

    cout<<Bridge(n,edge)<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int Bridge(int, std::vector<std::pair<int, int> >&)':
a.cc:40:9: error: 'memset' was not declared in this scope
   40 |         memset(visited,false,50);
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<cstdio>
  +++ |+#include <cstring>
    4 | 
a.cc: In function 'int main()':
a.cc:54:5: error: 'memset' was not declared in this scope
   54 |     memset(visited,false,50);
      |     ^~~~~~
a.cc:54:5: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C

#include <stdio.h>
int v[55]={},g[55][55]={},n,m,a[55]={},b[55]={},ans=0,i=0,j;int d(int v){v[v]=1;for(int w=0;w<n;w++)if(g[v][w]==1&&v[w]==0)d(w);return 0;}int main(){scanf("%d%d",&n,&m);for(;i<m;i++){scanf("%d%d",&a[i],&b[i]);a[i]--;b[i]--;g[a[i]][b[i]]=1;g[b[i]][a[i]]=1;}for(i=0;i<m;i++){g[a[i]][b[i]]=0;g[b[i]][a[i]]=0;for(j=0;j<n;j++)v[j]=0;d(0);for(j=0;j<n;j++)if(v[j]==0){ans++;break;}g[a[i]][b[i]]=1;g[b[i]][a[i]]=1;}printf("%d",ans);return 0;}

Compiler output:
main.c: In function 'd':
main.c:2:75: error: subscripted value is neither array nor pointer nor vector
    2 | int v[55]={},g[55][55]={},n,m,a[55]={},b[55]={},ans=0,i=0,j;int d(int v){v[v]=1;for(int w=0;w<n;w++)if(g[v][w]==1&&v[w]==0)d(w);return 0;}int main(){scanf("%d%d",&n,&m);for(;i<m;i++){scanf("%d%d",&a[i],&b[i]);a[i]--;b[i]--;g[a[i]][b[i]]=1;g[b[i]][a[i]]=1;}for(i=0;i<m;i++){g[a[i]][b[i]]=0;g[b[i]][a[i]]=0;for(j=0;j<n;j++)v[j]=0;d(0);for(j=0;j<n;j++)if(v[j]==0){ans++;break;}g[a[i]][b[i]]=1;g[b[i]][a[i]]=1;}printf("%d",ans);return 0;}
      |                                                                           ^
main.c:2:117: error: subscripted value is neither array nor pointer nor vector
    2 | int v[55]={},g[55][55]={},n,m,a[55]={},b[55]={},ans=0,i=0,j;int d(int v){v[v]=1;for(int w=0;w<n;w++)if(g[v][w]==1&&v[w]==0)d(w);return 0;}int main(){scanf("%d%d",&n,&m);for(;i<m;i++){scanf("%d%d",&a[i],&b[i]);a[i]--;b[i]--;g[a[i]][b[i]]=1;g[b[i]][a[i]]=1;}for(i=0;i<m;i++){g[a[i]][b[i]]=0;g[b[i]][a[i]]=0;for(j=0;j<n;j++)v[j]=0;d(0);for(j=0;j<n;j++)if(v[j]==0){ans++;break;}g[a[i]][b[i]]=1;g[b[i]][a[i]]=1;}printf("%d",ans);return 0;}
      |                                                                                                                     ^
Language: C++

//#include<bits/stdc++.h>
#include<iostream>
#include<memory>

using namespace std;

int map[55][55] = { 0 };
int  readed[55] = { 0 };
int q[51][51] = { 0 };

//当前遍历点为x,总共n个点；
int bianli(int x,int n)
{
	int e, sum = 0;
	for (e = 0; e <= n; e++)
	{
		if(map[x][e]&&readed[e]==0)
		{
			readed[e]++; 
			sum+=bianli(e, n);
		}
	}
	if(!sum)
	return 1;
	else return sum+1;
}
int main()
{
	int n, m, i, j, x, y, N = 0, Q = 0;
	cin >> n >> m;
	for (i = 0; i < m; i++)
	{
		cin >> x >> y;
		map[x][y] = 1;
		map[y][x] = 1;
	}
	for(i=1;i<=n;i++)
		for (j = 1; j <= n; j++)
		{
			if (map[i][j] == 1 && q[i][j] == 0) 
			{
				memset(readed, 0, 55);
				map[i][j] = 0;
				map[j][i] = 0;
				readed[i] = 1;
				if (bianli(i, n) != n) { Q++; q[i][j] = 1; q[j][i] = 1; }
				//看map[i][j]边是不是桥；
				//是的话Q++；
				map[i][j] = 1;
				map[j][i] = 1;
				readed[i] = 0;
			}
		}
	cout << Q << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:33: error: 'memset' was not declared in this scope
   42 |                                 memset(readed, 0, 55);
      |                                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<memory>
  +++ |+#include <cstring>
    4 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn=500;
vector<int> G[maxn];
int dfn[maxn],low[maxn];
int n,m,u,v,index,ans;

void init()
{
    index=ans=0;
    memset(dfn,0,sizeof(dfn));
    memset(low,0,sizeof(low));
    for(int i=0;i<=n;i++) G[i].clear();
}

void Tarjan(int u,int fa)
{
    dfn[u]=low[u]=++index;
    for(int i=0;i<G[u].size();i++){
        int v=G[u][i];
        if(!dfn[v]){
            Tarjan(v,u);
            low[u]=min(low[u],low[v]);
            if(low[v]>dfn[u]) ans++;
        }else if(v!=fa)
            low[u]=min(low[u],dfn[v]);
    }
}

int main()
{
    while(cin>>n>>m)
    {
        init();
        for(int i=0;i<m;i++){
            cin>>u>>v;
            G[u].push_back(v);
            G[v].push_back(u);
        }
        Tarjan(1,-1);
        cout<<ans<<endl;
    }
    return 0;
}


Compiler output:
a.cc:6:13: error: 'int index' redeclared as different kind of entity
    6 | int n,m,u,v,index,ans;
      |             ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'void init()':
a.cc:10:15: error: overloaded function with no contextual type information
   10 |     index=ans=0;
      |               ^
a.cc: In function 'void Tarjan(int, int)':
a.cc:18:21: error: no pre-increment operator for type
   18 |     dfn[u]=low[u]=++index;
      |                     ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <assert.h>

bool contain(std::vector<int> v, int x) {
  return std::find(v.begin(), v.end(), x) != v.end();
}

void reachable_vertexes(int v, int elen, int* edges, std::vector<int>& already_vertex, std::vector<int>& already_edge) {
  already_vertex.push_back(v);
 // std::cout << "v:" << v << " ";
  for(int i = 0; i < elen; i++) {
    if(contain(already_edge, i))
      continue;
    const int a = edges[i] / 100;
    const int b = edges[i] % 100;
    if(v != a && v != b)
      continue;
    already_edge.push_back(i);

    if(v == b && !contain(already_vertex, a)) {
      reachable_vertexes(a, elen, edges, already_vertex, already_edge);
    } else if(v == a && !contain(already_vertex, b)) {
      reachable_vertexes(b, elen, edges, already_vertex, already_edge);
    }
  }
}

bool is_linked_graph(int vlen, int elen, int* edges, int ignore_ind) {
  int i = ignore_ind == 0 ? 1 : 0;
  int a = edges[i] / 100;
  std::vector<int> already_vertex;
  std::vector<int> already_edge;
  already_edge.push_back(ignore_ind);
  reachable_vertexes(a, elen, edges, already_vertex, already_edge);
  //std::cout << already_vertex.size() << ", " <<  already_edge.size() <<"\n";
  return already_vertex.size() == vlen;
}

int bridge_count(int vlen, int elen, int* edges) {
  int b = 0;
  for(int i = 0; i < elen; i++) {
    if(!is_linked_graph(vlen, elen, edges, i)) {
      std::cout << "bridge!\n";
      b++;
    }
  }
  return b;
}

int main() {
  int n, m;
  std::cin >> n;
  std::cin >> m;
  int edges[m];
  int a, b;
  for(int i = 0; i < m; i++) {
    std::cin >> a;
    std::cin >> b;
    edges[i] = (a - 1) * 100 + (b - 1);
  }

  int c = bridge_count(n, m, edges);
  std::cout << c << "\n";
  return 0;
}

Compiler output:
a.cc: In function 'bool contain(std::vector<int>, int)':
a.cc:6:19: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
    6 |   return std::find(v.begin(), v.end(), x) != v.end();
      |          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:6:19: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
    6 |   return std::find(v.begin(), v.end(), x) != v.end();
      |          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

vector<int> a, b;
vector<vector<bool>> edge;

void dfs(int src, vector<bool>& table)
{
	table[src] = true;
	for(auto it=edge[src].begin(); it!=edge[src].end(); it++)
	{
		int dst = it - edge[src].begin();
		if(*it == false || table[dst] == true)
			continue;

		dfs(dst, table);
	}

	return;
}

int main(void)
{
	int N, M;
	cin >> N >> M;

	a = vector<int>(M);
	b = vector<int>(M);
	edge = vector<vector<bool>>(N, vector<bool>(N, false));

	for(int i=0; i<M; i++)
	{
		cin >> a[i] >> b[i];

		a[i]--;
		b[i]--;

		edge[a[i]][b[i]] = edge[b[i]][a[i]] = true;
	}

	int ret = 0;
	vector<bool> table(N, false);
	for(int i=0; i<M; i++)
	{
		int src = a[i];
		int dst = b[i];
		edge[src][dst] = edge[dst][src] = false;

		fill(table.begin(), table.end(), false);
		dfs(0, table);

		if(find(table.begin(), table.end(), false) != table.end())
			ret++;

		edge[src][dst] = edge[dst][src] = true;
	}

	cout << ret << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:24: error: no matching function for call to 'find(std::vector<bool>::iterator, std::vector<bool>::iterator, bool)'
   55 |                 if(find(table.begin(), table.end(), false) != table.end())
      |                    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:55:24: note:   'std::_Bit_iterator' is not derived from 'std::istreambuf_iterator<_CharT>'
   55 |                 if(find(table.begin(), table.end(), false) != table.end())
      |                    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int n,m;
bool used[52];
bool flag[52];
int a[i],b[i];
int ans;
void dfs(int t){
flag[t]=true;
for (int i=0;i<m;++i){
if(used[i]||(a[i]!=t&&b[i]!=t))continue;
used[i]=true;
dfs(t==a[i]?b[i]:a[i]);
used[i]=false;
}
}

int main(){
cin>>n>>m;
for(int i=0;i<m;++i){
cin>>a[i]>>b[i];
--a[i];--b[i];
}
for(int i=0;i<m;++i){
for(int j=0;j<m;++j)used[i]=false;
for(int j=0;j<n;++j)flag[i]=false;
used[i]=true;
dfs(0);
bool c=true;
for(int j=0;j<n;++j)c &= flag[i];
if(!c)++ans;
}
cout<<ans<<endl;
}

Compiler output:
a.cc:6:7: error: 'i' was not declared in this scope
    6 | int a[i],b[i];
      |       ^
a.cc:6:12: error: 'i' was not declared in this scope
    6 | int a[i],b[i];
      |            ^
a.cc: In function 'void dfs(int)':
a.cc:11:14: error: 'a' was not declared in this scope
   11 | if(used[i]||(a[i]!=t&&b[i]!=t))continue;
      |              ^
a.cc:11:23: error: 'b' was not declared in this scope
   11 | if(used[i]||(a[i]!=t&&b[i]!=t))continue;
      |                       ^
a.cc:13:8: error: 'a' was not declared in this scope
   13 | dfs(t==a[i]?b[i]:a[i]);
      |        ^
a.cc:13:13: error: 'b' was not declared in this scope
   13 | dfs(t==a[i]?b[i]:a[i]);
      |             ^
a.cc: In function 'int main()':
a.cc:21:6: error: 'a' was not declared in this scope
   21 | cin>>a[i]>>b[i];
      |      ^
a.cc:21:12: error: 'b' was not declared in this scope
   21 | cin>>a[i]>>b[i];
      |            ^
Language: C++

#include <cstdio>
#include <vector>
#include <stack>
#define INF (1LL<<60)
using namespace std;

typedef long long Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void visit(const Graph & g, int v, int u,
    Edges& brdg, vector< vector<int> >& tecomp,
    stack<int>& roots, stack<int>& S, vector<bool>& inS,
    vector<int>& num, int& time) {
  num[v] = ++time;
  S.push(v); inS[v] = true;
  roots.push(v);
  for(auto &e: g[v]) {
    int w = e.dst;
    if (num[w] == 0)
      visit(g, w, v, brdg, tecomp, roots, S, inS, num, time);
    else if (u != w && inS[w])
      while (num[roots.top()] > num[w]) roots.pop();
  }
  if (v == roots.top()) {
    brdg.push_back(Edge(u, v));
    tecomp.push_back(vector<int>());
    while (1) {
      int w = S.top(); S.pop(); inS[w] = false;
      tecomp.back().push_back(w);
      if (v == w) break;
    }
    roots.pop();
  }
}
void bridge(const Graph& g, Edges& brdg, vector< vector<int> >& tecomp) {
  const int n = g.size();
  vector<int> num(n);
  vector<bool> inS(n);
  stack<int> roots, S;
  int time = 0;
  for(int u=0;u<n;u++) if (num[u] == 0) {
    visit(g, u, n, brdg, tecomp, roots, S, inS, num, time);
    brdg.pop_back();
  }
}

int main(){
	int i,V,E,start,goal,s,t,e;
	//for(scanf("%d",&T);T;putchar(--T?' ':'\n')){
		scanf("%d%d",&V,&E);
		Graph g(V);
		for(i=0;i<E;i++)scanf("%d%d",&s,&t),g[s-1].push_back(Edge(s-1,t-1,1)),g[t-1].push_back(Edge(t-1,s-1,1));
		Edges brdg;
		vector< vector<int> >tecomp;
		bridge(g,brdg,tecomp);
		printf("%d\n",brdg.size());
	//}
}

Compiler output:
a.cc: In function 'void visit(const Graph&, int, int, Edges&, std::vector<std::vector<int> >&, std::stack<int>&, std::stack<int>&, std::vector<bool>&, std::vector<int>&, int&)':
a.cc:37:29: error: no matching function for call to 'Edge::Edge(int&, int&)'
   37 |     brdg.push_back(Edge(u, v));
      |                             ^
a.cc:11:3: note: candidate: 'Edge::Edge(int, int, Weight)'
   11 |   Edge(int src, int dst, Weight weight) :
      |   ^~~~
a.cc:11:3: note:   candidate expects 3 arguments, 2 provided
a.cc:8:8: note: candidate: 'constexpr Edge::Edge(const Edge&)'
    8 | struct Edge {
      |        ^~~~
a.cc:8:8: note:   candidate expects 1 argument, 2 provided
a.cc:8:8: note: candidate: 'constexpr Edge::Edge(Edge&&)'
a.cc:8:8: note:   candidate expects 1 argument, 2 provided
Language: C++

#include <cstdio>
#include <vector>
#include <stack>
#define INF (1LL<<60)
using namespace std;

typedef long long Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void visit(const Graph & g, int v, int u,
    Edges& brdg, vector< vector<int> >& tecomp,
    stack<int>& roots, stack<int>& S, vector<bool>& inS,
    vector<int>& num, int& time) {
  num[v] = ++time;
  S.push(v); inS[v] = true;
  roots.push(v);
  for(auto &e, g[v]) {
    int w = e.dst;
    if (num[w] == 0)
      visit(g, w, v, brdg, tecomp, roots, S, inS, num, time);
    else if (u != w && inS[w])
      while (num[roots.top()] > num[w]) roots.pop();
  }
  if (v == roots.top()) {
    brdg.push_back(Edge(u, v));
    tecomp.push_back(vector<int>());
    while (1) {
      int w = S.top(); S.pop(); inS[w] = false;
      tecomp.back().push_back(w);
      if (v == w) break;
    }
    roots.pop();
  }
}
void bridge(const Graph& g, Edges& brdg, vector< vector<int> >& tecomp) {
  const int n = g.size();
  vector<int> num(n);
  vector<bool> inS(n);
  stack<int> roots, S;
  int time = 0;
  for(int u=0;u<n;u++) if (num[u] == 0) {
    visit(g, u, n, brdg, tecomp, roots, S, inS, num, time);
    brdg.pop_back();
  }
}

int main(){
	int i,V,E,start,goal,s,t,e;
	//for(scanf("%d",&T);T;putchar(--T?' ':'\n')){
		scanf("%d%d",&V,&E);
		Graph g(V);
		for(i=0;i<E;i++)scanf("%d%d",&s,&t),g[s-1].push_back(Edge(s-1,t-1,1)),g[t-1].push_back(Edge(t-1,s-1,1));
		Edges brdg;
		vector< vector<int> >tecomp;
		bridge(g,brdg,tecomp);
		printf("%d\n",brdg.size());
	//}
}

Compiler output:
a.cc: In function 'void visit(const Graph&, int, int, Edges&, std::vector<std::vector<int> >&, std::stack<int>&, std::stack<int>&, std::vector<bool>&, std::vector<int>&, int&)':
a.cc:29:7: error: declaration of 'auto& e' has no initializer
   29 |   for(auto &e, g[v]) {
      |       ^~~~
a.cc:29:20: error: expected ';' before ')' token
   29 |   for(auto &e, g[v]) {
      |                    ^
      |                    ;
a.cc:29:20: error: expected primary-expression before ')' token
a.cc:29:20: error: expected ';' before ')' token
   29 |   for(auto &e, g[v]) {
      |                    ^
      |                    ;
a.cc:37:29: error: no matching function for call to 'Edge::Edge(int&, int&)'
   37 |     brdg.push_back(Edge(u, v));
      |                             ^
a.cc:11:3: note: candidate: 'Edge::Edge(int, int, Weight)'
   11 |   Edge(int src, int dst, Weight weight) :
      |   ^~~~
a.cc:11:3: note:   candidate expects 3 arguments, 2 provided
a.cc:8:8: note: candidate: 'constexpr Edge::Edge(const Edge&)'
    8 | struct Edge {
      |        ^~~~
a.cc:8:8: note:   candidate expects 1 argument, 2 provided
a.cc:8:8: note: candidate: 'constexpr Edge::Edge(Edge&&)'
a.cc:8:8: note:   candidate expects 1 argument, 2 provided
Language: Java

import java.util.Scanner;

public class Main {

	static int n;
	static int m;
	static int a[], b[];
	static boolean visited[];
	static boolean graph[][];

	static void DFS(int v) {
		visited[v] = true;
		for (int v2 = 0; v2 < n; v2++) {
			if (graph[v][v2] == false)
				continue;
			if (visited[v2] == true)
				continue;
			DFS(v2);
		}
		return;
	}

	public static void main(String[] args) {
ｓ		int count = 0;
		try (Scanner sc = new Scanner(System.in)) {
			n = sc.nextInt();
			m = sc.nextInt();
			visited = new boolean[n];
			graph = new boolean[n][n];
			a = new int[m];
			b = new int[m];

			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					graph[i][j] = false;
				}
			}

			for (int i = 0; i < m; i++) {
				a[i] = sc.nextInt() - 1;
				b[i] = sc.nextInt() - 1;
				graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
			}
			sc.close();
		}
		
		for (int i = 0; i < m; i++) {
			graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
			for (int j = 0; j < n; j++) {
				visited[j] = false;
			}
			DFS(0);
			boolean eval = true;
			for (int j = 0; j < n; j++) {
				if (visited[j] == false) {
					eval = false;
					break;
				}
			}
			if (!eval) {
				count++;
			}
			graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
		}
		System.out.println(count);
	}
}


Compiler output:
Main.java:24: error: not a statement
?		int count = 0;
^
Main.java:24: error: ';' expected
?		int count = 0;
 ^
2 errors
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
const int N = 1e5+10;
vector<int> g[201];
vector<pair<int,int>> ed;
int p[101];
int n,m,q;
void go(int s,int l,int e){
	if(!p[s]){
		q++;
		p[s]=1;
	}
	if(g[s].size()==0|| e==m-1){
		return;
	}
	if(g[s].size()==1&&g[s][0]==l){
		return 0;
	}
	for(int x=0;x<g[s].size();x++){
		bool c=0;
		for(int i=0;i<g[l].size();i++){
			if(g[s][x]==g[l][i]){
				c=1;
				break;
			}
		}
		if(g[s][x]==l){
			c=1;
		}
		if(c){
			continue;
		}
		go(g[s][x],s,e+1);
	}
}
int main() {
	cin>>n>>m;
	for(int x=0;x<m;x++){
		int u,v;
		cin>>u>>v;
		ed.push_back({u,v});
	}
	int pp=0;
	for(int x=0;x<ed.size();x++){
		memset(p,0,sizeof(p));
		for(int i=1;i<=n;i++){
			g[i].clear();
		}
		q=0;
		for(int i=0;i<ed.size();i++){
			if(x==i){
				continue;
			}
			g[ed[i].first].push_back(ed[i].second);
			g[ed[i].second].push_back(ed[i].first);
		}
		go(ed[x].second,0,0);
		if(q<n){
			pp++;
		}
	}
	cout << pp << endl;
}

Compiler output:
a.cc: In function 'void go(int, int, int)':
a.cc:19:24: error: return-statement with a value, in function returning 'void' [-fpermissive]
   19 |                 return 0;
      |                        ^
Language: C++

#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
#include<map>
#include<set>
using namespace std;
int conSize(int n, int m, vector<vector<int>> g, int begin, vector<int> &color) {
	if (color[begin] == 1) return 0;
	int size = 1;
	color[begin] = 1;
	for (int i = 0; i < g[begin].size(); i++) {
		size += conSize(n, m, g, g[begin][i], color);
	}
	return size;
}
int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> g(n, vector<int>());
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		g[a - 1].push_back(b - 1);
		g[b - 1].push_back(a - 1);
	}
	int bridge = 0;
	vector<int> color(n, 0);
	int iniSize = conSize(n, m, g, 0, color);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < g[i].size(); j++) {
			vector<vector<int>> g2 = g;
			g2[i].erase(g2[i].begin() + j, g2[i].begin() + j);

			int newSize = conSize(n, m, g2, 0, vector<int>(n, 0));
			if (newSize != iniSize)bridge++;
		}
	}
	cout << bridge;
	return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:42:60: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
   42 |                         int newSize = conSize(n, m, g2, 0, vector<int>(n, 0));
      |                                                            ^~~~~~~~~~~~~~~~~
a.cc:15:74: note:   initializing argument 5 of 'int conSize(int, int, std::vector<std::vector<int> >, int, std::vector<int>&)'
   15 | int conSize(int n, int m, vector<vector<int>> g, int begin, vector<int> &color) {
      |                                                             ~~~~~~~~~~~~~^~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

bool has_cycle(vector<int> *edge, int vertex_num);
bool dfs(vector<int> *edge, bool *used, int v, int vertex_num);

bool has_cycle(vector<int> *edge, int vertex_num){
  bool used[51] = {false};
  return dfs(edge, used, 1, vertex_num);
}

bool dfs(vector<int> *edge, bool *used, int v, int vertex_num){
  for(auto itr = edge[v].begin(); itr != edge[v].end(); ++itr) {
    if(!used[*itr]) {used[*itr]=true; dfs(edge, used, *itr, vertex_num);}
  }
  bool judge = 1;
  for(int i=1;i<=vertex_num;i++){
    judge *= used[i];
  }
  return judge;
}

int main(){
  int n,m,edge[51][2];
  vector<int> adj[51];
  cin >> n >> m;
  for(int i=1;i<=m;i++){
    cin >> edge[i][0] >> edge[i][1];
    adj[edge[i][0]].push_back(edge[i][1]);
    adj[edge[i][1]].push_back(edge[i][0]);
  }

  int count = 0;

  for(int i=1;i<=m;i++){
    vector<int> cp[51];
    for(int j=1;j<=51;j++) cp[j] = adj[j];
    cp[edge[i][0]].erase(remove(cp[edge[i][0]].begin(), cp[edge[i][0]].end(), edge[i][1]), cp[edge[i][0]].end());
    cp[edge[i][1]].erase(remove(cp[edge[i][1]].begin(), cp[edge[i][1]].end(), edge[i][0]), cp[edge[i][1]].end());
    count += !has_cycle(cp, n);
  }

  cout << count << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:53: error: cannot convert 'std::vector<int>::iterator' to 'const char*'
   40 |     cp[edge[i][0]].erase(remove(cp[edge[i][0]].begin(), cp[edge[i][0]].end(), edge[i][1]), cp[edge[i][0]].end());
      |                                 ~~~~~~~~~~~~~~~~~~~~^~
      |                                                     |
      |                                                     std::vector<int>::iterator
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:158:32: note:   initializing argument 1 of 'int remove(const char*)'
  158 | extern int remove (const char *__filename) __THROW;
      |                    ~~~~~~~~~~~~^~~~~~~~~~
a.cc:41:53: error: cannot convert 'std::vector<int>::iterator' to 'const char*'
   41 |     cp[edge[i][1]].erase(remove(cp[edge[i][1]].begin(), cp[edge[i][1]].end(), edge[i][0]), cp[edge[i][1]].end());
      |                                 ~~~~~~~~~~~~~~~~~~~~^~
      |                                                     |
      |                                                     std::vector<int>::iterator
/usr/include/stdio.h:158:32: note:   initializing argument 1 of 'int remove(const char*)'
  158 | extern int remove (const char *__filename) __THROW;
      |                    ~~~~~~~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>

using namespace std;

b[50];
way[50][50];

int main(){
int N,M,i,j,fir,las,cou=0;
cin >>N>>M;
for(i=0;i<M;i++){
cin >> fir >> las;
b[fir]++;
b[las]++;
way[fir][las]++;
way[las][fir]++;
}
  while(las!=0){
    las=0;
    for(i=0;i<=N;i++){
      if(b[i]==1){
        cou++;
        b[i]--;
        las=1;
        for(j=0;j<=N;j++){
          if(way[i][j]==1){
          way[i][j]--;
          b[j]--;
          way[j][i]--;
            }
        }
      }
    }
   }
  cout << cou << endl;
      
    return 0;  
}

Compiler output:
a.cc:5:1: error: 'b' does not name a type
    5 | b[50];
      | ^
a.cc:6:1: error: 'way' does not name a type
    6 | way[50][50];
      | ^~~
a.cc: In function 'int main()':
a.cc:13:1: error: 'b' was not declared in this scope
   13 | b[fir]++;
      | ^
a.cc:15:1: error: 'way' was not declared in this scope
   15 | way[fir][las]++;
      | ^~~
a.cc:21:10: error: 'b' was not declared in this scope
   21 |       if(b[i]==1){
      |          ^
a.cc:26:14: error: 'way' was not declared in this scope
   26 |           if(way[i][j]==1){
      |              ^~~
Language: C++

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

bool cone(bool gg[][], int n){
  bool rtn=true;
  bool ck[n+1]; fill(ck, ck+n+1, false);
  for(int i=2; i<=n; i++){
    if(gg[1][i])ck[1]=true;
  }
  for(int i=1; i<=n; i++){
    for(int j=i+1; j<=n; j++){
      if(gg[i][j] && (ck[i] || ck[j])){
        ck[i]=true;
        ck[j]=true;
      }
    }
  }
  for(int i=1; i<=n; i++){
    if(!ck[i])rtn=false;
  }
  return rtn;
}

bool coneRemoveAB(bool g[][], int n, int a, int b){
  bool gg[n+1][n+1];
  for(int i=1; i<=n; i++){
    for(int j=1; j<=n; j++){
      gg[i][j] = g[i][j];
    }
  }
  gg[a][b]=false;
  gg[b][a]=false;

  return cone(gg, n);
}


int main(void){
  int n, m;
  cin >> n>> m;

  bool g[n+1][n+1];
  fill(g[1],g[n+1],false);
  int a[m], b[m];
  for(int i=0; i<m; i++){
    cin >> a[i] >> b[i];
    g[a[i]][b[i]]=true;
    g[b[i]][a[i]]=true;
  }

  int mminusans=0;
  for(int i=0; i<m; i++){
    if(coneRemoveAB(g, n, a[i], b[i]))mminusans++;
  }
  int ans = m - mminusans;

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


Compiler output:
a.cc:5:16: error: declaration of 'gg' as multidimensional array must have bounds for all dimensions except the first
    5 | bool cone(bool gg[][], int n){
      |                ^~
a.cc:5:22: error: expected ')' before ',' token
    5 | bool cone(bool gg[][], int n){
      |          ~           ^
      |                      )
a.cc:5:24: error: expected unqualified-id before 'int'
    5 | bool cone(bool gg[][], int n){
      |                        ^~~
a.cc:25:24: error: declaration of 'g' as multidimensional array must have bounds for all dimensions except the first
   25 | bool coneRemoveAB(bool g[][], int n, int a, int b){
      |                        ^
a.cc:25:29: error: expected ')' before ',' token
   25 | bool coneRemoveAB(bool g[][], int n, int a, int b){
      |                  ~          ^
      |                             )
a.cc:25:31: error: expected unqualified-id before 'int'
   25 | bool coneRemoveAB(bool g[][], int n, int a, int b){
      |                               ^~~
Language: C++

#include<bits/stdc++.h>
const int maxn=1010;
int a[55][55];
int num[55] , low[55];
int n , m , ans , k;
void dfs(int t,int da){
    num[t] = ++k;
    low[t] = k;
    for (int i=1; i<=n; i++){
        if (a[t][i] == 1){
            if (num[i] == 0){
                dfs(i,t);
                low[t] = min(low[i] , low[t]);
                if (low[i] > num[t])  ans ++;
            }
            else if (i != da)
                low[t] = min(low[t] , num[i]);
        }
    }
}
int main()
{
    while (~scanf("%d%d",&n,&m)){
        memset(a , 0 , sizeof a);
        memset(low , 0 , sizeof low);
        memset(num , 0 , sizeof num);
        for (int i=1; i<=m; i++)  {
            int x , y;
            scanf("%d%d",&x,&y);
            a[x][y] = a[y][x] = 1;
        }

        k = 0;
        ans = 0;
        dfs(1,1);
        printf("%d\n",ans);
    }
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:13:26: error: 'min' was not declared in this scope; did you mean 'std::min'?
   13 |                 low[t] = min(low[i] , low[t]);
      |                          ^~~
      |                          std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:17:26: error: 'min' was not declared in this scope; did you mean 'std::min'?
   17 |                 low[t] = min(low[t] , num[i]);
      |                          ^~~
      |                          std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include <map>  

using namespace std;


int N, M ,sum=0;
int a[50], b[50];
int L[51][51] = {};

struct S {
	int l[51][51] = {};
};

bool dec(struct S s, int n, int ans) {
	bool flag = false;

	for (int i = 1; i <= N; i++) {
		if (s.l[n][i] == 1) {
			if (i == ans)
				flag = true;
			else {
				s.l[n][i] = 0;
				s.l[i][n] = 0;
				if (dec(s, i, ans))
					flag = true;
			}
		}
	}
	return flag;
}


int main()
{

	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> a[i] >> b[i];
		L[a[i]][b[i]] = 1;
		L[b[i]][a[i]] = 1;
	}

/*	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cout << L[i][j];
		}
		cout << endl;
	}*/



	for (int i = 0; i < M; i++) {
		struct S s;
		memcpy(s.l, L, sizeof(L));
		s.l[a[i]][b[i]] = 0;
		s.l[b[i]][a[i]] = 0;
		if (!dec(s, a[i], b[i]))
			sum++;
	}

	cout << sum << endl;

	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:57:17: error: 'memcpy' was not declared in this scope
   57 |                 memcpy(s.l, L, sizeof(L));
      |                 ^~~~~~
a.cc:5:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <map>
  +++ |+#include <cstring>
    5 |
Language: C++

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

bool cone(bool *g, int n){
  bool rtn=true;
  bool ck[n+1]; fill(ck, ck+n+1, false);
  for(int i=2; i<=n; i++){
    if(g[1][i])ck[1]=true;
  }
  for(int i=1; i<=n; i++){
    for(int j=i+1; j<=n; j++){
      if(g[i][j] && (ck[i] || ck[j])){
        ck[i]=true;
        ck[j]=true;
      }
    }
  }
  for(int i=1; i<=n; i++){
    if(!ck[i])rtn=false;
  }
  return rtn;
}

bool coneRemoveAB(bool *g, int n, int a, int b){
  bool gg[n+1][n+1];
  for(int i=1; i<=n; i++){
    for(int j=1; j<=n; j++){
      gg[i][j] = g[i][j];
    }
  }
  gg[a][b]=false;
  gg[b][a]=false;

  return cone(gg, n);
}


int main(void){
  int n, m;
  cin >> n>> m;

  bool g[n+1][n+1];
  fill(g[1],g[n+1],false);
  int a[m], b[m];
  for(int i=0; i<m; i++){
    cin >> a[i] >> b[i];
    g[a[i]][b[i]]=true;
    g[b[i]][a[i]]=true;
  }

  int mMinusAns=0;
  for(int i=0; i<m; i++){
    mMinusAns += coneRemoveAB(g, n, a[i], b[i]);
  }
  int ans = m - mMinusAns;

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


Compiler output:
a.cc: In function 'bool cone(bool*, int)':
a.cc:9:12: error: invalid types 'bool[int]' for array subscript
    9 |     if(g[1][i])ck[1]=true;
      |            ^
a.cc:13:14: error: invalid types 'bool[int]' for array subscript
   13 |       if(g[i][j] && (ck[i] || ck[j])){
      |              ^
a.cc: In function 'bool coneRemoveAB(bool*, int, int, int)':
a.cc:29:22: error: invalid types 'bool[int]' for array subscript
   29 |       gg[i][j] = g[i][j];
      |                      ^
a.cc:35:15: error: cannot convert 'bool (*)[(n + 1)]' to 'bool*'
   35 |   return cone(gg, n);
      |               ^~
      |               |
      |               bool (*)[(n + 1)]
a.cc:5:17: note:   initializing argument 1 of 'bool cone(bool*, int)'
    5 | bool cone(bool *g, int n){
      |           ~~~~~~^
a.cc: In function 'int main()':
a.cc:54:31: error: cannot convert 'bool (*)[(n + 1)]' to 'bool*'
   54 |     mMinusAns += coneRemoveAB(g, n, a[i], b[i]);
      |                               ^
      |                               |
      |                               bool (*)[(n + 1)]
a.cc:25:25: note:   initializing argument 1 of 'bool coneRemoveAB(bool*, int, int, int)'
   25 | bool coneRemoveAB(bool *g, int n, int a, int b){
      |                   ~~~~~~^
Language: Java


import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt(),m=sc.nextInt();
		ArrayList<Integer>[] data=new ArrayList[n+1];
		for(int i=0;i<n+1;i++){
			data[i]=new ArrayList<Integer>();
		}
		int[] info=new int[n];
		for(int i=0;i<m;i++){
			int buf=sc.nextInt();
			int buff=sc.nextInt();
//			System.out.println(buf+" "+buff);
			data[buf].add(buff);
			data[buff].add(buf);
		}
		int cnt=0;
		boolean update=true;
		while(update){
			update=false;
			for(int i=1;i<n+1;i++){
				if(data[i].size()==1){
					int buf=data[i].get(0);
					int k=0;
					while(true){
						if(data[buf].get(k)==i){
						data[buf].remove(k);
						break;
						}
						k++;
					}
					data[i].clear();
					//System.out.println(i+"is cleared");
					update=true;
					cnt++;
				}
			}
		}
	//	for(int i=0;i<n+1;i++){
	//		System.out.println(i+" sizeis "+data[i].size());
	//	}
		System.out.println(cnt);
	}

}

Compiler output:
Main.java:9: error: cannot find symbol
		ArrayList<Integer>[] data=new ArrayList[n+1];
		^
  symbol:   class ArrayList
  location: class Main
Main.java:9: error: cannot find symbol
		ArrayList<Integer>[] data=new ArrayList[n+1];
		                              ^
  symbol:   class ArrayList
  location: class Main
Main.java:11: error: cannot find symbol
			data[i]=new ArrayList<Integer>();
			            ^
  symbol:   class ArrayList
  location: class Main
3 errors
Language: C++

class UnionFind:
    def __init__(self, N):
        self.data = []
        for i in range(N):
            self.data.append(-1)
    def root(self, a):
        if self.data[a] < 0:
            return a
        else:
            self.data[a] = self.root(self.data[a])
            return self.data[a]
    def same(self, a, b):
        if self.root(a) == self.root(b):
            return 1
        else:
            return 0
    def unite(self, a, b):
        a = self.root(a)
        b = self.root(b)
        if a == b:
            return 0
        if self.data[a] < self.data[b]:
            self.data[a] += self.data[b]
            self.data[b] = a
        else:
            self.data[b] += self.data[a]
            self.data[a] = b
        return 1
s = input().split(" ")
N = int(s[0])
M = int(s[1])
a = []
b = []
for i in range(M):
    s = input().split(" ")
    a.append(int(s[0]) - 1)
    b.append(int(s[1]) - 1)
res = 0
for i in range(M):
    uf = UnionFind(N)
    for j in range(M):
        if j != i:
            uf.unite(a[j], b[j])
    if uf.same(a[i], b[i]) == 0:
        res += 1
print(res)

Compiler output:
a.cc:2:9: error: expected class-name before '__init__'
    2 |     def __init__(self, N):
      |         ^~~~~~~~
a.cc:2:9: error: expected '{' before '__init__'
a.cc:2:18: error: 'self' was not declared in this scope
    2 |     def __init__(self, N):
      |                  ^~~~
a.cc:2:24: error: 'N' was not declared in this scope
    2 |     def __init__(self, N):
      |                        ^
a.cc:2:25: error: expression list treated as compound expression in initializer [-fpermissive]
    2 |     def __init__(self, N):
      |                         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int father[55],n;

void init(int k)
{
    for(int i=1;i<=k;i++)
    {
        father[i]=i;
        Rank[i]=0;
    }
}
int find_set(int x)
{
    if(father[x]==x) return x;
    else father[x]==find_set(father[x]);
}
void unit(int x,int y)
{
    x=find_set(x);
    y=find_set(y);
    if(x==y) return ;
    father[x]=y;
}
int main()
{
    int i,n,m,j;
    int x[55],y[55];
    while(cin>>n>>m)
    {
//        for(i=1;i<=n;i++)
//            cout<<father[i]<<endl;
        for(i=0;i<m;i++)
        {
            cin>>x[i]>>y[i];
        }
        int q=0;
        for(i=0;i<m;i++)
        {
            int count=0;
            init(n);
            for(j=0;j<m;j++)
            {
                if(i==j) continue;
                unit(x[j],y[j]);
            }
            for(int p=1;p<=n;p++)
            {
                //cout<<father[p]<<endl;
                if(father[p]==p) count++;
            }
            //cout<<"ha"<<endl;
            if(count==2) q++;
        }
        cout<<q<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'void init(int)':
a.cc:10:9: error: 'Rank' was not declared in this scope
   10 |         Rank[i]=0;
      |         ^~~~
a.cc: In function 'int find_set(int)':
a.cc:16:29: warning: control reaches end of non-void function [-Wreturn-type]
   16 |     else father[x]==find_set(father[x]);
      |                     ~~~~~~~~^~~~~~~~~~~
Language: C++

#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <queue>
#include <tuple>
#include <functional>
#include <set>

using namespace std;

int n;
int m;
int a[50];
int b[50];
bool g[50][50];
int low[50];
int ord[50];
int order = 0;
int ans = 0;

void dfs(int cur,int par) {
	ord[cur] = order;
	low[cur] = order;
	++order;
	for (int i = 0; i < n; ++i) {
		if (!g[cur][i])
			continue;
		if (ord[i] != -1 && i != par) {
			low[cur] = min(low[cur], ord[i]);
		}
		else if (ord[i] == -1) {
			dfs(i, cur);
			low[cur] = min(low[cur], low[i]);
		}
	}

	if (cur != 0) {
		if (low[cur] > ord[par]) {
			++ans;
		}
	}

}


int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		cin >> a[i] >> b[i];
		--a[i];
		--b[i];
		g[a[i]][b[i]] = true;
		g[b[i]][a[i]] = true;
	}
	memset(ord, -1, sizeof(ord));
	dfs(0, -1);
	cout << ans << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:59:9: error: 'memset' was not declared in this scope
   59 |         memset(ord, -1, sizeof(ord));
      |         ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <set>
  +++ |+#include <cstring>
   11 |
Language: C++

#include<iostream>
#include<vector>
#define N 51
using namespace std;
vector<int>G[N];
int n,m,low[N],dfn[N];
int father[N];
int tim = 0;
void Tarjan(int i,int Father)
{
    father[i] = Father;
    dfn[i] = low[i] = tim++;
    for(int j = 0;j < G[i].size();++j)
    {
        int k = G[i][j];
        if(dfn[k] == -1)
        {
            Tarjan(k,i);
            low[i] = min(low[i], low[k]);
        }
        else if(Father != k) low[i] = min(low[i], dfn[k]);
    }
}
void count()
{
    Tarjan(1,0);
	int bridge = 0;
    for(int i = 1;i <= n; ++i)
    {
        int v = father[i];
        if(v > 0 && (low[i] > dfn[v])) bridge ++;
    }
    cout << bridge << endl;
}
int main()
{
    cin >> n >> m;
    int a,b;
    for(int i = 1;i <= m;++i)
    {
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    memset(dfn, -1, sizeof(dfn));
    memset(father, 0, sizeof(father));
    memset(low, -1, sizeof(low));
    count();
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:5: error: 'memset' was not declared in this scope
   45 |     memset(dfn, -1, sizeof(dfn));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<vector>
  +++ |+#include <cstring>
    3 | #define N 51
Language: C++

#include <iostream>
#include <cstring>
#include <cstdio>
#include <stack>
#include <vector>
using namespace std;
const int maxn=100000;
int cv[maxn],n,m,fa[maxn],index,dfn[maxn],low[maxn];
stack <int> st;
vector <int> imap[maxn];
int ans=0;
int min(int a,int b)
{
    if(a<b) return a;
    else return b;
}
void tarjan(int u,int father)
{
    index++;
    dfn[u]=low[u]=index;
    fa[u]=father;
    for(int i=0;i<imap[u].size();i++)
    {
        int v=imap[u][i];
        if(!dfn[v])
        {
            tarjan(v,u);
            low[u]=min(low[u],low[v]);
        }
        else if(v!=father)
            low[u]=min(low[u],dfn[v]);
    }
}
void counti()
{
    int rootson=0;
    for(int i=2;i<=n;i++)
    {
        int v=fa[i];
        if(v==1) rootson++;
        else if(low[i]>=dfn[v]) cv[v]=1;
    }
    if(rootson>1) cv[1]=1;
    for(int i=2;i<=n;i++)
    {
        int v=fa[i];
        if(dfn[v]<low[i])
        {
            ans++;
        }
    }
}

void init()
{
    index=0;
    ans=0;
    while(!st.empty()) st.pop();
    memset(cv,0,sizeof(cv));
    memset(dfn,0,sizeof(dfn));
    memset(low,0,sizeof(low));
    memset(fa,0,sizeof(fa));
    for(int i=0;i<maxn;i++) imap[i].clear();
}
int main()
{
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        init();
        for(int i=1;i<=m;i++)
        {
            int u,v;
            scanf("%d%d",&u,&v);
            imap[u].push_back(v);
            imap[v].push_back(u);
        }
        tarjan(1,0);
        counti();
        printf("%d\n", ans);
    }
    return 0;
}


Compiler output:
a.cc:8:27: error: 'int index' redeclared as different kind of entity
    8 | int cv[maxn],n,m,fa[maxn],index,dfn[maxn],low[maxn];
      |                           ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from a.cc:2:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'void tarjan(int, int)':
a.cc:19:10: error: no post-increment operator for type
   19 |     index++;
      |          ^~
a.cc:20:19: error: cannot resolve overloaded function 'index' based on conversion to type 'int'
   20 |     dfn[u]=low[u]=index;
      |                   ^~~~~
a.cc: In function 'void init()':
a.cc:56:11: error: overloaded function with no contextual type information
   56 |     index=0;
      |           ^