Language: C++

#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;


int main(void) {
	ll n, m, a, b;
	cin >> n >> m;
	vector<ll>island[3];
	for (ll i = 0;i < m;i++) {
		cin >> a >> b;
		if (a == 1) {
			island[a].push_back(b);
		}
		else {
			if (b == n) {
				island[2].push_back(a);
			}
		}
	}
	for (ll i = 2;i < n;i++) {
		auto itr1 = find(island[1].begin(), island[1].end(), i);
		if (itr1 != island[1].end()) {
			auto itr2 = find(island[2].begin(), island[2].end(), i);
			if (itr2 != island[2].end()) {
				cout << "POSSIBLE" << endl;
				return 0;
			}
		}
	}
	cout << "IMPOSSIBLE" << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:33: error: no matching function for call to 'find(std::vector<long long int>::iterator, std::vector<long long int>::iterator, ll&)'
   23 |                 auto itr1 = find(island[1].begin(), island[1].end(), i);
      |                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:23:33: note:   '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   23 |                 auto itr1 = find(island[1].begin(), island[1].end(), i);
      |                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:25:41: error: no matching function for call to 'find(std::vector<long long int>::iterator, std::vector<long long int>::iterator, ll&)'
   25 |                         auto itr2 = find(island[2].begin(), island[2].end(), i);
      |                                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:25:41: note:   '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   25 |                         auto itr2 = find(island[2].begin(), island[2].end(), i);
      |                                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~