Language: C++

#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(int i=x;i<y;i++)
#define frr(i,x,y) for(int i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
vector<VL> adj;
VL visit;
void dfs(ll v)
{
    visit[v]=1;
    for(auto i:adj[v])
    {
        if(visit[i]==-1)
        {
            dfs(i);
        }
    }
    return;
}
void solve()
{
    
    ll n,m;
    cin>>n>>m;
    vector<PLL> arr(n);
    fr(i,0,m)
    {
        cin>>arr[i].F>>arr[i].S;
        arr[i].F--;
        arr[i].S--;
    }
    ll bridge=0;    
    fr(i,0,m)
    {
        adj.clear();
        visit.clear();
        adj.assign(n,VL());
        bool fg=false;
        fr(j,0,m)
        {
            if(i!=j)
            {
                adj[arr[j].F].pb(arr[j].S);
                adj[arr[j].S].pb(arr[j].F);
            }
        }
        visit.assign(n,-1);
        dfs(0);
        fr(k,0,n)
        {
            if(visit[k]==-1)
            {
                fg=true;
            }
        }
        if(fg)
        {
            bridge++;
        }
    }
    cout<<bridge<<endl;
    return;
}
int main()
{
    IOS;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        //cout<<"Case #"<<pp-t<<":\n";
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
/*
recursion - matrix exponential

*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Compiler output:
a.cc: In function 'void dfs(ll)':
a.cc:39:5: error: reference to 'visit' is ambiguous
   39 |     visit[v]=1;
      |     ^~~~~
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:36:4: note:                 'VL visit'
   36 | VL visit;
      |    ^~~~~
a.cc:42:12: error: reference to 'visit' is ambiguous
   42 |         if(visit[i]==-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:36:4: note:                 'VL visit'
   36 | VL visit;
      |    ^~~~~
a.cc: In function 'void solve()':
a.cc:65:9: error: reference to 'visit' is ambiguous
   65 |         visit.clear();
      |         ^~~~~
/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:36:4: note:                 'VL visit'
   36 | VL visit;
      |    ^~~~~
a.cc:76:9: error: reference to 'visit' is ambiguous
   76 |         visit.assign(n,-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:36:4: note:                 'VL visit'
   36 | VL visit;
      |    ^~~~~
a.cc:80:16: error: reference to 'visit' is ambiguous
   80 |             if(visit[k]==-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:36:4: note:                 'VL visit'
   36 | VL visit;
      |    ^~~~~