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

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

const int N = 100005;

int n, m;
int v[N];

priority_queue<int> pq;

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

	cin >> n >> m;

	for(int i=0; i<n; i++){
		int x
		pq.insert(x);
	} 
	
	while(m--) {
		int x = pq.top(); pq.pop();
		pq.insert(x/2);
	}

	long long ans = 0;

	while(pq.size()) {
		ans+=(long long)pq.top(); pq.pop();
	}
	
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: expected initializer before 'pq'
   19 |                 pq.insert(x);
      |                 ^~
a.cc:24:20: error: 'class std::priority_queue<int>' has no member named 'insert'
   24 |                 pq.insert(x/2);
      |                    ^~~~~~
Language: C++

import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  a[i]*=-1
heapq.heapify(a)
for i in range(m):
  heapq.heappush(a,(heapq.heappop(a)+1)//2)
print(-sum(a))

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: Java

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

public class　Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		long A[] = new long[N];
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
		}
		int check = 2;
		do{
			Arrays.sort(A);
			if(M == 1) {
				A[N-1] /= 2;
				M--;
				break;
			}
			if(N == 1) {
				A[0] /= Math.pow(2, M);
				break;
			}
			long min = A[0];
			long max = A[N-1];
			long mid = (min + max) / 2;
			if(A[N - N/check] >= mid && (N - N/check) <= M) {
				for(int j = N - N/check; j < N; j++) {
					A[j] /= 2;
					M--; 
				}
			}else {
				check *= 2;
				if(check >= N) {
					check = N;
				}
			}
		}while(M > 0);
		long out = 0;
		for(int i = 0; i < N; i++) {
			out += A[i];
		}
		System.out.println(out);
		sc.close();
	}

}


Compiler output:
Main.java:4: error: illegal character: '\u3000'
public class?Main {
            ^
1 error
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
int main(){
  int n,m;std::cin>>n>>m;
  std::vector<int> a(1000000001);
  for(int i=0;i<n;++i)std::cin>>a[i];
  a = std::sort(a.begin(),a.end());
  while(m>0){
    for(int i=n-1;i>0;--i){
      if(a[i]>=a[i-1]){a[i]/=2;m-=1;break;}
    }
  }
  std::cout << std::accumulate(a.begin(),a.end(),0) << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:34: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'void')
    9 |   a = std::sort(a.begin(),a.end());
      |                                  ^
In file included from /usr/include/c++/14/vector:72,
                 from a.cc:2:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'void' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'void' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'void' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
int main(){
  int n,m;std::cin>>n>>m;
  std::vector<long long> a(1000000001);
  for(int i=0;i<n;++i)std::cin>>a[i];
  a = std::sort(a.begin(),a.end());
  while(m>0){
    for(int i=n-1;i>0;--i){
      if(a[i]>=a[i-1]){a[i]/=2;m-=1;break;}
    }
  }
  std::cout << std::accumulate(a.begin(),a.end(),0) << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:34: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'void')
    9 |   a = std::sort(a.begin(),a.end());
      |                                  ^
In file included from /usr/include/c++/14/vector:72,
                 from a.cc:2:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'void' to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'void' to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'void' to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Language: C++

#include<iostream>
#include<vector>
#include<string.h>
#include<queue>
#include<cmath>
typedef long long ll;
struct node {
	ll x, y;
	bool friend operator < (node a, node b) {
		if (a.x == b.x) return a.x > b.x;
		return a.x/a.y < b.x/b.y;
	}
}r;
priority_queue<node> q;
using namespace std;
int main() {
	ll n, m;
	cin >> n >> m;
	
	for (ll i = 0; i < n;i++) {
		cin >> r.x; r.y = 1;	
		q.push(r);
	}
	if (n == 1) {
		if (m > 30) m = 30;
		int x = pow(2, m);
		cout << n / ll(x) << '\n';
		return 0;
	}
	else {
		ll cnt = 0;
		while (cnt < m) {
			r = q.top();
			q.pop();
			ll x = 0;
			while (!q.empty() && cnt + x < m && (r.x / r.y > q.top().x / q.top().y || r.x / r.y == q.top().x / q.top().y && r.x <= q.top().x)) {
				r.y *= 2;
				x++;
			}
			cnt += x;
			q.push(r);
		}
		ll ans = 0;
		while (!q.empty()) {
			r = q.top(); q.pop();
			ans += r.x / r.y;
		}
		cout << ans << '\n';
	}
	return 0;
}



Compiler output:
a.cc:14:1: error: 'priority_queue' does not name a type
   14 | priority_queue<node> q;
      | ^~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:22:17: error: 'q' was not declared in this scope
   22 |                 q.push(r);
      |                 ^
a.cc:33:29: error: 'q' was not declared in this scope
   33 |                         r = q.top();
      |                             ^
a.cc:44:25: error: 'q' was not declared in this scope
   44 |                 while (!q.empty()) {
      |                         ^
Language: C++

#include<iostream>
#include<vector>
#include<string.h>
#include<queue>
typedef long long ll;
struct node {
	ll x, y;
	bool friend operator < (node a, node b) {
		if (a.x == b.x) return a.x > b.x;
		return a.x/a.y < b.x/b.y;
	}
}r;
using namespace std;
int main() {
	ll n, m;
	cin >> n >> m;
	priority_queue<node> q;
	for (ll i = 0; i < n;i++) {
		cin >> r.x; r.y = 1;	
		q.push(r);
	}
	if (n == 1) {
		if (m > 30) m = 30;
		int x = pow(2, m);
		cout << n / ll(x) << '\n';
		return 0;
	}
	ll cnt = 0;
	while (cnt < m) {
		r = q.top();
		q.pop();
		ll x = 0;
		while (cnt + x < m && (r.x/r.y > q.top().x/q.top().y || r.x/r.y == q.top().x / q.top().y && r.x <= q.top().x)) {
			r.y *= 2;
			x++;
		}
		cnt += x;
		q.push(r);
	}
	ll ans = 0;
	while (!q.empty()) {
		r = q.top(); q.pop();
		ans += r.x / r.y;
	}
	cout << ans << '\n';
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: 'pow' was not declared in this scope
   24 |                 int x = pow(2, m);
      |                         ^~~
Language: C++

#include<iostream>
#include<vector>
#include<string.h>
#include<queue>
typedef long long ll;
struct node {
	ll x, y;
	bool friend operator < (node a, node b) {
		if (a.x == b.x) return a.x > b.x;
		return a.x/a.y < b.x/b.y;
	}
}r;
using namespace std;
int main() {
	ll n, m;
	cin >> n >> m;
	priority_queue<node> q;
	for (ll i = 0; i < n;i++) {
		cin >> r.x; r.y = 1;	
		q.push(r);
	}
	if (n == 1) {
		if (m > 30) m = 30;
		ll x = pow(2, m);
		cout << n / m << '\n';
		return 0;
	}
	ll cnt = 0;
	while (cnt < m) {
		r = q.top();
		q.pop();
		ll x = 0;
		while (cnt + x < m && (r.x/r.y > q.top().x/q.top().y || r.x/r.y == q.top().x / q.top().y && r.x <= q.top().x)) {
			r.y *= 2;
			x++;
		}
		cnt += x;
		q.push(r);
	}
	ll ans = 0;
	while (!q.empty()) {
		r = q.top(); q.pop();
		ans += r.x / r.y;
	}
	cout << ans << '\n';
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:24:24: error: 'pow' was not declared in this scope
   24 |                 ll x = pow(2, m);
      |                        ^~~
Language: C++

#include <bits/stdc++.h>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);
#define rep(i, j) for (int (i)=0;(i)<(j);(i)++)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long int ll;

int N, M;
vector<int> sale(1e5+1,0);
vector<int> dis(1e5+1, 0);

void input() {
    cin >> N >> M;
    for (int i=1;i<=N;i++) {
        cin >> sale[i];
    }
    sort(sale.rbegin(), sale.rend());
}

void solve() {
    for(int i=1;i<=M;i++){
        sale[1] /= 2;
        sort(sale.rbegin(), sale.rend());
    }
    int ans = 0;
    for(int i=0;i<=N;i++) ans += sale[i];
    cout << ans << endl;
    return;
}

int main () {
    solve();
    return;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
   39 |     return;
      |     ^~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
int main()
{
   int i,n;
   string m[50010],x;
   cin>>n;
   for(int i=0;i<n;i++)
   {
    cin>>m[i];
   }
    sort(m,m+n);
    x=s[0];
    for(i=1;i<n;i++)
	{
    x+=m[i];
    }
    cout<<x<<endl; 
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:4: error: 'string' was not declared in this scope
    9 |    string m[50010],x;
      |    ^~~~~~
a.cc:9:4: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:10:4: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   10 |    cin>>n;
      |    ^~~
      |    std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:13:10: error: 'm' was not declared in this scope
   13 |     cin>>m[i];
      |          ^
a.cc:15:10: error: 'm' was not declared in this scope
   15 |     sort(m,m+n);
      |          ^
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   15 |     sort(m,m+n);
      |     ^~~~
      |     std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:16:5: error: 'x' was not declared in this scope
   16 |     x=s[0];
      |     ^
a.cc:16:7: error: 's' was not declared in this scope
   16 |     x=s[0];
      |       ^
a.cc:21:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   21 |     cout<<x<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:21:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   21 |     cout<<x<<endl;
      |              ^~~~
      |              std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

/*
ID: markusz1
TASK: template
PROG: template
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ul;
typedef priority_queue<int> p_int_max; // top is max
typedef priority_queue<int, vector<int>, greater<int> >p_int_min; // top is min
typedef priority_queue<ll> p_ll;
typedef priority_queue<double> p_double;

int n,m, temp,sum;
p_int_max a;

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

	cin >> n >> m;
	for (int i=0;i<n;i++){
		cin >> temp;
		a.push(temp);
	}
	for (int i=0;i<m;i++){
		temp = a.top();
		a.pop();
		a.push(temp/2);
	}
	for (int i=0;i<n;i++){
		sum += a.top();
		a.pop()
	}
	cout << sum << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:24: error: expected ';' before '}' token
   35 |                 a.pop()
      |                        ^
      |                        ;
   36 |         }
      |         ~
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
int n, k;
using namespace std;
int main() {
	priority_queue<int>q;	/*生成一个空的优先级数列*/
	scanf_s("%d%d", &n, &k);
	for (int i = 1; i <= n; i++) {
		int x;
		scanf_s("%d", &x);
		q.push(x);
	}
	long long ans = 0;
	for (int i = 1; i <= k; i++) {
		int temp = q.top();
		q.pop();
		temp = temp/2;
		q.push(temp);
	}
	while (!q.empty()) {
		int temp = q.top();
		q.pop();
		ans =ans+ temp;
	}
	printf("%lld\n", ans);
	return 0;
}



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

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
priority_queue<int>q;	/*生成一个空的优先级数列*/
int n, k;
using namespace std;
int main() {
	scanf_s("%d%d", &n, &k);
	for (int i = 1; i <= n; i++) {
		int x;
		scanf_s("%d", &x);
		q.push(x);
	}
	long long ans = 0;
	for (int i = 1; i <= k; i++) {
		int temp = q.top();
		q.pop();
		temp = temp/2;
		q.push(temp);
	}
	while (!q.empty()) {
		int temp = q.top();
		q.pop();
		ans =ans+ temp;
	}
	printf("%lld\n", ans);
	return 0;
}



Compiler output:
a.cc:5:1: error: 'priority_queue' does not name a type
    5 | priority_queue<int>q;   /*生成一个空的优先级数列*/
      | ^~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:9:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    9 |         scanf_s("%d%d", &n, &k);
      |         ^~~~~~~
      |         scanf
a.cc:13:17: error: 'q' was not declared in this scope
   13 |                 q.push(x);
      |                 ^
a.cc:17:28: error: 'q' was not declared in this scope
   17 |                 int temp = q.top();
      |                            ^
a.cc:22:17: error: 'q' was not declared in this scope
   22 |         while (!q.empty()) {
      |                 ^
Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int n, m, a;
  cin>>n>>m;
  priority_queue<int> q;
  while(n--) cin>>a, q.push(a);
  while(m--) q.push(q.top()/2), q.pop();
  int res = 0;
  while(!q.empty()) res += q.top(), q.pop();
  cour<<res<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'cour' was not declared in this scope
   12 |   cour<<res<<endl;
      |   ^~~~
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
#define N 100008
using namespace std;
int n, k;
long a[N];
int main()
{
	scanf_s("%d%d", &n, &k);
	for (int i = 0; i < n; i++)
	{
		scanf_s("%d", &a[i]);
	}
	sort(a, a + n);
	while (k--)
	{
		a[n - 1] = a[n - 1] / 2;
		sort(a, a+n);
	}
	int sum = 0;
	for (int k = 0; k < n; k++)
	{
		sum += a[k];
	}
	printf("%d", sum);
	return 0;
}

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

#include<iostream>
#include<algorithm>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int N, M;
int a[100005];
ull ans;

int dis(int x,int y)
{
	return x / pow(2, y);
}

int main()
{
	cin >> N >> M;
	for (int i = 1;i <= N;i++)
		cin >> a[i];
	sort(&a[1], &a[N + 1]);
	while (M--&&a[N] > 0)
	{
		a[N] = a[N] / 2;
		sort(&a[1], &a[N + 1]);
	}
	ans = 0;
	for (int i = 1;i <= N;i++)
		ans += a[i];
	cout << ans;
}

Compiler output:
a.cc: In function 'int dis(int, int)':
a.cc:13:20: error: 'pow' was not declared in this scope
   13 |         return x / pow(2, y);
      |                    ^~~
Language: C++

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int N, M;
int a[100005];
ull ans;

int dis(int x,int y)
{
	return x / pow(2, y);
}

//想法是找最大值然后/2，直到用完票或=0，关键在于找最大值
int main()
{
	cin >> N >> M;
	for (int i = 1;i <= N;i++)
		cin >> a[i];
	sort(&a[1], &a[N + 1]);
	while (M--&&a[N] > 0)
	{
		a[N] = a[N] / 2;
		sort(&a[1], &a[N + 1]);
	}
	ans = 0;
	for (int i = 1;i <= N;i++)
		ans += a[i];
	cout << ans;
}

Compiler output:
a.cc: In function 'int dis(int, int)':
a.cc:14:20: error: 'pow' was not declared in this scope
   14 |         return x / pow(2, y);
      |                    ^~~
Language: C++

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for(int i=0; i<n; ++i) cin >> a[i];
  sort(a.begin(), a.end(), greater<int>());
  
  int check = -1;
  while(m != 0 && check != 0){
    a[0] /= 2;
    -- m;
    check = a[0];
    
    int count = 0;
    while(check <= a[i] && i < n && m < n){
      ++ count;
    }
    
    int i = 1;
    if(count <= m){    
      while(m != 0 && check <= a[i] && i < n){
        a[i] /= 2;
        -- m;
        ++ i;
      }
    }
    else{
      sort(a.begin()+1, a.begin()+count, greater<int>());
      while(m != 0){
        a[i] /= 2;
        -- m;
        ++ i;
      }
      break;
    }
  }
  
  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:18:22: error: 'i' was not declared in this scope
   18 |     while(check <= a[i] && i < n && m < n){
      |                      ^
Language: C++

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

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

    std::sort(a.begin(),a.end());
    //割引券の枚数だけ先頭の数を割り続ける
  　for(int i=0;i<m;i++){
       *a.end() /= 2;
     　std::sort(a.begin(),a.end());
    }
    for(int i=0;i<n;i++)ans += a[i];
    std::cout<<ans<<std::endl;
}

Compiler output:
a.cc:15:3: error: extended character 　 is not valid in an identifier
   15 |   　for(int i=0;i<m;i++){
      |   ^
a.cc:17:6: error: extended character 　 is not valid in an identifier
   17 |      　std::sort(a.begin(),a.end());
      |      ^
a.cc: In function 'int main()':
a.cc:15:9: error: expected primary-expression before 'int'
   15 |   　for(int i=0;i<m;i++){
      |         ^~~
a.cc:15:17: error: 'i' was not declared in this scope
   15 |   　for(int i=0;i<m;i++){
      |                 ^
Language: C++

/*
#include<iostream>
#include<algorithm>
using namespace std;

long long a[100005];

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

	sort(a + 1, a + 1 + n);

	for (int cnt = 0, i = n; cnt < m;)
	{
			a[i] /= 2;
			cnt++;
			if (i > 0 && a[i] < a[i - 1])
			{
				i--;
			}
			else
				i = n;
	}
	for (int i = 1; i <= n; i++)
		ans += a[i];
	cout << ans << endl;
	return 0;
}
*/


#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	priority_queue<long> q;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		q.push(a);
	}

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

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

	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:30: error: expected ';' before ')' token
   61 |                 q.push(a / 2));
      |                              ^
      |                              ;
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include <iomanip>
#include<deque>
#include<stack>
#include<set>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;
const int INF = 111111111;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const int DIV = 1000000007; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;


int N, M;

int nibutan(vector<double> A, double target);

int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================

	cin >> N >> M;


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

	for (int i = 0; i < M; i++) {

		//cout << nibutan(A, A[N-1] / 2.0);
		int idx = nibutan(A, A[N - 1] / 2.0);
		double temp = A[N - 1] /= 2.0;

		for (int j = N - 2 ; j >= idx; j--) {
			A[j + 1] = A[j];
		}

		A[idx] = temp;

	}

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

	cout << ans;

}


// A[N-1] /2が入るインデックスを返す
int nibutan(vector<ll> A, ll target) {

	int start = 0;
	int last = N / 2;

	while (start != last) {
		if (A[last] <= target) {
			start = last;
			last = last + (last - start) / 2;
		}
		else {
			last = start + (last - start) / 2;
		}
	}

	if (N != 1) {
		return start + 1;
	}
	else {
		return 0;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:35: error: could not convert 'A' from 'vector<long long int>' to 'vector<double>'
   53 |                 int idx = nibutan(A, A[N - 1] / 2.0);
      |                                   ^
      |                                   |
      |                                   vector<long long int>
Language: C++

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

int main(){
  int N,M;
  cin>>N>>M;
  
  priority_queue<long long int> pq;
  
  for(int i=0; i<N; i++){
    int a;
    cin>>a;
    pq.push(a);
  }
  
  for(int i=0; i<M; i++){
    int tmp= pq.top()/2;
    pq.pop();
    pq.push(tmp);
  }
  
  int ws=0; 
  for(!pq.empty()){
    ws +=pq.top(); 
    pq.pop();
  }
  
  cout<<ws<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:18: error: expected ';' before ')' token
   23 |   for(!pq.empty()){
      |                  ^
      |                  ;
a.cc:29:1: error: expected primary-expression before '}' token
   29 | }
      | ^
a.cc:28:18: error: expected ')' before '}' token
   28 |   cout<<ws<<endl;
      |                  ^
      |                  )
   29 | }
      | ~                 
a.cc:23:6: note: to match this '('
   23 |   for(!pq.empty()){
      |      ^
a.cc:29:1: error: expected primary-expression before '}' token
   29 | }
      | ^
Language: C++

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

int main()
{
    int n,m;
    cin >> n >> m;
    priority_queue<int> pq;
    int a;
    for(int i=0;i<n;++i){
        cin >> a;
        pq.push(a);
    }
    for(int i=0;i<m;++i){
        pq.top()/=2;
    }
    long int sum=0;
    while(!pq.enpty()){
        sum += pq.top();
        pq.pop();
    }
    cout << sum << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: assignment of read-only location 'pq.std::priority_queue<int>::top()'
   15 |         pq.top()/=2;
      |         ~~~~~~~~^~~
a.cc:18:15: error: 'class std::priority_queue<int>' has no member named 'enpty'; did you mean 'empty'?
   18 |     while(!pq.enpty()){
      |               ^~~~~
      |               empty
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main()
{
	priority_queue<int>q;
	int n = 0, m = 0, i = 0, a = 0;
	long long sum = 0;
	scanf("%d %d", &n, &m);
	for(i = 1; i <= n; i++)
    {
		scanf("%d",&a);
		q.push(a);
	}
	for(i = 1;i <= m; i++){
		m = q.top();
		q.pop();
		m /= 2;
		q.push(temp);
	}
	while(!q.empty())
    {
		a=q.top();
		q.pop();
		sum += a;
	}
	printf("%lld\n", sum);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:24: error: 'temp' was not declared in this scope; did you mean 'tm'?
   20 |                 q.push(temp);
      |                        ^~~~
      |                        tm
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	priority_queue<int>q;
	int n = 0, m = 0, i = 0, a = 0;
	long long sum = 0;
	scanf("%d %d", &n, &m);
	for(i = 1; i <= n; i++)
    {
		scanf("%d",&a);
		q.push(a);
	}
	for(i = 1;i <= m; i++){
		m = q.top();
		q.pop();
		m /= 2;
		q.push(temp);
	}
	while(!q.empty())
    {
		a=q.top();
		q.pop();
		sum += a;
	}
	printf("%lld\n", sum);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: error: 'temp' was not declared in this scope; did you mean 'tm'?
   17 |                 q.push(temp);
      |                        ^~~~
      |                        tm
Language: C

#include<bits/stdc++.h>
using namespace std;
int main(){
	priority_queue<int>q;
	int n = 0, m = 0, i = 0, a = 0;
	long long sum = 0;
	scanf("%d %d", &n, &m);
	for(i = 1; i <= n; i++)
    {
		scanf("%d",&a);
		q.push(a);
	}
	for(i = 1;i <= m; i++){
		m = q.top();
		q.pop();
		m /= 2;
		q.push(temp);
	}
	while(!q.empty())
    {
		a=q.top();
		q.pop();
		sum += a;
	}
	printf("%lld\n", sum);
	return 0;
}

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

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

int main(){
  int n,m;
  cin >> n >> m;
  priority_queue<ll> a;
  
  rep(i,n){
    ll b;
    cin >> b;
    a.push(b);
  }
  rep(i,m){
    ll c = 0;
    c = a.top();
    a.push(c/2);
  }
  ll ans = 0;
  rep(i,n){
    ans += a[i];
  }
  cout << ans << endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: no match for 'operator[]' (operand types are 'std::priority_queue<long long int>' and 'int')
   23 |     ans += a[i];
      |             ^
Language: C++

#include<iostream>
#include<queue>

int main(){
  int n,m;
  std::cin >> n >> m;
  std::priority_queue<long long> que;
  
  int i;
  for(i=0;i<n;i++){
    long A;
    std::cin >> A;
  }
  for(i=0; i<m;i++){
    long long t = std::que.top();
    std::que.pop();
    std::que.push(t/2);
  }
  
  long long res = 0;
  while(!std::que.empty()){
    res += std::que.top();
    std::que.pop();
  }
  std::cout << res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: 'que' is not a member of 'std'
   15 |     long long t = std::que.top();
      |                        ^~~
a.cc:16:10: error: 'que' is not a member of 'std'
   16 |     std::que.pop();
      |          ^~~
a.cc:17:10: error: 'que' is not a member of 'std'
   17 |     std::que.push(t/2);
      |          ^~~
a.cc:21:15: error: 'que' is not a member of 'std'
   21 |   while(!std::que.empty()){
      |               ^~~
a.cc:22:17: error: 'que' is not a member of 'std'
   22 |     res += std::que.top();
      |                 ^~~
a.cc:23:10: error: 'que' is not a member of 'std'
   23 |     std::que.pop();
      |          ^~~
Language: C++

#include<iostream>
int main(){
  int n,m;
  std::cin >> n >> m;
  int a[n];
  std::sort(a,a+n,std::greater<>());
  int i,j;
  int tmp;
  for(i=0;i<n;i++){
    a[0] /= 2;
    for(j=1;j<n-1;j++){
      if(a[i-1] < a[i]){
        tmp = a[i-1];
        a[i-1] = a[i];
        a[i] = tmp;
      }else{
        break;
      }
    }
  }
  int ans = 0;
  for(i=0;i<n;i++){
    ans += a[i];
  }
  std::cout << ans;
}

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

//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define mod 100000007
#define testcases() ll t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
 
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	fast;
	int n,m,x;
	cin>>n>>m;
	priority_queue<int> q;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		q.push(x);
	}
	while(!q.empty() && m>0)
	{
		--m;
		int x = q.front();
		q.pop();
		q.push(x/2);
	}
	ll sum(0);
	while(!q.empty)
	{
		sum += (ll)q.front();
		q.pop();
	}
	cout<<sum;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:27: error: 'class std::priority_queue<int>' has no member named 'front'
   35 |                 int x = q.front();
      |                           ^~~~~
a.cc:40:18: error: cannot convert 'std::priority_queue<int>::empty' from type 'bool (std::priority_queue<int>::)() const' to type 'bool'
   40 |         while(!q.empty)
      |                  ^~~~~
a.cc:40:18: error: in argument to unary !
   40 |         while(!q.empty)
      |                ~~^~~~~
a.cc:42:30: error: 'class std::priority_queue<int>' has no member named 'front'
   42 |                 sum += (ll)q.front();
      |                              ^~~~~
Language: C++

//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define mod 100000007
#define testcases() ll t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
 
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	fast;
	int n,m,x;
	cin>>n>>m;
	priority_queue<int> q;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		q.push(x);
	}
	while(!q.empty() && m>0)
	{
		--m;
		int x = q.top();
		q.pop();
		q.push(x/2);
	}
	ll sum(0);
	while(!q.empty)
	{
		sum += (ll)q.top();
		q.pop();
	}
	cout<<sum;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:18: error: cannot convert 'std::priority_queue<int>::empty' from type 'bool (std::priority_queue<int>::)() const' to type 'bool'
   40 |         while(!q.empty)
      |                  ^~~~~
a.cc:40:18: error: in argument to unary !
   40 |         while(!q.empty)
      |                ~~^~~~~
Language: C

#include<stdio.h>
long long int a[100001],b[100001];
void quickSort(int i,int j){
	int p=i,q=j,t;long long mid;
	if(i>=j) return;
	i--;j++;
	mid=a[(i+j)/2];
	while(1){
		while(a[++i]>mid);
		while(a[--j]<mid);
		if(i<j){
			t=a[i];
			a[i]=a[j];
			a[j]=t;
		}
		else
			break;
	}
	quickSort(j+1,q);
	quickSort(p,i-1);
}
int main(){
	int n,m,i,j;
	long long sum=0,t=0; 
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)
		scanf("%lld",&a[i]);
	quickSort(0,n-1);
	while(m!=0){
		a[0]/=2;
		sort(0,n-1);
		m--;
	}
	for(i=0;i<n;i++)
		sum+=a[i];
	printf("%lld",sum);
	return 0;
} 

Compiler output:
main.c: In function 'main':
main.c:31:17: error: implicit declaration of function 'sort' [-Wimplicit-function-declaration]
   31 |                 sort(0,n-1);
      |                 ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  ll n,m;cin>>n>>m;
  priority_queue<ll> p;
  rep(i,n){
    ll a;cin>>a;
    p.push(a);
  }
  rep(i,m){
    p.push(p.top()/2);p,pop();
  }m=0LL;
  while(!p.empty()){
    m+=p.top();p.pop();
  }
  cout<<m;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: 'pop' was not declared in this scope; did you mean 'pow'?
   17 |     p.push(p.top()/2);p,pop();
      |                         ^~~
      |                         pow
Language: C++

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

int main() {
  int n , m ;cin >> n >> m;
  priority_queue<int> q;
  for(int i = 0 ;i < n; i ++ ) {
    int x ; cin >> x;
    q.push(x);
  }
  int ans = 0;
  while(m--) {
    auto t = q.front();
    q.pop();
    t = t / 2;
    q.push(t);
  }
  while(!q.empty()) {
    auto t = q.front();
    ans += t;
    q.pop();
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: 'class std::priority_queue<int>' has no member named 'front'
   13 |     auto t = q.front();
      |                ^~~~~
a.cc:19:16: error: 'class std::priority_queue<int>' has no member named 'front'
   19 |     auto t = q.front();
      |                ^~~~~
Language: C++

import bisect

N, M = input().split()
N = int(N)
M = int(M)
A = input().split()
for i in range(0, N):
  A[i] = int(A[i])
A.sort()
for i in range(0, M):
  a = A[N-1]
  A.pop(N-1)
  a = a // 2
  A.insert(bisect.bisect_left(A, a), a)
sum = 0
for i in range(0, N):
  sum += A[i]
print(sum)

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

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii  = pair<int,int>;
const int INF=1001001001;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define MOD 1000000007
#define EPS 10e-8
int gcd(int a,int b){return b?gcd(b,a%b):a;}    //最大公約数
int lcm(int a, int b) {return a * b / gcd(a, b);}   //最小公倍数

int main(){
    int n,m;
    cin >> n>>m;
    priority_queue<ll> PQ;
    ll t;
    rep(i, n)
    {
        cin >> t;
        PQ.push(t);
    }
    rep(i,m){
        t=PQ.pop()
        t/= 2;
        PO.push(t);
    }
    ll ans = 0;
    rep(i, n)
    {
        int t=PQ.pop();
        ans += t;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: void value not ignored as it ought to be
   24 |         t=PQ.pop()
      |           ~~~~~~^~
a.cc:26:9: error: 'PO' was not declared in this scope; did you mean 'PQ'?
   26 |         PO.push(t);
      |         ^~
      |         PQ
a.cc:31:21: error: void value not ignored as it ought to be
   31 |         int t=PQ.pop();
      |               ~~~~~~^~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main ()
{
    scanf ("%d%d" , &n ,&m);
    priority_queue<int> pq ;
    for (int i =0 ; i < n ;i++)
    {
        int  v ;scanf ("%d" , &v ); pq.push(v);
    }
    while (m)
    {
        int cur = pq.top();
        pq.pop();
        cur/=2;
        m--;
        pq.push(cur);
    }
    ll ans =0 ;
    while (!pq.empty())
    {
        ans += pq.top();pq.pop();
    }
    cout << ans <<"\n";
 
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:22: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |     scanf ("%d%d" , &n ,&m);
      |                      ^
      |                      yn
a.cc:7:26: error: 'm' was not declared in this scope; did you mean 'tm'?
    7 |     scanf ("%d%d" , &n ,&m);
      |                          ^
      |                          tm
a.cc:21:5: error: 'll' was not declared in this scope
   21 |     ll ans =0 ;
      |     ^~
a.cc:24:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |         ans += pq.top();pq.pop();
      |         ^~~
      |         abs
a.cc:26:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |     cout << ans <<"\n";
      |             ^~~
      |             abs
Language: C++

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

int main() {
  int n,m;
  cin>>n>>m;
  vector<int> mao(n);
  for(int i=0; i<n; i++) cin>>mao.at(i);
  
  for(int i=0; i<m; i++) {
    int(*std::max_element(mao.begin(), mao.end())) /= 2;
  }
  
  int ans = 0;
  for(int i=0; i<n; i++) {
    ans += mao.at(i);
  }
  
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: lvalue required as left operand of assignment
   11 |     int(*std::max_element(mao.begin(), mao.end())) /= 2;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
  int n,m;
  long long a[1000010]={};
  int  ans=0;

  cin>> n >> m;

  for(int i=0;i<n;i++) cin>> a[i];

  sort(a,a+n,greater<int>());

  for(int i=0;i<m;i++){
    if(a[0]==0){
      cout<<"0"<<endl;
      return 0;
    }
    a[0]/=2;
    sort(a,a+n,greater<int>());
  }
  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,greater<int>());
      |   ^~~~
      |   short
Language: C++

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

vector<int> cost;

void discount(int M){
    while(M){
        int expensive;
        sort(cost.begin(), cost.end());
        
        cout << "cost ";
        for(int i=0; i<cost.size(); i++){
            cout << cost[i] << " ";
        }
        cout << endl;
        
        M--;
        expensive = cost[cost.size()-1];
        cost.pop_back();
        cost.push_back(expensive/2);

        cout << "cost ";
        for(int i=0; i<cost.size(); i++){
            cout << cost[i] << " ";
        }
        cout << endl;
    }
}

int main(){
    int N, M, A;
    long long sum = 0;
    cin >> N >> M;
    for(int i=0; i<N; i++){
        cin >> A;
        cost.push_back(A);
    }
    
    discount(M);

    for(int i=0; i<cost.size(); i++){
        sum += cost[i];
    }

    cout << sum << endl;
}

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

#include<iostream>
#include<numeric>
#include<vector>
using namespace std;
#define ll long long

int main() {
  ll N, M, a, i = 0;
  cin >> N >> M;
  std::vector<ll> Avec(N);
  while (cin >> a) {
    Avec[i] = a;
    i++;
  }
  for (ll j = 0; j < M; ++j) 
    *std::max_element(Avec.begin(),Avec.end()) /= 2;

  cout << std::accumulate(Avec.begin(),Avec.end(),0LL) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:11: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   16 |     *std::max_element(Avec.begin(),Avec.end()) /= 2;
      |           ^~~~~~~~~~~
      |           tuple_element
Language: C++

#include<bits/stdc++.h>

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef long double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main()
{
	int n, m; scanf("%d%d", &n, &m);
	priority_queue<int> ans;
	forn(i, n) {
		int input; scanf("%d", &input);
		ans.push(input); 
	}
	while(m--) {
		int x = ans.top(); ans.pop();
		x /= 2; ans.push(x);
	}
	long long count = 0;
	while(!ans.empty()) {
		count+ = ans.top(); ans.pop();
	}
	printf("%ld", count);
}










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

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
  
int main () {
  int n, m;
  cin >> n >> m;
  priority_queue<int> a;
  
  rep(i,n) {
    int p;
    cin >> p;
    a.push(p);
  }
  
  rep(i,m) 
    a.top() /= 2;
  
  int64_t ans=0;
  
  rep(i,n) {
    ans += a.top();
    a.pop();
  }
  cout << ans;
}

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

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

const bool DEBUG = false;

// 直感的には均せばよさそう．最終的な金額がなるべく等しくなるように
// largestから順番に叩いていくのが最適解っぽい気がする

template <typename T>
void print_vector(const vector<T>& v) {
  for (auto elem : v) {
    cout << elem << ", ";
  }
  cout << endl;
}

int main(int argc, char const* argv[]) {
  int N, M;
  cin >> N >> M;
  vector<double> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  if (N == 1) {
    cout << (long long)(A[0] / pow(2, M)) << endl;
    return 0;
  }

  vector<size_t> idx(A.size());
  iota(idx.begin(), idx.end(), 0);

  int first = 0;
  int second = 1;
  while (M > 0) {
    sort(idx.begin(), idx.end(),
         [&v](size_t i1, size_t i2) { return A[i1] > A[i2]; });
    first = idx[0];
    second = idx[1];

    // for (int i = 1; i < N; i++) {
    //   if (A[i] > A[first]) {
    //     second = first;
    //     first = i;
    //   } else if (A[i] > A[second]) {
    //     second = i;
    //   }
    // }
    if (DEBUG) cout << M << ", " << first << ", " << second << endl;
    while ((M > 0) && (A[first] >= A[second])) {
      A[first] /= 2;
      M -= 1;
    }
    // first = 0;
    // second = 1;
    if (DEBUG) {
      cout << "A: ";
      print_vector(A);
    }
  }

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

  return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:37:12: error: 'v' was not declared in this scope
   37 |          [&v](size_t i1, size_t i2) { return A[i1] > A[i2]; });
      |            ^
a.cc: In lambda function:
a.cc:37:46: error: 'A' is not captured
   37 |          [&v](size_t i1, size_t i2) { return A[i1] > A[i2]; });
      |                                              ^
a.cc:37:13: note: the lambda has no capture-default
   37 |          [&v](size_t i1, size_t i2) { return A[i1] > A[i2]; });
      |             ^
a.cc:20:18: note: 'std::vector<double> A' declared here
   20 |   vector<double> A(N);
      |                  ^
a.cc:37:54: error: 'A' is not captured
   37 |          [&v](size_t i1, size_t i2) { return A[i1] > A[i2]; });
      |                                                      ^
a.cc:37:13: note: the lambda has no capture-default
   37 |          [&v](size_t i1, size_t i2) { return A[i1] > A[i2]; });
      |             ^
a.cc:20:18: note: 'std::vector<double> A' declared here
   20 |   vector<double> A(N);
      |                  ^
Language: Java

package abc141;

import java.util.*;

public class ABC141D {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
        for (int i = 0; i < n; i++) {
            pq.add(Integer.parseInt(sc.next()));
        }

        while (m > 0) {
            pq.add(pq.poll() / 2);
            m--;
        }

        long result = 0;
        for (int a : pq) {
            result += a;
        }

        System.out.println(result);
    }
}


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