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

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

int main(){
  int N,M;
  cin >> N >> M;
  int A[N],B[M],C[M];
  int min=0,max=0;
  for(i=0;i<N;i++){
    cin >> A[i];
  }
  for(int i=0; i<M;i++){
	cin >> B[i] >> C[i] ;
  }

  
  for(int i=0;i<M;i++){
    sort(A,A+N);
    for(int j=0;j<B[i];j++){
      if(A[j] > C[i])
		break;
      A[j] = C[i];
    }
  }

  int sum=0;
   for(i=0;i<N;i++){
    sum += A[i];
  }
  cout << sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   for(i=0;i<N;i++){
      |       ^
a.cc:27:8: error: 'i' was not declared in this scope
   27 |    for(i=0;i<N;i++){
      |        ^
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N,M,i,j;
    N = sc.nextInt();
    M = sc.nextInt();
    int[] a = new int[N];
    int[] b = new int[M];
    int[] c = new int[M];
    for(i=0;i<N;i++)
      a[i] = sc.nextInt();
    for(j=0;j<M;j++){
      b[j] = sc.nextInt();
      c[j] = sc.nextInt();
      if(c[j]>b[j]){
        int temp = a[j];
        a[j] = c[j];
        c[j] = temp;
      }
    }
    for(i=0;i<N;i++)
      s +=a[i];
    System.out.println(s);
  }
}

Compiler output:
Main.java:23: error: cannot find symbol
      s +=a[i];
      ^
  symbol:   variable s
  location: class Main
Main.java:24: error: cannot find symbol
    System.out.println(s);
                       ^
  symbol:   variable s
  location: class Main
2 errors
Language: C++

#include <iostream>

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

int main()
{
	/*
	int n, m;
	priority_queue<long> queue;

	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		queue.push(a);
	}
	for (int i = 0; i < m; i++) {
		int b, c;
		cin >> b >> c;
		for (int j = 0; j < b; j++) {
			queue.push(c);
		}
	}

	while (!queue.empty()) {
		cout << queue.top() << endl;
		queue.pop();
	}
	

	long  sum = 0;
	for (int i = 0; i < n; i++) {
		sum += (long)queue.top();
		queue.pop();
	}

	cout << sum << endl;
	*/

	int n, m;
	vector<long> queue;

	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		queue.push_back(a);
	}
	for (int i = 0; i < m; i++) {
		int b, c;
		cin >> b >> c;
		for (int j = 0; j < b; j++) {
			queue.push_back(c);
		}
	}
	std::sort(queue.begin(), queue.end(), std::greater<long>());

	long  sum = 0;
	for (int i = 0; i < n; i++) {
		sum += queue.at(i);
	}

	cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:58:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   58 |         std::sort(queue.begin(), queue.end(), std::greater<long>());
      |              ^~~~
      |              qsort
Language: C++

# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define MSG(x) std::cout << #x << " : " << x << "\n";
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
struct BC
{
    BC(lint _b, lint _c)
        : b(_b)
        , c(_c)
    {
    }
 
    lint b;
    lint c;
 
    bool operator <(const BC& other) const
    {
        return this->c < other.c;
    }
    bool operator >(const BC& other) const
    {
        return this->c > other.c;
    }
};
 
int main()
{
    lint N, M;
    cin >> N >> M;
    vector<lint> A(N);
    rep (i, N)
    {
        cin >> A[i];
    }
    vector<lint> B(M);
    vector<lint> C(M);
    vector<BC> BCs;
    rep (i, M)
    {
        cin >> B[i] >> C[i];
        BCs.push_back(BC(B[i], C[i]));
    }
 
 
    std::sort(ALL(A));
    std::sort(ALL(BCs), std::greater<BC>());
    rep (i, M)
    {
        rep (k, BCs.b[i])
        {
            if (A[k] < BCs.c[i])
            {
                A[k] = BCs.C[i];
            }
            else
            {
                break;
            }
        }
        std::sort(ALL(A));
    }
 
    lint sum = 0;
    rep (i, N)
    {
        sum += A[i];
    }
 
    cout << sum << endl;
 
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:21: error: 'class std::vector<BC>' has no member named 'b'
   60 |         rep (k, BCs.b[i])
      |                     ^
a.cc:2:42: note: in definition of macro 'rep'
    2 | # define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
      |                                          ^
a.cc:62:28: error: 'class std::vector<BC>' has no member named 'c'
   62 |             if (A[k] < BCs.c[i])
      |                            ^
a.cc:64:28: error: 'class std::vector<BC>' has no member named 'C'
   64 |                 A[k] = BCs.C[i];
      |                            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  for (int k = 0; k < M; k++) {
    int A, B;
    cin >> A >> B;
    for (int j = 0; j < A; j++) {
      int min = *std::min_element(vec.begin(), vec.end());
      if (min < B) {
        size_t minIndex = std::distance(vec.begin(), minIt);
        vec(minIndex) = B;
      }
    }
  }
  cout << std::accumulate(vec.begin(), vec.end(), 0) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:54: error: 'minIt' was not declared in this scope; did you mean 'min'?
   16 |         size_t minIndex = std::distance(vec.begin(), minIt);
      |                                                      ^~~~~
      |                                                      min
a.cc:17:12: error: no match for call to '(std::vector<int>) (size_t&)'
   17 |         vec(minIndex) = B;
      |         ~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>

#define ll long long

using namespace std;

int main(){

    int n,m;
    vector<ll> a;

    cin >> n >> m;

    for(int i = 0; i < n; i++){
        ll tmp;
        cin >> tmp;
        a.push_back(tmp);
    }

    for(int i = 0; i < m; i++){
        int b;
        ll c;
        cin >> b >>c;
        for(int j = 0; j < b; j++){
            a.push_back(c);
        }
    }
    a.sort();

    ll sum = 0;

    for(int i = 0; i < n; i++){
        sum = sum + a[a.size()- i - 1]
    }

    cout << sum << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:7: error: 'class std::vector<long long int>' has no member named 'sort'
   32 |     a.sort();
      |       ^~~~
a.cc:37:39: error: expected ';' before '}' token
   37 |         sum = sum + a[a.size()- i - 1]
      |                                       ^
      |                                       ;
   38 |     }
      |     ~
Language: C++

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

int main() {
  int N,M;
  cin >> N >> M;
  vector<long int> A(N);
  vector<long int> B(M);
  vector<long int> C(M);
  for(int h=0;h<N;h++){
    cin >> A.at(h);
  }
  
  for(int i=0;i<M;i++){
    cin >> B.at(i) >> C.at(i);
  }  
  
  for(int i=0;i<M;i++){
   while(B.at(i)>0){
     for(int j=0;j<N;j++){
      if(A.at(j)<C.at(i)){
        A.at(j)=C.at(i);
        B(i)--;
      }
     }
    }
  }
  
  long int sum=0;
  for(int k=0;k<N;k++){
  sum += A.at(k);
  }
	cout << sum <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:10: error: no match for call to '(std::vector<long int>) (int&)'
   23 |         B(i)--;
      |         ~^~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
    int sum=0;
  int max=0;
    int N; cin>>N;
    int M; cin>>M;
    vector<int> A(N);
    vector<int> B(M);
    vector<int> C(M);
    vector<int> value(N+1)={};
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    for(int i=0;i<M;i++){
        cin>>B[i];
        cin>>C[i];
    }
    for(int i=0;i<N;i++){
        sum+=A[i];
    }
    for(int i=0;i<M;i++){
        for(int j=0;j<=B[i]-1;j++){
            value[j]+=C[j]-B[j];
        }
        for(int i=0;i<=B[i]-1;i++){
            if(value[i]>max) max=value[i];
        }
        sum+=max;
      max=0;
    }
    printf("%d",sum);



    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:27: error: expected ',' or ';' before '=' token
   13 |     vector<int> value(N+1)={};
      |                           ^
Language: C++

#include <stdio.h>
int main()
{
  int N,M;
  scanf("%d %d",&N,&M);
  int l,i=0,A[N];
  while(cin>>l){
        A[i] = l;
        i++;
  }
  int B[M],C[M];
  for(i=0;i<M;i++){
  	scanf("%d %d",&B[i],&C[i]);
  }
  //Aの置換
  for(i=0;i<M;i++){
    A[B[i]-1]=C[i];
  }
  
  int sum=0;
  for(i=0;i<N;i++){
    sum+=A[i];
  }
  printf("%d\n",sum);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |   while(cin>>l){
      |         ^~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<list>

typedef long long ll;
typedef unsigned short int unsi;
typedef unsigned int uni;
typedef unsigned long int unli;

using namespace std;

int main(){
	int N, M;
	list<int> A;
	list<int>::iterator itr;
	int Input;
	int B;
	int C;
	ll Ans=0;

	cin >> N;
	cin >> M;
	//scanf("%d%d", &N, &M);
	
	for (int i = 1; i <= N; i++) {
		cin >> Input;
		//scanf("%d", &Input);
		A.push_back(Input);
	}

	A.sort();
	
	
	/*debug
	printf("\ndebug\n");
	for (itr = A.begin(); itr != A.end(); itr++) {
		cout << *itr << " ";
	}
	printf("\nここまで\n\n");
	*/

	itr = A.begin();
	
	for (int i = 1; i <= M; i++) {
		cin >> B;
		cin >> C;
		//scanf("%d%d", &B, &C);
		if (*itr < C) {
			for (itr=A.begin(); B>0 ; itr++) {
				if (*itr < C) {
					*itr = C;
					A.sort;
					B--;
				}else {
					break;
				}
			}
		}
	}

	/*debug
	printf("\ndebug\n");
	for (itr = A.begin(); itr != A.end(); itr++) {
		cout << *itr << " ";
	}
	printf("\nここまで\n\n");
	*/

	for (itr = A.begin(); itr != A.end(); itr++) {
		Ans += *itr;
	}
	
	printf("%lld", Ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:43: error: statement cannot resolve address of overloaded function
   52 |                                         A.sort;
      |                                         ~~^~~~
Language: Java

 
		public static void main(String[] args){
			Scanner sc = new Scanner(System.in);
			// 整数の入力
			int N = sc.nextInt();
			// スペース区切りの整数の入力
			int M = sc.nextInt();
			ArrayList<Integer> A = new ArrayList<Integer>();
			int B = 0;
			int C = 0;
			long sum = 0;
			for (int i = 0; i<N ; i++){
				A.add(sc.nextInt());
			}
			int min = Collections.min(A);
			
			for (int i = 0; i<M ; i++){
				B=sc.nextInt();
				C=sc.nextInt();
				if(min<C){
					for (int j = 0; j<B ; j++){
						A.add(C);
					}
				}
			}
			for (int i = 0; i<N ; i++){
				sum += (long)Collections.max(A);
				A.remove(A.indexOf(Collections.max(A)));
			}
			System.out.println(sum);
		}
 
	}

Compiler output:
Main.java:2: error: unnamed classes are a preview feature and are disabled by default.
		public static void main(String[] args){
		              ^
  (use --enable-preview to enable unnamed classes)
Main.java:33: error: class, interface, enum, or record expected
	}
	^
2 errors
Language: C++

#include <iostream>
#include <vector>
#include <list>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <iomanip>
#include <numeric>
#include <iterator>
#include <atltime.h>

using namespace std;

int main()
{
	long N;
	cin >> N;
	long M;
	cin >> M;

	vector<long> A;
	vector<long> B;
	vector<long> C;

	for (int i = 0; i < N; i++) {
		long tmp;
		cin >> tmp;
		A.emplace_back(tmp);
	}
	sort(A.begin(), A.end());

	for (int i = 0; i < M; i++) {
		long B_tmp;
		long C_tmp;
		cin >> B_tmp;
		cin >> C_tmp;
		B.emplace_back(B_tmp);
		C.emplace_back(C_tmp);
//		cout << i << endl;
	}

/*	CFileTime cTimeStart, cTimeEnd;
	CFileTimeSpan cTimeSpan;
	cTimeStart = CFileTime::GetCurrentTime();           // 現在時刻
*/
	long border = 0;
		for (int i = 0; i < M; i++) {//Bi Ciを順に
			long B_tmp = B[i];
			long C_tmp = C[i];

			//		cout << "i " << i << endl;
			if (C[i] >= border) {
				for (int j = 0; j < B_tmp; j++) {
					std::vector<long>::iterator minIt = std::min_element(A.begin(), A.end());
					size_t minIndex = std::distance(A.begin(), minIt);
					//			cout << "minIndex " << minIndex << endl;
					//			cout << "A[minIndex] " << A[minIndex] << endl;
					border = A[minIndex];
//					cout << "here" << std::endl;
					if (A[minIndex] < C_tmp) {
						A[minIndex] = C_tmp;
						//				cout << "代入 A[minIndex] " << A[minIndex] << endl;
					}
					else {
						//				cout << "break" << endl;
						break;
						//				j = B_tmp;
					}
				}
			}
		}

		//	cout << "exit" << std::endl;
		long long sum = 0;
		for (long i = 0; i < N; i++) {
			sum = sum + A[i];
		}
		//	cout << std::accumulate(A.begin(), A.end(), 0) << std::endl;
		cout << sum << std::endl;

/*	cTimeEnd = CFileTime::GetCurrentTime();           // 現在時刻
	cTimeSpan = cTimeEnd - cTimeStart;
	std::cout << "処理時間:" << cTimeSpan.GetTimeSpan() / 10000 << "[ms]" << std::endl;
*/
}

Compiler output:
a.cc:11:10: fatal error: atltime.h: No such file or directory
   11 | #include <atltime.h>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
    int sum=0;
    int N; cin>>N;
    int M; cin>>M;
    vector<int> A(N);
    vector<int> B(M);
    vector<int> C(M);
    vector<int> value(N+1)={};
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    for(int i=0;i<M;i++){
        cin>>B[i];
        cin>>C[i];
    }
    for(int i=0;i<N;i++){
        sum+=A[i];
    }
    for(int i=0;i<M;i++){
        for(int j=0;j<=B[i]-1;j++){
            value[j]+=C[j]-B[j];
        }
        for(int i=0;i<=B[i]-1;i++){
            if(value[i]>max) max=value[i];
        }
        sum+=max;
    }
    printf("%d",sum);



    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:27: error: expected ',' or ';' before '=' token
   12 |     vector<int> value(N+1)={};
      |                           ^
a.cc:28:24: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and '<unresolved overloaded function type>' to binary 'operator>'
   28 |             if(value[i]>max) max=value[i];
a.cc:28:41: error: overloaded function with no contextual type information
   28 |             if(value[i]>max) max=value[i];
      |                                         ^
a.cc:30:14: error: overloaded function with no contextual type information
   30 |         sum+=max;
      |              ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdio>
#define REP(i, n) for (int i = 0; i < (n); i++)
 
using namespace std;
 
int main() {
    int N, M;
    cin >> N >> M;
    static int A[N], B[M], C[M];
    long sum = 0;
    long long ans = 0;
    for (int i = 0; i < N; i++)
        cin >> A[i];
    for (int i = 0; i < M; i++){
        cin >> B[i] >> C[i];
        sum += B[i];
    }
    static int S[sum + N];
    for (int i = 0; i < N; i++)
        S[i] = A[i];
    int j = N;
    for (int i = 0; i < M; i++){
        while (B[i] > 0) {
            S[j] = C[i];
            B[i]--;
            j++;
        }
    }
    sort(S, S + N + sum, std::greater<>());
    for (int i = 0; i < N; i++){
        ans += S[i];
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: storage size of 'A' isn't constant
   13 |     static int A[N], B[M], C[M];
      |                ^
a.cc:13:22: error: storage size of 'B' isn't constant
   13 |     static int A[N], B[M], C[M];
      |                      ^
a.cc:13:28: error: storage size of 'C' isn't constant
   13 |     static int A[N], B[M], C[M];
      |                            ^
a.cc:22:16: error: storage size of 'S' isn't constant
   22 |     static int S[sum + N];
      |                ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>


using namespace std;
#define ll long long


int main(void){
    ll N,M;
    cin>>N>>M;
    vector<ll> A(N),B(M),C(M);
    vector<pair<ll,ll>> CB(M);
    for(ll i=0;i<N;i++) cin>>A.at(i);
    for(ll i=0;i<M;i++) {
        cin>>B.at(i)>>C.at(i);
        CB.at(i)=make_pair(C.at(i),B.at(i))
    }
    
    sort(A.begin(),A.end());
    sort(CB.begin(),CB.end());
    
    for(ll i=0;i<M;i+=0){
        ll j=1;
        while(C.at(i)==C.at(i+j)){
            B.at(i)+=B.at(i+j);
            B.at(i+j)=0;
            C.at(i+j)=0;
            j++;
        }
        i+=j;
    }
    sort(CB.begin(),CB.end());
    
    for(ll i=0;i<M;i++){
        if(C.at(i)<=A.at(0)) break;
        for(ll j=0;j<B.at(i);j++){
            if(A.at(j)<C.at(i)) A.at(j)=C.at(i);
            else break;
        }
        sort(A.begin(),A.end());
    }
    ll ans=0;
    for(ll i=0;i<N;i++) ans+=A.at(i);
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:44: error: expected ';' before '}' token
   23 |         CB.at(i)=make_pair(C.at(i),B.at(i))
      |                                            ^
      |                                            ;
   24 |     }
      |     ~
Language: C++

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

int main(){
 long long N,M,l,r,c,lm,rm,ans,k;
  cin>>N>>M;
  k=0;
  int s=0;
  ans=0;
  vector<long long>A(N),B(M),C(M);
  vector<pair<int,long long>> pair(M);
    for(int i=0;i<N;i++){
   cin>>A[i];
  }
  sort(A.begin(),A.end());
      for(int i=0;i<M;i++){
   cin>>B[i]>>C[i];
        if(B[i]==N){
          s=i;
        }
  }
  if(s!=0){
      for(int i=0;i<N;i++){
   A[i]=B[s];
  }
  }
  for(int i=s+1;i<M;i++){
    pair[i]=make_pair(C[i],B[i]);
  }
    sort(pair.first.begin(),pair.first.end());
  reverse(pair.begin(),pair.end());
      for(int i=0;i<M;i++){
            for(int j=0;j<pair[i].second;j++){
   if(A[j]>=pair[i].first){
     i=M+100;
     j=pair[i].second+100;
   }
	 else{
       A[j]=pair[i].first;
     }
  }
  sort(A.begin(),A.end());
  }
  for(int i=0;i<N;i++){
   ans+=A[i];
  }
 
       cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:15: error: 'class std::vector<std::pair<int, long long int> >' has no member named 'first'
   30 |     sort(pair.first.begin(),pair.first.end());
      |               ^~~~~
a.cc:30:34: error: 'class std::vector<std::pair<int, long long int> >' has no member named 'first'
   30 |     sort(pair.first.begin(),pair.first.end());
      |                                  ^~~~~
Language: C++

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

int main(){
  int N, M;
  int ANS=0;
  cin >> N >> M;
  vector<int> A(N), B(M), C(M);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  for(int i=0;i<M;i++){
    cin >> B.at(i) >> C.at(i);
  }
  
  sort(A.begin(), A.end());
  
  for(j=0;j<M;j++){
    for(k=0;k<j+1;k++){
      if(A.at(k)<C.at(k)){
        C.at(k)=A.at(j);
      }
    }
  }
  
  for(i=0;i<N;i++){
    ANS += A.at(i);
  }
  
  cout << ANS << endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:7: error: 'j' was not declared in this scope
   19 |   for(j=0;j<M;j++){
      |       ^
a.cc:20:9: error: 'k' was not declared in this scope
   20 |     for(k=0;k<j+1;k++){
      |         ^
a.cc:27:7: error: 'i' was not declared in this scope
   27 |   for(i=0;i<N;i++){
      |       ^
Language: C

#include<iostream>
using namespace std;

int main(){

int N,M;
cin>>N>>M;
int A[100000],B[100000],C[100000];

for(int i=0;i<N;i++){
cin>>A[i];
}
for(int j=0;j<M;j++){
cin>>B[j]>>C[j];
}



for(int a=1;a<M+1;a++){
   for(int b=0;b<B[a];b++){
       for(int c=0;c<A[a];c++){
	if(C[a]>A[a]){
	  A[a]=C[a];
	}
     }
   }
}


int goukei=0;
for(int k=0;k<N;k++){
goukei=goukei+A[k];
}

cout<<goukei;

return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include "bits/stdc++.h"
using ll = long long;
using namespace std;
int main(){
ll N,M;
cin>>N>>M;
vector<ll> A(N);
ll B,C,tmp=0;
for(ll i=0;i<N;i++) cin>>A[i];
for(ll i=0;i<M;i++){
sort(A.begin(),A.end());
tmp=0;
cin>>B>>C;
for(ll j=0;j<B;j++){
  if(C>A[j])
  A[j]=C;
  else
  break;
}
ll ans=0;
for(ll i=0;i<N;i++){
  ans+=A[i];
}
cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdio>
#define REP(i, n) for (int i = 0; i < (n); i++)
 
using namespace std;
 
int main() {
    int N, M;
    cin >> N >> M;
    static long long A[N], B[M], C[M];
    long sum = 0;
    long long ans = 0;
    for (int i = 0; i < N; i++)
        cin >> A[i];
    for (int i = 0; i < M; i++){
        cin >> B[i] >> C[i];
        sum += B[i];
    }
    static int S[sum + N];
    for (int i = 0; i < N; i++)
        S[i] = A[i];
    int j = N;
    for (int i = 0; i < M; i++){
        while (B[i] > 0) {
            S[j] = C[i];
            B[i]--;
            j++;
        }
    }
    sort(S, S + N + sum, std::greater<>());
    for (int i = 0; i < N; i++){
        ans += S[i];
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:22: error: storage size of 'A' isn't constant
   13 |     static long long A[N], B[M], C[M];
      |                      ^
a.cc:13:28: error: storage size of 'B' isn't constant
   13 |     static long long A[N], B[M], C[M];
      |                            ^
a.cc:13:34: error: storage size of 'C' isn't constant
   13 |     static long long A[N], B[M], C[M];
      |                                  ^
a.cc:22:16: error: storage size of 'S' isn't constant
   22 |     static int S[sum + N];
      |                ^
Language: C++

#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

int main() {
    int card, step;
    int b;
    int c;
    cin >> card >> step;
    int deck[card];
    int max;
    int sum;

    sum = 0;

    for(int i = 0; i < card; i++){
        cin >> deck[i];
        sum += deck[i];
        } 

    max = sum;
    
    //入れ替えて検証
    for(int i = 0; i < step; i++)
    {
        sum = 0;
        cin >> b >> c;
        sort(deck, deck + card);
        
        for(int s= 0; s < b; s++){
            if(deck[s] < c ) {
                max += c-deck[s];
                deck[s] = c;
        }
            }
            else break;
        }

        /* code */
    }

  cout << max << endl;  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:13: error: 'else' without a previous 'if'
   37 |             else break;
      |             ^~~~
a.cc: At global scope:
a.cc:43:3: error: 'cout' does not name a type
   43 |   cout << max << endl;
      |   ^~~~
a.cc:44:3: error: expected unqualified-id before 'return'
   44 |   return 0;
      |   ^~~~~~
a.cc:45:1: error: expected declaration before '}' token
   45 | }
      | ^
Language: C++

n,m=map(int,input().split())
A=list(map(int,input().split()))
for i in range(m):
  A=sorted(A)
  b,c=map(int,input().split())
  for j in range(b):
    if A[j]<c:
      A[j]=c
    else:
      break
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 Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] Array;
    Array = new int[N];
    for ( int i = 0 ; i < N ; i++ ){
      Array[i] = sc.nextInt();
    }
    int[] B;
    B = new int[M];
    int[] C;
    C = new int[M];
    for ( int i = 0 ; i < M ; i++ ){
      B[i] = sc.nextInt();
      C[i] = sc.nextInt();
    }

    Arrays.sort(Array); //Arrayを小さい順に並べかえる

    List<Integer> Xs = new ArrayList<>();
    for ( int i=0 ; i < M ; i++ ){
      while(B[i]>0){
        Xs.add( C[i] ) ;
        B[i]-- ;
      }
    }

    Collections.sort(Xs, Collections.reverseOrder()); //Xを降順
    int size =Xs.size();

    Integer[] X = Xs.toArray(new Integer[size]);
  
    if (X[0]>1000000){
      long sum=0;
    }else{
      int sum = 0;
    }
    for ( int i=0 ; i < N ; i++ ){
      if (i==size){sum +=Array[i];}
      else {
        if( Array[i] < X[i] ){
          Array[i] = X[i] ;
        }
      sum +=Array[i];
      }
    }
    System.out.println(sum);
  }
}

Compiler output:
Main.java:42: error: cannot find symbol
      if (i==size){sum +=Array[i];}
                   ^
  symbol:   variable sum
  location: class Main
Main.java:47: error: cannot find symbol
      sum +=Array[i];
      ^
  symbol:   variable sum
  location: class Main
Main.java:50: error: cannot find symbol
    System.out.println(sum);
                       ^
  symbol:   variable sum
  location: class Main
3 errors
Language: C

#include<stdio.h>
int main(){
int n,m,b,c;
scanf("%d %d",&n,&m);
int num[n];
int ans;
scanf("%d",num[]);
scanf("%d %d",b,c);
for(int i=0;i<b;i++){
for(int j=0;j<n;j++){
if(num[j]<c){
num[j]=c;
}
else {}
}
}
for(int i=0;i<n;i++){
ans=ans+num[i];
}
printf("%d",ans);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:16: error: expected expression before ']' token
    7 | scanf("%d",num[]);
      |                ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
#define int long long
long long n,m,a[100005],b,c;
long long ans,cnt;
vector<pair<long long ,long long>> p;
bool compare_by_b(pair<long long , long long> a, pair<long long, long long> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>a[i];
        ans+=a[i];
    }
    sort(a,a+n);
    for(int i=0;i<m;i++){
        cin>>b>>c;
        p.push_back({b,c});
    }
    sort(p.begin(),p.end(), compare_by_b);
    int j=0;
    for(int i=m-1;i>=0;i--){
        if(a[j]>=p[i].second)break;
        int f=0;
        while(f<p[i].first){
            if(a[j]<p[i].second)cnt+=abs(a[j]-p[i].second);
            j++,f++;
            if(a[j]>=p[i].second)break;
        }
        if(j>=n) break;
    }
    cout<<ans+cnt<<endl;
}

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

#include<stdio.h>
int main(){
int n,m,b,c;
scanf("%d %d",&n,&m);
int num[n];
long ans;
scanf("%d",num[]);
scanf("%d %d",b,c);
for(int i=0;i<b;i++){
for(int j=0;j<n;j++){
if(num[j]<c){
num[j]=c;
}
else {}
}
}
for(int i=0;i<n;i++){
ans=ans+(long)num[i];
}
printf("%lu",ans);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:16: error: expected expression before ']' token
    7 | scanf("%d",num[]);
      |                ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<list>

typedef long long ll;
typedef unsigned short int unsi;
typedef unsigned int uni;
typedef unsigned long int unli;

using namespace std;

int main(){
	int N, M;
	list<int> A;
	list<int>::iterator itr;
	int Input;
	int B;
	int C;
	ll Ans=0;

	scanf("%d%d", &N, &M);
	
	for (int i = 1; i <= N; i++) {
		scanf("%d", &Input);
		A.push_back(Input);
	}

	A.sort();
	
	
	/*debug
	printf("\ndebug\n");
	for (itr = A.begin(); itr != A.end(); itr++) {
		cout << *itr << " ";
	}
	printf("\nここまで\n\n");
	*/

	itr = A.begin();
	
	for (int i = 1; i <= M; i++) {
		scanf("%d%d", &B, &C);
		if (*itr < C) {
			for (itr=A.begin(); B>0 ; itr++) {
				if (*itr < C) {
					*itr = C;
					A.sort;
					B--;
				}else {
					break;
				}
			}
		}
	}

	/*debug
	printf("\ndebug\n");
	for (itr = A.begin(); itr != A.end(); itr++) {
		cout << *itr << " ";
	}
	printf("\nここまで\n\n");
	*/

	for (itr = A.begin(); itr != A.end(); itr++) {
		Ans += *itr;
	}
	
	printf("%lld", Ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:43: error: statement cannot resolve address of overloaded function
   47 |                                         A.sort;
      |                                         ~~^~~~
Language: C++

#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

int main() {
    long card, step;
    long b;
    long c;
    cin >> card >> step;
    long deck[card];
    long max;
    long sum;

    sum = 0;

    for(int i = 0; i < card; i++){
        cin >> deck[i];
        sum += deck[i];
        } 

    max = sum;
    
    //入れ替えて検証
    for(int i = 0; i < step; i++)
    {
        sum = 0;
        cin >> b >> c;
        sort(deck, deck + card);
        
        for(int s= 0; s < b; s++){
            if(deck[s] < c ) {
                max += c-deck[s];
                deck[s] = c;
        }
            }
            else break;
        }

        /* code */
    }

  cout << max << endl;  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:13: error: 'else' without a previous 'if'
   37 |             else break;
      |             ^~~~
a.cc: At global scope:
a.cc:43:3: error: 'cout' does not name a type
   43 |   cout << max << endl;
      |   ^~~~
a.cc:44:3: error: expected unqualified-id before 'return'
   44 |   return 0;
      |   ^~~~~~
a.cc:45:1: error: expected declaration before '}' token
   45 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define REP(i, n) for (int i = 0; i < (n); i++)
 
using namespace std;
 
int main() {
    int N, M;
    cin >> N >> M;
    static long long A[N], B[M], C[M];
    long sum = 0;
    long long ans = 0;
    for (int i = 0; i < N; i++)
        cin >> A[i];
    for (int i = 0; i < M; i++){
        cin >> B[i] >> C[i];
        sum += B[i];
    }
    static int S[sum + N];
    for (int i = 0; i < N; i++)
        S[i] = A[i];
    int j = N;
    for (int i = 0; i < M; i++){
        while (B[i] > 0) {
            S[j] = C[i];
            B[i]--;
            j++;
        }
    }
    sort(S, S + N + sum, std::greater<>());
    for (int i = 0; i < N; i++){
        ans += S[i];
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:22: error: storage size of 'A' isn't constant
   12 |     static long long A[N], B[M], C[M];
      |                      ^
a.cc:12:28: error: storage size of 'B' isn't constant
   12 |     static long long A[N], B[M], C[M];
      |                            ^
a.cc:12:34: error: storage size of 'C' isn't constant
   12 |     static long long A[N], B[M], C[M];
      |                                  ^
a.cc:21:16: error: storage size of 'S' isn't constant
   21 |     static int S[sum + N];
      |                ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<list>
#include<stdlib.h>
#include<math.h>
#include<string>

typedef long long ll;
typedef unsigned short int unsi;
typedef unsigned int uni;
typedef unsigned long int unli;

using namespace std;

unsi gojoho(unsi A, unsi B) {
	unsi R = 1;
	if (A > B) {
		while (R!=0) {
			R = A % B;
			A = B;
			B = R;
		}
		return A;
	} else {
		while (R != 0) {
			R = B % A;
			B = A;
			A = R;
		}
		return B;
	}
}

uni gojoho(uni A, uni B) {
	uni R = 1;
	if (A > B) {
		while (R != 0) {
			R = A % B;
			A = B;
			B = R;
		}
		return A;
	} else {
		while (R != 0) {
			R = B % A;
			B = A;
			A = R;
		}
		return B;
	}
}

unli gojoho(unli A, unli B) {
	unli R = 1;
	if (A > B) {
		while (R != 0) {
			R = A % B;
			A = B;
			B = R;
		}
		return A;
	} else {
		while (R != 0) {
			R = B % A;
			B = A;
			A = R;
		}
		return B;
	}
}

int gojoho(int A, int B) {
	int R = 1;
	if (A > B) {
		while (R != 0) {
			R = A % B;
			A = B;
			B = R;
		}
		return A;
	} else {
		while (R != 0) {
			R = B % A;
			B = A;
			A = R;
		}
		return B;
	}
}



int main(){
	int N, M;
	list<int> A;
	list<int>::iterator itr;
	int Input;
	int B;
	int C;
	ll Ans=0;

	scanf("%d%d", &N, &M);
	
	for (int i = 1; i <= N; i++) {
		scanf("%d", &Input);
		A.push_back(Input);
	}

	A.sort();
	
	
	/*debug
	printf("\ndebug\n");
	for (itr = A.begin(); itr != A.end(); itr++) {
		cout << *itr << " ";
	}
	printf("\nここまで\n\n");
	*/

	itr = A.begin();
	
	for (int i = 1; i <= M; i++) {
		scanf("%d%d", &B, &C);
		if (*itr < C) {
			for (itr=A.begin(); B>0 ; itr++) {
				if (*itr < C) {
					*itr = C;
					A.sort;
					B--;
				}else {
					break;
				}
			}
		}
	}

	/*debug
	printf("\ndebug\n");
	for (itr = A.begin(); itr != A.end(); itr++) {
		cout << *itr << " ";
	}
	printf("\nここまで\n\n");
	*/

	for (itr = A.begin(); itr != A.end(); itr++) {
		Ans += *itr;
	}
	
	printf("%lld", Ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:128:43: error: statement cannot resolve address of overloaded function
  128 |                                         A.sort;
      |                                         ~~^~~~
Language: C++

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

int main()
{
  int N, M;
  cin >> N >> M;

  vector<int> A(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A[i];
  }


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

  pair<int, int> change[100000];
  for (int i = 0; i < M; i++)
  {
    int a, b;
    cin >> change[i].first >> change[i].second;
  }

  int sum = 0;
  for(int i = 0;i < M; i++)
  {
    for(int j = 0;j < change[i].first; j++){
      A[j] = change[i].second;
      int x = accumulate(A.begin(), A.end(), 0);
      if(sum <= x){
        sum = x;
      }
    }
    sort(A.begin(), A.end());
  }

  

  cout << sum << endl;

}

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

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

void change(vector<int> &vec, int B, int C);
void smallSort(vector<int> &vec, int B, int C);

int main()
{
    int N, M, B, C;
    cin >> N >> M;
    vector<int> A;
    for (int i = 0; i < N; i++)
    {
        int tmp;
        cin >> tmp;
        A.push_back(tmp);
    }
    sort(A.begin(), A.end());
    for (int j = 0; j < M; j++)
    {
        cin >> B >> C;
        change(A, B, C);
    }

    //合計値を出す
    long ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans += A[i];
    }
    cout << ans << endl;
    return 0;
}

void smallSort(vector<int> &vec, int B, int C)
{
    //B以降の箇所で、Cより小さい番目を発見する
    int tmp = B;
    for (tmp; tmp < vec.size(); tmp++)
    {
        if (vec[tmp] > C)
            break;
    }
    //下に持ってくる
    if (tmp - B < B)
    {
        for (int j = 0; j < tmp - B; j++)
        {
            vec[j] = vec[j + B];
            vec[j + B] = C;
        }
    }
    else
    {
        for (int i = 0; i < tmp; i++)
        {
            if (i < tmp - B)
                vec[i] = vec[i + B];
            else
            {
                vec[i] = C;
            }
        }
    }
}

Compiler output:
/usr/bin/ld: /tmp/cc8aUzIe.o: in function `main':
a.cc:(.text+0xe2): undefined reference to `change(std::vector<int, std::allocator<int> >&, int, int)'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }

    vector<int> b(m), c(m);
    for (int i = 0; i < m; i++){
        cin >> b[i] >> c[i];
    }


    for (int i = 0; i < m; i++)
    {
        sort(a.begin(), a.end());
        //cout << "b[i]" << b[i] << endl;

        for (int j = 0; j < b[i]; j++)
        {
            //cout << "a[" << j << "]: " << a[j] << endl;
            if (a[j] < c[i])
                a[j] = c[i];
        }
    }

    unsigned 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:22:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |         sort(a.begin(), a.end());
      |         ^~~~
      |         short
Language: Java

import java.util.*;
public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int N = sc.nextInt();
     int M = sc.nextInt();
     long[] A = new long[N];
     long C,element,ans;
     int index,y,B;
     ans = 0;
     for(int i = 0;i<N;i++){
      A[i] = sc.nextInt();
     }
     sort(A,0,N-1);
     for(int j = 0;j<M;j++){
       B = sc.nextInt();
       C = sc.nextInt();
       index = 0;
       while(A[index] < C && index<N-1){
         index++;
       }

       if(index>B){
         for(int i=0;i<index-B;i++){
           A[i]=A[B+i];
         }
         for(int i=index-B;i<index;i++){
           A[i] = C;
         }
       }else{
         for(int i = 0;i<index;i++){
           A[i] = C;
         }
       }
     }
     for(int i=0;i<N;i++){
       ans += A[i];
     }
     System.out.println(ans);
   }
   int pivot(int[] a,int i,int j){
    int k=i+1;
    while(k<=j && a[i]==a[k]) k++;
    if(k>j) return -1;
    if(a[i]>=a[k]) return i;
    return k;
  }

  /*
   * パーティション分割
   * a[i]～a[j]の間で、x を軸として分割します。
   * x より小さい要素は前に、大きい要素はうしろに来ます。
   * 大きい要素の開始番号を返します。
   */
  int partition(int[] a,int i,int j,int x){
    int l=i,r=j;

    // 検索が交差するまで繰り返します
    while(l<=r){

      // 軸要素以上のデータを探します
      while(l<=j && a[l]<x)  l++;

      // 軸要素未満のデータを探します
      while(r>=i && a[r]>=x) r--;

      if(l>r) break;
      int t=a[l];
      a[l]=a[r];
      a[r]=t;
      l++; r--;
    }
    return l;
  }

  /*
   * クイックソート（再帰用）
   * 配列aの、a[i]からa[j]を並べ替えます。
   */
  public void quickSort(int[] a,int i,int j){
    if(i==j) return;
    int p=pivot(a,i,j);
    if(p!=-1){
      int k=partition(a,i,j,a[p]);
      quickSort(a,i,k-1);
      quickSort(a,k,j);
    }
  }
  public void sort(int[] a){
    quickSort(a,0,a.length-1);
  }
}


Compiler output:
Main.java:14: error: method sort in class Main cannot be applied to given types;
     sort(A,0,N-1);
     ^
  required: int[]
  found:    long[],int,int
  reason: actual and formal argument lists differ in length
1 error
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
    int N, M;
    long long s = 0;
    cin >> N >> M;
    vector<int> A(N), B(M), C(M);
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    for(int i = 0; i < M; i++){
        cin >> B[i] >> C[i];
    }
    sort(A.begin(), A.end());
    for(int i = 0; i < M; i++){
        vector<int>::iterator iter = max_element(C.begin(), C.end());
        size_t index = distance(C.begin(), iter);
        if(A[0] >= C[index]){break;}
        for(int j = 0; j < B[index]; j++){
            if(A[j] < C[index]){
                s += C[index];
                v.erase(v.begin() + j);
            }else{
                break;
            }
        }
        sort(A.begin(), A.end());
        C[index] = 0;
    }
    cout << accumulate(A.begin(), A.end(), 0LL) + s;
    return 0;
};


Compiler output:
a.cc: In function 'int main()':
a.cc:27:17: error: 'v' was not declared in this scope
   27 |                 v.erase(v.begin() + j);
      |                 ^
Language: Java

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int m = scanner.nextInt();

        final int[] cards = new int[n];

        for (int i = 0; i < n; i++) {
            cards[i] = scanner.nextInt();
        }

        Arrays.sort(cards);
        final Cs[] cs = new Cs[m];
        final Main d = new Main();

        for (int i = 0; i < m; i++) {
            cs[i] = d.new Cs(scanner.nextInt(), scanner.nextInt());
        }

        Arrays.sort(cs, Comparator.reverseOrder());

        int counter = 0;

        for(int i = 0;i<m;i++){
            final int c = cs[i].getNum();
            final int ati = cs[i].getAtai();
            boolean f = false;
            for(int j = 0;j<c;j++){
                if (counnter >= n || cards[counter] >= ati) {
                    f = true;
                    break;
                }

                cards[counter] = ati;
                counter++;
            }
            if(f){
                break;
            }
        }

        long result = 0;
        for (final int card : cards) {
            result += card;
        }

        System.out.println(result);
    }

    class Cs implements Comparable<Cs> {
        private final int num;
        private final int atai;

        public Cs(final int num, final int atai) {
            this.num = num;
            this.atai = atai;
        }

        public int getNum() {
            return num;
        }

        public int getAtai() {
            return atai;
        }

        @Override
        public int compareTo(final Cs cs) {
            return this.atai - cs.atai;
        }
    }
}


Compiler output:
Main.java:34: error: cannot find symbol
                if (counnter >= n || cards[counter] >= ati) {
                    ^
  symbol:   variable counnter
  location: class Main
1 error
Language: C++

#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>	
#include <utility>
#include <cinttypes>
#include <string>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <deque>
using namespace std;

int main(){
    cout<<std::fixed<<setprecision(10);
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int n,m;
    long long sum = 0ll;
    std::deque<int> a;
    vector<pair<int,int>> bc;
    cin>>n;
    cin>>m;
    bc.reserve(m);
    for (int i=0;i<n;i++){
        int ai;
        cin>>ai;
        a.push_back(ai);
    }
    for (int i=0;i<m;i++){
        int bi,ci;
        cin>>bi;
        cin>>ci;
        bc.push_back(pair<int,int>(bi,ci));
    }
    sort(a.begin(),a.end());
    sort(bc.begin(),bc.end(),[](pair<int,int>p1, pair<int,int>p2) -> int { return ( p1.second > p2.second ); } );
    for (int i=0;i<m;i++){
        for (int j=0;j<bc[i].first;j++){
            if (a.size()==0){
                break;
            }
            if (a[0]<bc[i].second){
                sum += bc[i].second;
                a.pop_front();
            }　else {
				break;
            }
        }
        if (a.size()==0){
            break;
        }
    }
    cout<<accumulate(a.begin(),a.end(),sum)<<"\n";
}

Compiler output:
a.cc:47:14: error: extended character 　 is not valid in an identifier
   47 |             }　else {
      |              ^
a.cc: In function 'int main()':
a.cc:47:14: error: '\U00003000else' was not declared in this scope
   47 |             }　else {
      |              ^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

void sort2vectors(vector<int64_t> &av, vector<int64_t> &bv)
{
        int n = av.size();
        vector<int64_t> p(n), av2(n), bv2(n);
        iota(p.begin(), p.end(), 0);
        sort(p.begin(), p.end(), [&](int64_t a, int64_t b) { return av[a] < av[b]; });
        for (int i = 0; i < n; i++) {
                av2[i] = av[p[i]];
                bv2[i] = bv[p[i]];
        }
        av = av2;
        bv = bv2;
}

int main(){
  int N,M;
  cin >> N >> M;

  vector<int64_t> A(N);
  vector<int64_t> B(M);
  vector<int64_t> C(M);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }

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

  int cnt = 0;
  for(int i=0;i<M;i++){
    cin >> B[i] >> C[i];
  }

  sort2vectors(C,B);
 
  for(int i=M;i>=0;i--){
    if(*min_element(A.begin(), A.end()) >= C[i])){
      break;
    }
    cnt = 0;
    for(int j =0;j<N;j++){
      if((cnt == B[i]) || (C[i] <= A[j]) ){
        break;
      }
      if(A[j] < C[i]){
        A[j] = C[i];
        cnt++;
      }
    }
    sort(A.begin(), A.end());
  }

  cout << accumulate(A.begin(), A.end(), 0LL) << endl;


  return 0;
}






Compiler output:
a.cc: In function 'int main()':
a.cc:40:49: error: expected primary-expression before ')' token
   40 |     if(*min_element(A.begin(), A.end()) >= C[i])){
      |                                                 ^
Language: C++

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

int main() {
	int N, M;
	int B, C;
	cin >> N >> M;

	vector<int> A(N);
	for (size_t i=0; i<N; i++) {
		cin >> A.at(i);
	}

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

	vector<vector<int>> BC(M, vector<int>(2));

	for (size_t j=0; j<M; j++) {
		cin >> BC.at(j).at(0) >> BC.at(j).at(1);
	}

	int cnt=0;
	for (size_t i=0; i<M; i++) {
		B = BC.at(i).at(0);
		C = BC.at(i).at(1);

		cnt = 0;
		for (size_t j=0; j<N; j++) {
			int val = A.at(j);
			if (val < C) {
				A.at(j) = C;
				cnt++;
			} else {
				break;
			}
			if (cnt >= B) break;
		}
	}

	cout << accumulate(A.begin(), A.end(), 0) << 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());
      |         ^~~~
      |         short
Language: C++

#include<bits/stdc++.h>
int main()
{
      std::priority_queue <int, std::vector<int>, greater<int> > pq; 
  int n,m,a,b,c;
  std::cin>>n>>m;
  for(int i=0;i<n;i++)
  {
    std::cin>>a;
    pq.push(a);
  }
  for(int i=0;i<m;i++)
  {
    std::cin>>b>>c;
    for(int j=0;j<b;j++)
    {
      pq.pop();
      pq.push(c);
    }
  }
  long long ans=0;
  while (pq.empty() == false) 
    { 
       ans= ans+ pq.top(); 
        pq.pop(); 
    } 
  std::cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:51: error: 'greater' was not declared in this scope; did you mean 'std::greater'?
    4 |       std::priority_queue <int, std::vector<int>, greater<int> > pq;
      |                                                   ^~~~~~~
      |                                                   std::greater
In file included from /usr/include/c++/14/string:49,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_function.h:353:12: note: 'std::greater' declared here
  353 |     struct greater;
      |            ^~~~~~~
a.cc:4:62: error: template argument 3 is invalid
    4 |       std::priority_queue <int, std::vector<int>, greater<int> > pq;
      |                                                              ^
a.cc:4:64: error: expected unqualified-id before '>' token
    4 |       std::priority_queue <int, std::vector<int>, greater<int> > pq;
      |                                                                ^
a.cc:10:5: error: 'pq' was not declared in this scope
   10 |     pq.push(a);
      |     ^~
a.cc:17:7: error: 'pq' was not declared in this scope
   17 |       pq.pop();
      |       ^~
a.cc:22:10: error: 'pq' was not declared in this scope
   22 |   while (pq.empty() == false)
      |          ^~
Language: C++

#include<bits/stdc++.h>
int main()
{
      priority_queue <int, std::vector<int>, greater<int> > pq; 
  int n,m,a,b,c;
  std::cin>>n>>m;
  for(int i=0;i<n;i++)
  {
    std::cin>>a;
    pq.push(a);
  }
  for(int i=0;i<m;i++)
  {
    std::cin>>b>>c;
    for(int j=0;j<b;j++)
    {
      pq.pop();
      pq.push(c);
    }
  }
  long long ans=0;
  while (pq.empty() == false) 
    { 
       ans= ans+ pq.top(); 
        pq.pop(); 
    } 
  std::cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:7: error: 'priority_queue' was not declared in this scope; did you mean 'std::priority_queue'?
    4 |       priority_queue <int, std::vector<int>, greater<int> > pq;
      |       ^~~~~~~~~~~~~~
      |       std::priority_queue
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:496:11: note: 'std::priority_queue' declared here
  496 |     class priority_queue
      |           ^~~~~~~~~~~~~~
a.cc:4:23: error: expected primary-expression before 'int'
    4 |       priority_queue <int, std::vector<int>, greater<int> > pq;
      |                       ^~~
a.cc:10:5: error: 'pq' was not declared in this scope
   10 |     pq.push(a);
      |     ^~
a.cc:17:7: error: 'pq' was not declared in this scope
   17 |       pq.pop();
      |       ^~
a.cc:22:10: error: 'pq' was not declared in this scope
   22 |   while (pq.empty() == false)
      |          ^~