Language: C++

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

int main(){
 long long N,M,l,r,c,lm,rm,ans,k;
  cin>>N>>M;
  k=0;
  int s=0;
  ans=0;
  vector<long long>A(N),B(M),C(M);
  vevtor<pair<int,long,long>> pair(M);
    for(int i=0;i<N;i++){
   cin>>A[i];
  }
  sort(A.begin(),A.end());
      for(int i=0;i<M;i++){
   cin>>B[i]>>C[i];
        if(B[i]==N){
          s=i;
        }
  }
  if(s!=0){
      for(int i=0;i<N;i++){
   A[i]=B[s];
  }
  }
  for(int i=s+1;i<M;i++){
    pair[i]=make_pair(C[i],B[i]);
  }
    sort(pair.first.begin(),pair.first.end());
  reverse(pair.begin(),pair.end());
      for(int i=0;i<M;i++){
            for(int j=0;j<pair[i].second;j++){
   if(A[j]>=pair[i].first){
     i=M+100;
     j=pair[i].second+100;
   }
	 else{
       A[j]=pair[i].first;
     }
  }
  sort(A.begin(),A.end());
  }
  for(int i=0;i<N;i++){
   ans+=A[i];
  }
 
       cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'vevtor' was not declared in this scope
   11 |   vevtor<pair<int,long,long>> pair(M);
      |   ^~~~~~
a.cc:11:24: error: wrong number of template arguments (3, should be 2)
   11 |   vevtor<pair<int,long,long>> pair(M);
      |                        ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
   89 |     struct pair;
      |            ^~~~
a.cc:11:37: error: class template argument deduction failed:
   11 |   vevtor<pair<int,long,long>> pair(M);
      |                                     ^
a.cc:11:37: error: no matching function for call to 'pair(long long int&)'
/usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > pair(std::pair<_ForwardIterator1, _ForwardIterator2>&&)-> std::pair<_T1, _T2>'
  913 |         explicit constexpr pair(pair<_U1, _U2>&& __p)
      |                            ^~~~
/usr/include/c++/14/bits/stl_pair.h:913:28: note:   template argument deduction/substitution failed:
a.cc:11:37: note:   mismatched types 'std::pair<_ForwardIterator1, _ForwardIterator2>' and 'long long int'
   11 |   vevtor<pair<int,long,long>> pair(M);
      |                                     ^
/usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > pair(std::pair<_ForwardIterator1, _ForwardIterator2>&&)-> std::pair<_T1, _T2>'
  902 |         constexpr pair(pair<_U1, _U2>&& __p)
      |                   ^~~~
/usr/include/c++/14/bits/stl_pair.h:902:19: note:   template argument deduction/substitution failed:
a.cc:11:37: note:   mismatched types 'std::pair<_ForwardIterator1, _ForwardIterator2>' and 'long long int'
   11 |   vevtor<pair<int,long,long>> pair(M);
      |                                     ^
/usr/include/c++/14/bits/stl_pair.h:891:28: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > pair(_U1&&, _U2&&)-> std::pair<_T1, _T2>'
  891 |         explicit constexpr pair(_U1&& __x, _U2&& __y)
      |                            ^~~~
/usr/include/c++/14/bits/stl_pair.h:891:28: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:881:19: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > pair(_U1&&, _U2&&)-> std::pair<_T1, _T2>'
  881 |         constexpr pair(_U1&& __x, _U2&& __y)
      |                   ^~~~
/usr/include/c++/14/bits/stl_pair.h:881:19: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:869:9: note: candidate: 'template<class _T1, class _T2, class _U2, typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U2> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T2, const _U2&> >, std::__not_<std::is_convertible<_U2, _T2> > >::value, bool>::type <anonymous> > pair(typename std::pair<_T1, _T2>::__zero_as_null_pointer_constant, _U2&&, ...)-> std::pair<_T1, _T2>'
  869 |         pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
      |         ^~~~
/usr/include/c++/14/bits/stl_pair.h:869:9: note:   candidate expects at least 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:856:9: note: candidate: 'template<class _T1, class _T2, class _U2, typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U2> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T2, const _U2&> >, std::is_convertible<_U2, _T2> >::value, bool>::type <anonymous> > pair(typename std::pair<_T1, _T2>::__zero_as_null_pointer_constant, _U2&&, ...)-> std::pair<_T1, _T2>'
  856 |         pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
      |         ^~~~
/usr/include/c++/14/bits/stl_pair.h:856:9: note:   candidate expects at least 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:843:9: note: candidate: 'template<class _T1, class _T2, class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_U2> >, std::is_pointer<_T2>, std::is_constructible<_T1, _U1>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_U1, _T1> > >::value, bool>::type <anonymous> > pair(_U1&&, typename std::pair<_T1, _T2>::__zero_as_null_pointer_constant, ...)-> std::pair<_T1, _T2>'
  843 |         pair(_U1&& __x, __zero_as_null_pointer_constant, ...)
      |         ^~~~
/usr/include/c++/14/bits/stl_pair.h:843:9: note:   candidate expects at least 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:830:9: note: candidate: 'template<class _T1, class _T2, class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_U2> >, std::is_pointer<_T2>, std::is_constructible<_T1, _U1>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U1, _T1> >::value, bool>::type <anonymous> > pair(_U1&&, typename std::pair<_T1, _T2>::__zero_as_null_pointer_constant, ...)-> std::pair<_T1, _T2>'
  830 |         pair(_U1&& __x, __zero_as_null_pointer_constant, ...)
      |         ^~~~
/usr/include/c++/14/bits/stl_pair.h:830:9: note:   candidate expects at least 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:789:28: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > pair(const std::pair<_ForwardIterator1, _ForwardIterator2>&)-> std::pair<_T1, _T2>'
  789 |         explicit constexpr pair(const pair<_U1, _U2>& __p)
      |                            ^~~~
/usr/include/c++/14/bits/stl_pair.h:789:28: note:   template argument deduction/substitution failed:
a.cc:11:37: note:   mismatched types 'const std::pair<_ForwardIterator1, _ForwardIterator2>' and 'long long int'
   11 |   vevtor<pair<int,long,long>> pair(M);
      |                                     ^
/usr/include/c++/14/bits/stl_pair.h:779:19: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > pair(const std::pair<_ForwardIterator1, _ForwardIterator2>&)-> std::pair<_T1, _T2>'
  779 |         constexpr pair(const pair<_U1, _U2>& __p)
      |                   ^~~~
/usr/include/c++/14/bits/stl_pair.h:779:19: note:   template argument deduction/substitution failed:
a.cc:11:37: note:   mismatched types 'const std::pair<_ForwardIterator1, _ForwardIterator2>' and 'long long int'
   11 |   vevtor<pair<int,long,long>> pair(M);
      |                                     ^
/usr/include/c++/14/bits/stl_pair.h:762:26: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<(std::_PCC<true, _T1, _T2>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > pair(const _T1&, const _T2&)-> std::pair<_T1, _T2>'
  762 |       explicit constexpr pair(const _T1& __a, const _T2& __b)
      |                          ^~~~
/usr/include/c++/14/bits/stl_pair.h:762:26: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:752:17: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<(std::_PCC<true, _T1, _T2>::_ConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > pair(const _T1&, const _T2&)-> std::pair<_T1, _T2>'
  752 |       constexpr pair(const _T1& __a, const _T2& __b)
      |                 ^~~~
/usr/include/c++/14/bits/stl_pair.h:752:17: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:737:26: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<std::__and_<std::is_default_constructible<_Allocator>, std::is_default_constructible<_U2>, std::__not_<std::__and_<std::__is_implicitly_default_constructible<_U1>, std::__is_implicitly_default_constructible<_U2> > > >::value, bool>::type <anonymous> > pair()-> std::pair<_T1, _T2>'
  737 |       explicit constexpr pair()
      |                          ^~~~
/usr/include/c++/14/bits/stl_pair.h:737:26: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:725:17: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<std::__and_<std::__is_implicitly_default_constructible<_U1>, std::__is_implicitly_default_constructible<_U2> >::value, bool>::type <anonym