Language: C++

#include<bits/stdc++.h>
int n, m, q, a[210000], b[210000], c, dist[110000], T[110000], cnt, U[110000];
vector<pair<int, int> >x[110000], y[110000]; bool used[210000];
int main() {
	scanf("%d%d%d", &n, &m, &q);
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &a[i], &b[i]);
		x[a[i]].push_back(make_pair(b[i], i));
		x[b[i]].push_back(make_pair(a[i], i));
	}
	fill(dist, dist + n + 1, 999999); dist[1] = 0;
	queue<int> Q; Q.push(1);
	while (!Q.empty()) {
		int a1 = Q.front(); Q.pop();
		for (pair<int, int> i : x[a1]) {
			if (dist[i.first] > dist[a1] + 1) {
				dist[i.first] = dist[a1] + 1;
				Q.push(i.first);
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		for (pair<int, int> j : x[i]) {
			if (dist[i] < dist[j.first]) {
				y[i].push_back(j);
				T[j.first]++;
			}
		}
	}
	for (int i = 0; i < q; i++) {
		scanf("%d", &c); c--;
		queue<pair<int, int> > Q1;
		int ss = -1;
		if (dist[a[c]] < dist[b[c]])ss = b[c];
		if (dist[a[c]] > dist[b[c]])ss = a[c];
		if (ss >= 1 && U[ss] == 0 && used[c] == false) {
			Q1.push(make_pair(ss, c));
			while (!Q1.empty()) {
				int a1 = Q1.front().first, a2 = Q1.front().second; Q1.pop();
				if (U[a1] == 1 || used[a2] == true) continue; T[a1]--; used[a2] = true;
				if (T[a1] != 0) continue; cnt++; U[a1] = 1;
				for (pair<int, int> j : y[a1]) {
					if (U[j.first] == 0) Q1.push(j);
				}
			}
		}
		cout << cnt << endl;
	}
	return 0;
}

Compiler output:
a.cc:3:1: error: 'vector' does not name a type
    3 | vector<pair<int, int> >x[110000], y[110000]; bool used[210000];
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:8:17: error: 'x' was not declared in this scope
    8 |                 x[a[i]].push_back(make_pair(b[i], i));
      |                 ^
a.cc:8:35: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
    8 |                 x[a[i]].push_back(make_pair(b[i], i));
      |                                   ^~~~~~~~~
      |                                   std::make_pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:11:9: error: 'fill' was not declared in this scope; did you mean 'std::fill'?
   11 |         fill(dist, dist + n + 1, 999999); dist[1] = 0;
      |         ^~~~
      |         std::fill
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: 'std::fill' declared here
  191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
a.cc:12:9: error: 'queue' was not declared in this scope; did you mean 'std::queue'?
   12 |         queue<int> Q; Q.push(1);
      |         ^~~~~
      |         std::queue
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157:
/usr/include/c++/14/bits/stl_queue.h:96:11: note: 'std::queue' declared here
   96 |     class queue
      |           ^~~~~
a.cc:12:15: error: expected primary-expression before 'int'
   12 |         queue<int> Q; Q.push(1);
      |               ^~~
a.cc:12:23: error: 'Q' was not declared in this scope
   12 |         queue<int> Q; Q.push(1);
      |                       ^
a.cc:15:22: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   15 |                 for (pair<int, int> i : x[a1]) {
      |                      ^~~~
      |                      std::pair
/usr/include/c++/14/bits/stl_pair.h:89:12: note: 'std::pair' declared here
   89 |     struct pair;
      |            ^~~~
a.cc:15:27: error: expected primary-expression before 'int'
   15 |                 for (pair<int, int> i : x[a1]) {
      |                           ^~~
a.cc:21:9: error: expected primary-expression before '}' token
   21 |         }
      |         ^
a.cc:20:18: error: expected ';' before '}' token
   20 |                 }
      |                  ^
      |                  ;
   21 |         }
      |         ~         
a.cc:21:9: error: expected primary-expression before '}' token
   21 |         }
      |         ^
a.cc:20:18: error: expected ')' before '}' token
   20 |                 }
      |                  ^
      |                  )
   21 |         }
      |         ~         
a.cc:15:21: note: to match this '('
   15 |                 for (pair<int, int> i : x[a1]) {
      |                     ^
a.cc:21:9: error: expected primary-expression before '}' token
   21 |         }
      |         ^
a.cc:23:22: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   23 |                 for (pair<int, int> j : x[i]) {
      |                      ^~~~
      |                      std::pair
/usr/include/c++/14/bits/stl_pair.h:89:12: note: 'std::pair' declared here
   89 |     struct pair;
      |            ^~~~
a.cc:23:27: error: expected primary-expression before 'int'
   23 |                 for (pair<int, int> j : x[i]) {
      |                           ^~~
a.cc:29:9: error: expected primary-expression before '}' token
   29 |         }
      |         ^
a.cc:28:18: error: expected ';' before '}' token
   28 |                 }
      |                  ^
      |                  ;
   29 |         }
      |         ~         
a.cc:29:9: error: expected primary-expression before '}' token
   29 |         }
      |         ^
a.cc:28:18: error: expected ')' before '}' token
   28 |                 }
      |                  ^
      |                  )
   29 |         }
      |         ~         
a.cc:23:21: note: to match this '('
   23 |                 for (pair<int, int> j : x[i]) {
      |                     ^
a.cc:29:9: error: expected primary-expression before '}' token
   29 |         }
      |         ^
a.cc:32:23: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   32 |                 queue<pair<int, int> > Q1;
      |                       ^~~~
      |                       std::pair
/usr/include/c++/14/bits/stl_pair.h:89:12: note: 'std::pair' declared here
   89 |     struct pair;
      |            ^~~~
a.cc:32:28: error: expected primary-expression before 'int'
   32 |                 queue<pair<int, int> > Q1;
      |                            ^~~
a.cc:37:25: error: 'Q1' was not declared in this scope; did you mean 'y1'?
   37 |                         Q1.push(make_pair(ss, c));
      |                         ^~
      |                         y1
a.cc:37:33: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   37 |                         Q1.push(make_pair(ss, c));
      |                                 ^~~~~~~~~
      |                                 std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:40:56: error: 'a2' was not declared in this scope; did you mean 'a1'?
   40 |                                 if (U[a1] == 1 || used[a2] == true) continue; T[a1]--; used[a2] = true;
      |                                                        ^~
      |                                                        a1
a.cc:40:93: error: 'a2' was not declared in this scope; did you mean 'a1'?
   40 |                                 if (U[a1] == 1 || used[a2] == true) continue; T[a1]--; used[a2] = true;
      |                                                                                             ^~
      |                                                                                             a1
a.cc:42:43: error: expected primary-expression before 'int'
   42 |                                 for (pair<int, int> j : y[a1]) {
      |                                           ^~~
a.cc:45:25: error: expected primary-expression before '}' token
   45 |                         }
      |                         ^
a.cc:44:34: error: expected ';' before '}' token
   44 |                                 }
      |                                  ^
      |                                  ;
   45 |                         }
      |                         ~         
a.cc:45:25: error: expected primary-expression before '}' token
   45 |                         }
      |                         ^
a.cc:44:34: error: expected ')' before '}' token
   44 |                                 }
      |                                  ^
      |                                  )
   45 |                         }
      |                         ~         
a.cc:42:37: note: to match this '('
   42 |                                 for (pair<int, int> j : y[a1]) {
      |                                     ^
a.cc:45:25: error: expected primary-expression before '}' token
   45 |                         }
      |                         ^
a.cc:47:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   47 |                 cout << cnt << endl;
      |                 ^~~~
      |                 std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:47:32: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   47 |                 cout << cnt << endl;
      |                                ^~~~
      |                                std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~