std::map is already sorted, you can take the last k elements from the end for the greatest and k elements from the start for the smallest.
for (auto it = map.rbegin(); it != map.rend(); it++)
{
if (v.size() == k)
{
break;
}
v.push_back(*it);
}
for an unordered_map, The standard library has a function std::partial_sort_copy to pick the largest or smallest elements of any container, which can be called with an unordered_map.
As for your question.
std::vector<typename MapType::value_type> v;
map's value_type is std::pair<const Key, T>, and const elements disable the copy assignment operator which std::sort needs to copy/move the elements.
you need to use
std::vector<std::pair<typename MapType::key_type, typename MapType::mapped_type>> v;
as for the translation, the error you got is:
error: use of deleted function 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(const std::pair<_T1, _T2>&) [with _T1 = const unsigned int; _T2 = Values]
which translates to, that std::pair<const unsigned int, Values> has operator= deleted.