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

#include<bits/stdc++.h>
int main()
{
     std::priority_queue <int, 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:32: error: 'vector' was not declared in this scope
    4 |      std::priority_queue <int, vector<int>, greater<int> > pq;
      |                                ^~~~~~
a.cc:4:32: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:4:42: error: template argument 2 is invalid
    4 |      std::priority_queue <int, vector<int>, greater<int> > pq;
      |                                          ^
a.cc:4:42: error: template argument 3 is invalid
a.cc:4:43: error: expected unqualified-id before ',' token
    4 |      std::priority_queue <int, vector<int>, greater<int> > pq;
      |                                           ^
a.cc:4:52: error: expected initializer before '<' token
    4 |      std::priority_queue <int, 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<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include <utility>
using namespace std;

int main(){
  int i,N,M,k;
  int A[i];
  pair<int,int> pairs[1111111];
  cin >> N >> M;
  for(i=0;i<=N-1;i++)
    cin >> A[i];
  for(i=0;i<=M-1;i++)
    cin >> pairs[i].second >> pairs[i].first;
  sort(A,A+N);
  sort(pairs.first,pairs+M.first,greater<int>());
  int sum = 0;
  for(i=0;i<=M-1;i++)
    sum += pairs[i].first;
  int count = 0;
  for(i=0;i<=M-1;i++){
    sum += pairs[count].first - A[i];
    count++;
    if(pairs[count].first <= A[i])
      goto END;
    };
  END:;
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: request for member 'first' in 'pairs', which is of non-class type 'std::pair<int, int> [1111111]'
   18 |   sort(pairs.first,pairs+M.first,greater<int>());
      |              ^~~~~
a.cc:18:28: error: request for member 'first' in 'M', which is of non-class type 'int'
   18 |   sort(pairs.first,pairs+M.first,greater<int>());
      |                            ^~~~~
Language: C++

#include<bits/stdc++.h>
int main()
{
      priority_queue <int, 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, 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, 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 <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <vector>

using namespace std;
// #define int long long
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

int main(int argc, const char * argv[]) {

    // source code
    // char s[4];
    int N, M;
    cin >> N >> M;
    int A[N];
    rep(i, N){
      cin >> A[i];
    }
    std::vector<int> B(M);
    std::vector<int> C(M);
    rep(i, M){
      cin >> B[i] >> C[i];
    }

    rep(i, M){
      sort(A, A+N);
      int minElementIndex = std::min_element(C.begin(), C.end()) - C.begin();
      int minElement = *std::min_element(C.begin(), C.end());
      rep(j, B[minElementIndex]){
        if (A[j] < minElement){
          A[j] = minElement;
        }
      }
      B.erase(B.begin()+minElementIndex);
      C.erase(C.begin()+minElementIndex);

    }

    long sum = 0;
    rep(i, N){
      sum = sum + A[i];
    }
    cout << sum <<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:41:7: error: 'sort' was not declared in this scope; did you mean 'short'?
   41 |       sort(A, A+N);
      |       ^~~~
      |       short
a.cc:42:34: error: 'min_element' is not a member of 'std'; did you mean 'tuple_element'?
   42 |       int minElementIndex = std::min_element(C.begin(), C.end()) - C.begin();
      |                                  ^~~~~~~~~~~
      |                                  tuple_element
a.cc:43:30: error: 'min_element' is not a member of 'std'; did you mean 'tuple_element'?
   43 |       int minElement = *std::min_element(C.begin(), C.end());
      |                              ^~~~~~~~~~~
      |                              tuple_element
Language: C++

#include <cstdio>
#include <vector>

int compar(const void *a, const void *b)
{
    return *(long *)a > *(long *)b ? 1 : -1;
}

int main()
{
    int N, M;
    scanf("%d %d", &N, &M);
    long A[N];
    long B[M], C[M];
    for(int i=0; i<N; i++)
        scanf(" %ld", &A[i]);
    for(int i=0; i<M; i++)
        scanf(" %ld %ld", &B[i], &C[i]);
    
    for(int i=0; i<M; i++){
        qsort(A, N, sizeof(long), compar);
        int num=B[i];
        for(int j=0; j<N; j++){
            if(A[j] >= C[i] || num <= 0) break;
            A[j] = C[i];
            num--;
        }
    }

    long sum = 0;
    for(int i=0; i<N; i++){
        sum += A[i];
    }
    printf("%ld\n", sum);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'qsort' was not declared in this scope
   21 |         qsort(A, N, sizeof(long), compar);
      |         ^~~~~
Language: C++

int main() {
    long long int N,M,B,C;
    cin >> N >> M;
    vector<long long int> A(N);
    for (auto &a:A) cin >> a;
    
    for (long long int i = 0; i < M; i++)
    {
        cin >> B >> C;
        sort(A.begin(),A.end());
        for (long long int j = 0; j < B; j++){
            if(A[j] < C)A[j] = C;
        }
        // for(auto &a:A)cout << a << ",";
        // cout << endl;
    }
    long long int sum = 0;
    for(auto &a:A){
        sum += a; 
    }

    cout << sum << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> N >> M;
      |     ^~~
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<long long int> A(N);
      |     ^~~~~~
a.cc:4:12: error: expected primary-expression before 'long'
    4 |     vector<long long int> A(N);
      |            ^~~~
a.cc:5:18: error: 'A' was not declared in this scope
    5 |     for (auto &a:A) cin >> a;
      |                  ^
a.cc:10:14: error: 'A' was not declared in this scope
   10 |         sort(A.begin(),A.end());
      |              ^
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |         sort(A.begin(),A.end());
      |         ^~~~
      |         short
a.cc:18:17: error: 'A' was not declared in this scope
   18 |     for(auto &a:A){
      |                 ^
a.cc:22:5: error: 'cout' was not declared in this scope
   22 |     cout << sum << endl;
      |     ^~~~
a.cc:22:20: error: 'endl' was not declared in this scope
   22 |     cout << sum << endl;
      |                    ^~~~
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);
	}

	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);

		auto result = find_if(v.begin(), v.end(), [](int x) { return x < C; });
	    if (result == v.end()) continue;
	    else {
			cnt = 0;
			for (size_t j=0; j<N; j++) {
				int val = A.at(j);
				if (val < C) {
					A.at(j) = C;
					cnt++;
				}
				if (cnt >= B) break;
			}
	    }
	}

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

}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:39: error: 'v' was not declared in this scope
   27 |                 auto result = find_if(v.begin(), v.end(), [](int x) { return x < C; });
      |                                       ^
a.cc: In lambda function:
a.cc:27:82: error: 'C' is not captured
   27 |                 auto result = find_if(v.begin(), v.end(), [](int x) { return x < C; });
      |                                                                                  ^
a.cc:27:60: note: the lambda has no capture-default
   27 |                 auto result = find_if(v.begin(), v.end(), [](int x) { return x < C; });
      |                                                            ^
a.cc:8:16: note: 'int C' declared here
    8 |         int B, C;
      |                ^
a.cc: In function 'int main()':
a.cc:27:31: error: 'find_if' was not declared in this scope
   27 |                 auto result = find_if(v.begin(), v.end(), [](int x) { return x < C; });
      |                               ^~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    int i, j;
    for(i = 0; i < N; i++)
        cin >> A[i];
    
    sort(A.begin(), A.end());

    long long sum = 0;

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

    int count = 0;

    for(i = 0; i < M; i++) {
        for(j = 0; j < N; j++) {
            if(A[j] < C[i] && count < B[i]) {
                A[j] = C[i];
                count++;
            }
        }
        count = 0;
        sort(A.begin(), A.end());
    }

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

    cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: expected ',' or ';' before 'for'
   20 |     for(i = 0; i < M; i++) {
      |     ^~~
a.cc:20:26: error: expected ';' before ')' token
   20 |     for(i = 0; i < M; i++) {
      |                          ^
      |                          ;
Language: C++

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

int main() {
  int n,m;
  cin >> n >> m;

  long a[n];
  for(int i=0;i<n;i++) {
    cin >> a[i];
  }
  sort(a,a+n);

  int b[m],c[m];
  for(int i=0;i<m;i++) {
    cin >> b[i] >> c[i];
  }
  
  long ans=0;
  for(int i=0;i<m;i++) {
    for(int j=0;j<b[i];j++) {
      if(a[0]<c[i]) {
        a[0]=c[i];
        sort(a,a+n);
      }
    }
  }
  for(int i=0;i<n;i++){
    ans += a[i];
  }
  
  cout << ans << endl;
  return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin >>N>>M;
  vector<int>A;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  vector<vector<int>>data(M,vector<int>(2));
  for(int i=0;i<M;i++){
    for(int j=0;j<2;j++){
      cin>>data.at(i).at(j);
    }
  }
  
  int my_min(vector<int>A){
    int small=A.at(0);
    for(int i=0;i<N;i++){
      if(small>A.at(i)){
        small=A.at(i);
      }
    }
    return small;
  }
  
  for(int i=0;i<M;i++){
    for(int k=0;k<data.at(i).at(0);k++){
      int A_min=my_min(vector<int>A);
      if(A_min <data.at(i).at(1)){
        A_min=data.at(i).at(1);
      }
    }
  }
  
  int answer=0;
  for(int i=0;i<N;i++){
    answer+=A.at(i);
  }
  cout << answer <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:27: error: a function-definition is not allowed here before '{' token
   17 |   int my_min(vector<int>A){
      |                           ^
a.cc:29:35: error: expected primary-expression before 'A'
   29 |       int A_min=my_min(vector<int>A);
      |                                   ^
a.cc:29:17: error: 'my_min' was not declared in this scope; did you mean 'A_min'?
   29 |       int A_min=my_min(vector<int>A);
      |                 ^~~~~~
      |                 A_min
Language: C++

#include <iostream>
#include <vector>
#include <tuple>

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;

  std::vector<std::pair<long, long> > a;

  for (int i = 1; i <= n; i++) {
    int index;
    cin >> index;
    a.push_back(std::make_pair(index, 1));
  }

  for (int i = 0; i < m; i++) {
    int b, c;
    cin >> b >> c;
    a.push_back(std::make_pair(c, b));
  }

  std::sort(a.begin(), a.end(), greater<pair<long,long> >());

  long ans = 0;
  for (int i = 0; i < a.size(); i++) {
    if (n == 0) {
      break;
    }

    if (n > a[i].second) {
      ans = ans + a[i].first * a[i].second;
      n = n - a[i].second;
    } else {
      ans = ans + a[i].first * n;
      break;
    }
  }

  cout << ans << "\n";

}


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

#include <iostream>
#include <vector>
#include <tuple>

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;

  std::vector<std::pair<long, long> > a;

  for (int i = 1; i <= n; i++) {
    int index;
    cin >> index;
    a.push_back(std::make_pair(index, 1));
  }

  for (int i = 0; i < m; i++) {
    int b, c;
    cin >> b >> c;
    a.push_back(std::make_pair(c, b));
  }

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

  long ans = 0;
  for (int i = 0; i < a.size(); i++) {
    if (n == 0) {
      break;
    }

    if (n > a[i].second) {
      ans = ans + a[i].first * a[i].second;
      n = n - a[i].second;
    } else {
      ans = ans + a[i].first * n;
      break;
    }
  }

  cout << ans << "\n";

}


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

#include<bits/stdc++.h>
using namespace std;
int A[1001000];
pair<int,int> BC[100100];
int main()
{
	int N,M;
	cin>>N>>M;
	for(int i=0;i<N;i++)
		cin>>A[i];
	for(int i=0;i<M;i++)
		cin>>BC[i].second>>BC[i].first;
	sort(BC,BC+M);
	sort(A,A+N);
	int j=0
	for(int i=0;i<M;i++)
	{
		for(;j<BC[i].second;j++)
		{
			if(A[j]>=BC[i].first)
				break;
			A[j+N]=BC[i].first;
		}
	}
	long long Sum=0;
	for(int i=j;i<N+j;i++)
		Sum+=A[i];
	cout<<Sum<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: expected ',' or ';' before 'for'
   16 |         for(int i=0;i<M;i++)
      |         ^~~
a.cc:16:21: error: 'i' was not declared in this scope
   16 |         for(int i=0;i<M;i++)
      |                     ^
Language: C++

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

int main() {
	
	long long n, m, ans = 0;
    cin >> n >> m;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a.at(i);
    }

    for(long long j = 1; j <= m; j++){
        long t, u;
        cin >> t >> u;
        vector<int> v(t, u);
    	copy(v.begin(), v.end(), back_inserter(a));
    }
    sort(a.begin(), a.end(), std::greater<int>() );
/*
    for(int i = 0; i < n; i++){
        ans += a.at(i);
    }

    /*for(int i = 0; i < a.size(); i++){
        cout << a.at(i) << endl;
    }*/

    cout << ans << endl;
*/


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:2: error: expected primary-expression before '/' token
   33 | */
      |  ^
a.cc:36:9: error: expected primary-expression before 'return'
   36 |         return 0;
      |         ^~~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int cards[100000];

int main(){
	int n, m;
	cin >> n >> m;
	int64_t sum = 0;

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

	sort(cards, cards+n);

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

		for(int j = 0; j < n; ++j){
			if(c > cards[j]){
				sum += c - cards[j];
				cards[j] = tmp;
				--b;
			}else{
				break;
			}
			if(b == 0){
				sort(cards, cards+n);
				break;
			}
		}
	}
	
	cout << sum << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:44: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   27 |                                 cards[j] = tmp;
      |                                            ^~~
      |                                            tm
Language: C++

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

int main() {
  int n, m, i;
  cin >> n >> m;
  
  vector<int> a(n);
  vector<vector<int>> bc(m, vector<int>(2));
  for(i = 0; i < n; i++){
    cin >> a.at(i);
  }
  for(i = 0; i < m; i++){
    cin >> bc.at(i).at(1) >> bc.at(i).at(0);
  }
  
  sort(a.begin(), a.end());
  sort(bc.begin(), bc.end());
  
  int pointa = n - 1, pointbc = m - 1, count = 0;
  long ans = 0
  while(count < n){
    if(pointa > 0 && a.at(pointa) > bc.at(pointbc).at(0)){
      ans += a.at(pointa);
      pointa--;
      count++;
    }
    else if(bc.at(0).at(1) > 0 && a.at(pointa) <= bc.at(pointbc).at(0)){
      ans += bc.at(pointbc).at(0);
      bc.at(pointbc).at(1)--;
      count++;
      if(bc.at(pointbc).at(1) == 0){
        pointbc--;
      }
    }
    else if(pointa == 0){
      ans += a.at(pointa);
      count++;
    }
  }
  
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: expected ',' or ';' before 'while'
   22 |   while(count < n){
      |   ^~~~~
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();
        Integer A[] = new Integer[n];
        Integer B[] = new Integer[m];
        Integer C[] = new Integer[m];
        for (int i=0; i<n; i++) {
            A[i] = sc.nextInt();
        }
        for (int i=0; i<m; i++) {
            B[i] = sc.nextInt();
            C[i] = sc.nextInt();
        }
        Arrays.sort(A);
        for(int i=0;i<m;i++){
            for(int j=0;j<i;i++){
                if(C[i]>A[j]){
                    A[j]=C[i];
                }
            }
            int ans = 0;
            for(int h=0; h<A.length; h++){
                ans += A[h];
            }
            System.out.println(ans);
        }
    }

Compiler output:
Main.java:30: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

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

using namespace std;

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

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

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

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

	for (long i = 0; i < M; i++) {//Bi Ciを順に
		long B_tmp = B[i];
		long C_tmp = C[i];
//		cout << "i " << i << endl;

		for (long 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;

			if (A[minIndex] < C_tmp) {
				A[minIndex] = C_tmp;
//				cout << "代入 A[minIndex] " << A[minIndex] << endl;
			}
			else {
//				cout << "break" << endl;
				break;
				//				j = B_tmp;
			}
		}

		for (long i = 0; i < N; i++) {
//			cout << A[i] << " ";
		}
//		cout << endl;
	}

//	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;


}

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

#include <iostream>
#include <vector>
#include <queue>


using namespace std;
int main()
{
    int N, M;
    cin>>N>>M;
    std::priority_queue< int, std::vector<int>, std::greater<int> > q;

    for(int i=0; i<N; i++){
        int num;
        cin>>num;
        q.push(num);
    }

    std::vector<int> C_vec;

    for(int i=0; i<M; i++){
        int B, C;
        cin>>B>>C;
        for(int j=0; j<B; j++){
            C_vec.push_back(C);
        }
    }

    std::sort(C_vec.rbegin(), C_vec.rend());

    for(int i=0; i<C_vec.size(); i++){
        int top = q.top();
        if(C_vec[i]<top)
            break;
        q.pop();
        q.push(C_vec[i]);
    }

//    for(int i=0; i<M; i++){
//        int B, C;
//        cin>>B>>C;
//        for(int j=0; j<B; j++){
//            int top = q.top();
//            if(top>C)
//                break;
//            q.pop();
//            q.push(C);
//        }
//    }

    uint64_t answer = 0;
    while(!q.empty()){
        answer+=q.top();
        q.pop();
    }

    cout<<answer<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   29 |     std::sort(C_vec.rbegin(), C_vec.rend());
      |          ^~~~
      |          qsort
a.cc:51:5: error: 'uint64_t' was not declared in this scope
   51 |     uint64_t answer = 0;
      |     ^~~~~~~~
a.cc:4:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    3 | #include <queue>
  +++ |+#include <cstdint>
    4 | 
a.cc:53:9: error: 'answer' was not declared in this scope
   53 |         answer+=q.top();
      |         ^~~~~~
a.cc:57:11: error: 'answer' was not declared in this scope
   57 |     cout<<answer<<endl;
      |           ^~~~~~
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:3:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'i'
    3 |         int n,m,a[100000],b[100000],c[100000]i,d,j,e=0;
      |                                              ^
main.c:5:9: error: 'i' undeclared (first use in this function)
    5 |     for(i=1;i<=n;i++){
      |         ^
main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:9: error: 'd' undeclared (first use in this function)
    8 |         d=a[i];
      |         ^
main.c:14:28: error: 'c' undeclared (first use in this function)
   14 |       scanf("%d %d",&b[i],&c[i]);
      |                            ^
main.c:15:11: error: 'j' undeclared (first use in this function)
   15 |       for(j=1;j<=n;j++){
      |           ^
main.c:20:22: error: 'e' undeclared (first use in this function)
   20 |     for(i=1;i<=n;i++)e+=a[i];
      |                      ^
Language: C++

#include <cstdio>
#include <vector>
static const int MAX = 100000;

struct bc
{
  long b, c;
  bc(long inputted_b, long inputted_c)
  {
    b = inputted_b;
    c = inputted_c;
  }
};

bool cmp(const bc &x, const bc &y)
{
  return x.c > y.c;
}

int main()
{
  int n, m;
  long a[MAX], b, c;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++)
  {
    scanf("%ld", &a[i]);
  }
  std::sort(a, a + n);

  std::vector<bc> change;
  for (int i = 0; i < m; i++)
  {
    scanf("%ld %ld", &b, &c);
    change.push_back(bc(b, c));
  }
  std::sort(change.begin(), change.end(), cmp);

  int count = 0;
  for (int i = 0; i < change.size(); ++i)
  {
    for (int j = 0; j < change[i].b; j++)
    {
      if (a[count] < change[i].c)
      {
        a[count] = change[i].c;
      }
      else
      {
        i = change.size();
        break;
      }
      count++;
    }
  }
  long sum;
  for (int i = 0; i < n; i++)
  {
    sum += a[i];
  }
  printf("%ld\n", sum);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:8: error: 'sort' is not a member of 'std'
   29 |   std::sort(a, a + n);
      |        ^~~~
a.cc:37:8: error: 'sort' is not a member of 'std'
   37 |   std::sort(change.begin(), change.end(), cmp);
      |        ^~~~
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);
}
  
  sort(vec.begin(), vec.end()); // vector
  
  for(int i=0; i<m; i++){
    
    int b,c;
    cin>>b>>c;
    
    for(int j=0; j<b; j++){
      if(vec.at(j)<c){
        vec.at(j)=c;}
      else{
        break;}
    }
    sort(vec.begin(), vec.end()); // vector
  }
  int sum=0;
   
  for(int i=0;i<n; i++){
    sum+=vec.at(i)}
  
  
 cout<<sum<<endl;
}
  
  
      
      
 

Compiler output:
a.cc: In function 'int main()':
a.cc:31:19: error: expected ';' before '}' token
   31 |     sum+=vec.at(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);
}
  
  sort(vec.begin(), vec.end()); // vector
  
  for(int i=0; i<m; i++){
    
    int b,c;
    cin>>b>>c;
    
    for(int j=0; j<b; j++){
      if(vec.at(j)<c){
        vec.at(j)=c;}
      else{
        break;}
    }
    sort(vec.begin(), vec.end()); // vector
  }
  sum=0;
   
  for(int i=0;i<n; i++){
    sum+=vec.at(i)}
  
  
 cout<<sum<<endl;
}
  
  
      
      
 

Compiler output:
a.cc: In function 'int main()':
a.cc:28:3: error: 'sum' was not declared in this scope
   28 |   sum=0;
      |   ^~~
Language: C++

#include <cstdio>
#include <vector>
using namespace std;
static const int MAX = 100000;

struct bc
{
  long b, c;
  bc(long inputted_b, long inputted_c)
  {
    b = inputted_b;
    c = inputted_c;
  }
};

bool cmp(const bc &x, const bc &y)
{
  return x.c > y.c;
}

int main()
{
  int n, m;
  long a[MAX], b, c;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++)
  {
    scanf("%ld", &a[i]);
  }
  std::sort(a, a + n);

  vector<bc> change;
  for (int i = 0; i < m; i++)
  {
    scanf("%ld %ld", &b, &c);
    change.push_back(bc(b, c));
  }
  std::sort(change.begin(), change.end(), cmp);

  int count = 0;
  for (int i = 0; i < change.size(); ++i)
  {
    for (int j = 0; j < change[i].b; j++)
    {
      if (a[count] < change[i].c)
      {
        a[count] = change[i].c;
      }
      else
      {
        i = change.size();
        break;
      }
      count++;
    }
  }
  long sum;
  for (int i = 0; i < n; i++)
  {
    sum += a[i];
  }
  printf("%ld\n", sum);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:8: error: 'sort' is not a member of 'std'
   30 |   std::sort(a, a + n);
      |        ^~~~
a.cc:38:8: error: 'sort' is not a member of 'std'
   38 |   std::sort(change.begin(), change.end(), cmp);
      |        ^~~~
Language: C++

#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>

using namespace std;

int N, M;

struct BC {
    int B, C;
};

bool operator<(const BC& left, const BC& right) {
    return left.C > right.C;
}

int main() {

    while (cin >> N >> M) {
        int l_max = 1, r_min = N;
        vector<int> a_v;
        for (int i = 0; i < N; i++) {
            int a;
            cin >> a;
            a_v.push_back(a);
        }
        sort(a_v.begin(), a_v.end());

        vector<BC> bc_v;
        for (int i = 0; i < M; i++) {
            BC bc;
            cin >> bc.B >> bc.C;
            bc_v.push_back(bc);
        }
        sort(bc_v.begin(), bc_v.end());

        for (int i = 0, a_i = 0; i < M; i++) {
            BC bc = bc_v.at(i);
            for (int j = 0; j < bc.B && a_i < a_v.size(); j++, a_i++) {
                if (a_v.at(a_i) < bc.C) {
                    a_v.erase(a_v.begin() + a_i);
                    a_v.insert(a_v.begin() + a_i, bc.C);
                }
            }
        }
        long int ret = 0;
        for (int i = 0; i < N; i++) {
            ret += a_v.at(i);
        }
        cout << ret << endl;
    }

    return 0;
}


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

#include <cstdio>
#include <vector>
using namespace std;
static const int MAX = 100000;

struct bc
{
  long b, c;
  bc(long inputted_b, long inputted_c)
  {
    b = inputted_b;
    c = inputted_c;
  }
};

bool cmp(const bc &x, const bc &y)
{
  return x.c > y.c;
}

int main()
{
  int n, m;
  long a[MAX], b, c;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++)
  {
    scanf("%ld", &a[i]);
  }
  sort(a, a + n);

  vector<bc> change;
  for (int i = 0; i < m; i++)
  {
    scanf("%ld %ld", &b, &c);
    change.push_back(bc(b, c));
  }
  sort(change.begin(), change.end(), cmp);

  int count = 0;
  for (int i = 0; i < change.size(); ++i)
  {
    for (int j = 0; j < change[i].b; j++)
    {
      if (a[count] < change[i].c)
      {
        a[count] = change[i].c;
      }
      else
      {
        i = change.size();
        break;
      }
      count++;
    }
  }
  long sum;
  for (int i = 0; i < n; i++)
  {
    sum += a[i];
  }
  printf("%ld\n", sum);
  return 0;
}

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

#include <iostream>
#include <array>

std::array<long,100000> cards;
int main(void){
	long N,M;
	std::cin>>N>>M;
	
	for(long i=0;i<N;i++){
		long temp;
		std::cin>>temp;
		cards.at(i) = temp;
	}

	for(long i=0;i<M;i++){
		sort(cards.begin(),cards.begin()+N);
		long B,C;
		std::cin>>B>>C;
		if(cards.at(0) < C){
			long j=0;
			while(j<B && cards.at(j) < C){
				cards.at(j) = C;
				j++;
			}
		}
	}

	long cnt = 0;
	for(long i=0;i<N;i++){
		cnt += cards.at(i);	
	}
	std::cout<<cnt<<std::endl;	
	return 0;
}


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

// #include <bits/stdc++.h>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<map>
#include<set>
#include<vector>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<numeric>
#include<string>
#include<tuple>
using namespace std;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
long N,M,B,C;
vector<long>A;
cpp_int sum;
inline void solve(void){
  in(N,M);
  A.rs(N);
  rep(i,N)in(A[i]);
  sort(all(A));
  rep(i,M){
    in(B,C);
    rep(j,B){
      if(A[j]<C)A[j]=C;
      else break;
    }
  }
  rep(i,N)sum+=A[i];
  out(sum);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Compiler output:
a.cc:49:1: error: 'cpp_int' does not name a type; did you mean 'u_int'?
   49 | cpp_int sum;
      | ^~~~~~~
      | u_int
a.cc: In function 'void solve()':
a.cc:62:11: error: 'sum' was not declared in this scope
   62 |   rep(i,N)sum+=A[i];
      |           ^~~
a.cc:63:7: error: 'sum' was not declared in this scope
   63 |   out(sum);
      |       ^~~
Language: C++

#include <iostream>
#include <array>

std::array<long,100000> cards;
int main(void){
	long N,M;
	std::cin>>N>>M;
	
	for(long i=0;i<N;i++){
		long temp;
		std::cin>>temp;
		cards.at(i) = temp;
	}

	for(long i=0;i<M;i++){
		std::sort(cards.begin(),cards.begin()+N);
		long B,C;
		std::cin>>B>>C;
		if(cards.at(0) < C){
			long j=0;
			while(j<B && cards.at(j) < C){
				cards.at(j) = C;
				j++;
			}
		}
	}

	long cnt = 0;
	for(long i=0;i<N;i++){
		cnt += cards.at(i);	
	}
	std::cout<<cnt<<std::endl;	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   16 |                 std::sort(cards.begin(),cards.begin()+N);
      |                      ^~~~
      |                      qsort
Language: C++

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

int main() {
    int N, M;
    int long sum = 0;
    int count = 0;
    int now = 0;
    cin >> N >> M;
    vector<long int> A(N);
    vector<int> B(M);
    vector<long int> C(M);
    vector<long int> D(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);
        D.at(i) = C.at(i);
    }
    sort(A.begin(), A.end());
    sort(D.begin(), D.end());
    reverse(D.begin(), D.end());

    for (int j = 0; j < M; j++) {
        if (C.at(j) == D.at(0)) {
            now = j;
            break;
        }
    }

    for (int i = 0; i < N; i++) {
        if (A.at(i) > D.at(count)) {
            break;
        }
        else {
            A.at(i) = D.at(count);
            B.at(now) -= 1;
            if (B.at(now) == 0) {
                count++;
                if (count == M) {
                    break;
                }
                C.at(now) = 0;
                for (int j = 0; j < M; j++) {
                    if (C.at(j) == D.at(count)) {
                        now = j;
                        break;
                    }
                }
            }
        }
    }

    for (int i = 0; i < N; i++) {
        sum += A.at(i);
    }

    cout << sum << endl;



}

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(A.begin(), A.end());
      |     ^~~~
      |     short
a.cc:25:5: error: 'reverse' was not declared in this scope
   25 |     reverse(D.begin(), D.end());
      |     ^~~~~~~
Language: C++

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

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

    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    sort(a.begin(), a.end());

    for (int i = 0; i < m; i++) {
        int max_index;
        long int new_val;
        cin >> max_index >> new_val;
        for (int j = 0; j < max_index; j++) {
            if (a[j] >= new_val)
                break;
            else
                a[j] = new_val;
        }
        sort(a.begin(), a.end());
    }
    long int sum = 0;
    for (int i = 0; i < a.size(); i++) {
        sum += a[i];
    }
    cout << sum << endl;

    return 0;
}


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

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

int main(){
	int n,m;
	cin >> n >> m;
	vector<long> all_cards;
	//read A
	for(int i=0; i<n;i++){
		long a_i;
		cin >> a_i;
		all_cards.push_back(a_i);
	}
	sort(all_cards.begin(),all_cards.end(),std::greater<long>());
	//read B,C
	for(int i=0; i<m;i++){
		long b_i, c_i;
		cin >> b_i >> c_i;
		for(int j=0;j<b_i;j++){
			if(all_cards[all_cards.size()-1] < c_i){
			all_cards.pop_back();
			all_cards.push_back(c_i);
			sort(all_cards.begin(),all_cards.end(),std::greater<int>());
			}
		}
	}
	long sum = 0;
	for(int i=0;i<n;i++){
//		cout << all_cards[i] << endl;
		sum += all_cards[i];
	}
	cout << sum << endl;
	return 0;
}


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

#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

using namespace std;

int main() {
    int N,M;
    cin >> N >> M;
    vector<long long> A;
    rep(i,N){
        long long a;
        cin >> a;
        A.push_back(a);
    }

    rep(i,M) {
        long long B,C;
        cin >> B >> C;
        sort(A.begin(),A.end());
        rep(i,B) {
            if(A[i]<C) A[i]=C:
            else break;
        }
    }
    cout << accumulate(A.begin(),A.end(),0L) <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:30: error: expected ';' before ':' token
   23 |             if(A[i]<C) A[i]=C:
      |                              ^
      |                              ;
Language: C++

#include <vector>
#include <algorithm>

class BC{
 public:
  int B;
  int C;
  BC(const int B_, const int C_){
    B = B_;
    C = C_;
  }
};

int main(){
  int N,M;
  scanf("%d%d",&N,&M);
  int A[N];
  for(int i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  std::vector<BC> bc;
  for(int i=0;i<M;i++){
    int B,C;
    scanf("%d%d",&B,&C);
    bc.push_back(BC(B,C));
  }
  std::sort(A,A+N);
  std::sort(bc.begin(),
	    bc.end(),
	    [](const BC& a,const BC& b){return a.C > b.C;}
	    );

  int count = 0;
  for(int i=0;i<M;i++){
    for(int j=0;j<bc[i].B;j++){
      if(A[count] < bc[i].C){
	A[count] = bc[i].C;
	count++;
      }else{
	break;
      }
    }
  }
  long sum = 0;
  for(int i=0;i<N;i++){
    sum += A[i];
  }
  printf("%ld\n",sum);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'scanf' was not declared in this scope
   16 |   scanf("%d%d",&N,&M);
      |   ^~~~~
a.cc:48:3: error: 'printf' was not declared in this scope
   48 |   printf("%ld\n",sum);
      |   ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <algorithm>
  +++ |+#include <cstdio>
    3 |
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 B[MAX_NUM];
	static int C[MAX_NUM];
	int i, j;
	int cnt;
	long long sum = 0;

	scanf("%d %d", &N, &M);
	for (i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}
	for (i = 0; i < M; i++) {
		scanf("%d %d", &B[i], &C[i]);
	}

	for (i = 0; i < M; i++) {
		qsort(A, N, sizeof(int), (int(*)(const void *, const void *))compar);
		cnt = 0;
		for (j = 0; j < N; j++) {
			if (A[j] < C[i]) {
				A[j] = C[i];
				cnt++;
			}
			if (cnt == B[i]) {
				break;
			}
		}
	}

	for (i = 0; i < N; i++) {
		sum += A[i];
	}
	printf("%lld\n", sum);

	return 0;
}

Compiler output:
/usr/bin/ld: /tmp/ccpxxVHg.o: in function `main':
a.cc:(.text+0xe0): undefined reference to `compar(int const*, int const*)'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n,m,count,b;
  	long long c;
    long long ans = 0;
  	count = 0;
    cin >> n>>m;
    vector<pair<long long,int>> card(n+m);
    for (int i=0;i<n;i++){
        cin >> c;
        card.at(i) = make_pair(c,1);
    }
    for (int i=n;i<n+m;i++){
        cin >> b>>c;
        card.at(i) = make_pair(c,b);
    }
    sort(card.begin(), card.end());
    reverse(card.begin(), card.end());
    for (int i = 0;count <n;i++){
        if (n-count-card.at(i).second > 0){
            ans +=card.at(i).first * card.at(i).second;
        }
        else {
            ans +=card.at(i).first * (n-count); 
        }

Compiler output:
a.cc: In function 'int main()':
a.cc:27:10: error: expected '}' at end of input
   27 |         }
      |          ^
a.cc:21:33: note: to match this '{'
   21 |     for (int i = 0;count <n;i++){
      |                                 ^
a.cc:27:10: error: expected '}' at end of input
   27 |         }
      |          ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> a;
  
  for(int i=0; i<N; ++i){
    long int A;
    cin>>A;
    a.push_back(A);
  }
  
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int mn=a[N-1];
  
  vector<pair<long int,long int>> p;
  for(int i=0; i<M; ++i){
    long int B,C;
    cin>>B>>C;
    if(C>mn) a.push_back(make_pair(C,B));
  }
  
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  
  int t=0;
  for(int i=0; i<p.size(); ++i){
    if(t>N) break;
    for(int j=0; j<p[i].second; ++j){
      a.push_back(p[i].first);
      t+=p[i].second;
    }
  }
  
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  long int 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:28:25: error: no matching function for call to 'std::vector<int>::push_back(std::pair<long int, long int>)'
   28 |     if(C>mn) a.push_back(make_pair(C,B));
      |              ~~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::pair<long int, long int>' to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::pair<long int, long int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
Language: C++

//Keep working hard :)
#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long

void fileIO()
{
        #ifndef ONLINE_JUDGE
        freopen("int.txt","r",stdin);
        freopen("out.txt","w",stdout);
        #endif
}
int32_t main()
{
	IOS;
       // fileIO();
        multiset<int> s;
        int n,m;
        cin >> n >> m;
        for(int i = 0; i < n; i++)
        {
                int x;
                cin >> x;
                s.insert(x);
        }
        for(int i = 0; i < m; i++)
        {
                int b,c;
                cin >> b >> c;
                for(int j = 0; j < b; j++)
                {
                        auto it = s.begin();
                        if(*it < c)
                        {
                                s.erase(it);
                                s.insert(c);
                        }
                        else
                        {
                                break;
                        }
                }
        }
        ll temp = 0;
        for(auto i : s)
        {
                temp += i;
        }
        cout << temp;
	return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:46:9: error: 'll' was not declared in this scope
   46 |         ll temp = 0;
      |         ^~
a.cc:49:17: error: 'temp' was not declared in this scope; did you mean 'tm'?
   49 |                 temp += i;
      |                 ^~~~
      |                 tm
a.cc:51:17: error: 'temp' was not declared in this scope; did you mean 'tm'?
   51 |         cout << temp;
      |                 ^~~~
      |                 tm