Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <map>
#include <ios>
#include <iomanip>
#include <set>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl
 
//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) > (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)
 
 
int main(){
 
    int n,m;
    scanf("%d %d\n",&n,&m);
    vector<pair<int,int>> ids(m);
    set<int> grid[100001];
    
    REP(i,m){
        scanf("%d %d\n",&ids[i].first,&ids[i].second);
 
        grid[ids[i].first].insert(ids[i].second);
    }
    
 
 
 
    
    for(auto x:ids){
        
        printf("%06d%06ld\n", x.first, (int)(lower_bound(grid[x.first].begin(),grid[x.first].end(), x.second)-grid[x.first].begin()) + 1);
    }
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:110: error: no match for 'operator-' (operand types are 'std::_Rb_tree_const_iterator<int>' and 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'})
   40 |         printf("%06d%06ld\n", x.first, (int)(lower_bound(grid[x.first].begin(),grid[x.first].end(), x.second)-grid[x.first].begin()) + 1);
      |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
      |                                                         |                                                                        |
      |                                                         _Rb_tree_const_iterator<[...]>                                           _Rb_tree_const_iterator<[...]>
In file included from /usr/include/c++/14/string:48,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:40:131: note:   'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
   40 |         printf("%06d%06ld\n", x.first, (int)(lower_bound(grid[x.first].begin(),grid[x.first].end(), x.second)-grid[x.first].begin()) + 1);
      |                                                                                                                                   ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:40:131: note:   'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::move_iterator<_IteratorL>'
   40 |         printf("%06d%06ld\n", x.first, (int)(lower_bound(grid[x.first].begin(),grid[x.first].end(), x.second)-grid[x.first].begin()) + 1);
      |                                                                                                                                   ^