Language: C++

//隣接行列でグラフを管理して、DEFで連結判定する
#include<bits/stdc++.h>
using namespace std;

int n, m;//ノードの数、エッジの数
int a[limit] , b[limit];//連結するノードのペア

bool graph[limit][limit];//隣接行列
bool visited[limit];//訪問済みかどうか
//DFS
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);//未探索のノードならそこからさらに調べる
  }
}

int main(){
  cin >> n >> m;
  for(int i = o; i < m; ++i){
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
  }//ノードのペアに値を代入すると同時に、隣接行列も作成
  
  int ans = 0;
  
  for( int i = 0; i < m; ++i){
    graph[a[i]][b[i]] == graph[b[i]][a[i]] = false; //i番目のペアのエッジを削除
    
    for( int j = 0; j < n; ++j) visited[j] = false; //全ノードを見探索にする
    
    dfs(0);//グラフが連結か調べる
    
    bool bridge = false;
    for ( int j = 0; j < n ; ++j) if (visited[j] == false ) bridge = true;//探索で全ノードを訪問できたら、消去したエッジはブリッジ
    if(bridge) ans += 1;
    graph[a[i]][b[i]] = graph[[b[i]][a[i]] = true;//消去したエッジを元に戻す
 	}
  cout << ans << endl;
  return 0;
}
                              

Compiler output:
a.cc:6:7: error: 'limit' was not declared in this scope
    6 | int a[limit] , b[limit];//連結するノードのペア
      |       ^~~~~
a.cc:6:18: error: 'limit' was not declared in this scope
    6 | int a[limit] , b[limit];//連結するノードのペア
      |                  ^~~~~
a.cc:8:12: error: 'limit' was not declared in this scope
    8 | bool graph[limit][limit];//隣接行列
      |            ^~~~~
a.cc:8:19: error: 'limit' was not declared in this scope
    8 | bool graph[limit][limit];//隣接行列
      |                   ^~~~~
a.cc:9:14: error: 'limit' was not declared in this scope
    9 | bool visited[limit];//訪問済みかどうか
      |              ^~~~~
a.cc: In function 'void dfs(int)':
a.cc:12:3: error: 'visited' was not declared in this scope
   12 |   visited[v] = true;//訪問済みにする
      |   ^~~~~~~
a.cc:14:9: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   14 |     if (graph[v][v2] == false) continue;//非連結なら次のノードを調べる
      |         ^~~~~
      |         isgraph
a.cc: In function 'int main()':
a.cc:22:15: error: 'o' was not declared in this scope
   22 |   for(int i = o; i < m; ++i){
      |               ^
a.cc:23:12: error: 'a' was not declared in this scope
   23 |     cin >> a[i] >> b[i];
      |            ^
a.cc:23:20: error: 'b' was not declared in this scope
   23 |     cin >> a[i] >> b[i];
      |                    ^
a.cc:25:5: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   25 |     graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
      |     ^~~~~
      |     isgraph
a.cc:31:5: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   31 |     graph[a[i]][b[i]] == graph[b[i]][a[i]] = false; //i番目のペアのエッジを削除
      |     ^~~~~
      |     isgraph
a.cc:31:11: error: 'a' was not declared in this scope
   31 |     graph[a[i]][b[i]] == graph[b[i]][a[i]] = false; //i番目のペアのエッジを削除
      |           ^
a.cc:31:17: error: 'b' was not declared in this scope
   31 |     graph[a[i]][b[i]] == graph[b[i]][a[i]] = false; //i番目のペアのエッジを削除
      |                 ^
a.cc:33:33: error: 'visited' was not declared in this scope
   33 |     for( int j = 0; j < n; ++j) visited[j] = false; //全ノードを見探索にする
      |                                 ^~~~~~~
a.cc:38:39: error: 'visited' was not declared in this scope
   38 |     for ( int j = 0; j < n ; ++j) if (visited[j] == false ) bridge = true;//探索で全ノードを訪問できたら、消去したエッジはブリッジ
      |                                       ^~~~~~~
a.cc:40:30: error: two consecutive '[' shall only introduce an attribute before '[' token
   40 |     graph[a[i]][b[i]] = graph[[b[i]][a[i]] = true;//消去したエッジを元に戻す
      |                              ^