criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=(a-1); (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
#define show(a) cout<<a<<"\n";
typedef long long ll;

using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N,M;
  cin>>N>>M;
  vll A(N);
  vpll D;
  REP(i,N)cin>>A[i];
  ll tmp,tmp2;
  REP(i,M){
    cin>>tmp>>tmp2;
    D.push_back(make_pair(tmp2,tmp));
  }
  sort(ALL(A),greater<ll>());
  sort(ALL(D),greater<pll>);
  vll newD;
  while(newD.size()<=N){
    RREP(i,M){
      RREP(i,D[i].second)newD.push_back(D[i].first);
      if(newD.size()>=N)break;
    }
  }
  vll newA;
  while(newA.size()<=N){
    if(newD[0]>=A[0]){
      newA.push_back(newD[0]);
      newD.erase(newD.begin(),newD.begin()+1);
    }else{
      newA.push_back(A[0]);
      A.erase(A.begin(),A.begin()+1);
    }
  }

  ll ans=0;
  REP(i,N){ans+=newA[i];}
  cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:23: error: 'pll' was not declared in this scope; did you mean 'll'?
   36 |   sort(ALL(D),greater<pll>);
      |                       ^~~
      |                       ll
a.cc:36:26: error: template argument 1 is invalid
   36 |   sort(ALL(D),greater<pll>);
      |                          ^
Language: C++

#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#include<queue>
#define rep(i,n) for(int i=0;i<(n);i++)
 
int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> b(m),c(m);
  rep(j,m) cin >> b[j] >> c[j];
  
  priority_queue<pair<int,int>> q;
  
  rep(i,n) q.push(make_pair(a[i],1));
  rep(j,m) q.push(make_pair(c[j],b[j]));
  
  long long ans;
  
  rep(i,n){
    auto p = q.top();
    q.pop();
    ans += p.first;
    if(p.second > 1){
      p.second--;
      q.push(p);
    }
  }
  
  cout << ans << endl;
}
#include<bits/stdc++.h>
using namespace std;
#include<queue>
#define rep(i,n) for(int i=0;i<(n);i++)

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> b(m),c(m);
  rep(j,m) cin >> b[j] >> c[j];
  
  priority_queue<pair<int,int>> q;
  
  rep(i,n) q.push(make_pair(a[i],1));
  rep(j,m) q.push(make_pair(c[j],b[j]));
  
  long long ans;
  
  rep(i,n){
    auto p = q.top();
    q.pop();
    ans += p.first;
    if(p.second > 1){
      p.second--;
      q.push(p);
    }
  }
  
  cout << ans << endl;
}


Compiler output:
a.cc:119:5: error: redefinition of 'int main()'
  119 | int main(){
      |     ^~~~
a.cc:87:5: note: 'int main()' previously defined here
   87 | int main(){
      |     ^~~~
Language: C++

#include <iostream>
#include <numeric>
#include <vector>

typedef long long ll;

using namespace std;

int main() {
  int N, M;
  while (cin >> N >> M) {
    vector<int> A;
    for (int i = 0; i < N; i++) {
      int a;
      cin >> a;
      A.push_back(a);
    }
    vector<pair<int, int> > bc;
    for (int i = 0; i < M; i++) {
      int b, c;
      cin >> b >> c;
      bc.emplace_back(-c, b);
    }
    for (int i = 0; i < bc.size(); i++) {
      for (int j = 0; j < bc[i].second; j++) {
        A.push_back(-bc[i].first);
        if (A.size() > 2 * N) break;
      }
      if (A.size() > 2 * N) break;
    }
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());
    cout << accumulate(A.begin(), A.begin() + N, 0ll) << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   31 |     sort(A.begin(), A.end());
      |     ^~~~
      |     short
a.cc:32:5: error: 'reverse' was not declared in this scope
   32 |     reverse(A.begin(), A.end());
      |     ^~~~~~~
Language: C++

#include "bits/stdc++.h"
 
using namespace std;
 
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
 
#define int long long
 
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
 
void print(T x)
{
	std::cout << x << '\n';
}
 
 
int main() {
	int N,M;
	cin >> N>>M;
	vector<int>a(N);
	vector<pair<int, int>>v(M);
 
	rep(i, N) {
		cin >> a[i];
	}
	sort(rall(a));
	rep(i, M) {
		cin >> v[i].sec;
		cin >> v[i].fst;
	}
	sort(v.begin(), v.end(), greater<pair<int, int> >());
	long ans = 0;
	int j = 0;
	int k = 0;
	rep (i, N) {
		if (j < M and k < N) {
			if (v[j].fst <= a[k]) {
				ans += a[k];
				k++;
			}elif(v[j].fst > a[k]) {
				ans += v[j].fst;
				if (v[j].sec == 1) j++;
				else v[j].sec--;
			}
		}
		elif(j < M and k == N-1) {
			ans += v[j].fst;
			if (v[j].sec == 0) j++;
			else v[i].second--;
		}elif(j == M - 1 and k < N) {
				ans += a[k];
				k++;
			}
	}
 
	print(ans);
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include "bits/stdc++.h"

using namespace std;


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>

void print(T x)
{
	std::cout << x << '\n';
}


int main() {
	int N,M;
	cin >> N>>M;
	vector<int>a(N);
	vector<pair<int, int>>v(M);

	rep(i, N) {
		cin >> a[i];
	}
	sort(rall(a));
	rep(i, M) {
		cin >> v[i].sec;
		cin >> v[i].fst;
	}
	sort(v.begin(), v.end(), greater<pair<int, int> >());
	long ans = 0;
	int j = 0;
	int k = 0;
	rep (i, N) {
		if (j < M and k < N) {
			if (v[j].fst <= a[k]) {
				ans += a[k];
				k++;
			}elif(v[j].fst > a[k]) {
				ans += v[j].fst;
				if (v[j].sec == 1) j++;
				else v[j].sec--;
			}
		}
		elif(j < M and k == N-1) {
			ans += v[j].fst;
			if (v[j].sec == 0) j++;
			else v[i].second--;
		}elif(j == M - 1 and k < N) {
				ans += a[k];
				k++;
			}
	}

	print(ans);
	
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  using in = int64_t;
 in ans=0;
 in n,m;
  cin>>n>>m;
  priority_queue<in, vector<in>, greater<in>> a;
  for(in i =0;i<n;i++){
    in x;
  cin >>x;
    a.push(x);
  }
  
  
  for(in i =0;i<m;i++){
    in b,c;
    cin >>b>>c;
   for(in j =0;j<b;j++){
   if(a.top() <c){
     a.pop;
     a.push(c);
   }
   else
     break;
   }
  }
  for(in i =0;i<n;i++){
    ans +=a.top();
    a.pop();
  }
  cout <<ans<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:22:8: error: invalid use of non-static member function 'void std::priority_queue<_Tp, _Sequence, _Compare>::pop() [with _Tp = long int; _Sequence = std::vector<long int>; _Compare = std::greater<long int>]'
   22 |      a.pop;
      |      ~~^~~
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:771:7: note: declared here
  771 |       pop()
      |       ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  using in = int64_t;
 in ans=0;
 in n,m;
  vector<in> a(n);
  for(in i =0;i<n;i++)
  cin >>a.at(i);
  sort(a.begin(),a.end());
  
  for(in i =0;i<m;i++){
    i b,c;
    cin >>b>>c;
   for(i j =0;j<b;j++){
   if(a.at(j) <c)
     a.at(j) =c;
   else
     break;
   }
  }
  for(in i =0;i<n;i++)
    ans +=a.at(i);
  cout <<ans<<endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:14:6: error: expected ';' before 'b'
   14 |     i b,c;
      |      ^~
      |      ;
a.cc:15:11: error: 'b' was not declared in this scope
   15 |     cin >>b>>c;
      |           ^
a.cc:15:14: error: 'c' was not declared in this scope
   15 |     cin >>b>>c;
      |              ^
a.cc:16:9: error: expected ';' before 'j'
   16 |    for(i j =0;j<b;j++){
      |         ^~
      |         ;
a.cc:16:15: error: 'j' was not declared in this scope
   16 |    for(i j =0;j<b;j++){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
 int_64t ans;
 int n,m;
  vector<int> a(n);
  for(int i =0;i<n;i++)
  cin >>a.at(i);
  sort(a.begin(),a.end());
  
  for(int i =0;i<m;i++){
    int b,c;
    cin >>b>>c;
   for(int j =0;j<b;j++){
   if(a.at(j) <c)
     a.at(j) =c
   }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:5:2: error: 'int_64t' was not declared in this scope; did you mean 'int64_t'?
    5 |  int_64t ans;
      |  ^~~~~~~
      |  int64_t
a.cc:17:16: error: expected ';' before '}' token
   17 |      a.at(j) =c
      |                ^
      |                ;
   18 |    }
      |    ~            
a.cc:19:4: error: expected '}' at end of input
   19 |   }
      |    ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

N, M = map(int,input().split())

A = list(map(int,input().split()))
B = []
C = []

for _ in range(M):
    left = list(map(int,input().split()))
    B.append(left)
A.sort()

C = sorted(B,reverse=True, key=lambda x:x[1])

for i in range(M):
    loop_max = C[i][0]
    cnt = 0
    while cnt < loop_max:
        num = C[i][1]
        if A[0] < num:
            A[0] = num
            A.sort()
        else:
            pass
        cnt += 1

print(sum(A))

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N, M = map(int,input().split())
      | ^
Language: Java

import java.util.*;

public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(a);

        List<Pair> pairs = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            pairs.add(new Pair(Integer.parseInt(sc.next()), Integer.parseInt(sc.next())));
        }
        Collections.sort(pairs);

        int[] d = new int[n];
        int index = 0;
        long sum = 0;
        for (Pair p : pairs) {
            int b = p.b;
            int c = p.c;
            for (int j = 0; j < b; j++) {
                d[index] = c;
                sum += c;
                index++;
                if (index >= n) {
                    break;
                }
            }
            if (index >= n) {
                break;
            }
        }

        for (int i = 0; i < n; i++) {
            long tmp = sum - d[n - 1 - i] + a[n - 1 - i];
            if (sum > tmp) {
                break;
            }
            sum = tmp;
        }

        System.out.println(sum);

    }

    public static class Pair implements Comparable<Pair> {
        int b;
        int c;

        public Pair(int b, int c) {
            this.b = b;
            this.c = c;
        }

        @Override
        public int compareTo(Pair o) {
            return o.c - this.c;
        }
    }
}


Compiler output:
Main.java:3: error: class D is public, should be declared in a file named D.java
public class D {
       ^
1 error
Language: C++

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include 
#include<string.h>
#include
#include
#define ll long long
#define hengheng main ()

const int INF=0x3f3f3f3f;
const int MAX=1e6+5;
using namespace std;
struct node{
int to,len;
int next;
}edge[MAX];
int head[MAX],cnt=0;
void initedge(int n)
{
memset(head+1,-1,sizeof(head));
cnt=0;
}
void addedge(int u,int v,int w)
{
edge[cnt].to=v;
edge[cnt].len=w;
edge[cnt].next=head[u];
head[u]=cnt++;
}
struct paidui{
int id;
int len;
};
int n,m;
int dis[1000010],vis[1000010];
bool operator<(paidui a,paidui b)
{
return a.len<b.len;
}

void dijikstra(int S)
{
for(int i=1;i<=n;i++)
dis[i]=INF;
cnt=0;
dis[S]=0;

priority_queue<paidui> q;
q.push({S,0});
while(!q.empty() )
{
	 paidui k=q.top(); q.pop();
   if(k.len!=dis[k.id]) continue;
 
    for(int i=head[k.id];i!=-1;i=edge[i].next)
    {
        int t=edge[i].to;
        if(dis[t]>dis[k.id]+edge[i].len)
        {
            dis[t]=dis[k.id]+edge[i].len;
            q.push(paidui{t,dis[t]});
        }
    }
}

}

int lu1[1000100],lu2[1000100],len[1000100];
int hengheng
{
int t;
scanf("%d",&t);
while(t–)
{

	scanf("%d%d",&n,&m);
	initedge(n);
	for(int i=0;i<m;i++)
	{
		scanf("%d%d%d",&lu1[i],&lu2[i],&len[i]);
		addedge(lu1[i],lu2[i],len[i]);
	}
	dijikstra(1);
	long long sum=0;
	for(int i=1;i<=n;i++)  sum+=dis[i];// 第一个图 
	initedge(n); //初始化 
	for(int i=0;i<m;i++) addedge(lu2[i],lu1[i],len[i]);//第二个图 
	dijikstra(1);
	
	for(int i=1;i<=n;i++)  sum+=dis[i];
	printf("%lld\n",sum);
}

}


Compiler output:
a.cc:4:10: error: #include expects "FILENAME" or <FILENAME>
    4 | #include
      |          ^
a.cc:6:9: error: #include expects "FILENAME" or <FILENAME>
    6 | #include
      |         ^
a.cc:7:9: error: #include expects "FILENAME" or <FILENAME>
    7 | #include
      |         ^
a.cc:74:7: error: extended character – is not valid in an identifier
   74 | while(t–)
      |       ^
a.cc: In function 'void dijikstra(int)':
a.cc:49:1: error: 'priority_queue' was not declared in this scope
   49 | priority_queue<paidui> q;
      | ^~~~~~~~~~~~~~
a.cc:6:1: note: 'std::priority_queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
    5 | #include<string.h>
  +++ |+#include <queue>
    6 | #include
a.cc:49:22: error: expected primary-expression before '>' token
   49 | priority_queue<paidui> q;
      |                      ^
a.cc:49:24: error: 'q' was not declared in this scope
   49 | priority_queue<paidui> q;
      |                        ^
a.cc: In function 'int main()':
a.cc:74:7: error: 't\U00002013' was not declared in this scope
   74 | while(t–)
      |       ^~
Language: C++

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

long long N,M,B,C,i,j,n,ans;

main(){
    cin>>N>>M;
    vector<long long>A(N);
    vector<pair<long long,int>>c(M);

    for(auto&a:A) cin>>a;
    sort(A.begin(),A.end());

    for(;i<M;++i){
        cin >> B >> C;
        c[i]=make_pair(C,B);
    }
    sort(c.begin(),c.end());

    // ソートしてAの最小値をCの最大値から書き換えていく．
    // 書き換え出来なくなったら総和取って返す．
    for(i=0,j=M-1,n=c[M-1].second; i<N&&A[i]<c[j].first; ++i){
        A[i]=c[j].first;
        // nは回数。nが0になったらjが1減り、nが補充される．
        if(--n==0&&--j>=0) n=c[j].second;
    }

    ans = accumulate(A.begin(),A.end(),0LL);
    cout << ans;
    return 0
}


Compiler output:
a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:30:13: error: expected ';' before '}' token
   30 |     return 0
      |             ^
      |             ;
   31 | }
      | ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
int N,M;
map<int,int> mp;
int A[101010];
void solve() 
{
	int i,j,k,l,r,x,y; 
	string s;
	cin>>N>>M;
	for(i=0; i<N; ++i) 
	   cin>>A[i];
	sort(A,A+N);
	for(i=0; i<M; ++i) 
	{
		cin>>x>>y;
		mp[y] += x;
	}
	ll ans=0;
	for(i=0; i<N; ++i) 
	{    //Ô­ÊýÁÐÅÅµÝÔöÐò£» map£ºµÝ¼õÐò£» Ì°ÐÄ 
		if(mp.size() && mp.rbegin()->first>A[i]) 
		{
			A[i]=mp.rbegin()->first;
			mp.rbegin()->second--;   
			if(mp.rbegin()->second==0) 
			{
				mp.erase(mp.rbegin()->first);
			}
		}
		ans += A[i];
	}
	cout<<ans<<endl;
	return 0;
}
int main(){
	string s;
	int i;
	ios::sync_with_stdio(false);
	cin.tie(0);	
	solve(); 
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:35:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   35 |         return 0;
      |                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
int N,M;
map<int,int> mp;
int A[101010];
void solve() {
	int i,j,k,l,r,x,y; 
	string s;
	cin>>N>>M;
	for(i=0; i<N; ++i) 
	   cin>>A[i];
	sort(A,A+N);
	for(i=0; i<M; ++i) {
		cin>>x>>y;
		mp[y] += x;
	}
	ll ans=0;
	for(i=0; i<N; ++i) {   
		if(mp.size() && mp.rbegin()->first>A[i]) {
			A[i]=mp.rbegin()->first;
			mp.rbegin()->second--;   
			if(mp.rbegin()->second==0) {
				mp.erase(mp.rbegin()->first);
			}
		}
		ans += A[i];
	}
	cout<<ans<<endl;
	return 0;
}
int main(){
	string s;
	int i;
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve(); 
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:30:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   30 |         return 0;
      |                ^
Language: C++

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

typedef signed long long ll;

int N,M;
map<int,int> mp;
int A[101010];

void solve() {
	int i,j,k,l,r,x,y; 
	string s;
	
	cin>>N>>M;
	
	for(i=0; i<N; ++i) 
	   cin>>A[i];
	
	sort(A,A+N);
	
	for(i=0; i<M; ++i) {
		cin>>x>>y;
		mp[y] += x;
	}
	
	ll ans=0;
	
	for(i=0; i<N; ++i) {    //原数列排递增序； map：递减序； 贪心 
		if(mp.size() && mp.rbegin()->first>A[i]) {
			A[i]=mp.rbegin()->first;
			mp.rbegin()->second--;   
			if(mp.rbegin()->second==0) {
				mp.erase(mp.rbegin()->first);
			}
		}
		
		ans += A[i];
	}
	
	cout<<ans<<endl;
	return 0;
}

int main(){
	string s;
	int i;
	
	ios::sync_with_stdio(false);
	cin.tie(0);
		
	solve(); 
	
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:41:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   41 |         return 0;
      |                ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
    long long n,m;
    cin >> n >> m;
    vector<long long> a(n);
    for(long long i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<pair<long long, long long>> b(m);
    for(long long i = 0; i < m; i++){
        long long x,y;
        cin >> x >> y;
        b[i].second = x;
        b[i].first = -y;
    }

    sort(a.begin(),a.end(),greater<long long>());
    sort(b.begin(),b.end());

    vector<long long> sum;
    long long j = 0;
    long long i = 0;
    while(sum.size() < n){
        if(a[i] > -b[j].first){
            sum.push_back(a[i]);
            i++;
            continue;
        }
        if(b[j].second > 0){
            sum.push_back(-b[j].first);
            b[j].second--;
            continue;
        }
        j++;
    }

    long long ans = 0;
    for(long long i = 0; i < sum.size(); i++){
        ans += sum[i];
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   21 |     sort(a.begin(),a.end(),greater<long long>());
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<functional>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  ll n,m,ans=0,tmp;
  cin>>n>>m;
  map<ll,ll> mp;
  vector<ll> v;
  ll a[n],b[m],c[m];
  rep(i,n){
    cin>>a[i];
    mp[a[i]]++;
  }
  rep(i,m){
    cin>>b[i]>>c[i];
    mp[c[i]]+=b[i];
  }
  for(auto p:mp){
    v.push_back(p.first());
  }
  sort(v.begin(),v.end(),greater<ll>());
  ll kosuu=0;
  rep(i,n+m){
    tmp=mp[v[i]];
    if(kosuu+tmp>n){
      ans+=v[i]*(n-kosuu);
      break;
    }else{
      ans+=v[i]*tmp;
      kosuu+=tmp;
    }
  }
  cout<<ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:24: error: expression cannot be used as a function
   30 |     v.push_back(p.first());
      |                 ~~~~~~~^~
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main(){
	int N,M;
	cin>>N>>M;
	vector<long long>A(N);
	vector<long long>B(M);
	vector<long long>C(M);
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<M;i++){
		cin>>B[i]>>C[i];
		for(int b=0;b<B[i];b++)A.push_back(C[i]);
	}
	sort(A.begin(),A.end(),greater<long long>());
	long long ans=0;
	for(int i=0;i<N;i++)ans+=A[i];
	
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |         sort(A.begin(),A.end(),greater<long long>());
      |         ^~~~
      |         short
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;

long table[n];

int n;

void make(long a,long b,int c){
	for(int i = c;i < c+b;i++){
		if(i >= n)break;
		table[i] = a;
	}
}


int main(){
	int m;
	cin >> n >> m;
	vector<long> A;
	for(int i = 0;i < n;i++){
		cin >> A[i];
	}
	long B[m];long C[m];
	for(int i = 0;i< m;i++){
		cin >> B[i] >> C[i];
	}
	vector<pair<long,long>> CB;
	for(int i = 0;i < m;i++){
		CB[i] = make_pair(C[i],B[i]);
	}
	sort(CB.begin(),CB.end());
	int count = 0;
	for(int i = m-1;i >= 0;i--){
		make(CB[i].first,CB[i].second,count);
		count += CB[i].second;
	}
	for(int i = 0;i< n;i++){
		A[A.size() + 1 + i] = table[i];
	}
	sort(A.begin(),A.end());
	long ans = 0;
	for(int i = A.size()-1;i >= A.size()-n;i--){
		ans += A[i];
	}
	cout << ans;
}


Compiler output:
a.cc:7:12: error: 'n' was not declared in this scope
    7 | long table[n];
      |            ^
a.cc: In function 'void make(long int, long int, int)':
a.cc:14:17: error: 'table' was not declared in this scope; did you mean 'mutable'?
   14 |                 table[i] = a;
      |                 ^~~~~
      |                 mutable
a.cc: In function 'int main()':
a.cc:41:39: error: 'table' was not declared in this scope; did you mean 'mutable'?
   41 |                 A[A.size() + 1 + i] = table[i];
      |                                       ^~~~~
      |                                       mutable
Language: Java

import java.io.*;
import java.util.*;

public class ABC127d{
    
    public static void main(String[] arg){

        Scanner scan =new Scanner(System.in);

        int n=Integer.parseInt(scan.next());
        int m=Integer.parseInt(scan.next());

        ArrayList<Integer> A=new ArrayList<Integer>();

        for(int i=0;i<n;i++){
            A.add(Integer.parseInt(scan.next()));
        }



        for(int i=0;i<m;i++){
            int b=Integer.parseInt(scan.next());
            int c=Integer.parseInt(scan.next());

            for(int j=0;j<b;j++){
                int minAind=A.indexOf(Collections.min(A));
                if(A.get(minAind) <= c){
                    A.set(minAind,c);
                }
                else break;
            }

        }

        long sum = 0;
        for(int d : A){
        sum += d;
        }

        System.out.print(sum);
        
        
     
    }
}

Compiler output:
Main.java:4: error: class ABC127d is public, should be declared in a file named ABC127d.java
public class ABC127d{
       ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m;
  cin >> n >> m;
  vector<int> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  vector<int> b(m),c(m);
  for(int j = 0; j < m; j++) {
    cin >> b.at(j) >> c.at(j);
  }
  int l=accumulate(b.begin(), b.end(), 0);
  vector<pair<int, int> > pairs(m);
  for (int j = 0; j < m; j++) {
    pairs[j] = make_pair(c.at(j), b.at(j));
  }
  // firstが小さい順、secondが小さい順にソート
  sort(pairs.begin(), pairs.end());
  reverse(pairs.begin(), pairs.end());
//  for(int j = 0; j < m; j++) {
//    cout << pairs[j].first << endl;
//  }
  int i=0;
  int flag = 0;
  for(int j = 0; j < m; j++) {
    for(int k = 0; k < pairs[j].second; k++){
//      if(i==n){
//       flag=1;
//        break;
      }
      if((a.at(i) > pairs[j].first) || (i==n)){
        flag=1;
        ++i;
        break;
      }else{
        a.at(i) = pairs[j].first;
        ++i;
      }
    }
    if(flag==1){
      break;
    }
  }
  long long s=accumulate(a.begin(), a.end(), 0LL);
  cout << s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:7: error: break statement not within loop or switch
   45 |       break;
      |       ^~~~~
a.cc: At global scope:
a.cc:48:26: error: 'a' was not declared in this scope
   48 |   long long s=accumulate(a.begin(), a.end(), 0LL);
      |                          ^
a.cc:48:37: error: 'a' was not declared in this scope
   48 |   long long s=accumulate(a.begin(), a.end(), 0LL);
      |                                     ^
a.cc:49:3: error: 'cout' does not name a type
   49 |   cout << s << endl;
      |   ^~~~
a.cc:50:1: error: expected declaration before '}' token
   50 | }
      | ^
Language: C++

#include <iostream>
#include <map>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  map<long long, long long, greater<long long>> numbers;
  for(int i=0; i<N; i++){
    long long num;
    cin >> num;
    numbers[num]++;
  }
  for(int i=0; i<M; i++){
    long long selectableCard, point;
    cin >> selectableCard >> point;
    numbers[point] += selectableCard;
  }
  long long sum = 0;
  int cnt = 0;
  for(auto v : numbers){
    if(cnt == N) break;
    longlong remainCnt = N - cnt;
    sum += v.first * min(v.second, remainCnt);
    cnt += min(v.second, remainCnt);
  }
  cout << sum;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'longlong' was not declared in this scope
   23 |     longlong remainCnt = N - cnt;
      |     ^~~~~~~~
a.cc:24:36: error: 'remainCnt' was not declared in this scope
   24 |     sum += v.first * min(v.second, remainCnt);
      |                                    ^~~~~~~~~
Language: C++

#include <iostream>
#include <map>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  map<int, int, greater<int>> numbers;
  for(int i=0; i<N; i++){
    int num;
    cin >> num;
    numbers[num]++;
  }
  for(int i=0; i<M; i++){
    int selectableCard, point;
    cin >> selectableCard >> point;
    numbers[point] += selectableCard;
  }
  long long sum = 0;
  int cnt = 0;
  for(auto v : numbers){
    if(cnt == N) break;
    int remainCnt = N - cnt;
    sum += v.first * min(v.second, remainCnt);
    cnt += min(vec.second, remainCnt);
  }
  cout << sum;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: 'vec' was not declared in this scope
   25 |     cnt += min(vec.second, remainCnt);
      |                ^~~
Language: C++

#include <iostream>
#include <map>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  map<int, int, greater<int>> numbers;
  for(int i=0; i<N; i++){
    int num;
    cin >> num;
    numbers[num]++;
  }
  for(int i=0; i<M; i++){
    int selectableCard, point;
    cin >> selectableCard >> point;
    numbers[point] += selectableCard;
  }
  long long sum = 0;
  int cnt = 0;
  for(auto v : numbers){
    if(cnt == N) break;
    int remainCnt = N - cnt;
    sum += vec.first * min(vec.second, remainCnt);
    cnt += min(vec.second, remainCnt);
  }
  cout << sum;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:12: error: 'vec' was not declared in this scope
   24 |     sum += vec.first * min(vec.second, remainCnt);
      |            ^~~
Language: C++

#include <iostream>
#include <map>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  map<int, int, greater<int>> numbers;
  for(int i=0; i<N; i++){
    int num;
    cin >> num;
    num[A]++;
  }
  for(int i=0; i<M; i++){
    int selectableCard, point;
    cin >> selectableCard >> point;
    num[point] += selectableCard;
  }
  long long sum = 0;
  int cnt = 0;
  for(auto v : numbers){
    if(cnt == N) break;
    int remainCnt = N - cnt;
    sum += vec.first * min(vec.second, remainCnt);
    cnt += min(vec.second, remainCnt);
  }
  cout << sum;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'A' was not declared in this scope
   12 |     num[A]++;
      |         ^
a.cc:17:5: error: 'num' was not declared in this scope; did you mean 'enum'?
   17 |     num[point] += selectableCard;
      |     ^~~
      |     enum
a.cc:24:12: error: 'vec' was not declared in this scope
   24 |     sum += vec.first * min(vec.second, remainCnt);
      |            ^~~
Language: C++

#include <iostream>
using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  map<int, int, greater<int>> numbers;
  for(int i=0; i<N; i++){
    int num;
    cin >> num;
    num[A]++;
  }
  for(int i=0; i<M; i++){
    int selectableCard, point;
    cin >> selectableCard >> point;
    num[point] += selectableCard;
  }
  long long sum = 0;
  int cnt = 0;
  for(auto v : numbers){
    if(cnt == N) break;
    int remainCnt = N - cnt;
    sum += vec.first * min(vec.second, remainCnt);
    cnt += min(vec.second, remainCnt);
  }
  cout << sum;
  return 0;
}
    
    
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'map' was not declared in this scope
    7 |   map<int, int, greater<int>> numbers;
      |   ^~~
a.cc:2:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    1 | #include <iostream>
  +++ |+#include <map>
    2 | using namespace std;
a.cc:7:7: error: expected primary-expression before 'int'
    7 |   map<int, int, greater<int>> numbers;
      |       ^~~
a.cc:11:9: error: 'A' was not declared in this scope
   11 |     num[A]++;
      |         ^
a.cc:16:5: error: 'num' was not declared in this scope; did you mean 'enum'?
   16 |     num[point] += selectableCard;
      |     ^~~
      |     enum
a.cc:20:16: error: 'numbers' was not declared in this scope
   20 |   for(auto v : numbers){
      |                ^~~~~~~
a.cc:23:12: error: 'vec' was not declared in this scope
   23 |     sum += vec.first * min(vec.second, remainCnt);
      |            ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
  int cardNum, turnNum;
  cin >> cardNum >> turnNum;
  vector<int> cards(cardNum);
  for(int i=0; i<cardNum; i++){
    int num;
    cin >> num;
    cards[i] = num;
  }
  sort(cards.begin(), cards.end());
  for(int i=0; i<turnNum; i++){
    int selectableCard, point;
    cin >> selectableCard >> point;
    if(cards[0] >= point) continue;
    int j;
    if(cards[selectableCard-1] < point){
      vector<int> between;
      for(j=selectableCard; j<cardNum; j++){
        if(cards[j] >= point){
          for(int k=selectableCard; k<j; k++){
            cards[k - selectableCard] = cards[k]
          }
          for(int k=j-selectableCard; k<j; k++){
            cards[k] = point;
          }
          break;
        }
      }
      if(j == cardNum){
        for(int k=selectableCard; k<j; k++){
          cards[k - selectableCard] = cards[k]
        }
        for(int k=j-selectableCard; k<j; k++){
          cards[k] = point;
        }
      }
    }
    for(j=0; j<selectableCard; j++){
      if(cards[j] < point){
        cards[j] = point;
      }else{
        break;
      }
    }
  }
  int64_t sum = 0;
  for(int i=0; i<cardNum; i++){
    sum += cards[i];
  }
  cout << sum;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:49: error: expected ';' before '}' token
   26 |             cards[k - selectableCard] = cards[k]
      |                                                 ^
      |                                                 ;
   27 |           }
      |           ~                                      
a.cc:36:47: error: expected ';' before '}' token
   36 |           cards[k - selectableCard] = cards[k]
      |                                               ^
      |                                               ;
   37 |         }
      |         ~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
  int cardNum, turnNum;
  cin >> cardNum >> turnNum;
  vector<int> cards(cardNum);
  for(int i=0; i<cardNum; i++){
    int num;
    cin >> num;
    cards[i] = num;
  }
  sort(cards.begin(), cards.end());
  for(int i=0; i<turnNum; i++){
    int selectableCard, point;
    cin >> selectableCard >> point;
    int selectCount = 0;
    if(cards[0] >= point) continue;
    bool isbroken = false;
    int j;
    for(j=0; j<selectableCard; j++){
      if(cards[j] < point){
        cards[j] = point;
      }else{
        isbroken = true;
        break;
      }
    }
    if(!isbroken){
      vector<int> between;
      for(j=selectableCard; j<cardNum; j++){
        if(cards[j] >= point){
          for(int k=selectableCard; k<j; k++){
            between.push_back(cards[k]);
          }
          break;
        }
      }
      if(j == cardNum){
        for(int k=selectableCard; k<j; k++){
          between.push_back(cards[k]);
        }
      }
      for(int k=0; k<between.size(); k++){
        cards[k] = between[k];
      }
      for(int k=between.size(); k<j; k++){
        card[k] = point;
      }
    }  
  }
  int64_t sum = 0;
  for(int i=0; i<cardNum; i++){
    sum += cards[i];
  }
  cout << sum;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:9: error: 'card' was not declared in this scope; did you mean 'cards'?
   50 |         card[k] = point;
      |         ^~~~
      |         cards
Language: C++

#include <algorithm>
using namespace std;
 
int main() {
  int cardNum, turnNum;
  cin >> cardNum >> turnNum;
  vector<int> cards(cardNum);
  for(int i=0; i<cardNum; i++){
    int num;
    cin >> num;
    cards[i] = num;
  }
  sort(cards.begin(), cards.end());
  for(int i=0; i<turnNum; i++){
    int selectableCard, point;
    cin >> selectableCard >> point;
    int selectCount = 0;
    if(cards[0] >= point) continue;
    bool isbroken = false;
    for(int j=0; j<selectableCard; j++){
      if(cards[j] < point){
        cards[j] = point;
      }else{
        sort(cards.begin(), cards.begin() + j);
        isbroken = true;
        break;
      }
    }
    if(!isbroken) sort(cards.begin(), cards.end());
  }
  int64_t sum = 0;
  for(int i=0; i<cardNum; i++){
    sum += cards[i];
  }
  cout << sum;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> cardNum >> turnNum;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <algorithm>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> cards(cardNum);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <algorithm>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> cards(cardNum);
      |          ^~~
a.cc:11:5: error: 'cards' was not declared in this scope; did you mean 'cardNum'?
   11 |     cards[i] = num;
      |     ^~~~~
      |     cardNum
a.cc:13:8: error: 'cards' was not declared in this scope; did you mean 'cardNum'?
   13 |   sort(cards.begin(), cards.end());
      |        ^~~~~
      |        cardNum
a.cc:35:3: error: 'cout' was not declared in this scope
   35 |   cout << sum;
      |   ^~~~
a.cc:35:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <stdio.h>
#include <stdlib.h>

/* functions */
int compar(const int *val1, const int *val2);

#define MAX_NUM 100000
int main()
{
	int N, M;
	static int A[MAX_NUM];
	static int Kakikae[MAX_NUM];
	int tmpchara, tmpnum;
	int beforechara = 0;
	int beforenum = 0;
	int i, j;
	int cnt = 0;
	long long sum = 0;

	scanf_s("%d %d", &N, &M);
	for (i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}
	for (i = 0; i < M; i++) {
		scanf("%d %d", &tmpchara, &tmpnum);
		if (tmpchara > beforechara) {
			if (beforenum < tmpnum) {
				cnt = cnt - beforenum;
				for (j = 0; j < tmpnum; j++) {
					Kakikae[cnt++] = tmpchara;
				}
			}
			else {
				cnt = cnt - tmpnum;
				for (j = 0; j < tmpnum; j++) {
					Kakikae[cnt++] = tmpchara;
				}
			}
		}
		else {
			for (j = 0; j < tmpnum; j++) {
				Kakikae[cnt++] = tmpchara;
			}
		}
		beforechara = tmpchara;
		beforenum = tmpnum;
	}
	qsort(A, N, sizeof(int), (int(*)(const void *, const void *))compar);
	qsort(Kakikae, cnt, sizeof(int), (int(*)(const void *, const void *))compar);
	
	for (i = 0; i < cnt; i++) {
		if (A[i] < Kakikae[i]) {
			A[i] = Kakikae[i];
		}
		sum += A[i];
	}
	printf("%lld\n", sum);

	return 0;
}

/**
* 比較関数
*/
int compar(const int *val1, const int *val2) {
	if (*val1 < *val2) {
		return -1;
	}
	else if (*val1 == *val2) {
		return 0;
	}
	else {
		return 1;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   20 |         scanf_s("%d %d", &N, &M);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin >> N >> M;
  vector<int> A(N);
  for(int i = 0;i < N;i++){
    cin >> A.at(i);
  }//Aのデータ受け取り
  for(int m = 0;m < M;m++){
    int b ,c;
    cin >> b >> c;
    int counter = 0;
   for(int k = 0;k < N;k++){
      if(c > A.at(k)){
        counter++;//書き換える数
      }
    }
      if(b > counter){
      sort(A.begin(),A.end());
        for(int g = 0;g < counter;g++){
          swap(c,B.at(g));
          }//全て書き換え可能
      }
    if(b <= counter){
     sort(A.begin(),A.end());
        for(int g = 0;g < b;g++){
          swap(c,B.at(b));
        }
    }
  }
  int H = 0;
  for(int h = 0;h < N;h++){
    H += A.at(h);
  }
    cout << H << endl;
}
    
      
      
    

Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: 'B' was not declared in this scope
   22 |           swap(c,B.at(g));
      |                  ^
a.cc:28:18: error: 'B' was not declared in this scope
   28 |           swap(c,B.at(b));
      |                  ^
Language: Java

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class integer_cards{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int num1 = scan.nextInt();
        int num2 = scan.nextInt();
        int num3,k,temp,sum=0;
        ArrayList<Integer> Array = new ArrayList<Integer>();
        for(int i = 0; i<num1;i++){
            num3 = scan.nextInt();
            Array.add(num3);   
        }

        Collections.sort(Array);

        for(int i = 0; i<num2; i++){
            num3 = scan.nextInt();
            num1 = scan.nextInt();
            for(int j = 0; j<num3; j++){
                if(Array.get(0) >= num1)    continue;
                else{
                    Array.set(0,num1);
                    k = 0;
                    while(Array.get(k) > Array.get(k+1)){
                        temp = Array.get(k);
                        Array.set(k,Array.get(k+1));
                        Array.set(k+1,temp);
                        k++;
                    }
                }
            }
        }
        for(int temp1: Array){
            sum += temp1;
        }
        System.out.println(sum);
    }
}

Compiler output:
Main.java:5: error: class integer_cards is public, should be declared in a file named integer_cards.java
public class integer_cards{
       ^
1 error
Language: C++

#include<iostream>
#include<queue>
#include<algorihm>
#include<vector>
#include<utility>
using namespace std;

int N,M;
priority_queue<int, vector<int>, greater<int> > A;
vector< pair<int,int> > O;

int main() {
    cin>>N>>M;
    for(int i=0;i<N;i++) {
        int a;
        cin>>a;
        A.push(a);
    }

    for(int i=0;i<M;i++) {
        int b,c;
        cin>>b>>c;
        O.push_back(make_pair(c,b));
    }

    sort(O.begin(), O.end());

    long long res = 0;
    for(int i=M-1;i>=0&&!A.empty();i--) {
        int b = O[i].second;
        int c = O[i].first;
        while(!A.empty() && A.top() < c  && b>0) {
            res+=c;
            A.pop();
            b--;
        }
    }

    while(!A.empty()) {
        res+=A.top();
        A.pop();
    }
    cout<<res;
}

Compiler output:
a.cc:3:9: fatal error: algorihm: No such file or directory
    3 | #include<algorihm>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<queue>
using namespace std;

int N,M;
priority_queue<int, vector<int>, greater<int> > A;
vector< pair<int,int> > O;

int main() {
    cin>>N>>M;
    for(int i=0;i<N;i++) {
        int a;
        cin>>a;
        A.push(a);
    }

    for(int i=0;i<M;i++) {
        int b,c;
        cin>>b>>c;
        O.push_back(make_pair(c,b));
    }

    sort(O.begin(), O.end());

    long long res = 0;
    for(int i=M-1;i>=0&&!A.empty();i--) {
        int b = O[i].second;
        int c = O[i].first;
        while(!A.empty() && A.top() < c  && b>0) {
            res+=c;
            A.pop();
            b--;
        }
    }

    while(!A.empty()) {
        res+=A.top();
        A.pop();
    }
    cout<<res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   23 |     sort(O.begin(), O.end());
      |     ^~~~
      |     short
Language: C++

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(n);
  vector<int> b(m);
  vector<int> c(m);

  priority_queue<pair<int, int> > v;

  for(int i=0;i<=n-1;i++){
    cin >> a[i];
    v.push(make_pair(a[i],1));
  }

  for(int i=0;i<=m-1;i++){
    cin >> b[i] >> c[i];
    v.push(make_pair(c[i],b[i]));
  }

  unsigned long long ans = 0;

  for(int i=0;i<n;i++){
    auto p = v.top();
    v.pop();
    ans+= p.first;

    if(p.second>1){
      p.second--;
      v.push(p);
    }
  }
  cout << ans << endl;
}
    









}


Compiler output:
a.cc:47:1: error: expected declaration before '}' token
   47 | }
      | ^
Language: Java

//package at_coder;

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc =  new Scanner(System.in);
		int num = sc.nextInt();
		int time = sc.nextInt();
		Calc calc = new Calc(num+1);
		for(int i=0;i<num;i++) {
			calc.add(sc.nextInt());
		}

		for(int i=0;i<time;i++) {
			int t = sc.nextInt();
			int x = sc.nextInt();
			for(int j=0;j<t;j++)
				if(calc.min() < x) {
					calc.arr[1] = x;
					calc.downHeap();
				}else {
					break;
				}
		}

		int sum = 0;
		for(int i=1;i<=num;i++) {
			sum += calc.arr[i];
		}
		System.out.println(sum);
	}
}

public class Calc {

	int arr[];
	int length;

	Calc(int length){
		arr = new int[length];
		this.length = 0;
	}

	/*
	 * ヒープソート(最小または最大要素のみを参照できる配列)
	 * index 0 = 要素数
	 * index 1 = 参照要素
	 * 要素数より大きいindexにも値が入っている可能性がある
	 */

	//最小ヒープソートへの追加
	void add(int x) {
		int point = length + 1;
		for(point = length+1;point>1;point /= 2) {
			if(arr[point/2] > x)
				arr[point] = arr[point/2];
			else {
				arr[point] = x;
				break;
			}
		}
		if(point == 1)
			arr[1] = x;
		arr[0]++;
	}

	//最小ヒープソートから最小値を取り出す(参照配列に変化なし)
	int min() {
		return arr[1];
	}

	//最小ヒープソートから最小値を除く(参照配列は最小値を除く配列になる)
	void removeMin() {
		int x = arr[arr[0]];
		arr[0]--;
		int point = 1;
		while(point<=(arr[0])/2) {
			int child = arr[point*2] < arr[point*2+1] ? point*2 : point*2+1;
			if(arr[child] < x)
				arr[point] = arr[child];
			else {
				arr[point] = x;
				break;
			}
			point = child;
		}
		if(point*2 > arr[0])
			arr[point] = x;
	}


	/*
	 * root部分の要素を適切な位置におろす作業
	 */
	void downHeap() {
		int x = arr[1];
		int point = 1;
		while(point<=(arr[0])/2) {
			int child = arr[point*2] < arr[point*2+1] ? point*2 : point*2+1;
			if(arr[child] < x)
				arr[point] = arr[child];
			else {
				arr[point] = x;
				break;
			}
			point = child;
		}
		if(point*2 > arr[0])
			arr[point] = x;
	}
}

Compiler output:
Main.java:35: error: class Calc is public, should be declared in a file named Calc.java
public class Calc {
       ^
1 error
Language: C

#include<stdio.h>
#include<stdlib.h>

void sort_a(long int *array, int n);
void sort_bc(long int *array_b,long int *array_c, int n);

int main(){
    int n, m;
    long int *a, *b, *c;
    int i,j;
    long int ans = 0;    
    //a = (long int*)malloc(sizeof(long int)*n);
    //b = (long int*)malloc(sizeof(long int)*m);
    //c = (long int*)malloc(sizeof(long int)*m);
    a[100000] = {};
    b[100000] = {};
    c[100000] = {};
    
    scanf("%d %d", &n, &m);
    for(i=0;i<n;i++){
        scanf("%ld", &a[i]);
    }
    for(i=0;i<m;i++){
        scanf("%ld %ld", &b[i], &c[i]);
    }
    sort_a(a,n);
    sort_bc(b,c,m);
    
    /*
    for(i=0;i<n;i++){
        printf("%d:", a[i]);
    }
    printf("\n");

    for(i=0;i<m;i++){
        printf("%d:", b[i]);
    }
    printf("\n");

    for(i=0;i<m;i++){
        printf("%d:", c[i]);
    }
    printf("\n");
    */

    for(i=0; i<m; i++){
        for(j=0; j<b[i]; j++){
            if(a[j]<c[i]){
                a[j] = c[i];
            }
        }
        sort_a(a,n);
    }


    
    for(i=0;i<n;i++){
        //printf("%d:",a[i]);
        ans += a[i];
    }
    printf("%ld\n", ans);
    
    free(a);
    free(b);
    free(c);

    return 0;
}







void sort_a(long int *array,int n){
    int i,j;
    long int tmp;
    for(i=0; i<n; i++){
        for(j=0; j<n-1; j++){
            if(array[j]>array[j+1]){
                tmp = array[j+1];
                array[j+1] = array[j];
                array[j] = tmp;
            }
        }
    }
}

void sort_bc(long int *array_b, long int *array_c, int n){
    int i, j;
    long int tmp1, tmp2;
    for(i=0; i<n; i++){
        for(j=0; j<n-1; j++){
            if(array_c[j]>array_c[j+1]){
                tmp1 = array_c[j+1];
                array_c[j+1] = array_c[j];
                array_c[j] = tmp1;
                tmp2 = array_b[j+1];
                array_b[j+1] = array_b[j];
                array_b[j] = tmp2;
            }
        }
    }
}
    









Compiler output:
main.c: In function 'main':
main.c:15:17: error: expected expression before '{' token
   15 |     a[100000] = {};
      |                 ^
main.c:16:17: error: expected expression before '{' token
   16 |     b[100000] = {};
      |                 ^
main.c:17:17: error: expected expression before '{' token
   17 |     c[100000] = {};
      |                 ^