Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int __int64
const int maxn=1e7+5;
int num[maxn];
int n,m,b,c,i,j;
int ans=0,now;
vector<pair<int,int> >v;
inline int read() {
	int x=0,neg=1;char ch=getchar();
	while(!isdigit(ch)) {
		if (ch=='-') neg=-1;
		ch=getchar();
	}
	while(isdigit(ch)) {
		x=x*10+(ch-'0');
		ch=getchar();
	}
	return x*neg;
}
bool cmp(const pair<int,int> &x,const pair<int,int> &y) {return x.second>y.second;}
signed main() {
	n=read(),m=read();
    for(i=1;i<=n;i++) {num[i]=read();}
    sort(num+1,num+n+1);
    for(i=1;i<=m;i++) {
        b=read(),c=read();
        v.push_back(make_pair(b,c));
    }
    sort(v.begin(),v.end(),cmp);
    now=1;
    for(i=0;i<v.size();++i) {
        for(j=1;j<=v[i].first&&v[i].second>num[now];j++) {
    		num[now]=v[i].second;
	       	++now;
        }
    }
    for(i=1;i<=n;i++) ans+=num[i];
    cout<<ans<<'\n';
    return 0;
}

    

Compiler output:
a.cc:3:13: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 | #define int __int64
      |             ^~~~~~~
a.cc:4:7: note: in expansion of macro 'int'
    4 | const int maxn=1e7+5;
      |       ^~~
a.cc:3:13: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 | #define int __int64
      |             ^~~~~~~
a.cc:5:1: note: in expansion of macro 'int'
    5 | int num[maxn];
      | ^~~
a.cc:3:13: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 | #define int __int64
      |             ^~~~~~~
a.cc:6:1: note: in expansion of macro 'int'
    6 | int n,m,b,c,i,j;
      | ^~~
a.cc:3:13: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 | #define int __int64
      |             ^~~~~~~
a.cc:7:1: note: in expansion of macro 'int'
    7 | int ans=0,now;
      | ^~~
a.cc:3:13: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
    3 | #define int __int64
      |             ^~~~~~~
a.cc:8:13: note: in expansion of macro 'int'
    8 | vector<pair<int,int> >v;
      |             ^~~
a.cc:3:13: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
    3 | #define int __int64
      |             ^~~~~~~
a.cc:8:17: note: in expansion of macro 'int'
    8 | vector<pair<int,int> >v;
      |                 ^~~
a.cc:8:20: error: template argument 1 is invalid
    8 | vector<pair<int,int> >v;
      |                    ^
a.cc:8:20: error: template argument 2 is invalid
a.cc:8:22: error: template argument 1 is invalid
    8 | vector<pair<int,int> >v;
      |                      ^
a.cc:8:22: error: template argument 2 is invalid
a.cc:3:13: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 | #define int __int64
      |             ^~~~~~~
a.cc:9:8: note: in expansion of macro 'int'
    9 | inline int read() {
      |        ^~~
a.cc:3:13: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
    3 | #define int __int64
      |             ^~~~~~~
a.cc:21:21: note: in expansion of macro 'int'
   21 | bool cmp(const pair<int,int> &x,const pair<int,int> &y) {return x.second>y.second;}
      |                     ^~~
a.cc:3:13: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
    3 | #define int __int64
      |             ^~~~~~~
a.cc:21:25: note: in expansion of macro 'int'
   21 | bool cmp(const pair<int,int> &x,const pair<int,int> &y) {return x.second>y.second;}
      |                         ^~~
a.cc:21:28: error: template argument 1 is invalid
   21 | bool cmp(const pair<int,int> &x,const pair<int,int> &y) {return x.second>y.second;}
      |                            ^
a.cc:21:28: error: template argument 2 is invalid
a.cc:3:13: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
    3 | #define int __int64
      |             ^~~~~~~
a.cc:21:44: note: in expansion of macro 'int'
   21 | bool cmp(const pair<int,int> &x,const pair<int,int> &y) {return x.second>y.second;}
      |                                            ^~~
a.cc:3:13: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
    3 | #define int __int64
      |             ^~~~~~~
a.cc:21:48: note: in expansion of macro 'int'
   21 | bool cmp(const pair<int,int> &x,const pair<int,int> &y) {return x.second>y.second;}
      |                                                ^~~
a.cc:21:51: error: template argument 1 is invalid
   21 | bool cmp(const pair<int,int> &x,const pair<int,int> &y) {return x.second>y.second;}
      |                                                   ^
a.cc:21:51: error: template argument 2 is invalid
a.cc: In function 'bool cmp(const int&, const int&)':
a.cc:21:67: error: request for member 'second' in 'x', which is of non-class type 'const int'
   21 | bool cmp(const pair<int,int> &x,const pair<int,int> &y) {return x.second>y.second;}
      |                                                                   ^~~~~~
a.cc:21:76: error: request for member 'second' in 'y', which is of non-class type 'const int'
   21 | bool cmp(const pair<int,int> &x,const pair<int,int> &y) {return x.second>y.second;}
      |                                                                            ^~~~~~
a.cc: In function 'int main()':
a.cc:23:9: error: 'n' was not declared in this scope; did you mean 'yn'?
   23 |         n=read(),m=read();
      |         ^
      |         yn
a.cc:23:15: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   23 |         n=read(),m=read();
      |           ~~~~^~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:1:
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
a.cc:23:18: error: 'm' was not declared in this scope
   23 |         n=read(),m=read();
      |                  ^
a.cc:23:24: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   23 |         n=read(),m=read();
      |                    ~~~~^~
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
a.cc:24:9: error: 'i' was not declared in this scope
   24 |     for(i=1;i<=n;i++) {num[i]=read();}
      |         ^
a.cc:24:24: error: 'num' was not declared in this scope; did you mean 'enum'?
   24 |     for(i=1;i<=n;i++) {num[i]=read();}
      |                        ^~~
      |                        enum
a.cc:24:35: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   24 |     for(i=1;i<=n;i++) {num[i]=read();}
      |                               ~~~~^~
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
a.cc:25:10: error: 'num' was not declared in this scope; did you mean 'enum'?
   25 |     sort(num+1,num+n+1);
      |          ^~~
      |          enum
a.cc:26:9: error: 'i' was not declared in this scope
   26 |     for(i=1;i<=m;i++) {
      |         ^
a.cc:27:9: error: 'b' was not declared in this scope
   27 |         b=read(),c=read();
      |         ^
a.cc:27:15: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   27 |         b=read(),c=read();
      |           ~~~~^~
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
a.cc:27:18: error: 'c' was not declared in this scope
   27 |         b=read(),c=read();
      |                  ^
a.cc:27:24: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   27 |         b=read(),c=read();
      |                    ~~~~^~
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
a.cc:28:11: error: request for member 'push_back' in 'v', which is of non-class type 'int'
   28 |         v.push_back(make_pair(b,c));
      |           ^~~~~~~~~
a.cc:30:12: error: request for member 'begin' in 'v', which is of non-class type 'int'
   30 |     sort(v.begin(),v.end(),cmp);
      |            ^~~~~
a.cc:30:22: error: request for member 'end' in 'v', which is of non-class type 'int'
   30 |     sort(v.begin(),v.end(),cmp);
      |                      ^~~
a.cc:31:5: error: 'now' was not declared in this scope; did you mean 'pow'?
   31 |     now=1;
      |     ^~~
      |     pow
a.cc:32:9: error: 'i' was not declared in this scope
   32 |     for(i=0;i<v.size();++i) {
      |         ^
a.cc:32:17: error: request for member 'size' in 'v', which is of non-class type 'int'
   32 |     for(i=0;i<v.size();++i) {
      |                 ^~~~
a.cc:33:13: error: 'j' was not declared in this scope
   33 |         for(j=1;j<=v[i].first&&v[i].second>num[now];j++) {
      |             ^
a.cc:38:9: error: 'i' was not declared in this scope
   38 |     for(i=1;i<=n;i++) ans+=num[i];
      |         ^
a.cc:38:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   38 |     for(i=1;i<=n;i++) ans+=num[i];
      |                       ^~~
      |                       abs
a.cc:39:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   39 |     cout<<ans<<'\n';
      |           ^~~
      |           abs