Language: C++

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

int main() {
    int N,M;
    cin >> N >> M;

    vector<vector<int>> pre_year(100100);
    vector<int> pre(100100);
    vector<int> year(100100);
    int a,b;

    for(int i=0;i<M;i++){
        cin >> a >> b;
        pre_year[a].push_back(b);
        sort(pre_year[a].begin(),pre_year.end());
        pre[i]=a;
        year[i]=b;
      	
    }
    //for(int j=0;j<N;j++){
    //    if(pre_year[j].size()==0) continue;
    //    else{
    //        sort(pre_year[j].begin(),pre_year[j].end());
    //    }
    //}
    for(int i=0;i<M;i++){
        cout << setfill('0') << right << setw(6) << pre[i];
        for(int j=0;j<pre_year[pre[i]].size();j++){
            if(year[i]==pre_year[pre[i]][j]){
                cout << setfill('0') << right << setw(6) << j+1 << endl;
                break;
            }
        }
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: no matching function for call to 'sort(std::vector<int>::iterator, std::vector<std::vector<int> >::iterator)'
   16 |         sort(pre_year[a].begin(),pre_year.end());
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   template argument deduction/substitution failed:
a.cc:16:13: note:   deduced conflicting types for parameter '_RAIter' ('__gnu_cxx::__normal_iterator<int*, std::vector<int> >' and '__gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int> > >')
   16 |         sort(pre_year[a].begin(),pre_year.end());
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided