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

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

int main(){
  int N;
  cin>>N;
  int ans1,ans2;
  int a[N];
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
    sort(a.begin(), a.end()); 
    reverse(a.begin(), a.end());
  ans1=0;ans2=0;
  for(int i=0;i<N;i++){
    if(i%2==1){
      ans1=ans1+a[i];
    }
    else{
      ans2=ans2+a[i];
    }
  }
  cout<<ans1-ans2;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   12 |     sort(a.begin(), a.end());
      |            ^~~~~
a.cc:12:23: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   12 |     sort(a.begin(), a.end());
      |                       ^~~
a.cc:13:15: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   13 |     reverse(a.begin(), a.end());
      |               ^~~~~
a.cc:13:26: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   13 |     reverse(a.begin(), a.end());
      |                          ^~~
Language: C++

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

int main(){
  int N;
  cin>>N;
  int ans1,ans2;
  int a[N];
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
    sort(a.begin(), a.end()); 
    reverse(a.begin(), a.end());
  ans1=0;ans2=0;
  for(int i=0;i<N;i++){
    if(i%2==1){
      ans1=ans1+vec[i];
    }
    else{
      ans2=ans2+vec[i];
    }
  }
  cout<<ans1-ans2;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   12 |     sort(a.begin(), a.end());
      |            ^~~~~
a.cc:12:23: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   12 |     sort(a.begin(), a.end());
      |                       ^~~
a.cc:13:15: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   13 |     reverse(a.begin(), a.end());
      |               ^~~~~
a.cc:13:26: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   13 |     reverse(a.begin(), a.end());
      |                          ^~~
a.cc:17:17: error: 'vec' was not declared in this scope
   17 |       ans1=ans1+vec[i];
      |                 ^~~
a.cc:20:17: error: 'vec' was not declared in this scope
   20 |       ans2=ans2+vec[i];
      |                 ^~~
Language: C++

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

int main(){
  int N;
  cin>>N;
  int ans1,ans2;
  int a[N];
    sort(a.begin(), a.end()); 
    reverse(a.begin(), a.end());
  ans1=0;ans2=0;
  for(int i=0;i<N;i++){
    if(i%2==1){
      ans1=ans1+vec[i];
    }
    else{
      ans2=ans2+vec[i];
    }
  }
  cout<<ans1-ans2;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
    9 |     sort(a.begin(), a.end());
      |            ^~~~~
a.cc:9:23: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
    9 |     sort(a.begin(), a.end());
      |                       ^~~
a.cc:10:15: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   10 |     reverse(a.begin(), a.end());
      |               ^~~~~
a.cc:10:26: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   10 |     reverse(a.begin(), a.end());
      |                          ^~~
a.cc:14:17: error: 'vec' was not declared in this scope
   14 |       ans1=ans1+vec[i];
      |                 ^~~
a.cc:17:17: error: 'vec' was not declared in this scope
   17 |       ans2=ans2+vec[i];
      |                 ^~~
Language: C++

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

int main(){
  int N;
  cin>>N;
  int ans1,ans2;
  int vec[N];
    sort(vec.begin(), vec.end()); 
    reverse(vec.begin(), vec.end());
  ans1=0;ans2=0;
  for(int i=0;i<N;i++){
    if(i%2==1){
      ans1=ans1+vec[i];
    }
    else{
      ans2=ans2+vec[i];
    }
  }
  cout<<ans1-ans2;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: request for member 'begin' in 'vec', which is of non-class type 'int [N]'
    9 |     sort(vec.begin(), vec.end());
      |              ^~~~~
a.cc:9:27: error: request for member 'end' in 'vec', which is of non-class type 'int [N]'
    9 |     sort(vec.begin(), vec.end());
      |                           ^~~
a.cc:10:17: error: request for member 'begin' in 'vec', which is of non-class type 'int [N]'
   10 |     reverse(vec.begin(), vec.end());
      |                 ^~~~~
a.cc:10:30: error: request for member 'end' in 'vec', which is of non-class type 'int [N]'
   10 |     reverse(vec.begin(), vec.end());
      |                              ^~~
Language: C++

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

int main(){
  int N;
  cin>>N;
  int ans1,ans2;
  int data[N];
    sort(data.begin;, data.end;); 
    reverse(data.begin;, data.end;);
  ans1=0;ans2=0;
  for(int i=0;i<N;i++){
    if(i%2==1){
      ans1=ans1+data[i];
    }
    else{
      ans2=ans2+data[i];
    }
  }
  cout<<ans1-ans2;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: request for member 'begin' in 'data', which is of non-class type 'int [N]'
    9 |     sort(data.begin;, data.end;);
      |               ^~~~~
a.cc:9:21: error: expected primary-expression before ',' token
    9 |     sort(data.begin;, data.end;);
      |                     ^
a.cc:9:28: error: request for member 'end' in 'data', which is of non-class type 'int [N]'
    9 |     sort(data.begin;, data.end;);
      |                            ^~~
a.cc:9:32: error: expected primary-expression before ')' token
    9 |     sort(data.begin;, data.end;);
      |                                ^
a.cc:10:18: error: request for member 'begin' in 'data', which is of non-class type 'int [N]'
   10 |     reverse(data.begin;, data.end;);
      |                  ^~~~~
a.cc:10:24: error: expected primary-expression before ',' token
   10 |     reverse(data.begin;, data.end;);
      |                        ^
a.cc:10:31: error: request for member 'end' in 'data', which is of non-class type 'int [N]'
   10 |     reverse(data.begin;, data.end;);
      |                               ^~~
a.cc:10:35: error: expected primary-expression before ')' token
   10 |     reverse(data.begin;, data.end;);
      |                                   ^
Language: C++

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

int main(){
  int N;
  cin>>N;
  int ans1,ans2;
  int data[N];
    sort(data.begin(), data.end()); 
    reverse(data.begin(), data.end());
  ans1=0;ans2=0;
  for(int i=0;i<N;i++){
    if(i%2==1){
      ans1=ans1+data[i];
    }
    else{
      ans2=ans2+data[i];
    }
  }
  cout<<ans1-ans2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: request for member 'begin' in 'data', which is of non-class type 'int [N]'
    9 |     sort(data.begin(), data.end());
      |               ^~~~~
a.cc:9:29: error: request for member 'end' in 'data', which is of non-class type 'int [N]'
    9 |     sort(data.begin(), data.end());
      |                             ^~~
a.cc:10:18: error: request for member 'begin' in 'data', which is of non-class type 'int [N]'
   10 |     reverse(data.begin(), data.end());
      |                  ^~~~~
a.cc:10:32: error: request for member 'end' in 'data', which is of non-class type 'int [N]'
   10 |     reverse(data.begin(), data.end());
      |                                ^~~
Language: C++

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

int main(){
  int N;
  cin>>N;
  int ans1,ans2;
  int data[N];
    sort(data.begin(), data.end()); 
    reverse(data.begin(), data.end());
  ans1=0;ans2=0;
  for(int i=0;i<N;i++){
    if(i%2==1){
      ans1=ans1+data[i];
    }
    else{
      ans2=ans2+data[i];
    }
  }
  cout<<ans1-ans2;

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: request for member 'begin' in 'data', which is of non-class type 'int [N]'
    9 |     sort(data.begin(), data.end());
      |               ^~~~~
a.cc:9:29: error: request for member 'end' in 'data', which is of non-class type 'int [N]'
    9 |     sort(data.begin(), data.end());
      |                             ^~~
a.cc:10:18: error: request for member 'begin' in 'data', which is of non-class type 'int [N]'
   10 |     reverse(data.begin(), data.end());
      |                  ^~~~~
a.cc:10:32: error: request for member 'end' in 'data', which is of non-class type 'int [N]'
   10 |     reverse(data.begin(), data.end());
      |                                ^~~
a.cc:20:19: error: expected '}' at end of input
   20 |   cout<<ans1-ans2;
      |                   ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

int main() {
    int N;
    int a[110];  // 最大 100 個ですが余裕をもたせます
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> a[i];

    sort(a.begin(),a.end());  // a[0:N] を大きい順にソート
    int Alice = 0;
    int Bob = 0;
    for (int i = 0; i < N; ++i) {
        if (i % 2 == 0) { // Alice のターン
            Alice += a[i];
        }
        else { // Bob のターン
            Bob += a[i];
        }
    }
    cout << Alice - Bob << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: request for member 'begin' in 'a', which is of non-class type 'int [110]'
   11 |     sort(a.begin(),a.end());  // a[0:N] を大きい順にソート
      |            ^~~~~
a.cc:11:22: error: request for member 'end' in 'a', which is of non-class type 'int [110]'
   11 |     sort(a.begin(),a.end());  // a[0:N] を大きい順にソート
      |                      ^~~
Language: C++

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

int main() {
  int n;
    int a[110];  // 最大 100 個ですが余裕をもたせます
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];

    sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  int sum1=0;
    int sum2=0;
  for(int i=0;i<n;i=i+2){
  	sum1+=a[i];
  }
  for(int i=1;i<n;i=i+2){
  	sum2+=a[i];
  }
  
  cout << sum1-sum2 << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: request for member 'begin' in 'a', which is of non-class type 'int [110]'
   10 |     sort(a.begin(),a.end());
      |            ^~~~~
a.cc:10:22: error: request for member 'end' in 'a', which is of non-class type 'int [110]'
   10 |     sort(a.begin(),a.end());
      |                      ^~~
a.cc:11:13: error: request for member 'begin' in 'a', which is of non-class type 'int [110]'
   11 |   reverse(a.begin(),a.end());
      |             ^~~~~
a.cc:11:23: error: request for member 'end' in 'a', which is of non-class type 'int [110]'
   11 |   reverse(a.begin(),a.end());
      |                       ^~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  int a[110];
  for(int i=0;i<n;i++){
  	cin >> a[i];
  }
  sort(a.begin(),a.end());
  int sum1=0, sum2=0;
  for(int i=n-1;i>=0;i=i-2){
  	sum1+=a[i];
  }
  for(int i=n-2;i>=0;i=i-2){
  	sum2+=a[i];
  }
  
  cout << sum1-sum2 << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: request for member 'begin' in 'a', which is of non-class type 'int [110]'
   11 |   sort(a.begin(),a.end());
      |          ^~~~~
a.cc:11:20: error: request for member 'end' in 'a', which is of non-class type 'int [110]'
   11 |   sort(a.begin(),a.end());
      |                    ^~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++){
  	cin >> a[i];
  }
  sort(a.begin(),a.end());
  int sum1=0, sum2=0;
  for(int i=n-1;i>=0;i=i-2){
  	sum1+=a[i];
  }
  for(int i=n-2;i>=0;i=i-2){
  	sum2+=a[i];
  }
  
  cout << sum1-sum2 << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   11 |   sort(a.begin(),a.end());
      |          ^~~~~
a.cc:11:20: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   11 |   sort(a.begin(),a.end());
      |                    ^~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++){
  	cin >> a[i];
  }
  sort(a.begin().a.end());
  int sum1=0, sum2=0;
  for(int i=n-1;i>=0;i=i-2){
  	sum1+=a[i];
  }
  for(int i=n-2;i>=0;i=i-2){
  	sum2+=a[i];
  }
  
  cout << sum1-sum2 << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   11 |   sort(a.begin().a.end());
      |          ^~~~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  int a[];
  for(int i=0;i<n;i++){
  	cin >> a[i];
  }
  sort(a.begin().a.end());
  int sum1=0, sum2=0;
  for(int i=n-1;i>=0;i=i-2){
  	sum1+=a[i];
  }
  for(int i=n-2;i>=0;i=i-2){
  	sum2+=a[i];
  }
  
  cout << sum1-sum2 << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:7: error: storage size of 'a' isn't known
    7 |   int a[];
      |       ^
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a.at(i); 
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int b=0,c=0;
  for(int j=0;j<N;j++){
    if(j%2==0){
     b+=a.at(i); 
    }else{
     c+=a.at(i); 
    }
  }
  cout << b-c << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: 'i' was not declared in this scope
   16 |      b+=a.at(i);
      |              ^
a.cc:18:14: error: 'i' was not declared in this scope
   18 |      c+=a.at(i);
      |              ^
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a(i); 
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int b=0,c=0;
  for(int j=0;j<N;j++){
    if(i%2==0){
     b+=a.at(i); 
    }else{
     c+=a.at(i); 
    }
  cout << b-c << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: no match for call to '(std::vector<int>) (int&)'
    9 |     cin >> a(i);
      |            ~^~~
a.cc:15:8: error: 'i' was not declared in this scope
   15 |     if(i%2==0){
      |        ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main(void)
{
    int n;
    cin >> n;
    int a[n];
    for ( int i = 0; i < n; i++ )
        cin >> a[i];
    
    sort(a.begin(), a.end(), greater<int>());
    
    int alice = 0,bob = 0;
    for ( int i = 0; i < n; i++ )
    {
        if ( i % 2 == 0 )
            alice += a[i];
        else
            bob += a[i];
    }
    
    int ans = alice - bob;
    
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   12 |     sort(a.begin(), a.end(), greater<int>());
      |            ^~~~~
a.cc:12:23: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   12 |     sort(a.begin(), a.end(), greater<int>());
      |                       ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >>n;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  int a=0,b=0;
  for(int i=0,i<n,i+=2){
    a+=vec.at(i);
  }
  for(int i=1;i<n;i+=2){
    b+=vec.at(i);
  }
  if(a<=b){
    cout <<b-a<<endl;
  }
  else{
    cout <<a-b<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: expected ';' before '<' token
   12 |   for(int i=0,i<n,i+=2){
      |                ^
      |                ;
a.cc:12:16: error: expected primary-expression before '<' token
a.cc:12:23: error: expected ';' before ')' token
   12 |   for(int i=0,i<n,i+=2){
      |                       ^
      |                       ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >>n;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  int a=0,b=0;
  for(i=0,i<n,i+=2){
    a+=vec.at(i);
  }
  for(i=1;i<n;i+=2){
    b+=vec.at(i);
  }
  if(a<=b){
    cout <<b-a<<endl;
  }
  else{
    cout <<b-a<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i=0,i<n,i+=2){
      |       ^
a.cc:15:3: error: expected primary-expression before 'for'
   15 |   for(i=1;i<n;i+=2){
      |   ^~~
a.cc:14:4: error: expected ';' before 'for'
   14 |   }
      |    ^
      |    ;
   15 |   for(i=1;i<n;i+=2){
      |   ~~~
a.cc:15:3: error: expected primary-expression before 'for'
   15 |   for(i=1;i<n;i+=2){
      |   ^~~
a.cc:14:4: error: expected ')' before 'for'
   14 |   }
      |    ^
      |    )
   15 |   for(i=1;i<n;i+=2){
      |   ~~~
a.cc:12:6: note: to match this '('
   12 |   for(i=0,i<n,i+=2){
      |      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int al=0;
  int bo=0;
  cin >> N;
  vector<int>vec(N);
  for (int X=0; X<N; X++){
    cin >> vec.at(X);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  for (int Y=0; Y<N; Y++){
    if (Y%2==0){
      al+=vec.at(Y);
    }
    else if (Y%2==1){
      bo+=vec.at(Y)
    }
  }
  cout << al-bo << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:20: error: expected ';' before '}' token
   20 |       bo+=vec.at(Y)
      |                    ^
      |                    ;
   21 |     }
      |     ~
Language: C++

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


int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    REP(i, N) cin >> a[i];
    sort(a.begin(), a.end(), greater<int>());
    int A = 0;
    int B = 0;
    REP(i, N) {
        if (i %2 == 0) A += a[i];
        else B += a[i];
    }
    cout << A - B << endl;




Compiler output:
a.cc: In function 'int main()':
a.cc:18:27: error: expected '}' at end of input
   18 |     cout << A - B << endl;
      |                           ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, n, i, j;
  a=0;
  b=0;
  c=0;
  cin >> n;
  vector<int> card(100);
  for(i=0;i<n;i++) {
    cin >> card.at(i);
  }
  for(i=0;i<n;i++) {
    for(j=0;j<n;j++) {
      if (card.at(i) < card.at(j)) {
        b=card.at(i);
        card.at(i) = card.at(j);
        card.at(j) = b;
      }
    }
  }
  for(i=0;i<n;i+=2) {
   a += card.at(i);
  }
  for(i=1;i<n+1;i+=2) {
   c += card.at(i);
  }
  cout << a-c << endl;
    return 0;
  }
      

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

#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, n, i, j;
  a=0;
  b=0;
  c=0;
  cin >> n;
  vector<int> card(100);
  for(i=0;i<n;i++) {
    cin >> card.at(i);
  }
  for(i=0;i<n;i++) {
    for(j=0;j<n;j++) {
      if (card.at(i) < card.at(j)) {
        b=card.at(i);
        card.at(i) = card.at(j);
        card.at(j) = b;
      }
    }
  }
  for(i=0;i<n;i+=2) {
   a += card.at(i)
  }
  for(i=1;i<n+1;i+=2) {
   c += card.at(i)
  }
  cout << a-c << endl;
    return 0;
  }
      

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'c' was not declared in this scope
    7 |   c=0;
      |   ^
a.cc:23:19: error: expected ';' before '}' token
   23 |    a += card.at(i)
      |                   ^
      |                   ;
   24 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, n, i, j;
  a=0;
  b=0;
  cin >> n;
  vector<int> card(100);
  for(i=0;i<n;i++) {
    cin >> card.at(i);
  }
  for(i=0;i<n;i++) {
    for(j=0;j<n;j++) {
      if (card.at(i) < card.at(j)) {
        b=card.at(i);
        card.at(i) = card.at(j);
        card.at(j) = b;
      }
    }
  }
  for(i=0;i<n;i+=2) {
   a += card.at(i) -card.at(i+1)
  }
  cout << a << endl;
    return 0;
  }
        

Compiler output:
a.cc: In function 'int main()':
a.cc:22:33: error: expected ';' before '}' token
   22 |    a += card.at(i) -card.at(i+1)
      |                                 ^
      |                                 ;
   23 |   }
      |   ~
Language: C++

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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i=1;i<=N;i++){
    cin >> a.at(i)
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int Alice=0;
  int Bob=0;
  for(int i=1;i<=N;i++){
    if(i%2==1){
      Alice+=a.at(i);
    }
    else{
      Bob+=a.at(i);
    }
  }
  cout << Alice-Bob << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:19: error: expected ';' before '}' token
    9 |     cin >> a.at(i)
      |                   ^
      |                   ;
   10 |   }
      |   ~
Language: C++

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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(i=1;i<=N;i++){
    cin >> a.at(i)
  }
  sort(a.begin(),a.end());
  revarse(a.begin(),a.end());
  int Alice=0;
  int Bob=0;
  for(int i=1;i<=N;i++){
    if(i%2=1){
      Alice+=a.at(i);
    }
    else{
      Bob+=a.at(i);
    }
  }
  cout << Alice-Bob << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=1;i<=N;i++){
      |       ^
a.cc:12:3: error: 'revarse' was not declared in this scope
   12 |   revarse(a.begin(),a.end());
      |   ^~~~~~~
a.cc:16:9: error: lvalue required as left operand of assignment
   16 |     if(i%2=1){
      |        ~^~
Language: C++

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

int main()
{
  int n;
  cin >> n;
  
  vector<int> c(n);
  for (int i = 0; i < n; i ++)
    cin >> c.at(i);
  
  sort(c.begin(), c.end());
  
  int a = b = 0;
  for (int i = 0; i < n; i ++)
  {
    if (i % 2 == 0) a += c.at(i);
    else b += c.at(i);
  }
  
  cout << a - b;
  
  return 0;
}


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

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

int main() {
  int N;
  cin >> N;
  vector<int>data(N)
  for(int i=0;i<N;i++){
    cin >> data.at(i);
  }
  sort(data.begin(),data.end());
  int result=0;
  for(int i=0;i<N;i++){
    if(i%2==0) result+=data.at(i);
    else result-=data.at(i);
  }
  cout << result << endl;
}


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

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

int main(){
  int N, sum_A = 0, sum_B = 0, ans;
  vector<int> cards(N);
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> cards.at(i);
  }
  sort(cards.begin(), cards.end());
  for(int j = 0; j < N; j += 2){
    sum_A += cards.at(j);
    if(j + 1 != N) sum_B += cards.at(j + 1);
  }
  ans = sum_A - sum_B;
  cout << ans << endl;
}

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

// package abc_088;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;



public class B_CardGameforTwo {

	public static int[] Sorting(int[] a) {
		  int str = a[0];
		  for(int i = a.length - 1;  i > 0 ; i--) {
			  for(int j = 0; j < a.length- 1; j++){
			    if(a[j] < a[ j+1]){
			      str = a[ j];
			      a[ j] = a[ j+1];
			      a[j+1] = str;
			    }
			  }
		  }
		  return a;
	}

	public static void main(String[] args) throws IOException {

		BufferedReader reader = new BufferedReader (new InputStreamReader (System.in));
		String str = reader.readLine();
		int N = Integer.parseInt(str);

//		System.out.println(N);

		int i = 0;
		int[] a = new int[N];

		while (i < N) {
			str = reader.readLine();
			a[i] = Integer.parseInt(str);
			i++;
		}

		a = B_CardGameforTwo.Sorting(a);

//		System.out.println(a[1] + a[2]);
//		for (i = 0; i < a.length; i++) {
//			System.out.println(a[i]);
//		}

		int A = 0, B = 0;

		if (N % 2 == 0) {
			for(i = 0; i < N; i += 2) {
				A += a[i];
				B += a[i+1];
		}
		}else {
			for(i = 0; i < N-2; i += 2) {
				A += a[i];
				B += a[i+1];
			}
			A += a[N-1];
		}
		System.out.println(A - B);

		}

}


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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  int sum_a = 0
  int sum_b = 0;
  sort(vec.(), vec.begin());
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) sum_a += vec.at(i);
    else sum_b += vec.at(i);
  }
  cout << sum_a - sum_b;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: expected ',' or ';' before 'int'
   12 |   int sum_b = 0;
      |   ^~~
a.cc:13:12: error: expected unqualified-id before '(' token
   13 |   sort(vec.(), vec.begin());
      |            ^
a.cc:16:10: error: 'sum_b' was not declared in this scope; did you mean 'sum_a'?
   16 |     else sum_b += vec.at(i);
      |          ^~~~~
      |          sum_a
a.cc:18:19: error: 'sum_b' was not declared in this scope; did you mean 'sum_a'?
   18 |   cout << sum_a - sum_b;
      |                   ^~~~~
      |                   sum_a
Language: C++

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

int main() {
  int N;
  vector<int> card;
  for (i=0; i<N; i++){
    cin >> card[i];
  }
  sort( card.begin(), card.end());
  reverse( card.begin(), card.end());
  int A,B;
  for (j=0; j<N; j++){
    if ( j%2 == 0){
      B += card[j];
    }else{
      A += card[j];
    }
    cout << A-B << endl;
  }
    
}


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

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

int main() {
  int N;
  vector<int> card;
  for (i=0; i<N; i++){
    cin >> card[i];
  }
  sort( card.begin(), card.end());
  reverse( card.begin(), card.end());
  int A,B;
  for (j=0; j<N; j++){
    if ( j%2 == 0){
      B += card[j];
    }else{
      A += card[j];
    }
    cout << A-B << endl;
      
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: 'i' was not declared in this scope
    7 |   for (i=0; i<N; i++){
      |        ^
a.cc:13:8: error: 'j' was not declared in this scope
   13 |   for (j=0; j<N; j++){
      |        ^
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main() {
	int N;
	cin >> N;
	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	sort(v.begin(), v.end(), greater<int>());
	int d = 0, sgn = 1;
	for (int i = 0; i < N; i++) {
		d += sgn * v[i];
		sgn = -sgn;
	}
	cout << d << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:17:27: error: expected '}' at end of input
   17 |         cout << d << endl;
      |                           ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main(){
  int N;
  cin >> N;
  
  int A[N];
  rep(i,N){
    int a;
    cin >> a;
    A[i] = a;
  }
  
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  
  int sum=0;
  
  rep(i,N){
    if(i%2 == 0) sum += A[i];
    else sum -= A[i];
  }
  
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:10: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   16 |   sort(A.begin(), A.end());
      |          ^~~~~
a.cc:16:21: error: request for member 'end' in 'A', which is of non-class type 'int [N]'
   16 |   sort(A.begin(), A.end());
      |                     ^~~
a.cc:17:13: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   17 |   reverse(A.begin(), A.end());
      |             ^~~~~
a.cc:17:24: error: request for member 'end' in 'A', which is of non-class type 'int [N]'
   17 |   reverse(A.begin(), A.end());
      |                        ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> cards(N);
  for(int n = 0; n < N; n++){
    cin >> cards.at(n);
  }
  sort(cards.begin(), cards.end(), greater<int>());
  for(int n = 0; n < N; n += 2){
    ans += cards.at(n);
  }
  for(int n = 1; n < N; n += 2){
    ans -= cards.at(n);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |     ans += cards.at(n);
      |     ^~~
      |     abs
a.cc:16:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |     ans -= cards.at(n);
      |     ^~~
      |     abs
a.cc:18:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

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

int main(){
  int N;
  cin >> N;
  
  int A[N];
  rep(i,N){
    int a;
    cin >> a;
    A[i] = a;
  }
  
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  
  int sum=0;
  
  rep(i,N){
    if(i%2 == 0) sum += A[i];
    else sum -= A[i];
  }
  
  cout << sum << endl;
}
      
    
  


Compiler output:
a.cc: In function 'int main()':
a.cc:16:10: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   16 |   sort(A.begin(), A.end());
      |          ^~~~~
a.cc:16:21: error: request for member 'end' in 'A', which is of non-class type 'int [N]'
   16 |   sort(A.begin(), A.end());
      |                     ^~~
a.cc:17:13: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   17 |   reverse(A.begin(), A.end());
      |             ^~~~~
a.cc:17:24: error: request for member 'end' in 'A', which is of non-class type 'int [N]'
   17 |   reverse(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;
  cin >> N;
  
  int A[N];
  rep(i,N){
    cin >> A[i];
  }
  
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  
  int sum=0;
  
  rep(i,N){
    if(i%2 == 0) sum += A[i];
    else sum -= A[i];
  }
  
  cout << sum << endl;
}
      
    
  


Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   14 |   sort(A.begin(), A.end());
      |          ^~~~~
a.cc:14:21: error: request for member 'end' in 'A', which is of non-class type 'int [N]'
   14 |   sort(A.begin(), A.end());
      |                     ^~~
a.cc:15:13: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   15 |   reverse(A.begin(), A.end());
      |             ^~~~~
a.cc:15:24: error: request for member 'end' in 'A', which is of non-class type 'int [N]'
   15 |   reverse(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;
  cin >> N;
  
  int A[N];
  rep(i,N){
    cin >> A[i];
  }
  
  sort(A.begin, A.end);
  reverse(A.begin, A.end);
  
  int sum=0;
  
  rep(i,N){
    if(i%2 == 0) sum += A[i];
    else sum -= A[i];
  }
  
  cout << sum << endl;
}
      
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   14 |   sort(A.begin, A.end);
      |          ^~~~~
a.cc:14:19: error: request for member 'end' in 'A', which is of non-class type 'int [N]'
   14 |   sort(A.begin, A.end);
      |                   ^~~
a.cc:15:13: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   15 |   reverse(A.begin, A.end);
      |             ^~~~~
a.cc:15:22: error: request for member 'end' in 'A', which is of non-class type 'int [N]'
   15 |   reverse(A.begin, A.end);
      |                      ^~~
Language: C++

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

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

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

    int alice = 0;
    int bob = 0;
    while(true){
        int max = 0;
        for(int i = 0; i < n; i++){
            if(max <= a[i]){
                max = a[i];
                a[i] = 0;
            }
        }
        alice += max;

        --n;
        if(n < 1)
            break;

        int bmax = 0;
        for(int i = 0; i < n; i++){
            if(bmax <= a[i]){
                bmax = a[i]
                a[i] = 0;
            }
        }
        bob += bmax;

        --n;
        if(n < 1)
            break;
    }

    cout << alice - bob << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:28: error: expected ';' before 'a'
   31 |                 bmax = a[i]
      |                            ^
      |                            ;
   32 |                 a[i] = 0;
      |                 ~
Language: C++

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

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

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

    int alice = 0;
    int bob = 0;
    while(true){
        int max = 0;
        for(int j = 0; j < n; j++){
            if(max <= a[i]){
                max = a[i];
                a[i] = 0;
            }
        }
        alice += max;

        --n;
        if(n < 1)
            break;

        int bmax = 0;
        for(int i = 0; i < n; i++){
            if(bmax <= a[i]){
                bmax = a[i]
                a[i] = 0;
            }
        }
        bob += bmax;

        --n;
        if(n < 1)
            break;
    }

    cout << alice - bob << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: 'i' was not declared in this scope
   17 |             if(max <= a[i]){
      |                         ^
a.cc:31:28: error: expected ';' before 'a'
   31 |                 bmax = a[i]
      |                            ^
      |                            ;
   32 |                 a[i] = 0;
      |                 ~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n, sum1, sum2;
    sum1 = 0;
    sum2 = 0;
    cin >> n;
    vector<int> var(n);
    for (int x = 0; x < n; x++){
        cin >> var[x];
    }
    sort(var.begin(), var.end(), greater<int>());
    
    for (int x = 0; x < n; x += 2){
        sum1 += var.at(x);
    }
    for (int x = 1; x < n; x += 2){
        sum2 += var.at(x);
    }
    cout << sum1 - sum2 << endl;
}
    


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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  int X;
  priority_queue<int> A;
  for(int i=0;i<N;i++){
    X=0;
    cin>>X;
    A.push(X);
  }
  int countA=0;
  int countB=0;
  if(N%2==0){
    for(int i=0;i<N/2;i++){
    countA+=A.top();
    A.pop();
    countB+=A.top();
    A.pop();
  }
  }
  if(N%2==1){
    for(int i=0;i<(N-1)/2;i++){
    countA+=A.top();
    A.pop();
    countB+=A.top();
    A.pop();
    }
    coutA+=top();
  }
  int ans;
  ans=countA-countB;
  cout<<ans<<endl;
}
    
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:31:5: error: 'coutA' was not declared in this scope; did you mean 'countA'?
   31 |     coutA+=top();
      |     ^~~~~
      |     countA
a.cc:31:12: error: 'top' was not declared in this scope
   31 |     coutA+=top();
      |            ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  int X;
  priority_queue<int> A;
  for(int i=0;i<N;i++){
    X=0;
    cin>>X;
    A.push(X);
  }
  int countA=0;
  int countB=0;
  for(int i=0;i<(N+1)/2;i++){
    countA+=A.top();
    A.pop();
    countB+=A.top();
    B.pop();
  }
  int ans;
  ans=countA-countB;
  cout<<ans<<endl;
}
    
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'B' was not declared in this scope
   20 |     B.pop();
      |     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i=0;i<N;i++)cin >> a.at(i);
    sort(a.begin(),a.end());
    reverce(a.begin(),a.end());
    int Alice=0;
    int Bob=0;
    for(int i=0;i<N;i+=2){
        Alice+=a.at(i);        
    }
    for(int i=1;i<N;i+=2){
        Bob+=a.at(i);
    }
    cout << Alice-Bob << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'reverce' was not declared in this scope
   11 |     reverce(a.begin(),a.end());
      |     ^~~~~~~
Language: C++

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

int main() {
  int n; cin >> n;
  int a[100]; for ( int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, greater<int>()); 
  int Alice = 0;
  int Bob = 0;
  for (int i = 0; i < N; i += 2) Alice += a[i];
  for (int i = 1; i < N; i += 2) Bob += a[i];
  cout << Alice - Bob << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: 'N' was not declared in this scope
   10 |   for (int i = 0; i < N; i += 2) Alice += a[i];
      |                       ^
a.cc:11:23: error: 'N' was not declared in this scope
   11 |   for (int i = 1; i < N; i += 2) Bob += a[i];
      |                       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main() {
  int i(0),l,n,A(0),B(0);
  cin >> n;
  int a[n];
  while(cin >> l){
    a[i] = l;
    i++;
  }
  sort(a.begin(),a.end());
  for(int j(0);j<n;j++){
    if(i%2==0)	A += a[n-1-j];
    else	B += a[n-1-j];
  }
  cout << A-B;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   12 |   sort(a.begin(),a.end());
      |          ^~~~~
a.cc:12:20: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   12 |   sort(a.begin(),a.end());
      |                    ^~~
Language: C++

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

int main(){
  int N; cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++ ) cin >> vec.at(i);
  //入力値の受け取り
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  int count = 0;
  for (int i = 0; i < N; i++ ) count += vec.at(i) * ((-1)**i);
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:59: error: invalid type argument of unary '*' (have 'int')
   12 |   for (int i = 0; i < N; i++ ) count += vec.at(i) * ((-1)**i);
      |                                                           ^~
Language: C++

#include <iostream>
using namespace std;

int main() {
  int N, Alice=0, Bob=0;
  cin >> N;
  int a[109];
  for (int i = 0; i < N; i++) cin >> a[i];
  
  sort(a, a+N, greater<int>());
  
  for (int j = 0; j < N; j++) {
    if (j%2 == 1) Alice += a[j];
    else Bob += a[j];
  }  
  cout << Bob-Alice << endl;
}

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

#include <iostream>
using namespace std;

int main() {
  int N, Alice=0, Bob=0;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) cin >> a[i];
  
  sort(a, a+N, greater<int>());
  
  for (int j = 0; j < N; j++) {
    if (j%2 == 1) Alice += a[j];
    else Bob += a[j];
  }  
  cout << Bob-Alice << endl;
}

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

#include<bits/stdc++.h>
using namespace std;
int main(void){
  	int n;
  int sum = 0;
  int a = 0;
  	cin >> n;
  	vector<int> vec(n);
  for(int k = 0; k < n; k++){
    	cin >> vec(k);
  }
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  for(int i = 0; i < n; i=i+2){
    	sum += vec.at(i);
  }
  for(int j = 1; j < n; j = j + 2){
    	a += vec.at(j);
  }
  cout << sum - a << endl;
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:10:19: error: no match for call to '(std::vector<int>) (int&)'
   10 |         cin >> vec(k);
      |                ~~~^~~
Language: C++

#include<iostream>
#include<cstdlib>


using namespace std;
int main(){
    int N;

    cin >> N;

    int point[2] = {};
    int *card = NULL;

    card = (int *)malloc(sizeof(int) * N);

    for (int i = 0; i < N;i++){
        cin >> *(card + i);
    }

    std::sort(card, card + N);
    std::reverse(card,card+N);

    for (int i = 0; i < N;i++){
        point[i % 2] += *(card + i);
    }
    cout << max(point[0], point[1]) - min(point[0], point[1]) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   20 |     std::sort(card, card + N);
      |          ^~~~
      |          qsort
a.cc:21:10: error: 'reverse' is not a member of 'std'
   21 |     std::reverse(card,card+N);
      |          ^~~~~~~
Language: C++

#include<iostream>
#include<cstdlib>


using namespace std;
int main(){
    int N;

    cin >> N;

    int point[2] = {};
    int *card = NULL;

    card = (int *)malloc(sizeof(int) * N);

    for (int i = 0; i < N;i++){
        cin >> *(card + i);
    }

    sort(card,card+N);
    reverse(card,card+N);

    for (int i = 0; i < N;i++){
        point[i % 2] += *(card + i);
    }
    cout << max(point[0], point[1]) - min(point[0], point[1]) << endl;
}

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

#include<iostream>
#include<cstdlib>


int main(){
    using namespace std;
    int N;

    cin >> N;

    int point[2] = {};
    int *card = NULL;

    card = (int *)malloc(sizeof(int) * N);

    for (int i = 0; i < N;i++){
        cin >> *(card + i);
    }

    sort(card,card+N);
    reverse(card,card+N);

    for (int i = 0; i < N;i++){
        point[i % 2] += *(card + i);
    }
    cout << max(point[0], point[1]) - min(point[0], point[1]) << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,x,y;
  cin>>n;
  vector <int>vec(n);
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  for (int i=0;i<n;i+=2){
   x+=vec.at(i);}
  for (int j=1;j<n;j+=2){
   y+=vec(j);}
  cout<<x-y<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: no match for call to '(std::vector<int>) (int&)'
   12 |    y+=vec(j);}
      |       ~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,x,y
  cin>>n;
  vector <int>vec(n);
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  for (int i=0;i<n;i+=2){
   x+=vec.at(i);}
  for (int j=1;j<n;j+=2){
   y+=vec(j);}
  cout<<x-y<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: expected initializer before 'cin'
    5 |   cin>>n;
      |   ^~~
a.cc:12:4: error: 'y' was not declared in this scope
   12 |    y+=vec(j);}
      |    ^
a.cc:12:10: error: no match for call to '(std::vector<int>) (int&)'
   12 |    y+=vec(j);}
      |       ~~~^~~
a.cc:13:11: error: 'y' was not declared in this scope
   13 |   cout<<x-y<<endl;}
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector <int>vec(n);
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  for (int i=0;i<n;i+=2){
    int x+=vec.at(i);}
  for (int j=1;j<n;j+=2){
    int y+=vec(j);}
  cout<<x-y<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: expected initializer before '+=' token
   10 |     int x+=vec.at(i);}
      |          ^~
a.cc:12:10: error: expected initializer before '+=' token
   12 |     int y+=vec(j);}
      |          ^~
a.cc:13:9: error: 'x' was not declared in this scope
   13 |   cout<<x-y<<endl;}
      |         ^
a.cc:13:11: error: 'y' was not declared in this scope
   13 |   cout<<x-y<<endl;}
      |           ^
Language: C++

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

int main(){
  int N,A=0,B=0;
  cin >> N;
  vactor<int> a(N);
  for(int i=0;i<a.size();i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end(),greater<int>());
  for(int i=0;i<a.size();i++){
    if(i%2==0){
      A += a.at(i);
    }else{
      B += a.at(i);
    }
  }
  cout << A-B << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'vactor' was not declared in this scope
    9 |   vactor<int> a(N);
      |   ^~~~~~
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vactor<int> a(N);
      |          ^~~
a.cc:10:17: error: 'a' was not declared in this scope
   10 |   for(int i=0;i<a.size();i++){
      |                 ^
a.cc:13:8: error: 'a' was not declared in this scope
   13 |   sort(a.begin(),a.end(),greater<int>());
      |        ^
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++)
    cin >> A(i);
  int a,b;
  a=0;
  b=0;
  sort(A.begin(),A.end());
  for(int i=N-1;i>0;i--){
    a+=A(i);
    b+=A(i-1);
  }
  cout << a-b << endl;
  
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: no match for call to '(std::vector<int>) (int&)'
    9 |     cin >> A(i);
      |            ~^~~
a.cc:15:9: error: no match for call to '(std::vector<int>) (int&)'
   15 |     a+=A(i);
      |        ~^~~
a.cc:16:9: error: no match for call to '(std::vector<int>) (int)'
   16 |     b+=A(i-1);
      |        ~^~~~~
Language: C++

#include <iostream>
using namespace std;

 int main(){
   int N;
   int a[110];
   cin >> N;
   for (int i =0; i < N; i++) {
     cin >> a[i];
   }
   
   sort(a, a + N, gretare<int>());
   int Alice = 0;
   int Bob = 0;
   for (int i = 0; i < N; i++) {
     if (i % 2 == 0) {
       Alice += a[i];
     }
     else {
       Bob += a[i];
     }
   }
   cout << Alice - Bob << endl;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'gretare' was not declared in this scope
   12 |    sort(a, a + N, gretare<int>());
      |                   ^~~~~~~
a.cc:12:27: error: expected primary-expression before 'int'
   12 |    sort(a, a + N, gretare<int>());
      |                           ^~~
a.cc:12:4: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |    sort(a, a + N, gretare<int>());
      |    ^~~~
      |    short
Language: C++

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

int main(){
  int n, i;
  cin >> n;
  vector<int> a(n);
  for(i = 0; i < n; i++){
    cin >> a[i];
  }
  sort(a, a + SIZE_OF_ARRAY(a), greater<>());
  int ans = 0;
  for(i = 0; i < n; i += 2){
    ans += a[i];
  }
  for(i = 1; i < n; i += 2){
    ans -= a[i];
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: 'SIZE_OF_ARRAY' was not declared in this scope
   11 |   sort(a, a + SIZE_OF_ARRAY(a), greater<>());
      |               ^~~~~~~~~~~~~