Language: C++

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(6);
  int n, m;
  cin >> n >> m;
  vector<long long, long long> ans(m);
  vector<pair<pair<long long, long long>, long long> > vec(m);
  for (int i = 0; i < m; i++) {
    cin >> vec[i].first.second >> vec[i].first.first;
    vec[i].second = 1; 
  }
  sort(vec.begin(), vec.end());
  for (int i = 1; i < m; i++) {
    if (vec[i].first.second == vec[i-1].first.second) {
      ++(vec[i].second);
    }
    ans[i].first = vec[i].first.second;
    ans[i].second = vec[i].second;
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < m; i++) {
    cout << ans[i].first << ans[i].second << '\n';
  }
}

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<long long int, long long int>':
/usr/include/c++/14/bits/stl_vector.h:428:11:   required from 'class std::vector<long long int, long long int>'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:11:37:   required from here
   11 |   vector<long long, long long> ans(m);
      |                                     ^
/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<long long int, long long int>':
a.cc:11:37:   required from here
   11 |   vector<long long, long long> ans(m);
      |                                     ^
/usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<long long 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<long long 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<long long int, long long int>::_Base'
  521 |       using _Base::_M_get_Tp_allocator;
      |                    ^~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:11:37: error: call of overloaded 'vector(int&)' is ambiguous
   11 |   vector<long long, long long> ans(m);
      |                                     ^
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = long long int]'
  620 |       vector(vector&&) noexcept = default;
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = long long int]'
  601 |       vector(const vector& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = long long int; _Alloc = long long int; size_type = long unsigned int; allocator_type = long long int]'
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = long long int; _Alloc = long long int; allocator_type = long long int]'
  542 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |       ^~~~~~
a.cc:22:8: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
   22 |     ans[i].first = vec[i].first.second;
      |        ^
a.cc:23:8: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
   23 |     ans[i].second = vec[i].second;
      |        ^
a.cc:25:12: error: 'class std::vector<long long int, long long int>' has no member named 'begin'
   25 |   sort(ans.begin(), ans.end());
      |            ^~~~~
a.cc:25:25: error: 'class std::vector<long long int, long long int>' has no member named 'end'
   25 |   sort(ans.begin(), ans.end());
      |                         ^~~
a.cc:27:16: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
   27 |     cout << ans[i].first << ans[i].second << '\n';
      |                ^
a.cc:27:32: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
   27 |     cout << ans[i].first << ans[i].second << '\n';
      |                                ^