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

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

typedef long long ll;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(ll i=0; i<(ll)n;i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)

/*--------------------------------------------*/

int main(){
  ll n, m;
  cin >> n >> m;
  
  priority_queue<ll> pq;
  
  ll a;
  
  rep(i,n){
      cin >> a;
      pq.push(a);
  }
  
  rep(i,m){
      a = pq.pop();
      a/=2;
      pq.push(a);
  }
  
  ll ans = 0;
  
  while(!pq.empty()){
      ans += pq.top();
      pq.pop();
  }
  
  cout << ans << endl;
  
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:17: error: void value not ignored as it ought to be
   39 |       a = pq.pop();
      |           ~~~~~~^~
Language: C

#include <stdio.h>
#include <stdlib.h>
 
int compare_int(const void *a, const void *b) {
  return *(int*)a - *(int*)b;
}
 
int main() {
  int N, M;
  scanf("%d %d",&N,&M);
  int A[N];
  for (int i = 0; i < N; i++) {
    scanf("%d",&A[i]);
  }
  qsort(A, N, sizeof(int), compare_int);
  for (int i = 0; i < M; i++) {
    A[N-1] /= 2;
    int max = 0, p = 0;
    for (int j = 0; j <N; j++) {
      if (max < A[j]) {
        max = A[j];
        p = j;
      }
    }
    int tmp = A[N-1];
    A[N-1] = A[j];
    A[j] = tmp;
  }
  long int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += A[i];
  }
  printf("%ld\n",sum);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:26:16: error: 'j' undeclared (first use in this function)
   26 |     A[N-1] = A[j];
      |                ^
main.c:26:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

int main()
{
  // int��v�f�Ɏ��D�揇�ʕt���L���[�B
  // �~���ɏ�������
  std::priority_queue<int64_t> que;
  int N,M;
	int64_t A;
  cin >> N >> M;
	for(int i=0;i<N;i++){
		cin >> A;
		que.push(A);
		
	}
  
	while(M>0){
		que.push(que.top()/2);
		que.pop();
		
		M--;
	}


  // �������ɏo�͂���
	int64_t sum=0;
  while (!que.empty()) {
    //std::cout << que.top() << std::endl;
  	sum += que.top();
  	que.pop();
  }
	cout << sum << endl;
	return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

public class Main{
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static void main(String[] args){
        int N, M;
        PriorityQueue<Integer> A = new PriorityQueue<>((x,y) -> -x+y);
        long total = 0;
        {
            int[] a = in.ii(); N = a[0]; M = a[1];
            a = in.ii();
            for(int i = 0; i < N; i++){
                A.add(a[i]);
                total += a[i];
            }
        }
        for(int i = 0; i < M; i++){
            int x = A.poll();
            total -= x-x/2;
            A.add(x/2);
        }
        out.println(total);
        out.flush();
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main{
      | ^~~~~~
Language: C++

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

signed main(){
    if(N*M>=10000000){
        cout<<0<<endl;
        return 0;
    }
    int sum=0;
    for(int i=0;i<10000000;i++){
        sum+=i;
    }
    cout<<sum<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:8: error: 'N' was not declared in this scope
    6 |     if(N*M>=10000000){
      |        ^
a.cc:6:10: error: 'M' was not declared in this scope
    6 |     if(N*M>=10000000){
      |          ^
Language: Java

import java.util.Scanner;
import java.util.PriorityQueue;

public class PowerfulDiscountTicket {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    long N = scanner.nextLong(); // Items
    long M = scanner.nextLong(); // Discount tickets

    PriorityQueue<Long> queue = new PriorityQueue<>();
    while (scanner.hasNextInt()) {
      long price = scanner.nextInt();
      // Use the negative version because PriorityQueue is a min heap!
      queue.add(-price);
    }

    while (M-- > 0) {
      long negativePrice = queue.poll();
      queue.add(negativePrice / 2);
    }

    long totalPrice = 0;
    for (long negativePrice : queue) {
      long price = -negativePrice;
      totalPrice += price;
    }

    System.out.println(totalPrice);
  }
}


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

#include <bits/stdc++.h>

using namespace std;

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

    priority_queue<int> q;

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

    for (int i = 0; i < M; i++)
    {
        int n = q.top();
        q.pop();
        q.push(n / 2);
    }

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

    cout << sum << endl;

    return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e17;
const int INT_INF = 1e9;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 0; i <= n; i++)

template<int mod,int base=10007>
struct rolliha{
    vector<ll> hsh,pwr;
    ll umod(ll n) { return (n % mod + mod) % mod; }
    rolliha() {}
    rolliha(const string &s){
        int sz = (int)s.size();
        hsh.assign(sz+1,0);
        pwr.assign(sz + 1, 0);
        pwr[0] = 1;
        rep(i,sz){
            hsh[i + 1] = umod(hsh[i] * base + s[i]);
            pwr[i + 1] = umod(pwr[i] * base);
        }
    }
    ll get(int l,int r){
        return umod(hsh[r] - hsh[l] * pwr[r - l]);
    }
    ll join(ll h1,ll h2,int h2_sz){
        return umod(h1 * pwr[h2_sz] + h2);
    }
    ll rotate(ll idx,int len_s){
        return join(get(idx, len_s), get(0, idx), idx);
    }
};
using rh1=rolliha<(int)1e9+7>;
using rh2 = rolliha<(int)1e9 + 9>;
using rh=pair<rh1,rh2>;
using H = pair<ll, ll>;
rh init(const string &s) { return make_pair(rh1(s), rh2(s)); }
H get(rh &Rh, int l, int r) { return make_pair(Rh.first.get(l, r), rh.second.get(l, r)); }
H rotate(rh &Rh, int n, int sz) { return make_pair(rh.first.rotate(n, sz), rh.second.rotate(n, sz)); }

int N;
string str;

bool check(int len,rh &Rh){
    map<H, vector<int>> mp;
    rep(frm,N-len+1){
        int to = frm + len;
        mp[get(rh, frm, to)].emplace_back(frm);
    }
    for(auto& e : mp){
        int sz = e.second.size();
        if(sz==1)
            continue;
        int mn = e.second[0];
        int mx = e.second[sz - 1];
        if(mn+len<=mx)
            return true;
    }
    return false;
}

int main(){
    cin >> N >> str;
    rh Rh = init(str);
    ll ok = 0, ng = N / 2 + 1;
    while(abs(ok-ng)>1){
        ll mid = (ok + ng) / 2;
        if(check(mid,Rh)){
            ok = mid;
        }else{
            ng = mid;
        }
    }

    cout << ok << endl;
}


Compiler output:
a.cc: In function 'H get(rh&, int, int)':
a.cc:39:70: error: expected primary-expression before '.' token
   39 | H get(rh &Rh, int l, int r) { return make_pair(Rh.first.get(l, r), rh.second.get(l, r)); }
      |                                                                      ^
a.cc: In function 'H rotate(rh&, int, int)':
a.cc:40:54: error: expected primary-expression before '.' token
   40 | H rotate(rh &Rh, int n, int sz) { return make_pair(rh.first.rotate(n, sz), rh.second.rotate(n, sz)); }
      |                                                      ^
a.cc:40:78: error: expected primary-expression before '.' token
   40 | H rotate(rh &Rh, int n, int sz) { return make_pair(rh.first.rotate(n, sz), rh.second.rotate(n, sz)); }
      |                                                                              ^
a.cc: In function 'bool check(int, rh&)':
a.cc:49:18: error: expected primary-expression before ',' token
   49 |         mp[get(rh, frm, to)].emplace_back(frm);
      |                  ^
Language: C++

#include<fstream>
#include<string>
#include<iostream>
#include<sstream>
#include<iterator>
#include<cmath>
#include <cstdio>
#include <queue>
 
using namespace std;
 
int main(){
 int N;
 int M;
 cin >> N >> M;
 int A[N];
 int i;
 int j;
 int tmp;
 for(i=0;i<N;++i){
   cin >> A[i];}
for(j=0;j<M;++j){
    priority_queue<int> q;
    for (i=0; i < N; ++i) {
        q.push(A[i]);
    }
    q.top() /= 2;
}
 int count = 0;
 for(i=0;i<N;++i){
    count += A[i];
 }
 cout << count << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:13: error: assignment of read-only location 'q.std::priority_queue<int>::top()'
   27 |     q.top() /= 2;
      |     ~~~~~~~~^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N, M;
  cin >> N >> M;
  priority_queue<int> que;
  rep(i,N){
    int a;
    cin >> a;
    que.push(a);
  }

  rep(i,M){
    int p = que.top(); que.pop();
    i(p > 0){
      p >>= 1;
    }
    que.push(p);
  }

  ll ret = 0;
  while(!que.empty()){
    int p = que.top(); que.pop();
    ret += p;
  }
  cout << ret << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:6: error: 'i' cannot be used as a function
   23 |     i(p > 0){
      |     ~^~~~~~~
Language: C

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

int compare(const void *a, const void *b){
    return *(int *)a - *(int *)b;
}

int main(void){
    long long wa = 0;
    int N, M;
    scanf("%i %i", &N, &M);
    int A[N];
    int B[30] = {};
    for (int i = 0; i < N; i++){
        scanf("%i", &A[i]);
    }
    qsort(A, N, sizeof(int), compare);
    for (int i = 0; i < N; i++){
        for (int j = 0; j < 30; j++){
            if (A[i] >= (1<<j) && A[i] <= (1<<(j+1)){
                B[j]++;
            }
        }
    }
    for (int i = 29; i >= 0; i--){
        if (B[i] == 0){
            continue;
        }
        if (!M){
            break;
        }
        int k = fmin(M, B[i]);
        for (int j = 0; j < k; j++){
            A[N - 1 - j] /= 2;
        }
        M -= k;
        if (i > 0){
            B[i - 1] += k;
        }
        if (M){
            qsort(A, N, sizeof(int), compare);
        }
    }
    for (int i = 0; i < N; i++){
        wa += A[i];
    }
    printf("%lli", wa);
}

Compiler output:
main.c: In function 'main':
main.c:21:53: error: expected ')' before '{' token
   21 |             if (A[i] >= (1<<j) && A[i] <= (1<<(j+1)){
      |                ~                                    ^
      |                                                     )
main.c:24:9: error: expected expression before '}' token
   24 |         }
      |         ^
Language: C++

#include<fstream>
#include<string>
#include<iostream>
#include<sstream>
#include<iterator>
#include<cmath>
#include <cstdio>
#include <queue>
 
using namespace std;
 
int main(){
 int N;
 int M;
 cin >> N >> M;
 int A[N];
 int i;
 int j;
 int tmp;
 for(i=0;i<N;++i){
   cin >> A[i];}
for(j=0;j<M;++j){
    tmp = 0;
    priority_queue<int> q;
    for (i=0; i < N; ++i) {
        q.push(A[i]);
    }
    while (!q.empty()) {
        if(tmp==0){
        A[i] = q.top()/2;
        tmp++;}
        else A[i] = q.top();
        q.pop;}
}
 int count = 0;
 for(i=0;i<N;++i){
    count += A[i];
 }
 cout << count << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:11: error: invalid use of non-static member function 'void std::priority_queue<_Tp, _Sequence, _Compare>::pop() [with _Tp = int; _Sequence = std::vector<int, std::allocator<int> >; _Compare = std::less<int>]'
   33 |         q.pop;}
      |         ~~^~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_queue.h:771:7: note: declared here
  771 |       pop()
      |       ^~~
Language: C++

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

int main()
{
  long long N, M, A, max, sum;
  cin >> N >> M;

  priority_queue<long long> S;

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

  for (int i = 0; i < M; i++)
  {
    max = S.top();
    S.pop;
    S.push(max / 2);
  }

  for (int i = 0; i < N; i++)
  {
    sum += S.top();
    S.pop();
  }

  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:7: error: invalid use of non-static member function 'void std::priority_queue<_Tp, _Sequence, _Compare>::pop() [with _Tp = long long int; _Sequence = std::vector<long long int, std::allocator<long long int> >; _Compare = std::less<long long int>]'
   20 |     S.pop;
      |     ~~^~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:771:7: note: declared here
  771 |       pop()
      |       ^~~
Language: C++

#include<fstream>
#include<string>
#include<iostream>
#include<sstream>
#include<iterator>
#include<cmath>
#include <cstdio>
#include <queue>
 
using namespace std;
 
int main(){
 int N;
 int M;
 cin >> N >> M;
 int A[N];
 int i;
 int j;
 int tmp;
 for(i=0;i<N;++i){
   cin >> A[i];}
for(j=0;j<M;++j){
    tmp = 0;
    priority_queue<int> q;
    for (i=0; i < N; ++i) {
        q.push(a[i]);
    }
    while (!q.empty()) {
        if(tmp==0){
        A[i] = q.pop()/2;
        tmp++;}
        else A[i] = q.pop();}
}
 int count = 0;
 for(i=0;i<N;++i){
    count += A[i];
 }
 cout << count << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:16: error: 'a' was not declared in this scope
   26 |         q.push(a[i]);
      |                ^
a.cc:30:23: error: invalid operands of types 'void' and 'int' to binary 'operator/'
   30 |         A[i] = q.pop()/2;
      |                ~~~~~~~^~
      |                     |  |
      |                     |  int
      |                     void
a.cc:32:26: error: void value not ignored as it ought to be
   32 |         else A[i] = q.pop();}
      |                     ~~~~~^~
Language: C++

#include<bits/stdc++.h>

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;

    int x;
    priority_queue<int> pq;
    long long result = 0;

    REPI(i, n){
        cin >> x;
        pq.push(x);
        result += x;
    }

    while(m--){
        int top = pq.top();
        pq.pop();
        int after = top / 2;
        res -= (top - after);
        pq.push(after);
    }
    cout << result;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'res' was not declared in this scope
   29 |         res -= (top - after);
      |         ^~~
Language: C++

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

int main() {
	ios::sync_with_stdio(false);

	int n, m;

	cin >> n >> m;

	vector<int> plice(n);

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

	int tmp;

	for (int i = 0; i < m; i++) {
		plice[0] /= 2;
		if (plice[0] >= plice[1]) {
			continue;
		}
		else {
			for (int j = 2; j < n; j++) {
				if (plice[0] >= plice[j]) {
					plice.insert(plice.begin() + j - 1, plice[0]);
					plice.erase(plice.begin());
				}
			}
		}
	}



	long long int r = 0;

	for (int i = 0; i < n; i++) {
		r += q.top();
		q.pop();
	}

	cout << r;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:22: error: 'q' was not declared in this scope
   43 |                 r += q.top();
      |                      ^
Language: C++

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

int main() {
  long long N, M, S = 0, H = 0;
  cin >> N >> M;
  vector<double> vec1(N);
  for(int i = 0; i < N; i++){
    cin >> vec1[i];
  }
  for(int i = 0; i < M; i++){
    S = vec1.top() / 2;
    vec1.pop();
    vec1.push(S);
  }
  for(int i = 0; i < N; i++){
    H += vec1[i];
  }
  cout << H <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: 'class std::vector<double>' has no member named 'top'
   12 |     S = vec1.top() / 2;
      |              ^~~
a.cc:13:10: error: 'class std::vector<double>' has no member named 'pop'
   13 |     vec1.pop();
      |          ^~~
a.cc:14:10: error: 'class std::vector<double>' has no member named 'push'
   14 |     vec1.push(S);
      |          ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int n, m;
    cin >> n >>m;
    pritority_queue<int> q;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        q.push(a);
    }
    for(int i = 0; i < n; i++){
        int a = q.top(); q.pop();
        q.push(a/2);
    }
    long long ans = 0;
    for(int i = 0; i < n; i++){
        ans += q.top(); q.pop();
    }
    cout << ans << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'pritority_queue' was not declared in this scope
    8 |     pritority_queue<int> q;
      |     ^~~~~~~~~~~~~~~
a.cc:8:21: error: expected primary-expression before 'int'
    8 |     pritority_queue<int> q;
      |                     ^~~
a.cc:12:9: error: 'q' was not declared in this scope
   12 |         q.push(a);
      |         ^
a.cc:15:17: error: 'q' was not declared in this scope
   15 |         int a = q.top(); q.pop();
      |                 ^
a.cc:20:16: error: 'q' was not declared in this scope
   20 |         ans += q.top(); q.pop();
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

int main(){
  int n,m;cin >> n >> m;
  priority_queue<int> que;
  for(int i=0;i<n;i++){
    int x;cin >> x;
    que.emplace(x);
  }
  while(m--){
    auto p = que.top();
    que.pop();
    que.emplace(p/2);
  }
  while(que.size()){
    autp p = que.top();
    que.pop();
    ret += p;
  }
  cout << ret << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'autp' was not declared in this scope; did you mean 'auto'?
   27 |     autp p = que.top();
      |     ^~~~
      |     auto
a.cc:29:5: error: 'ret' was not declared in this scope; did you mean 'rep'?
   29 |     ret += p;
      |     ^~~
      |     rep
a.cc:29:12: error: 'p' was not declared in this scope
   29 |     ret += p;
      |            ^
a.cc:31:11: error: 'ret' was not declared in this scope; did you mean 'rep'?
   31 |   cout << ret << endl;
      |           ^~~
      |           rep
Language: C++

#define REP(i, n) for(long long int i = 0; i < (long long int)(n); i++)
#define lint long long int

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

int main() {
	lint N, M;
	cin >> N >> M;
	priority_queue<lint, vector<lint>, greater<lint>> q;

	REP(i, N) {
		lint A;
		cin >> A;
		q.push(A);
	}

	REP(m, M) {
		lint new_A = q.top() / 2;
		q.pop();
		q.push(A);
	}

	lint shiharai = 0;
	while(!q.empty()) {
		shiharai += q.top();
		q.pop();
	}

	cout << shiharai << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:24: error: 'A' was not declared in this scope
   21 |                 q.push(A);
      |                        ^
Language: C++

#define REP(i, n) for(long long int i = 0; i < (long long int)(n); i++)
#defin lint long long int

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

auto compare = []()

int main() {
	lint N, M;
	cin >> N >> M;
	priority_queue<lint, vector<lint>, greater<lint>> q;

	REP(i, N) {
		lint A;
		cin >> A;
		q.push(A);
	}

	REP(m, M) {
		lint new_A = q.top() / 2;
		q.pop();
		q.push(A);
	}

	lint shiharai = 0;
	while(!q.empty()) {
		shiharai += q.top();
		q.pop();
	}

	cout << shiharai << endl;

	return 0;
}


Compiler output:
a.cc:2:2: error: invalid preprocessing directive #defin; did you mean #define?
    2 | #defin lint long long int
      |  ^~~~~
      |  define
a.cc:9:1: error: type-specifier invalid in lambda
    9 | int main() {
      | ^~~
a.cc: In lambda function:
a.cc:9:5: error: expected '{' before 'main'
    9 | int main() {
      |     ^~~~
a.cc: At global scope:
a.cc:9:5: error: expected ',' or ';' before 'main'
Language: C++

#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
//inline int in() { int x; scanf("%d",&x); return x;}
inline ll in() { ll x; cin >> x; return x; }
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

vector<int> to[2505];
vector<int> rto[2505];
bool reachablefrom1[2505];
bool reachableToN[2505];
bool ok[2505];

void dfs(int v) {
  if (reachablefrom1[v]) return;
  reachablefrom1[v] = true;
  for (int u : to[v]) {
    dfs(u);
  }
}
void rdfs(int v) {
  if (reachableToN[v]) return;
  reachableToN[v] = true;
  for (int u : rto[v]) {
    rdfs(u);
  }
}

int main() {
  int n = in(), m = in();
  priority_queue<int> q = in();
  rep(i,n) {
    int a;
    cin >> a;
    q.push(a);
  }
  rep(i,m) {
    int a = q.top(); q.pop();
    q.push(a/2);
  }
  ll ans = 0;
  rep(i,n) {
    ans += q.top(); q.pop();
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:82:29: error: conversion from 'll' {aka 'long long int'} to non-scalar type 'std::priority_queue<int>' requested
   82 |   priority_queue<int> q = in();
      |                           ~~^~
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

priority_queue<int> A;
int N;
int M;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N >> M;

    int temp;
    rep(i, N)
    {
        cin >> temp;
        A.push_back(temp);
    }

    int m = 0;
    while (m < M)
    {
        temp = A.top();
        if (temp == 0)
        {
            break;
        }
        else
        {
            A.pop();
            A.push_back(temp / 2);
            ++m;
        }
    }

    u64 ret = 0;
    while(!A.empty())
    {
        ret += A.top();
        A.pop();
    }

    cout << ret << "\n";

    return 0;
}



Compiler output:
a.cc:18:9: error: 'uint64_t' does not name a type
   18 | typedef uint64_t u64;
      |         ^~~~~~~~
a.cc:15:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   14 | #include <cstring>
  +++ |+#include <cstdint>
   15 | 
a.cc:20:9: error: 'uint32_t' does not name a type
   20 | typedef uint32_t u32;
      |         ^~~~~~~~
a.cc:20:9: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc: In function 'int main()':
a.cc:46:11: error: 'class std::priority_queue<int>' has no member named 'push_back'
   46 |         A.push_back(temp);
      |           ^~~~~~~~~
a.cc:60:15: error: 'class std::priority_queue<int>' has no member named 'push_back'
   60 |             A.push_back(temp / 2);
      |               ^~~~~~~~~
a.cc:65:5: error: 'u64' was not declared in this scope; did you mean 's64'?
   65 |     u64 ret = 0;
      |     ^~~
      |     s64
a.cc:68:9: error: 'ret' was not declared in this scope; did you mean 'rep'?
   68 |         ret += A.top();
      |         ^~~
      |         rep
a.cc:72:13: error: 'ret' was not declared in this scope; did you mean 'rep'?
   72 |     cout << ret << "\n";
      |             ^~~
      |             rep
Language: C

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

typedef unsigned long long int uint64;
typedef long long int          int64;
 
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void get_N (int64 *n)
{
  int cnt;
  
  cnt = scanf("%lld", n);

  return;
}

void get_NK (int64 *n, int64 *k)
{
  int cnt;
  
  cnt = scanf("%lld %lld", n, k);

  return;
}

typedef struct _tmp_t {
  int64    a;
  int64    b;
} tmp_t;


int compare_a(const void *a, const void *b)
{
  tmp_t *x;
  tmp_t *y;

  x = (tmp_t *)a;
  y = (tmp_t *)b;

  if (x->a > y->a) return -1;
  if (x->a < y->a) return 1;

  return 0;
}

int compare_b(const void *a, const void *b)
{
  tmp_t *x;
  tmp_t *y;

  x = (tmp_t *)a;
  y = (tmp_t *)b;

  if (x->b > y->b) return 1;
  if (x->b < y->b) return -1;

  return 0;
}

void qsort_a (tmp_t *array, int size)
{
  qsort(array, size, sizeof(tmp_t), compare_a);
}

void qsort_b (tmp_t *array, int size)
{
  qsort(array, size, sizeof(tmp_t), compare_b);
}

#define SIZE (10*10*10*10*10)
tmp_t A[SIZE];

int main()
{
  int cnt;
  int64 N,M;
  int i,j;
  int64 result = 0;

  get_NK(&N,&M);

  for (i=0; i<N; i++) {
    get_N(&A[i].a);
  }

  qsort_a (A, N);
  j = 0;
  for (i=0; i<M; i++) {
    A[j].a = A[j].a / 2;
    if (N < 10000) {
      qsort_a (A, N);
      continue;
    }
    j++;
    if (A[j-1] > A[j]) {
      j--;
    }
  }

  for (i=0; i<N; i++) {
    result += A[i].a;
  }

  printf("%lld", result);

  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:100:16: error: invalid operands to binary > (have 'tmp_t' {aka 'struct _tmp_t'} and 'tmp_t' {aka 'struct _tmp_t'})
  100 |     if (A[j-1] > A[j]) {
      |         ~~~~~~ ^ ~~~~
      |          |        |
      |          |        tmp_t {aka struct _tmp_t}
      |          tmp_t {aka struct _tmp_t}
Language: C++

#include <iostream>
#include <vector>
#include <string.h>
#include <string>
#include <stdio.h>
#include <queue>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    priority_queue<long long> a;
    long long tmp;
    for (int i = 0; i < n; ++i)
    {
        scanf_s("%lld", &tmp);
        a.push(tmp);
    }
    
    for (int i = 0; i < m; ++i)
    {
        long long newPrice = a.top() >> 1;
        a.pop();
        a.push(newPrice);
    }
    long long sum = 0;
    for (int i = 0; i < n; ++i)
    {
        sum += a.top();
        a.pop();
    }
    cout << sum << endl;

    return 0;
}


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

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

int main() {
  long long N, M, S = 0, H = 0;
  cin >> N >> M;
  vector<double> vec1(N);
  for(int i = 0; i < N; i++){
    cin >> vec1[i];
  }
  sort(vec1.begin(), vec1.end());
  reverse(vec1.begin(), vec1.end());
  for(int i = 0; i < M; i++){
    for(int i = 0; i < N; i++){
    if(vec1[i] >= vec1[i+1]){
      vec1[0] /= 2;
      break;
    }
    else{
      swap(vec1[i], vec1[i+1]);
    }
    }
  S = 0;
  for(int i = 0; i < N; i++){
    H = vec1[i];
    S += H;
  }
  cout << S <<endl;
}


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

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

int main() {
  long long N, M, S = 0, H = 0;
  cin >> N >> M;
  vector<double> vec1(N);
  for(int i = 0; i < N; i++){
    cin >> vec1[i];
  }
  sort(vec1.begin(), vec1.end());
  reverse(vec1.begin(), vec1.end());
  for(int i = 0; i < M; i++){
    for(int i = 0; i < N; i++){
    if(vec1[i] >= vec1[i+1]){
      vec1[0] /= 2;
      break;
    }
    else{
      swap(vec1[i], vec1[i+1])
    }
    }
  S = 0;
  for(int i = 0; i < N; i++){
    H = vec1[i];
    S += H;
  }
  cout << S <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:31: error: expected ';' before '}' token
   20 |       swap(vec1[i], vec1[i+1])
      |                               ^
      |                               ;
   21 |     }
      |     ~                          
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

int main(){
  int n,m; cin >> n >> m;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int t=1;
  int sum=0;
  int s;
    for(int j=0;;j++){
      s=a[0];
      t=t*2;
      a[0]=a[0]/t;
      sum++;
      if(sum!=m){
        if(a[0]<a[1]){
          sort(a.begin(),a.end());
          reverse(a.begin(),a.end());
          t=1;
        }
        else{
          a[0]=s;
        }
      }
      else{
        break;
      }
    }
    if(sum==m){
      break;
    }
    t=1;
  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:35:7: error: break statement not within loop or switch
   35 |       break;
      |       ^~~~~
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue(優先度付きキュー)：最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>

#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n) for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n) for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;
/*ビットxにi番目のフラグが立っているかどうか
if(x & (1 << i))
↑ a << b == a*pow(b,2)
/*{0, 1, ..., n-1} の部分集合の全探索
for (int bit = 0; bit < (1 << n); ++bit)
*/

int main(){
  ll n,m;  cin >> n >> m;
  priority_queue<ll> q;
  rep0(i,n){
    ll a; cin >> a;
    q.push(a);
  }

  rep0(i,m){
    ll x = q.top();  q.pop();
    q.push(x/2);
  }

  ll ans = 0;
  while(!q.empty()){
    ans += q.top();  q.pop(;)
  }
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:28: error: expected primary-expression before ';' token
   52 |     ans += q.top();  q.pop(;)
      |                            ^
a.cc:52:29: error: expected primary-expression before ')' token
   52 |     ans += q.top();  q.pop(;)
      |                             ^
Language: C++

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

using ll = long long;
using namespace std;

int N, M;

int main(void) {

    cin >> N >> M;
    priority_queue<int, vector<int>> q;

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

    while(M--){
        int t = q.top();
        q.pop();
        q.push(t/2);
    }

    ll ans = 0;
    while(!q.empty()) {
        ans += q.top();
        q.pop();
    }

    cout << ans << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:33:25: error: expected '}' at end of input
   33 |     cout << ans << endl;
      |                         ^
a.cc:10:16: note: to match this '{'
   10 | int main(void) {
      |                ^
Language: C++

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<long long> a(n);
    for (int i = 0; i < n; ++i)
    {
        scanf_s("%lld", &a[i]);
    }
    
    for (int i = 0; i < m; ++i)
    {
        int maxIndex = -1;
        long long max = -1;
        for (int x = 0; x < n; ++x)
        {
            if (a[x] > max)
            {
                max = a[x];
                maxIndex = x;
            }
        }
        a[maxIndex] >>= 1;
    }
    long long sum = 0;
    for (int i = 0; i < n; ++i)
    {
        sum += a[i];
    }
    cout << sum << endl;

    return 0;
}


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

#include <iostream>
#include <vector>
#include <string.h>
#include <string>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<long long> a(n);
    for (int i = 0; i < n; ++i)
    {
        scanf_s("%lld", &a[i]);
    }
    
    for (int i = 0; i < m; ++i)
    {
        int maxIndex = -1;
        long long max = -1;
        for (int x = 0; x < n; ++x)
        {
            if (a[x] > max)
            {
                max = a[x];
                maxIndex = x;
            }
        }
        a[maxIndex] >>= 1;
    }
    long long sum = 0;
    for (int i = 0; i < n; ++i)
    {
        sum += a[i];
    }
    cout << sum << endl;

    return 0;
}


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

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

int main(){
    ll n, m;
    cin >> n >> m;
    priority_queue<int> q;
    for(ll i = 0; i < n; i++){
        ll a;
        cin >> a;
        q.push(a);
    }
    for(ll i = 0; i < m; i++){
        ll a = q.top();
        q.pop()
        q.push(a / 2);
    }
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        ans += q.top();
        q.pop();
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: expected ';' before 'q'
   16 |         q.pop()
      |                ^
      |                ;
   17 |         q.push(a / 2);
      |         ~
Language: C++

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

int main(){
    ll n, m;
    cin >> n >> m;
    priority_queue<int> q;
    for(ll i = 0; i < n; i++){
        ll a;
        cin >> a;
        q.push(a);
    }
    for(ll i = 0; i < m; i++){
        ll a = q.top();
        q.pop()
        q.push(a / 2);
    }
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        ans += q.top();
        q.pop();
    }
    cout << ans << endl;
}

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

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
 
int main(){
	long n;
	long m;
 
	cin >> n >> m;
    vector<long long int> ans(n,0);

	for(int i=0;i<n;i++){
		cin >> ans[i];
	}
    sort(ans.begin(), ans.end())
    long long l;
	for(int i=0;i<m;i++){
		l = ans.back() / 2;
        int left, right;
        left=0;
        right=ans.length()-1;
        while(left < right){
        	if(ans[(left + right) / 2] < l){
            	left = (left+right) / 2 + 1;
            }else{
            	right = (left+right) / 2;
            }
        }
        ans.insert(left, l)
        ans.pop_back()
	}
	long long a = 0;
	for(int i=0;i<n;i++){
		a += ans[i];
	}
	cout << a << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:33: error: expected ';' before 'long'
   17 |     sort(ans.begin(), ans.end())
      |                                 ^
      |                                 ;
   18 |     long long l;
      |     ~~~~                         
a.cc:20:17: error: 'l' was not declared in this scope
   20 |                 l = ans.back() / 2;
      |                 ^
a.cc:23:19: error: 'class std::vector<long long int>' has no member named 'length'
   23 |         right=ans.length()-1;
      |                   ^~~~~~
Language: C++

import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = list(map(lambda x: x * (-1), a))
heapq.heapify(a)
while m != 0:
    price = heapq.heappop(a) * (-1)
    price //= 2
    m -= 1
    heapq.heappush(a, (-1) * price)
print(sum(a) * (-1))


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import heapq
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<bits/stdc++.h>
typedef long long ll;
#define sz(x) int(x.size())
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define MOD 1000000007
using namespace std;

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> a(N);
    ll ans = 0;
    rep(i,N){
        scanf("%d",&a[i]);
        ans += a[i];
    }
    
    vector<int> x;
    for (int i = 0; i < N; i++)
    {
        while(a[i] >=1){
            int X = a[i]%2;
            a[i] /= 2;
            x.push_back(a[i] + X);
        }
    }
    sort(x.begin(),x.end(),greater<int>());
    for (int i = 0; i < M; i++)
    {
        ans -= x[i];
        if(ans < 0){
            ans = 0; break;
        }
    }
    cout << ans << endl;
    return 0;
}#include<bits/stdc++.h>
typedef long long ll;
#define sz(x) int(x.size())
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define MOD 1000000007
using namespace std;

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> a(N);
    ll ans = 0;
    rep(i,N){
        scanf("%d",&a[i]);
        ans += a[i];
    }
    
    vector<int> x;
    for (int i = 0; i < N; i++)
    {
        while(a[i] >=1){
            int X = a[i]%2;
            a[i] /= 2;
            x.push_back(a[i] + X);
        }
    }
    sort(x.begin(),x.end(),greater<int>());
    for (int i = 0; i < M; i++)
    {
        ans -= x[i];
        if(ans < 0){
            ans = 0; break;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc:37:2: error: stray '#' in program
   37 | }#include<bits/stdc++.h>
      |  ^
a.cc:37:3: error: 'include' does not name a type
   37 | }#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc:44:5: error: redefinition of 'int main()'
   44 | int main(){
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main(){
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

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

	vector<double> a(N);
	for (int i = 0; i < N; i++)
		cin >> a[i];

	sort(a.begin(), a.end(), greater<int>());
	for (int i = 0; i < M; i++) {
		a[0] /= 2;
    if (a[0] < a[1]){
      double tmp = a[0];
      int j;
      for (j = 0;; j++){
        if (tmp < a[j]) break;
        a[j] = a[j + 1];
      }
      a[j - 1] = tmp
    }
	}

	int ans = 0;
	for (int i = 0; i < N; i++) {
		ans += (int)a[i];
	}

	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:21: error: expected ';' before '}' token
   24 |       a[j - 1] = tmp
      |                     ^
      |                     ;
   25 |     }
      |     ~
Language: C

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

#define N_MAX 100001

int desc(const void *a, const void *b){
  if(*(long *)a > *(long *)b){
    return -1;
  }else if(*(long *)a == *(long *)b){
    return 0;
  }else{
    return 1;
  }
}

int main(void){
  int i, j;

  int n, m;
  scanf("%d%d", &n, &m);

  std::priority_queue<long> q;

  long a;
  for(i=0; i<n; i++){
    scanf("%ld", &a);
    q.push(a);
  }

  for(i=0; i<m; i++){
    a=q.top();
    q.pop();
    a/=2;
    q.push(a);
  }

  long ans=0;
  for(i=0; i<n; i++){
    a=q.top();
    q.pop();
    ans+=a;
  }

  printf("%ld\n", ans);

  return 0;
}


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

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
  int N,M;
  cin >> N >> M;
  long long A[N];
  REP(i,N) {
    cin >> A[i];
  }
  long long sum = 0;
  REP(i,M) {
    *max_element(ALL(A)) /= 2;
  }
  REP(i,N) {
    sum += A[i];
  }
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: request for member 'begin' in 'A', which is of non-class type 'long long int [N]'
    7 | #define ALL(v) v.begin(), v.end()
      |                  ^~~~~
a.cc:18:18: note: in expansion of macro 'ALL'
   18 |     *max_element(ALL(A)) /= 2;
      |                  ^~~
a.cc:7:29: error: request for member 'end' in 'A', which is of non-class type 'long long int [N]'
    7 | #define ALL(v) v.begin(), v.end()
      |                             ^~~
a.cc:18:18: note: in expansion of macro 'ALL'
   18 |     *max_element(ALL(A)) /= 2;
      |                  ^~~
Language: C++


#include<iostream>
#include <string>
#include<algorithm>
#include <set>
#include <cmath>
using namespace std;
typedef long long lint;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep0(i,n) rep(i,0,n)

struct hoge {

};

int main(void){
	ios::sync_with_stdio(false);
	long A, B, i, j, k, M, N;
	lint res;
	cin >> N >> M;
	long nedan;
	float nlog;
	float a, b, c;
	b = 1.0 / log(2.0);
	for (i = 0; i < N; i++) {
		cin >> nedan[i];
		nlog[i] = log(nedan[i])) *b;
	}
	for (j = 0; j < M; j++) {
		a = 0.0;
		k = 0;
		for (i = 0; i < N; i++) {
			if (nlog[i] > a) {
				k = i;
				a = nlog[i];
			}
		}
		nedan[k] /= 2;
		nlog[k] = log(double(nedan[k]))*b;
	}
	res = 0;
	for (i = 0; i < N; i++) {
		res += nedan[i];
	}
	cout << res;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:29: error: invalid types 'long int[long int]' for array subscript
   26 |                 cin >> nedan[i];
      |                             ^
a.cc:27:21: error: invalid types 'float[long int]' for array subscript
   27 |                 nlog[i] = log(nedan[i])) *b;
      |                     ^
a.cc:27:36: error: invalid types 'long int[long int]' for array subscript
   27 |                 nlog[i] = log(nedan[i])) *b;
      |                                    ^
a.cc:33:33: error: invalid types 'float[long int]' for array subscript
   33 |                         if (nlog[i] > a) {
      |                                 ^
a.cc:35:41: error: invalid types 'float[long int]' for array subscript
   35 |                                 a = nlog[i];
      |                                         ^
a.cc:38:22: error: invalid types 'long int[long int]' for array subscript
   38 |                 nedan[k] /= 2;
      |                      ^
a.cc:39:21: error: invalid types 'float[long int]' for array subscript
   39 |                 nlog[k] = log(double(nedan[k]))*b;
      |                     ^
a.cc:39:43: error: invalid types 'long int[long int]' for array subscript
   39 |                 nlog[k] = log(double(nedan[k]))*b;
      |                                           ^
a.cc:43:29: error: invalid types 'long int[long int]' for array subscript
   43 |                 res += nedan[i];
      |                             ^