Language: C++

#include<iostream>
#include<map>
using namespace std;
int main(){
	multimap<string, int>m;
	int q;
	cin>>q;
	while(q--){
		int c;
		string k;
		cin>>c>>k;
		if(c==0){
			int x;
			cin>>x;
			m.insert(k,x);
		}
		else if(c==1){
			if(m.find(k)==m.end())
				cout<<0<<endl;
			else
				cout<<m[k]<<endl;
		}
		else if(c==2){
			m.erase(k);
		}
		else if(c==3){
			string y;
			cin>>y;
			map<string, int>::iterator i;
			for(i=m.lower_bound(k); i!=m.upper_bound(y); i++)
				cout<<(*i).first<<" "<<(*i).second<<endl;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:33: error: no matching function for call to 'std::multimap<std::__cxx11::basic_string<char>, int>::insert(std::string&, int&)'
   15 |                         m.insert(k,x);
      |                         ~~~~~~~~^~~~~
In file included from /usr/include/c++/14/map:64,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_multimap.h:557:9: note: candidate: 'template<class _Pair> std::__enable_if_t<((bool)std::is_constructible<std::pair<const _Key, _Tp>, _Pair>::value), 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::multimap<_Key, _Tp, _Compare, _Alloc>::insert(_Pair&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >]'
  557 |         insert(_Pair&& __x)
      |         ^~~~~~
/usr/include/c++/14/bits/stl_multimap.h:557:9: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_multimap.h:600:9: note: candidate: 'template<class _Pair> std::__enable_if_t<((bool)std::is_constructible<std::pair<const _Key, _Tp>, _Pair&&>::value), 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::multimap<_Key, _Tp, _Compare, _Alloc>::insert(const_iterator, _Pair&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >]'
  600 |         insert(const_iterator __position, _Pair&& __x)
      |         ^~~~~~
/usr/include/c++/14/bits/stl_multimap.h:600:9: note:   template argument deduction/substitution failed:
a.cc:15:34: note:   cannot convert 'k' (type 'std::string' {aka 'std::__cxx11::basic_string<char>'}) to type 'std::multimap<std::__cxx11::basic_string<char>, int>::const_iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::const_iterator'}
   15 |                         m.insert(k,x);
      |                                  ^
/usr/include/c++/14/bits/stl_multimap.h:619:9: note: candidate: 'template<class _InputIterator> void std::multimap<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >]'
  619 |         insert(_InputIterator __first, _InputIterator __last)
      |         ^~~~~~
/usr/include/c++/14/bits/stl_multimap.h:619:9: note:   template argument deduction/substitution failed:
a.cc:15:33: note:   deduced conflicting types for parameter '_InputIterator' ('std::__cxx11::basic_string<char>' and 'int')
   15 |                         m.insert(k,x);
      |                         ~~~~~~~~^~~~~
/usr/include/c++/14/bits/stl_multimap.h:545:7: note: candidate: 'std::multimap<_Key, _Tp, _Compare, _Alloc>::iterator std::multimap<_Key, _Tp, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; iterator = std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator; value_type = std::pair<const std::__cxx11::basic_string<char>, int>]'
  545 |       insert(const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_multimap.h:545:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_multimap.h:552:7: note: candidate: 'std::multimap<_Key, _Tp, _Compare, _Alloc>::iterator std::multimap<_Key, _Tp, _Compare, _Alloc>::insert(value_type&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; iterator = std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator; value_type = std::pair<const std::__cxx11::basic_string<char>, int>]'
  552 |       insert(value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_multimap.h:552:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_multimap.h:585:7: note: candidate: 'std::multimap<_Key, _Tp, _Compare, _Alloc>::iterator std::multimap<_Key, _Tp, _Compare, _Alloc>::insert(const_iterator, const value_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; iterator = std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator; const_iterator = std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::const_iterator; value_type = std::pair<const std::__cxx11::basic_string<char>, int>]'
  585 |       insert(const_iterator __position, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_multimap.h:585:29: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::multimap<std::__cxx11::basic_string<char>, int>::const_iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::const_iterator'}
  585 |       insert(const_iterator __position, const value_type& __x)
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_multimap.h:595:7: note: candidate: 'std::multimap<_Key, _Tp, _Compare, _Alloc>::iterator std::multimap<_Key, _Tp, _Compare, _Alloc>::insert(const_iterator, value_type&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; iterator = std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator; const_iterator = std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::const_iterator; value_type = std::pair<const std::__cxx11::basic_string<char>, int>]'
  595 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_multimap.h:595:29: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::multimap<std::__cxx11::basic_string<char>, int>::const_iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::const_iterator'}
  595 |       insert(const_iterator __position, value_type&& __x)
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_multimap.h:631:7: note: candidate: 'void std::multimap<_Key, _Tp, _Compare, _Alloc>::insert(std::initializer_list<std::pair<const _Key, _Tp> >) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >]'
  631 |       insert(initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_multimap.h:631:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_multimap.h:651:7: note: candidate: 'std::multimap<_Key, _Tp, _Compare, _Alloc>::iterator std::multimap<_Key, _Tp, _Compare, _Alloc>::insert(node_type&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; iterator = std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator; nod