Language: C++

#include<map>
#include<cstdio>
using namespace std;
int main(){for(int T;~scanf("%d",&T)&&T;puts("")){
	map<pair<int,int>,int>m;
	char C[2];
	int n,k;
	for(;T--;){
		scanf("%s%d",C,&n);
		if(*C=='D'){
			for(auto it=m.begin();it!=m.end();)if(it->second==n)m.erase(it++);else	++it;
		}else if(*C=='R'){
			auto it=m.lower_bound(make_pair(n,2000000000));
			printf("%d\n",it==m.begin()||n<(--it)->first.first||it->first.second<n ? -1 : it->second);
		}else if(*C=='W'){
			int c=!scanf("%d",&k),d;
			for(auto it=m.begin();k&&it!=m.end();++it){
				d=it->first.first-c;
				if(d>k)d=k;
				if(d)m.emplace({c,c+d-1},n);
				k-=d;
				c=it->first.second+1;
			}
			if(k)m.emplace({c,c+k-1},n);
		}
	}
}}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:47: error: no matching function for call to 'std::map<std::pair<int, int>, int>::emplace(<brace-enclosed initializer list>, int&)'
   20 |                                 if(d)m.emplace({c,c+d-1},n);
      |                                      ~~~~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/map:63,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:588:9: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::emplace(_Args&& ...) [with _Args = {}; _Key = std::pair<int, int>; _Tp = int; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator = std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<const std::pair<int, int>, int> > >::iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other = std::allocator<std::pair<const std::pair<int, int>, int> >; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> > = __gnu_cxx::__alloc_traits<std::allocator<std::pair<const std::pair<int, int>, int> >, std::pair<const std::pair<int, int>, int> >::rebind<std::pair<const std::pair<int, int>, int> >; typename _Alloc::value_type = std::pair<const std::pair<int, int>, int>]'
  588 |         emplace(_Args&&... __args)
      |         ^~~~~~~
/usr/include/c++/14/bits/stl_map.h:588:9: note:   candidate expects 0 arguments, 2 provided
a.cc:24:39: error: no matching function for call to 'std::map<std::pair<int, int>, int>::emplace(<brace-enclosed initializer list>, int&)'
   24 |                         if(k)m.emplace({c,c+k-1},n);
      |                              ~~~~~~~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_map.h:588:9: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::emplace(_Args&& ...) [with _Args = {}; _Key = std::pair<int, int>; _Tp = int; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator = std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<const std::pair<int, int>, int> > >::iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other = std::allocator<std::pair<const std::pair<int, int>, int> >; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> > = __gnu_cxx::__alloc_traits<std::allocator<std::pair<const std::pair<int, int>, int> >, std::pair<const std::pair<int, int>, int> >::rebind<std::pair<const std::pair<int, int>, int> >; typename _Alloc::value_type = std::pair<const std::pair<int, int>, int>]'
  588 |         emplace(_Args&&... __args)
      |         ^~~~~~~
/usr/include/c++/14/bits/stl_map.h:588:9: note:   candidate expects 0 arguments, 2 provided