Language: C++

/// Author: Yen-Jen Wang
#include <bits/stdc++.h>

using namespace std;

struct Dsu {
	int n, cc;
	int par[MAX_N];
	int sz[MAX_N];

	void init(int _n) {
		n = _n;
		cc = n;
		for (int i = 1; i <= n; i++) {
			par[i] = i;
			sz[i] = 1;
		}
	}

	int find(int x) {
		return par[x] == x ? x : (par[x] = find(par[x]));
	}

	bool merge(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)
			return 1;
		cc--;
		if (sz[x] < sz[y])
			swap(x, y);
		sz[x] += sz[y];
		par[y] = x;
		return 1;
	}
};

int main() {
	int N, M;
	cin >> N >> M;
	vector<pair<int, int> > es;
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		es.emplace_back(a, b);
	}
	int ans = 0;
	for (int i = 0; i < M; i++) {
		dsu.init(N);
		for (int j = 0; j < M; j++) {
			if (j != i)
				dsu.merge(es[j].first, es[j].second);
		}
		if (dsu.cc != 1)
			ans++;
	}
	cout << ans << '\n';
	return 0;
}

Compiler output:
a.cc:8:17: error: 'MAX_N' was not declared in this scope
    8 |         int par[MAX_N];
      |                 ^~~~~
a.cc:9:16: error: 'MAX_N' was not declared in this scope
    9 |         int sz[MAX_N];
      |                ^~~~~
a.cc: In member function 'void Dsu::init(int)':
a.cc:15:25: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   15 |                         par[i] = i;
      |                         ^~~
      |                         __pstl::execution::v1::par
In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/pstl/execution_defs.h:43:45: note: '__pstl::execution::v1::par' declared here
   43 | _GLIBCXX17_INLINE constexpr parallel_policy par{};
      |                                             ^~~
a.cc:16:25: error: 'sz' was not declared in this scope
   16 |                         sz[i] = 1;
      |                         ^~
a.cc: In member function 'int Dsu::find(int)':
a.cc:21:24: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   21 |                 return par[x] == x ? x : (par[x] = find(par[x]));
      |                        ^~~
      |                        __pstl::execution::v1::par
/usr/include/c++/14/pstl/execution_defs.h:43:45: note: '__pstl::execution::v1::par' declared here
   43 | _GLIBCXX17_INLINE constexpr parallel_policy par{};
      |                                             ^~~
a.cc: In member function 'bool Dsu::merge(int, int)':
a.cc:30:21: error: 'sz' was not declared in this scope
   30 |                 if (sz[x] < sz[y])
      |                     ^~
a.cc:32:17: error: 'sz' was not declared in this scope
   32 |                 sz[x] += sz[y];
      |                 ^~
a.cc:33:17: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   33 |                 par[y] = x;
      |                 ^~~
      |                 __pstl::execution::v1::par
/usr/include/c++/14/pstl/execution_defs.h:43:45: note: '__pstl::execution::v1::par' declared here
   43 | _GLIBCXX17_INLINE constexpr parallel_policy par{};
      |                                             ^~~
a.cc: In function 'int main()':
a.cc:49:17: error: 'dsu' was not declared in this scope; did you mean 'Dsu'?
   49 |                 dsu.init(N);
      |                 ^~~
      |                 Dsu