Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main() {
	int n, m;
	while (cin >> n >> m){
		if (n == 0 && m == 0)return 0;
		vector<pair<int, int>>l;
		vector<int>k;
		vector<int>linst;
		cin >> n >> m;
		for (int i = 0; i < m; i++) {
			pair<int, int>p;
			cin >> p.first >> p.second;
			if (p.first == 1) {
				k.push_back(p.second);
				linst.push_back(p.second);
			}
			else if (p.second == 1) {
				k.push_back(p.first);
				linst.push_back(p.first);
			}
			else l.push_back(p);
		}
		for (int i = 0; i < l.size(); i++) {
			if (find(k.begin(), k.end(), l[i].first) != k.end()) {
				if (find(linst.begin(), linst.end(), l[i].second) == linst.end()) {
					linst.push_back(l[i].second);
				}
			}
			if (find(k.begin(), k.end(), l[i].second) != k.end()) {
				if (find(linst.begin(), linst.end(), l[i].first) == linst.end()) {
					linst.push_back(l[i].first);
				}
			}
		}
		cout << linst.size() << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:33: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   26 |                         if (find(k.begin(), k.end(), l[i].first) != k.end()) {
      |                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:26:33: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   26 |                         if (find(k.begin(), k.end(), l[i].first) != k.end()) {
      |                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:27:41: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   27 |                                 if (find(linst.begin(), linst.end(), l[i].second) == linst.end()) {
      |                                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:27:41: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   27 |                                 if (find(linst.begin(), linst.end(), l[i].second) == linst.end()) {
      |                                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:31:33: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   31 |                         if (find(k.begin(), k.end(), l[i].second) != k.end()) {
      |                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:31:33: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   31 |                         if (find(k.begin(), k.end(), l[i].second) != k.end()) {
      |                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:32:41: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   32 |                                 if (find(linst.begin(), linst.end(), l[i].first) == linst.end()) {
      |                                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:32:41: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   32 |                                 if (find(linst.begin(), linst.end(), l[i].first) == linst.end()) {
      |                                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~