Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef __int64 ll;
int num[1000005];
int n,m,b;
ll c;
ll ans=0,now=0;
vector<pair<int,ll> > v;
bool cmp(const pair<int,ll> &x,const pair<int,ll> &y) {return x.second>y.second;}
signed main() {
	cin>>n>>m;
    for(int i=1;i<=n;i++) {cin>>num[i];}
    sort(num+1,num+n+1);
    for(int i=1;i<=m;i++) {
        cin>>b>>c;
        v.push_back(make_pair(b,c));
    }
    sort(v.begin(),v.end(),cmp);
    now=1;
    for(int i=0;i<v.size();++i) {
        for(int j=1;j<=v[i].first&&v[i].second>num[now];++j) {
    		num[now++]=v[i].second;
        }
    }
    for(int i=1;i<=n;i++) ans+=num[i];
    cout<<ans<<'\n';
    return 0;
}

Compiler output:
a.cc:3:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 | typedef __int64 ll;
      |         ^~~~~~~
      |         __int64_t
a.cc:6:1: error: 'll' does not name a type
    6 | ll c;
      | ^~
a.cc:7:1: error: 'll' does not name a type
    7 | ll ans=0,now=0;
      | ^~
a.cc:8:17: error: 'll' was not declared in this scope
    8 | vector<pair<int,ll> > v;
      |                 ^~
a.cc:8:19: error: template argument 2 is invalid
    8 | vector<pair<int,ll> > v;
      |                   ^
a.cc:8:21: error: template argument 1 is invalid
    8 | vector<pair<int,ll> > v;
      |                     ^
a.cc:8:21: error: template argument 2 is invalid
a.cc:9:25: error: 'll' was not declared in this scope
    9 | bool cmp(const pair<int,ll> &x,const pair<int,ll> &y) {return x.second>y.second;}
      |                         ^~
a.cc:9:27: error: template argument 2 is invalid
    9 | bool cmp(const pair<int,ll> &x,const pair<int,ll> &y) {return x.second>y.second;}
      |                           ^
a.cc:9:47: error: 'll' was not declared in this scope
    9 | bool cmp(const pair<int,ll> &x,const pair<int,ll> &y) {return x.second>y.second;}
      |                                               ^~
a.cc:9:49: error: template argument 2 is invalid
    9 | bool cmp(const pair<int,ll> &x,const pair<int,ll> &y) {return x.second>y.second;}
      |                                                 ^
a.cc: In function 'bool cmp(const int&, const int&)':
a.cc:9:65: error: request for member 'second' in 'x', which is of non-class type 'const int'
    9 | bool cmp(const pair<int,ll> &x,const pair<int,ll> &y) {return x.second>y.second;}
      |                                                                 ^~~~~~
a.cc:9:74: error: request for member 'second' in 'y', which is of non-class type 'const int'
    9 | bool cmp(const pair<int,ll> &x,const pair<int,ll> &y) {return x.second>y.second;}
      |                                                                          ^~~~~~
a.cc: In function 'int main()':
a.cc:15:17: error: 'c' was not declared in this scope
   15 |         cin>>b>>c;
      |                 ^
a.cc:16:11: error: request for member 'push_back' in 'v', which is of non-class type 'int'
   16 |         v.push_back(make_pair(b,c));
      |           ^~~~~~~~~
a.cc:18:12: error: request for member 'begin' in 'v', which is of non-class type 'int'
   18 |     sort(v.begin(),v.end(),cmp);
      |            ^~~~~
a.cc:18:22: error: request for member 'end' in 'v', which is of non-class type 'int'
   18 |     sort(v.begin(),v.end(),cmp);
      |                      ^~~
a.cc:19:5: error: 'now' was not declared in this scope; did you mean 'pow'?
   19 |     now=1;
      |     ^~~
      |     pow
a.cc:20:21: error: request for member 'size' in 'v', which is of non-class type 'int'
   20 |     for(int i=0;i<v.size();++i) {
      |                     ^~~~
a.cc:21:25: error: invalid types 'int[int]' for array subscript
   21 |         for(int j=1;j<=v[i].first&&v[i].second>num[now];++j) {
      |                         ^
a.cc:21:37: error: invalid types 'int[int]' for array subscript
   21 |         for(int j=1;j<=v[i].first&&v[i].second>num[now];++j) {
      |                                     ^
a.cc:22:29: error: invalid types 'int[int]' for array subscript
   22 |                 num[now++]=v[i].second;
      |                             ^
a.cc:25:27: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |     for(int i=1;i<=n;i++) ans+=num[i];
      |                           ^~~
      |                           abs
a.cc:26:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |     cout<<ans<<'\n';
      |           ^~~
      |           abs