Language: C++

#include <bits/stdc++.h>
using namespace std;

class Dijkstra{ //O((N+M)logN)
    private:
        vector<vector<pair<int,long long>>> graph; //pair<next_path,cost>
        vector<long long> total_cost;
    
    public:
        Dijkstra(vector<vector<pair<int,long long>>> graph,int start,int size,bool path_check = false){
            priority_queue<
                pair<int,long long>,
                vector<pair<int,long long>>,
                greater<pair<int,long long>>> q;
            vector<long long> cost(size,1e18+7);
            cost[start] = 0;
            q.push(make_pair(start,0ll));
            while (!q.empty()){
                auto now = q.top();
                q.pop();
                int prev = now.first;
                if( cost[prev] < now.second) continue;
                for (auto next : graph[prev]){
                    if (cost[next.first] <= cost[now.first] + next.second) continue;
                    cost[next.first] = cost[now.first] + next.second;
                    q.push(next);
                }
            }
            total_cost = cost;
        }
        long long get_cost(int goal){ return total_cost[goal]; }
};
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int n,m; cin >> n >> m;
    vector<vector<int,ll>> graph[n+1]; //graph[i].first  i:現在地,first:次の場所,second:コスト
    rep(i,0,m){
        int b1,b2; cin >> b1 >> b2;
        graph[b2].push_back(make_pair(b1,1));
        graph[b1].push_back(make_pair(b2,1));
    }
    Dijkstra G(graph,1,n+1);
    if( G.get_cost(n) == 2)cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Compiler output:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<int, long long int>':
/usr/include/c++/14/bits/stl_vector.h:428:11:   required from 'class std::vector<int, long long int>'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:46:28:   required from here
   46 |         graph[b2].push_back(make_pair(b1,1));
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:87:28: error: 'long long int' is not a class, struct, or union type
   87 |         rebind<_Tp>::other _Tp_alloc_type;
      |                            ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:89:9: error: 'long long int' is not a class, struct, or union type
   89 |         pointer;
      |         ^~~~~~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<int, long long int>':
a.cc:46:28:   required from here
   46 |         graph[b2].push_back(make_pair(b1,1));
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<int, long long int>::_Base'
  518 |       using _Base::_M_allocate;
      |                    ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<int, long long int>::_Base'
  519 |       using _Base::_M_deallocate;
      |                    ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<int, long long int>::_Base'
  521 |       using _Base::_M_get_Tp_allocator;
      |                    ^~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:46:28: error: no matching function for call to 'std::vector<std::vector<int, long long int> >::push_back(std::pair<int, int>)'
   46 |         graph[b2].push_back(make_pair(b1,1));
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int, long long int>; _Alloc = std::allocator<std::vector<int, long long int> >; value_type = std::vector<int, long long int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'const std::vector<std::vector<int, long long int> >::value_type&' {aka 'const std::vector<int, long long int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int, long long int>; _Alloc = std::allocator<std::vector<int, long long int> >; value_type = std::vector<int, long long int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<std::vector<int, long long int> >::value_type&&' {aka 'std::vector<int, long long int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:47:28: error: no matching function for call to 'std::vector<std::vector<int, long long int> >::push_back(std::pair<int, int>)'
   47 |         graph[b1].push_back(make_pair(b2,1));
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int, long long int>; _Alloc = std::allocator<std::vector<int, long long int> >; value_type = std::vector<int, long long int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'const std::vector<std::vector<int, long long int> >::value_type&' {aka 'const std::vector<int, long long int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int, long long int>; _Alloc = std::allocator<std::vector<int, long long int> >; value_type = std::vector<int, long long int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<std::vector<int, long long int> >::value_type&&' {aka 'std::vector<int, long long int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:49:27: error: no matching function for call to 'Dijkstra::Dijkstra(std::vector<std::vector<int, long long int> > [(n + 1)], int, int)'
   49 |     Dijkstra G(graph,1,n+1);
      |                           ^
a.cc:10:9: note: candidate: 'Dijkstra::Dijkstra(std::vector<std::vector<std::pair<int, long long int> > >, int, int, bool)'
   10 |         Dijkstra(vector<vector<pair<int,long long>>> graph,int start,int size,bool path_check = false){
      |         ^~~~~~~~
a.cc:10:54: note:   no known conversion for argument 1 from 'std::vector<std::vector<int, long long int> > [(n + 1)]' to 'std::vector<std::vector<std::pair<int, long long int> > >'
   10 |         Dijkstra(vector<vector<pair<int,long long>>> graph,int start,int size,bool path_check = false){
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
a.cc:4:7: note: candidate: 'Dijkstra::Dijkstra(const Dijkstra&)'
    4 | class Dijkstra{ //O((N+M)logN)
      |       ^~~~~~~~
a.cc:4:7: note:   candidate expects 1 argument, 3 provided
a.cc:4:7: note: candidate: 'Dijkstra::Dijkstra(Dijkstra&&)'
a.cc:4:7: note:   candidate expects 1 argument, 3 provided