Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[])
{
    int N, M;
    cin >> N >> M;
    vector<int> a, b;
    a.resize(M);
    b.resize(M);
    vector<bool> ftoi;
    vector<bool> itoN;
    ftoi.resize(N + 1);
    fill(ftoi.begin(), ftoi.end());
    itoN.resize(N + 1);
    fill(itoN.begin(), itoN.end());
    fill
    for (int i = 0; i < M; i++)
    {
        cin >> a[i];
        cin >> b[i];

        if (a[i] > b[i]) swap(a[i], b[i]);

        if (a[i] == 1)
        {
            ftoi[b[i]] = true;
        }else
        {
            ftoi[b[i]] = false;
        }
        if (b[i] == N)
        {
            itoN[a[i]] = true;
        }else
        {
            itoN[a[i]] = false;
        }
        
    }

    for (int i = 0; i < N; i++)
    {
        if (ftoi[i] & itoN[i])
        {
            cout << "POSSIBLE" << endl;
            return 0;
        }
        
    }
    
    cout << "IMPOSSIBLE" << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:18:9: error: no matching function for call to 'fill(std::vector<bool>::iterator, std::vector<bool>::iterator)'
   18 |     fill(ftoi.begin(), ftoi.end());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note: candidate: 'template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1022 |     fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
      |     ^~~~
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:4:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note:   candidate expects 4 arguments, 2 provided
a.cc:20:9: error: no matching function for call to 'fill(std::vector<bool>::iterator, std::vector<bool>::iterator)'
   20 |     fill(itoN.begin(), itoN.end());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note: candidate: 'template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1022 |     fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
      |     ^~~~
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note:   candidate expects 4 arguments, 2 provided
a.cc:21:9: error: expected ';' before 'for'
   21 |     fill
      |         ^
      |         ;
   22 |     for (int i = 0; i < M; i++)
      |     ~~~  
a.cc:22:19: error: statement cannot resolve address of overloaded function
   22 |     for (int i = 0; i < M; i++)
      |                   ^
a.cc:22:21: error: 'i' was not declared in this scope
   22 |     for (int i = 0; i < M; i++)
      |                     ^