Language: C++

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

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

    vector<vector<int>> pre_year(100001);
    vector<int> pre(100001);
    vector<int> year(100001);

    for(int i=0;i<M;i++){
        cin >> pre[i] >> year[i];
        pre_year[pre[i]].push_back(year[i]);
    }
    for(int i=0;i<N;i++){
        sort(pre_year[i].begin(),pre_year.end());
    }
    for(int i=0;i<M;i++){
        cout << setfill('0') << right << setw(6) << pre[i];
        int a=lower_bound(pre_year[pre[i]].begin(),pre_year[pre[i]],year[i]);
        a-=pre_year[pre[i]].begin()+1;
        cout << setfill('0') << right << setw(6) << a << endl;
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: no matching function for call to 'sort(std::vector<int>::iterator, std::vector<std::vector<int> >::iterator)'
   17 |         sort(pre_year[i].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:17: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> > >')
   17 |         sort(pre_year[i].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
a.cc:21:26: error: no matching function for call to 'lower_bound(std::vector<int>::iterator, __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   21 |         int a=lower_bound(pre_year[pre[i]].begin(),pre_year[pre[i]],year[i]);
      |               ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note:   template argument deduction/substitution failed:
a.cc:21:26: note:   deduced conflicting types for parameter '_ForwardIterator' ('__gnu_cxx::__normal_iterator<int*, std::vector<int> >' and 'std::vector<int>')
   21 |         int a=lower_bound(pre_year[pre[i]].begin(),pre_year[pre[i]],year[i]);
      |               ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note:   candidate expects 4 arguments, 3 provided
a.cc:22:10: error: no match for 'operator-=' (operand types are 'int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >')
   22 |         a-=pre_year[pre[i]].begin()+1;
      |         ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~