Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
 
int32_t main()
{
  int n;int m;cin>>n>>m;
  priority_queue<pair<int,int>>pq;
  for(int i=1;i<=n;i++)
  {
    int a;cin>>a;pq.push({a,1});
  }
  for(int i=1;i<=m;i++)
  {
    int b;int c;cin>>b>>c;
    pq.push({c,b});
  }
  
  int ans=0;
  for(int i=0;i<n;i++)
  {
    int temp=pq.top();
    pq.pop();
    ans+=temp.first;
    if(temp.second>1)
      pq.push({temp.first,temp.second-1});
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:22:20: error: cannot convert 'const __gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'const std::pair<long long int, long long int>'} to 'long long int' in initialization
   22 |     int temp=pq.top();
      |              ~~~~~~^~
      |                    |
      |                    const __gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type {aka const std::pair<long long int, long long int>}
a.cc:24:15: error: request for member 'first' in 'temp', which is of non-class type 'long long int'
   24 |     ans+=temp.first;
      |               ^~~~~
a.cc:25:13: error: request for member 'second' in 'temp', which is of non-class type 'long long int'
   25 |     if(temp.second>1)
      |             ^~~~~~
a.cc:26:21: error: request for member 'first' in 'temp', which is of non-class type 'long long int'
   26 |       pq.push({temp.first,temp.second-1});
      |                     ^~~~~
a.cc:26:32: error: request for member 'second' in 'temp', which is of non-class type 'long long int'
   26 |       pq.push({temp.first,temp.second-1});
      |                                ^~~~~~
a.cc:26:14: error: no matching function for call to 'std::priority_queue<std::pair<long long int, long long int> >::push(<brace-enclosed initializer list>)'
   26 |       pq.push({temp.first,temp.second-1});
      |       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::vector<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; _Compare = std::less<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<std::pair<long long int, long long int> >::value_type&' {aka 'const std::pair<long long int, long long int>&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::vector<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; _Compare = std::less<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~