Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long signed int ll;
int n,m;
int a[100005],b[100005];
int toit[100005];
vector<vector<int>> node;

queue<int> check;
int parent[100005];
bool removed[100005];
bool isroot(int k){
    if(toit[k]<=0) return true;
    return false;
    
}

void bfs(int root){
    check.push(root);
    while(check.size()){
        int k=check.front(); check.pop();
        for(int i=0;i< node[k].size();i++){
            
                
                parent[b[node[k][i]]]=k;
                a[node[k][i]]=-1;
                b[node[k][i]]=-1;
                toit[b[node[k][i]]]--;
                if(isroot(b[node[k][i]])){
                    check.push(b[node[k][i]]);
                }
            }
        }
        
        
    }
    

int main(){
    cin>>n>>m;
    int root=1;
    
    for(int i=0;i<n+m-1;i++){
        cin>>a[i]>>b[i];
        toit[b[i]]++;
        node[a[i]].insert(b[i]);
    }
    while(!isroot(root)){
        root++;
    }
    //cout<<root<<endl;
    bfs(root);
    for(int i=1;i<n+1;i++){
        cout<<parent[i]<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:26: error: no matching function for call to 'std::vector<int>::insert(int&)'
   46 |         node[a[i]].insert(b[i]);
      |         ~~~~~~~~~~~~~~~~~^~~~~~
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:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Alloc = std::allocator<int>]'
 1484 |         insert(const_iterator __position, _InputIterator __first,
      |         ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1484:9: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/vector:72:
/usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]'
  133 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:133:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]'
 1395 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1413 |       insert(const_iterator __position, initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; size_type = long unsigned int; value_type = int]'
 1439 |       insert(const_iterator __position, size_type __n, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note:   candidate expects 3 arguments, 1 provided