criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.*;

public class Powerful_Discount_Tickets{

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int m = sc.nextInt();

    PriorityQueue<Integer> pq = new PriorityQueue<Integer>(Collections.reverseOrder());

    for(int i=0; i<n; i++){
      int a = sc.nextInt();
      pq.add(a);
    }
    //System.out.println(pq);

    for(int i=0; i<m; i++){
      int s = pq.poll();
       s = s/2;
      pq.add(s);
    }
    //System.out.println(pq);
    int si = pq.size();
    long sum = 0;
    for(int i=0; i<si; i++){
      long ll = pq.poll();
      sum += ll;
    }
    System.out.println(sum);

  }

}

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

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
 
char od[3] = {'R', 'U', 'D'};
char ev[3] = {'L', 'U', 'D'};
vector<long long int> ans(100001,0);
int main(){
	long n;
	long m;
 
	cin >> n >> m;
	for(int i=0;i<n;i++){
		cin >> ans[i];
	}
  	vector<long long int>::iterator miter;
	for(int i=0;i<m;i++){
		miter = *max_element(ans.begin(), ans.end());
		*miter /= 2;
	}
	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:20:60: error: no match for 'operator=' (operand types are 'std::vector<long long int>::iterator' and 'long long int')
   20 |                 miter = *max_element(ans.begin(), ans.end());
      |                                                            ^
In file included from /usr/include/c++/14/string:48,
                 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,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:1038:11: note: candidate: 'constexpr __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >& __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::operator=(const __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >&)'
 1038 |     class __normal_iterator
      |           ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1038:11: note:   no known conversion for argument 1 from 'long long int' to 'const __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >&'
/usr/include/c++/14/bits/stl_iterator.h:1038:11: note: candidate: 'constexpr __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >& __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::operator=(__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >&&)'
/usr/include/c++/14/bits/stl_iterator.h:1038:11: note:   no known conversion for argument 1 from 'long long int' to '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >&&'
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    long long a[n];
    long long count=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a,a+n);
    
    long long swap;
    for(int i=0;i<m;i++){
        
        a[n-1]=a[n-1]/2;
        int z=2;
        while(true){
            if(n-z>=0&&a[n-z]>=a[n-z+1]){ 
                swap=a[n-z+1];
                a[n-z+1=a[n-z];
                a[n-z]=swap;
                z++;
            }else{
                break;
            }

        }
    }
    for(int i=0;i<n;i++){
        count+=a[i];
    }
    cout << count;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:22: error: lvalue required as left operand of assignment
   25 |                 a[n-z+1=a[n-z];
      |                   ~~~^~
a.cc:25:31: error: expected ']' before ';' token
   25 |                 a[n-z+1=a[n-z];
      |                               ^
      |                               ]
Language: C

#include<stdio.h>
int main(){
  int n; int m;
  scanf("%d%d",&n,&m);
  int a[n];
  for (int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  int x[n];
  for (int i=0;i<n;i++){
    int y=a[i];
    for(int j=0;j<n;j++){
      if(y<a[j]){
        y=a[j];
      }
    }
    x[i]=y;
  }
  int count=0;
  int k=0;
  while(k<m){
    int b=x[i];
    while(b<x[i+1]){b=b/2;k++
                   }
    x[i]=b;
  }
  for (int i=0;i<n;i++){
    count=count+x[i];
  }
printf("%d\n",count)
    
      
      

Compiler output:
main.c: In function 'main':
main.c:22:13: error: 'i' undeclared (first use in this function)
   22 |     int b=x[i];
      |             ^
main.c:22:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:30: error: expected ';' before '}' token
   23 |     while(b<x[i+1]){b=b/2;k++
      |                              ^
      |                              ;
   24 |                    }
      |                    ~          
main.c:30:21: error: expected ';' at end of input
   30 | printf("%d\n",count)
      |                     ^
      |                     ;
......
main.c:30:1: error: expected declaration or statement at end of input
   30 | printf("%d\n",count)
      | ^~~~~~
Language: C++

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

int main() {
  long long N, M;
  cin >> N >> M;
  
  vector<long long> A(N);
  
  
  long long count = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  
  sort(A.rbegin(), A.rend());
  if (M > 1e4) {
    for (int t = 0; t < 10; t++) {
      sort(A.rbegin(), A.rend());
      for (int i = 0; i < M; i++) {
        long long max_price = -1;
        long long max_idx = -1;
        for (int j = 0; j <= i%(1e4+1) && j < N; j++) {
          if(max_price < A[j]) {
            max_price = A[j];
            max_idx = j;
          }
        }
        A[max_idx] /= 2;
      }
    }
  }
  else {
    for (int i = 0; i < M; i++) {
      long long max_price = -1;
      long long max_idx = -1;
      for (int j = 0; j <= i && j < N; j++) {
        if(max_price < A[j]) {
          max_price = A[j];
          max_idx = j;
        }
      }
      A[max_idx] /= 2;
    }
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:23:31: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   23 |         for (int j = 0; j <= i%(1e4+1) && j < N; j++) {
      |                              ~^~~~~~~~
      |                              |     |
      |                              int   double
Language: C++

#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007

using namespace std;
using P = pair<long, long>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };

vector<edge>tree[100010];
long long dist[100010];
long long dp[100005][4];

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

int main() {

	int N, M;
	cin >> N >> M;

	priority_queue<long long>que;
	for (int i = 0; i < N; ++i) {
		long long a;
		cin >> a;
		que.push(a);
	}

	for (int i = 0; i < M;++i) {
		long long target = que.top(); que.pop();
		que.push(long long(target/2));
	}

	long long ans = 0;
	while (!que.empty()) {
		ans += que.top(); que.pop();
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:26: error: expected primary-expression before 'long'
   51 |                 que.push(long long(target/2));
      |                          ^~~~
Language: C++

#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

using namespace std;

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

int main(){
    int N,M;
   cin>>N>>M;
   vector<int> value;
   rep(i,N){
       cin>>value.at(i);
   }
   rep(j,M){
   sort(value.begin(),value.end(),greater<int>());
   value.at(0)/=2;
   }
   int64_t sum=0;
   for(i,N){
       sum+=value.at(i);
   }
   cout<<sum<<endl;
    return 0; 
}




Compiler output:
a.cc: In function 'int main()':
a.cc:36:8: error: 'i' was not declared in this scope
   36 |    for(i,N){
      |        ^
a.cc:40:5: error: expected primary-expression before 'return'
   40 |     return 0;
      |     ^~~~~~
a.cc:39:20: error: expected ')' before 'return'
   39 |    cout<<sum<<endl;
      |                    ^
      |                    )
   40 |     return 0;
      |     ~~~~~~          
a.cc:36:7: note: to match this '('
   36 |    for(i,N){
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	priority_queue<int>pq;
	long long sum=0;
	rep(i,n){int x;cin>>x;pq.push(x);}
	rep(i,m){
		int p=pq.top();
		pq.pop();
		pq.push(p/2);
	}
	while(!pq.empty()){
		sum+=(long long)(pq.top());
		pq.pop();
	}
	cout<<sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'i' was not declared in this scope
    9 |         rep(i,n){int x;cin>>x;pq.push(x);}
      |             ^
a.cc:9:9: error: 'rep' was not declared in this scope
    9 |         rep(i,n){int x;cin>>x;pq.push(x);}
      |         ^~~
Language: C++

#include <iostream>
using namespace std;

void quick_sort_recursive(int A[], int arr[], int start, int end) {
	if (start >= end)
		return;
	int mid = arr[end];
	int left = start, right = end - 1;
	while (left < right) { 
		while (arr[left] < mid && left < right) 
			left++;
		while (arr[right] >= mid && left < right) 
			right--;
		swap(arr[left], arr[right]);
		swap(A[left], A[right]);
	}
	if (arr[left] >= arr[end])
	{
		swap(arr[left], arr[end]);
		swap(A[left], A[end]);
	}		
	else
		left++;
	quick_sort_recursive(A, arr, start, left - 1);
	quick_sort_recursive(A, arr, left + 1, end);
}

void quick_sort(int A[], int arr[], int len) {
	quick_sort_recursive(A, arr, 0, len - 1);
}

int main()
{
	int N, M;
	long long sum = 0;
	cin >> N >> M;

	int *A = new int[N];
	int *B = new int[N];
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
		B[i] = log(A[i]) / log(2);
	}

	for (int i = 0; i < M; i++)
	{
		quick_sort(A, B, N);
		A[N - 1] >>= 1;
		B[N - 1] -= 1;
	}
	
	for (int i = 0; i < N; i++)
		sum += A[i];
	cout << sum << endl;

	delete[] A;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:24: error: 'log' was not declared in this scope; did you mean 'long'?
   43 |                 B[i] = log(A[i]) / log(2);
      |                        ^~~
      |                        long
Language: C++

#include<iostream>
#include<vector>
#include<string>
using namespace std;
 
char od[3] = {'R', 'U', 'D'};
char ev[3] = {'L', 'U', 'D'};
vector<long long int> ans(100001,0);
int main(){
	long n;
	long m;
 
	cin >> n >> m;
	for(int i=0;i<n;i++){
		cin >> ans[i];
	}
  	vector<long long int>::iterator miter;
	for(int i=0;i<m;i++){
		miter = *max_element(ans.begin(), ans.end());
		*miter /= 2;
	}
	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:19:26: error: 'max_element' was not declared in this scope
   19 |                 miter = *max_element(ans.begin(), ans.end());
      |                          ^~~~~~~~~~~
a.cc:23:9: error: expected ',' or ';' before 'for'
   23 |         for(int i=0;i<n;i++){
      |         ^~~
a.cc:23:21: error: 'i' was not declared in this scope
   23 |         for(int i=0;i<n;i++){
      |                     ^
Language: C++

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

int main(){
  int n, m, max_i;
  cin >> n >> m;
  vector <long long> a(n);
  vector<long long>::iterator max_v
  for(int i=0; i<n; i++) cin >> a[i];
  for(int i=0; i<m; i++){
    max_v = max_element(a.begin(), a.end());
    max_i = distance(a.begin(), max_v);
    a[max_i] = a[max_i] / 2;
  }
  long long s = accumulate(a.begin(), a.end(), 0LL);
  cout << s << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: expected initializer before 'for'
   12 |   for(int i=0; i<n; i++) cin >> a[i];
      |   ^~~
a.cc:12:16: error: 'i' was not declared in this scope
   12 |   for(int i=0; i<n; i++) cin >> a[i];
      |                ^
a.cc:14:5: error: 'max_v' was not declared in this scope; did you mean 'max_i'?
   14 |     max_v = max_element(a.begin(), a.end());
      |     ^~~~~
      |     max_i
a.cc:14:13: error: 'max_element' was not declared in this scope
   14 |     max_v = max_element(a.begin(), a.end());
      |             ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m; cin >> n >> m;
  multiset<int> s;
  for (int i = 0; i < n; i++) {
    int t; cin >> t;
    s.insert(t);
  }
  for (int i = 0; i < m; i++) {
    int a = *s.rbegin();
    s.erase(s.rbegin());
    s.insert(a / 2);
  }
  long long cnt = 0;
  for (auto it = s.begin(); it != s.end(); it++) {
    cnt += *it;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: no matching function for call to 'std::multiset<int>::erase(std::multiset<int>::reverse_iterator)'
   12 |     s.erase(s.rbegin());
      |     ~~~~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/set:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_multiset.h:641:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::erase(const_iterator) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator]'
  641 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_multiset.h:641:28: note:   no known conversion for argument 1 from 'std::multiset<int>::reverse_iterator' {aka 'std::reverse_iterator<std::_Rb_tree_const_iterator<int> >'} to 'std::multiset<int>::const_iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'}
  641 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:671:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::size_type std::multiset<_Key, _Compare, _Alloc>::erase(const key_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; size_type = long unsigned int; key_type = int]'
  671 |       erase(const key_type& __x)
      |       ^~~~~
/usr/include/c++/14/bits/stl_multiset.h:671:29: note:   no known conversion for argument 1 from 'std::multiset<int>::reverse_iterator' {aka 'std::reverse_iterator<std::_Rb_tree_const_iterator<int> >'} to 'const std::multiset<int>::key_type&' {aka 'const int&'}
  671 |       erase(const key_type& __x)
      |             ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_multiset.h:693:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::erase(const_iterator, const_iterator) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator]'
  693 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_multiset.h:693:7: note:   candidate expects 2 arguments, 1 provided
Language: C

#include<stdio.h>
#include <algorithm>
using namespace std;
int main(){
	int n,m,a[100010];
	long long sum;
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	while(m!=0){
		sort(a,a+n);
		a[n-1]=a[n-1]/2;
		m--;
	}
	for(int i=0;i<n;i++){
		sum+=a[i];
	}
	printf("%lld\n",sum);
	return 0;
}

Compiler output:
main.c:2:10: fatal error: algorithm: No such file or directory
    2 | #include <algorithm>
      |          ^~~~~~~~~~~
compilation terminated.
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];
  
  for (int j = 0; j < M; j++) {
    int iter = max_element(A.begin(), A.end());
    int index = distance(A.begin(), iter);
    A[index] = A[index]/2;
  }
  
  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:11:27: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   11 |     int iter = max_element(A.begin(), A.end());
      |                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      |                           |
      |                           __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:12:25: error: no matching function for call to 'distance(std::vector<int>::iterator, int&)'
   12 |     int index = distance(A.begin(), iter);
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
  148 |     distance(_InputIterator __first, _InputIterator __last)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note:   template argument deduction/substitution failed:
a.cc:12:25: note:   deduced conflicting types for parameter '_InputIterator' ('__gnu_cxx::__normal_iterator<int*, std::vector<int> >' and 'int')
   12 |     int index = distance(A.begin(), iter);
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/filesystem:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_path.h:1431:1: note: candidate: 'std::ptrdiff_t std::distance(filesystem::__cxx11::path::iterator, filesystem::__cxx11::path::iterator)'
 1431 | distance(filesystem::path::iterator __first, filesystem::path::iterator __last)
      | ^~~~~~~~
/usr/include/c++/14/bits/fs_path.h:1431:37: note:   no known conversion for argument 1 from 'std::vector<int>::iterator' to 'std::filesystem::__cxx11::path::iterator'
 1431 | distance(filesystem::path::iterator __first, filesystem::path::iterator __last)
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
Language: C++

#include<fstream>
#include<string>
#include<iostream>
#include<sstream>
#include<iterator>
#include<cmath>
#include<algorithm>
 
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];}
   sort(A,A+N);
 for(i=0;i<M;++i){
     A[N-1] /= 2;
    for(j=2;j<N+1;j++){
   if(A[N-j+1]<A[N-j]){
       tmp = A[N-j+1];
       A[N-j+1] = A[N-j];
       A[N-j] = tmp;
   }
   else break;
 }
 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:38:2: error: expected '}' at end of input
   38 | }
      |  ^
a.cc:11:11: note: to match this '{'
   11 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<vector>
#include<string>
using namespace std;
 
char od[3] = {'R', 'U', 'D'};
char ev[3] = {'L', 'U', 'D'};
vector<long long> ans(100001,0);
int main(){
	long n;
	long m;
 
	cin >> n >> m;
	for(int i=0;i<n;i++){
		cin >> ans[i];
	}
	for(int i=0;i<m;i++){
		vector<long long>::iterator miter = *max_element(ans.begin(), ans.end());
		ans[*miter] /= 2;
	}
	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:18:54: error: 'max_element' was not declared in this scope
   18 |                 vector<long long>::iterator miter = *max_element(ans.begin(), ans.end());
      |                                                      ^~~~~~~~~~~
a.cc:22:9: error: expected ',' or ';' before 'for'
   22 |         for(int i=0;i<n;i++){
      |         ^~~
a.cc:22:21: error: 'i' was not declared in this scope
   22 |         for(int i=0;i<n;i++){
      |                     ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(void){
    int N, M;
    cin >> N >> M;
    vector<unsigned long> A(N);
    
    rep(i, N){
        cin >> A.at(i);
    }
    
    sort(A.begin(), A.end(), greater<unsigned long>());
    
    rep(i, M){
        A.at(0) /= 2;
        if(N != 1){
            if(A.at(0) < A.at(1)){
                sort(A.begin(), A.end(), greater<unsigned long>());
            }
        }
    }
    
    cout << accumulate(A.begin(), A.end(), 0LL)　<< endl;
}


Compiler output:
a.cc:24:48: error: extended character 　 is not valid in an identifier
   24 |     cout << accumulate(A.begin(), A.end(), 0LL)　<< endl;
      |                                                ^
a.cc: In function 'int main()':
a.cc:24:48: error: expected ';' before '\U00003000'
   24 |     cout << accumulate(A.begin(), A.end(), 0LL)　<< endl;
      |                                                ^~
      |                                                ;
Language: C++

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

char od[3] = {'R', 'U', 'D'};
char ev[3] = {'L', 'U', 'D'};
vector<long long> ans(100001,0);
int main(){
	long n;
	long m;

	cin >> n >> m;
	for(int i=0;i<n;i++){
		cin >> ans[i];
	}
	for(int i=0;i<m;i++){
		vector<long long>::iterator miter = *max_element(ans.begin(), ans.end());
		ans[miter] /= 2;
	}
	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:18:54: error: 'max_element' was not declared in this scope
   18 |                 vector<long long>::iterator miter = *max_element(ans.begin(), ans.end());
      |                                                      ^~~~~~~~~~~
a.cc:19:20: error: no match for 'operator[]' (operand types are 'std::vector<long long int>' and 'std::vector<long long int>::iterator')
   19 |                 ans[miter] /= 2;
      |                    ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = long long int; _Alloc = std::allocator<long long int>; reference = long long int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from 'std::vector<long long int>::iterator' to 'std::vector<long long int>::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = long long int; _Alloc = std::allocator<long long int>; const_reference = const long long int&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from 'std::vector<long long int>::iterator' to 'std::vector<long long int>::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
a.cc:22:9: error: expected ',' or ';' before 'for'
   22 |         for(int i=0;i<n;i++){
      |         ^~~
a.cc:22:21: error: 'i' was not declared in this scope
   22 |         for(int i=0;i<n;i++){
      |                     ^
Language: C++

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

int main() {
	int n, m;
	cin >> n >> m;
	double a[n];
	for (int i=0; i<n; i++)
	{
		cin >> a.at(i);
	}
	for(int i=0; i<m; i++)
	{
		sort(a.begin(), a.end());
		reverse(a.begin(), a.end());
		a.at(0) /= 2;
	}
	long long ans = 0;
	for(int i=0; i<n; i++)
	{
		ans += a.at(i);
	}
	cout << ans << endl;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: error: request for member 'at' in 'a', which is of non-class type 'double [n]'
   11 |                 cin >> a.at(i);
      |                          ^~
a.cc:15:24: error: request for member 'begin' in 'a', which is of non-class type 'double [n]'
   15 |                 sort(a.begin(), a.end());
      |                        ^~~~~
a.cc:15:35: error: request for member 'end' in 'a', which is of non-class type 'double [n]'
   15 |                 sort(a.begin(), a.end());
      |                                   ^~~
a.cc:16:27: error: request for member 'begin' in 'a', which is of non-class type 'double [n]'
   16 |                 reverse(a.begin(), a.end());
      |                           ^~~~~
a.cc:16:38: error: request for member 'end' in 'a', which is of non-class type 'double [n]'
   16 |                 reverse(a.begin(), a.end());
      |                                      ^~~
a.cc:17:19: error: request for member 'at' in 'a', which is of non-class type 'double [n]'
   17 |                 a.at(0) /= 2;
      |                   ^~
a.cc:22:26: error: request for member 'at' in 'a', which is of non-class type 'double [n]'
   22 |                 ans += a.at(i);
      |                          ^~
Language: C++

#include <bits/stdc++.h>

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define FOR(i, a, b) for(int i = a;i < b;++i)
#define ALL(x) (x).begin(),(x).end()
#define INF 999999999
using namespace std;
#define lint long long

int main(){
  lint n,m; cin >> n >> m;
  string s;
  vector<lint> a(n);
  REP(i,n){
   cin >> a[i]; 
  }
  sort(ALL(a));
  lint t = n-1;
  REP(i,m){
   a[t] /= 2;
   if(a[t] < a[t-1] t--;
  }
  lint sum = 0;
  REP(i,n){
    sum += a[i];
  }
  cout << sum;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: error: expected ';' before 't'
   23 |    if(a[t] < a[t-1] t--;
      |                    ^~
      |                    ;
a.cc:24:3: error: expected primary-expression before '}' token
   24 |   }
      |   ^
a.cc:23:25: error: expected ')' before '}' token
   23 |    if(a[t] < a[t-1] t--;
      |      ~                  ^
      |                         )
   24 |   }
      |   ~                      
a.cc:24:3: error: expected primary-expression before '}' token
   24 |   }
      |   ^
Language: C++

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

#define F first
#define S second
typedef double db;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;


int main(){
  ll n,m,sum=0;
  cin>>n>>m;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  rep(i,m){
  sort(a.begin(),a.end(),greater<ll>());
  a[0]/=2;
  }
  rep(i,n)sum+=a[i];
  cout<<sum<<endl;
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc:11:9: error: 'pair' does not name a type
   11 | typedef pair<int,int> pii;
      |         ^~~~
a.cc:12:9: error: 'pair' does not name a type
   12 | typedef pair<ll,ll> pll;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:17:3: error: 'cin' was not declared in this scope
   17 |   cin>>n>>m;
      |   ^~~
a.cc:18:3: error: 'vector' was not declared in this scope
   18 |   vector<ll> a(n);
      |   ^~~~~~
a.cc:18:12: error: expected primary-expression before '>' token
   18 |   vector<ll> a(n);
      |            ^
a.cc:18:15: error: 'a' cannot be used as a function
   18 |   vector<ll> a(n);
      |              ~^~~
a.cc:19:17: error: invalid types 'int[int]' for array subscript
   19 |   rep(i,n)cin>>a[i];
      |                 ^
a.cc:21:10: error: request for member 'begin' in 'a', which is of non-class type 'int'
   21 |   sort(a.begin(),a.end(),greater<ll>());
      |          ^~~~~
a.cc:21:20: error: request for member 'end' in 'a', which is of non-class type 'int'
   21 |   sort(a.begin(),a.end(),greater<ll>());
      |                    ^~~
a.cc:21:26: error: 'greater' was not declared in this scope
   21 |   sort(a.begin(),a.end(),greater<ll>());
      |                          ^~~~~~~
a.cc:21:36: error: expected primary-expression before '>' token
   21 |   sort(a.begin(),a.end(),greater<ll>());
      |                                    ^
a.cc:21:38: error: expected primary-expression before ')' token
   21 |   sort(a.begin(),a.end(),greater<ll>());
      |                                      ^
a.cc:21:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   21 |   sort(a.begin(),a.end(),greater<ll>());
      |   ^~~~
      |   short
a.cc:22:4: error: invalid types 'int[int]' for array subscript
   22 |   a[0]/=2;
      |    ^
a.cc:24:17: error: invalid types 'int[int]' for array subscript
   24 |   rep(i,n)sum+=a[i];
      |                 ^
a.cc:25:3: error: 'cout' was not declared in this scope
   25 |   cout<<sum<<endl;
      |   ^~~~
a.cc:25:14: error: 'endl' was not declared in this scope
   25 |   cout<<sum<<endl;
      |              ^~~~
Language: C++

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

int main(){
  int n, m;
  cin >> n >> m;
  vector <long long> a(n);
  for(int i=0; i<n; i++) cin >> a[i];
  for(int i=0; i<m; i++){
    vector<long long>::iterator max_v = max_element(a.begin(), a.end());
    int max_i = distance(a.begin(), max_v);
    a[max_i] = a[max_i] / 2;
  }
  long long s = accumulate(a.begin(), a.end(), 0LL);
  cout << s << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:41: error: 'max_element' was not declared in this scope
   13 |     vector<long long>::iterator max_v = max_element(a.begin(), a.end());
      |                                         ^~~~~~~~~~~
Language: C++

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);

    int cnt = m;
  
  	bool flag = true; 

    if(n==1) {
        while(cnt >= 0) {
            a.at(0) /= 2;
            if(a.at(0) == 0) {
                cout << 0 << endl;
                return 0;
            }
        }
    }

  	if(n!=1) {
      while(1) {
          if(a.at(0)<a.at(i)) sort(a.begin(), a.end(), greater<int>());
          while(a.at(0)>=a.at(1) && a.at(0)>0) {
              a.at(0) /= 2;
              cnt--;
              if(cnt == 0) {
                flag = false;
                break;
              }
          }

          if(flag == false || (a.at(0) == 0 && a.at(1) == 0)) break;
      }
    }

    long long int sum = 0;

    rep(i, n) sum += a.at(i);

    cout << sum << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:27: error: 'i' was not declared in this scope
   27 |           if(a.at(0)<a.at(i)) sort(a.begin(), a.end(), greater<int>());
      |                           ^
Language: C

#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;

int main()
{
    int n,m,i;
    long long int sum=0;
    cin>>n>>m;
    int *amount=new int [n];
    for(i=0;i<n;i++) cin>>amount[i];
    sort(amount,amount+n,greater<int>());
    for(i=0;i<m;i++)
    {
        amount[0]/=2;
        sort(amount,amount+n,greater<int>());
    }
    for(i=0;i<n;i++) sum+=amount[i];
    cout<<sum;
    delete [] amount;
    return 0;
}


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

#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include<math.h>
#include<algorithm>


using namespace std;


int log2(int num) {

	long long int soko = 1;
	int result = 0;
	
	while (pow(2, result) < num) {

		result++;
	}

	return result-1;
}



int main()
{



	int n, m;
	vector<int> a;
	vector<int> wkvec;

	int wkcount = 0;

	cin >> n >> m;

	int wk;
	int max = 0;
	for (int i = 0; i < n; i++) {
		cin >> wk;
		a.push_back(wk);

		if (max < wk) {
			max = wk;
		}
	}

	//０だけ例外処理
	if (max = 0) {
		cout << 0 << endl;
		return 0;
	}

//	int border = log2(max);
	int border = INT_MAX;
	bool endflg = false;
	
	while (true) {

		for (int i = 0; i < n; i++) {
			if (a[i] >= border) {
				wkvec.push_back(a[i]);
				a[i] = 0;
			}
		}
		border /= 2;

		sort(wkvec.begin(), wkvec.end(), greater<int>());

		for (int i = 0; i < wkvec.size(); i++) {
			wkvec[i] /= 2;
			wkcount++;

			if (wkcount == m) {
				endflg = true;
				break;
			}
		}
		if (endflg)break;

	}

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

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

	cout << sum << endl;






	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:58:22: error: 'INT_MAX' was not declared in this scope
   58 |         int border = INT_MAX;
      |                      ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include<algorithm>
  +++ |+#include <climits>
    7 |
Language: C++

#include <bits/stdc++.h>

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define FOR(i, a, b) for(int i = a;i < b;++i)
#define ALL(x) (x).begin(),(x).end()
#define INF 999999999
using namespace std;
#define lint long long

int main(){
  lint n,m; cin >> n >> m;
  string s;
  vector<lint> a(n);
  REP(i,n){
   cin >> a[i]; 
  }
  REP(i,m){
   sort(ALL(a));
   a[n-1] /= 2  
  }
  lint sum = 0;
  REP(i,n){
    sum += a[i];
  }
  cout << sum;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: expected ';' before '}' token
   21 |    a[n-1] /= 2
      |               ^
      |               ;
   22 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define FOR(i, a, b) for(int i = a;i < b;++i)
#define ALL(x) (x).begin(),(x).end()
#define INF 999999999
using namespace std;
#define lint long long

int main(){
  lint n,m; cin >> n >> m;
  string s;
  vector<lint> a(n);
  REP(i,n){
   cin >> a[i]; 
  }
  REP(i,m){
   sort(ALL(a));
   a[n-1] /= 2  
  }
  lint sum = 0;
  REP(i,n){
    sum += a[i];
  }
}




Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: expected ';' before '}' token
   21 |    a[n-1] /= 2
      |               ^
      |               ;
   22 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
//桁
int kt(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
signed main(){
  int a,b;
  cin>>a>>b;
  vector<int> c(a);
  rep(i,a)
    cin>>c.at(i);
  sort(all(c));
  rep(i,b){
    c.at(0)/=2
    sort(all(c));
  }
  int f=0;
  rep(i,a){
    f+=c.at(i);
  }
  cout<<f;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:15: error: expected ';' before 'sort'
   60 |     c.at(0)/=2
      |               ^
      |               ;
   61 |     sort(all(c));
      |     ~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(){
  long n, m, hm;
  cin >> n >> m;
  vector<long> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());

  int j=n-1;
  rep(i, m){
    if(j == n-1){
      a[j] /= 2;
      hm = a[j];
      j++;
    }else if(a[j] < hm){
      sort(a.begin(), a.end());
      j = n-1;
      i -= 1;
      continue;
    }else{
      a[j] /= 2;
      j++;
    }
  }
  long sum = 0;
  rep(i, n){
    sum += a[i];
  }
  cout << sum << 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 'sqrt'?
   13 |   sort(a.begin(), a.end());
      |   ^~~~
      |   sqrt
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main (){
  int N, M;
  cin >> N >> M;
  vector<double> A(N);
  vector<int> B(N);
  int max=0;
  int num;
  int SUM;
  
  for(int i=0; i<N i++){
    cin >> A[i];
  }
  
  for(int V=0; V<M; V++){
    max =0;
    for(i=0; i<N; i++){
        if(A[i] > max){
            max = A[i];
            num = i;
        }
    }
    A[num] /=2;
  }
  
  for(int i=0; i<M; i++){
    B[i]= A[i];
    SUM += B[i];
  }
  
  cout << SUM << endl;
}

    


Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: expected ';' before 'i'
   13 |   for(int i=0; i<N i++){
      |                   ^~
      |                   ;
a.cc:19:9: error: 'i' was not declared in this scope
   19 |     for(i=0; i<N; i++){
      |         ^
Language: C++

void sortAfterUpdateTail(vector<long>& price){
	int i = price.size()-2;
	int j = price.size()-1;
	while(i>=0 && price[i]>price[j]){
		long tmp = price[i];
		price[i] = price[j];
		price[j] = tmp;
		i--;
		j--;
	}
}
int main(){
    int n, m;
	cin >> n >> m;
	vector<long> price;
	long sum=0;
	for(int i=0; i<n; i++){
		long num;
		cin >> num;
		price.push_back(num);
		//sum+=num;
	}
	sort(price.begin(), price.end());
	while(m>0){
		price[price.size()-1]/=2;
		sortAfterUpdateTail(price);
		m--;
	}
	
	for(int i=0; i<n; i++){
		sum+=price[i];
	}
	cout << sum << endl;
    return 0;
}

Compiler output:
a.cc:1:6: error: variable or field 'sortAfterUpdateTail' declared void
    1 | void sortAfterUpdateTail(vector<long>& price){
      |      ^~~~~~~~~~~~~~~~~~~
a.cc:1:26: error: 'vector' was not declared in this scope
    1 | void sortAfterUpdateTail(vector<long>& price){
      |                          ^~~~~~
a.cc:1:33: error: expected primary-expression before 'long'
    1 | void sortAfterUpdateTail(vector<long>& price){
      |                                 ^~~~
a.cc: In function 'int main()':
a.cc:14:9: error: 'cin' was not declared in this scope
   14 |         cin >> n >> m;
      |         ^~~
a.cc:15:9: error: 'vector' was not declared in this scope
   15 |         vector<long> price;
      |         ^~~~~~
a.cc:15:16: error: expected primary-expression before 'long'
   15 |         vector<long> price;
      |                ^~~~
a.cc:20:17: error: 'price' was not declared in this scope
   20 |                 price.push_back(num);
      |                 ^~~~~
a.cc:23:14: error: 'price' was not declared in this scope
   23 |         sort(price.begin(), price.end());
      |              ^~~~~
a.cc:23:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   23 |         sort(price.begin(), price.end());
      |         ^~~~
      |         short
a.cc:26:17: error: 'sortAfterUpdateTail' was not declared in this scope
   26 |                 sortAfterUpdateTail(price);
      |                 ^~~~~~~~~~~~~~~~~~~
a.cc:33:9: error: 'cout' was not declared in this scope
   33 |         cout << sum << endl;
      |         ^~~~
a.cc:33:24: error: 'endl' was not declared in this scope
   33 |         cout << sum << endl;
      |                        ^~~~
Language: C

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


int N,M;
//long int *A,*fact,**count;
long int A[100001],fact[100001],count[100001][10000];

long int dp(int n,int m)
{
  long int temp;
  int s;
  
  if(count[n][m]!=-1)
  {
    return count[n][m];
  }
  else
  {
    temp=dp(n-1,m)+A[n];
    
    for(s=1;s<m+1;s++)
    {
      temp=fminl(temp,dp(n-1,m-s)+A[n]/fact[s]);
    }

  }
  count[n][m]=temp;
  
  return temp; 

  
}


int main()
{
  
  int i,j;
  scanf("%d %d ",&N,&M);
  /*
  A=(int *)malloc(sizeof(int )*(N+1)); 

  
  count=(int **)malloc(sizeof(int * )*(N+1));
  for(i=0;i<N+1;i++)
  {
    count[i]=(int *)malloc(sizeof(int )*(M+1));
  }
*/
  
  
  for(i=1;i<N+1;i++)
  {
    scanf("%ld",&A[i]);
    for(j=0;j<M+1;j++)
    {
      count[i][j]=-1;
    }
  }
  fact[0]=1;
  for(i=1;i<31;i++)
  {
    fact[i]=fact[i-1]*2;
  }
  if(M>31)
  {
    for(i=31;i<M+1;i++)
    {
      fact[i]=fact[30];
    }
  }
  
  for(i=0;i<M+1;i++)
  {
    count[1][i]=A[1]/fact[i];
  }

 // printf("%ld",dp(N,M));
  
 return 0; 
}

Compiler output:
/usr/bin/ld: /tmp/cccNzpR5.o: in function `dp':
main.c:(.text+0x113): undefined reference to `fminl'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <iterator>

#include <vector>
#include <queue>
#include <unordered_map>

using namespace std;

long long int dp[10001][10001];

int main(){
    int N, M;
    cin >> N >> M;
    vector<long long int> A(N+1,0);
    for(int i=1; i<=N; i++){
        cin >> A[i];
    }

    for(int j=1; j<=M; j++){
        dp[1][j] = A[1] / pow(2,j);
    }

    dp[1][0] = A[1];
    for(int i=2; i<=N; i++){
        dp[i][0] = A[i] + dp[i-1][0];
    }

    long long int max = A[1];
    long long int sum = A[1];
    for(int i=2; i<=N; i++){
        sum += A[i];
        max = std::max(max, A[i]);
        dp[i][1] = sum-max + max/2;
    }



    for(int i=2; i<=N; i++){
        for(int j=2; j<=M; j++){
            long long int min = INT_MAX;
            for(int ticket_num=0; ticket_num<=j; ticket_num++){
                long long int cost = dp[i-1][j-ticket_num] + A[i] / std::pow(2,ticket_num);
                min = std::min(min, cost);
            }
            dp[i][j] = min;
        }
    }

    cout << dp[N][M] << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:27: error: 'pow' was not declared in this scope
   22 |         dp[1][j] = A[1] / pow(2,j);
      |                           ^~~
a.cc:42:33: error: 'INT_MAX' was not declared in this scope
   42 |             long long int min = INT_MAX;
      |                                 ^~~~~~~
a.cc:8:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include <unordered_map>
  +++ |+#include <climits>
    8 | 
a.cc:44:74: error: 'pow' is not a member of 'std'
   44 |                 long long int cost = dp[i-1][j-ticket_num] + A[i] / std::pow(2,ticket_num);
      |                                                                          ^~~
Language: C++


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


Compiler output:
a.cc:3:3: error: expected unqualified-id before 'for'
    3 |   for(int ii=0;ii<N;ii++){
      |   ^~~
a.cc:3:16: error: 'ii' does not name a type
    3 |   for(int ii=0;ii<N;ii++){
      |                ^~
a.cc:3:21: error: 'ii' does not name a type
    3 |   for(int ii=0;ii<N;ii++){
      |                     ^~
a.cc:6:3: error: 'cout' does not name a type
    6 |   cout << ans << endl;
      |   ^~~~
a.cc:7:1: error: expected declaration before '}' token
    7 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(){
  long n, m, hm, j=0;
  cin >> n >> m;
  vector<long> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end(), greater<int>());

  rep(i, m){
    if(j == 0){
      a[j] /= 2;
      hm = a[j];
      j++;
    }else if(a[j] < hm){
      sort(a.begin(), a.end(), greater<int>());
      j = 0;
      i -= 1;
      continue;
    }else{
      a[j] /= 2;
      j++;
    }
  }
  long sum = 0;
  rep(i, n){
    sum += a[i];
  }
  cout << sum << 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 'sqrt'?
   13 |   sort(a.begin(), a.end(), greater<int>());
      |   ^~~~
      |   sqrt
Language: C++

#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;
 
int main(){

    long long N,M,A[100000]={},ans=0,max,tmp=0;
    cin >> N>>M;

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

    sort(A,A+N,greater<int>());
    max=0

    for(int i=0;i<M;i++){
        tmp=max+1;
        for(int j=0;j<=tmp;j++){
            if(A[max]<A[j]){
                max=j;
            }
        }
        A[max]/=2;
    }

    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:22:10: error: expected ';' before 'for'
   22 |     max=0
      |          ^
      |          ;
   23 | 
   24 |     for(int i=0;i<M;i++){
      |     ~~~   
a.cc:24:17: error: 'i' was not declared in this scope
   24 |     for(int i=0;i<M;i++){
      |                 ^
Language: C++

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

#define rep(i,a,b) for(int (i) = (a) ; (i) < (b) ; (i) ++)
#define scin(a) scanf("%d",&a);
#define scdo(a) scanf("%lf",&a);
#define scch(a) scanf("%s",a);
#define anin(a) printf("%d\n",a);
#define ando(a) printf("%lf\n",a);
#define anch(a) printf("%s\n",a);

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

int main(void){
	long int N,M;
	scanf("%ld %ld",&N,&M);
	long long int A[N],ans(0),del(0);
	rep(i,0,N){
		scanf("%lld",&A[i]);
		ans += A[i];
	}
	rep(i,0,M){
		if(A[0] < A[1] && n > 1 && i != 0)qsort(A,N,sizeof(long long int),asc);
		if(A[0] % 2 == 0){
			A[0] /= 2;
			del += A[0];
		} else {
			A[0] /= 2;
			del += A[0] + 1;
		}
	}
	printf("%lld\n",ans - del);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:35: error: 'n' was not declared in this scope
   27 |                 if(A[0] < A[1] && n > 1 && i != 0)qsort(A,N,sizeof(long long int),asc);
      |                                   ^
Language: Java

package Atcoder.abc_ontime;

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

public class D_141_PowerfulDiscountTickets {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<Long> a = new ArrayList<>();
		long sum = 0;
		for(int i=0;i<n;i++) {
			long ai =sc.nextLong();
			a.add(ai);
			sum += ai;
		}

		for(int i=0;i<m;i++) {
			long max_a = Collections.max(a);
			sum -= max_a;
			int max_ind = a.indexOf(max_a);
			max_a /= 2;
			sum += max_a;
			a.set(max_ind, max_a);
		}
		System.out.println(sum);

	}

}


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