Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int N,M;
int done[50];
vector< vector<int> > path;

#define MAX_N 50
int par[MAX_N];
int rank[MAX_N];

void uf_init( int n ) {
    for ( int i = 0; i < n; i++ ) {
        par[i] = i;
        rank[i] = 0;
    }
}

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

void uf_unite( int x, int y ) {
    x = uf_find( x );
    y = uf_find( y );
    if ( x == y ) { return; }
    
    if ( rank[x] < rank[y] ) {
        par[x] = y;
    }
    else {
        par[y] = x;
        if ( rank[x] == rank[y] ) { rank[x]++; }
    }
    
}

bool uf_same( int x, int y ) {
    return ( uf_find(x) == uf_find(y) );
}


void dfs( int a, int b, int c ) {
    
    done[c] = 1;
    
    for ( int i = 0; i < path[c].size(); i++ ) {
        int n = path[c][i];
        if ( a == c && b == n ) { continue; }
        if ( b == c && a == n ) { continue; }
        if ( !done[n] ) { dfs( a, b, n ); }
    }
    
}

void bfs( int a, int b ) {
    
    fill( done, done+50, 0 );
    
    queue<int> Q;
    for ( int i = 0; i < path[0].size(); i++ ) {
        if ( ( a == 0 && b == path[0][i] ) || ( a == path[0][i] && b == 0 ) ) { continue; }
        Q.push(path[0][i]);
        done[path[0][i]] = 1;        
    }
    
    while ( !Q.empty() ) {
        int c = Q.front();
        Q.pop();
        
        for ( int i = 0; i < path[c].size(); i++ ) {
            int n = path[c][i];
            if ( ( a == c && b == n ) || ( a == n && b == c ) ) { continue; }
            if ( !done[n] ) {
                Q.push(n);
                done[n] = 1;
            }
        }
    }
    
}

bool is_all() {
    for ( int i = 0; i < N; i++ ) {
        if ( !done[i] ) { return false; }
    }
    return true;
}

int main() {
    
    cin >> N >> M;
    path.resize(N);
    vector< pair<int, int> > P;
    for ( int i = 0; i < M; i++ ) {
        int a,b;
        cin >> a >> b;
        a--; b--;
        path[a].push_back(b);
        path[b].push_back(a);
        P.push_back( make_pair(a,b) );
    }
    
    
    int ans = 0;
    
    for ( int i = 0; i < M; i++ ) {
        uf_init(N);
        for ( int j = 0; j < M; j++ ) {
            if ( i == j ) { continue; }
            uf_unite( P[j].first, P[j].second );
        }
        for ( int k = 0; k < N-1; k++ ) {
            if ( !uf_same( k, k+1 ) ) { ans++; break; }
        }
    }
    
    // for ( int i = 0; i < M; i++ ) {
        // fill( done, done+50, 0 );
        // bfs( P[i].first, P[i].second );
        // dfs( P[i].first, P[i].second, 0 );
        // if ( !is_all() ) { ans++; }
    // }
    
    cout << ans << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'void uf_init(int)':
a.cc:29:9: error: reference to 'rank' is ambiguous
   29 |         rank[i] = 0;
      |         ^~~~
In file included from /usr/include/c++/14/bits/move.h:37,
                 from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:24:5: note:                 'int rank [50]'
   24 | int rank[MAX_N];
      |     ^~~~
a.cc: In function 'void uf_unite(int, int)':
a.cc:43:10: error: reference to 'rank' is ambiguous
   43 |     if ( rank[x] < rank[y] ) {
      |          ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:24:5: note:                 'int rank [50]'
   24 | int rank[MAX_N];
      |     ^~~~
a.cc:43:20: error: reference to 'rank' is ambiguous
   43 |     if ( rank[x] < rank[y] ) {
      |                    ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:24:5: note:                 'int rank [50]'
   24 | int rank[MAX_N];
      |     ^~~~
a.cc:48:14: error: reference to 'rank' is ambiguous
   48 |         if ( rank[x] == rank[y] ) { rank[x]++; }
      |              ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:24:5: note:                 'int rank [50]'
   24 | int rank[MAX_N];
      |     ^~~~
a.cc:48:25: error: reference to 'rank' is ambiguous
   48 |         if ( rank[x] == rank[y] ) { rank[x]++; }
      |                         ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:24:5: note:                 'int rank [50]'
   24 | int rank[MAX_N];
      |     ^~~~
a.cc:48:37: error: reference to 'rank' is ambiguous
   48 |         if ( rank[x] == rank[y] ) { rank[x]++; }
      |                                     ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:24:5: note:                 'int rank [50]'
   24 | int rank[MAX_N];
      |     ^~~~