Language: C++

#include<iostream>
#include<iomanip>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
#include<tuple>
#include<numeric>
#include<map>
#include<cmath>
#define ll long long
#define mod 1000000000+7
#define rep(i,n) for(int i=0;i<(int) (n);i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
using namespace std;
int main() {
	int n, m;
	priority_queue<pair<int, int>>que;
	cin >> n >> m;
	rep(i, n) {
		int a;
		cin >> a;
		que.push(a, 1);
	}
	rep(i, m) {
		int b, c;
		cin >> b >> c;
		que.push(c, b);
	}

	ll ans = 0;
	rep(i, n) {
		vector<pair<int,int>>a;
		a = que.top();
		que.pop();
		ans += a.first;
		if (a.second > 1) {
			a.second--;
			que.push(a);
		}
	}
	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::push(int&, int)'
   24 |                 que.push(a, 1);
      |                 ~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:4:
/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<int, int>; _Sequence = std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >; _Compare = std::less<std::pair<int, int> >; value_type = std::pair<int, int>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note:   candidate expects 1 argument, 2 provided
/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<int, int>; _Sequence = std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >; _Compare = std::less<std::pair<int, int> >; value_type = std::pair<int, int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note:   candidate expects 1 argument, 2 provided
a.cc:29:25: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::push(int&, int&)'
   29 |                 que.push(c, b);
      |                 ~~~~~~~~^~~~~~
/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<int, int>; _Sequence = std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >; _Compare = std::less<std::pair<int, int> >; value_type = std::pair<int, int>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note:   candidate expects 1 argument, 2 provided
/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<int, int>; _Sequence = std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >; _Compare = std::less<std::pair<int, int> >; value_type = std::pair<int, int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note:   candidate expects 1 argument, 2 provided
a.cc:35:29: error: no match for 'operator=' (operand types are 'std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >' and 'const __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'const std::pair<int, int>'})
   35 |                 a = que.top();
      |                             ^
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/queue:63:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'const __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'const std::pair<int, int>'} to 'const std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'const __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'const std::pair<int, int>'} to 'std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'const __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'const std::pair<int, int>'} to 'std::initializer_list<std::pair<int, int> >'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:37:26: error: 'class std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >' has no member named 'first'
   37 |                 ans += a.first;
      |                          ^~~~~
a.cc:38:23: error: 'class std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >' has no member named 'second'
   38 |                 if (a.second > 1) {
      |                       ^~~~~~
a.cc:39:27: error: 'class std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >' has no member named 'second'
   39 |                         a.second--;
      |                           ^~~~~~
a.cc:40:33: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::push(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >&)'
   40 |                         que.push(a);
      |                         ~~~~~~~~^~~
/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<int, int>; _Sequence = std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >; _Compare = std::less<std::pair<int, int> >; value_type = std::pair<int, 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 'std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >' to 'const std::priority_queue<std::pair<int, int> >::value_type&' {aka 'const std::pair<int, 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<int, int>; _Sequence = std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >; _Compare = std::less<std::pair<int, int> >; value_type = std::pair<int, int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from 'std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >' to 'std::priority_queue<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~