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

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

int findsumofDigits(int n){
        int sum = 0;
        while(n >0){
            sum += n%10;
            n /= 10;
        }
        return sum;
    }

int main()
{
    int n,alice,bob;
    alice = 0;
    bob = 0;
    cin >> n;
    std::vector<int> vec(n);
    
    for(int i = 0; i < n; i++)
    {
        cin >> vec[i];
    }
    
    sort(vec.begin(),vec.end(),greater<int>());

    
    for(int i = 0; i < n; i++)
    {
        if(i%2 == 0)alice += vec[i];
        else bob += vec[i];

    }

    cout << alice - bob << endl;
    

Compiler output:
a.cc: In function 'int main()':
a.cc:39:33: error: expected '}' at end of input
   39 |     cout << alice - bob << endl;
      |                                 ^
a.cc:17:1: note: to match this '{'
   17 | {
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
	int n, tmp;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a(i);

	}
	sort(a.begin(), a.end());
	int alice = 0, bob = 0;
	for (int i = n - 1; i >= 0; i++) {
		alice += a[i];
		if (i == 0) break;
		bob += a[i - 1];

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

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

#include<bits/stdc++.h>
using namespace std;
int main() {
	int n, tmp;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a(n);

	}
	sort(a.begin(), a.end());
	int alice = 0, bob = 0;
	for (int i = n - 1; i >= 0; i++) {
		alice += a[i];
		if (i == 0) break;
		bob += a[i - 1];

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

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

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

int main() {
  int n ;
  int sa,sb =0;
  cin >> n;
  vector<int> con(n);
  for(int a:con )
    cin >> a;
  
  sort(con, con.end(), greater<int>());

  
  for( int i= 0;i< n;i++){
    if( i % 2 ==0)
    sa += con[i];
    else
    sb += con[i];
  }

  cout << sa - sb << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: no matching function for call to 'sort(std::vector<int>&, std::vector<int>::iterator, std::greater<int>)'
   12 |   sort(con, con.end(), greater<int>());
      |   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   template argument deduction/substitution failed:
a.cc:12:7: note:   deduced conflicting types for parameter '_RAIter' ('std::vector<int>' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >')
   12 |   sort(con, con.end(), greater<int>());
      |   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 3 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   template argument deduction/substitution failed:
a.cc:12:7: note:   deduced conflicting types for parameter '_RandomAccessIterator' ('__gnu_cxx::__normal_iterator<int*, std::vector<int> >' and 'std::greater<int>')
   12 |   sort(con, con.end(), greater<int>());
      |   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
  int n ;
  cin >> n;
  vector<int> con(n);
  for(auto a:con )
    cin >> a;
  
  sort(con.begin(), con.end(), greater<int>());
  for(int a:con)

  int sa,sb =0;
  for( int i= 0;i< n;i++){
    if( i % 2 ==0)
    {sa += con[i];}
    else{sb += con[i];}
  }

  cout << sa - sb << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:6: error: 'sa' was not declared in this scope
   17 |     {sa += con[i];}
      |      ^~
a.cc:18:10: error: 'sb' was not declared in this scope
   18 |     else{sb += con[i];}
      |          ^~
a.cc:21:11: error: 'sa' was not declared in this scope
   21 |   cout << sa - sb << endl;
      |           ^~
a.cc:21:16: error: 'sb' was not declared in this scope
   21 |   cout << sa - sb << endl;
      |                ^~
Language: C++

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

int main() {
  int n ;
  cin >> n;
  vector<int> con(n);
  for(auto a;con )
    cin >> a;
  
  sort(con.begin(), con.end(), greater<int>());
  for(int a:con)

  int sa,sb =0;
  for( int i= 0;i< n;i++){
    if( i % 2 ==0)
    {sa += con[i];}
    else{sb += con[i];}
  }

  cout << sa - sb << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: declaration of 'auto a' has no initializer
    8 |   for(auto a;con )
      |       ^~~~
a.cc:8:14: error: could not convert 'con' from 'std::vector<int>' to 'bool'
    8 |   for(auto a;con )
      |              ^~~
      |              |
      |              std::vector<int>
a.cc:8:17: error: expected ';' before ')' token
    8 |   for(auto a;con )
      |                 ^~
      |                 ;
a.cc:17:6: error: 'sa' was not declared in this scope
   17 |     {sa += con[i];}
      |      ^~
a.cc:18:10: error: 'sb' was not declared in this scope
   18 |     else{sb += con[i];}
      |          ^~
a.cc:21:11: error: 'sa' was not declared in this scope
   21 |   cout << sa - sb << endl;
      |           ^~
a.cc:21:16: error: 'sb' was not declared in this scope
   21 |   cout << sa - sb << endl;
      |                ^~
Language: C++

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

int main() {
  int n ;
  cin >> n;
  vector<int> con(n);
  for(auto a;con )
    cin >> a;
  
  sort(con.begin(), con.end(), greater<int>());
  for(auto a:con)
  cout << a << endl;
  int sa,sb =0;
  for( auto i= 0;i< n;i++){
  cout << i << endl << con[i] <<endl;
    if( i % 2 ==0)
    {sa += con[i];}
    else{sb += con[i];}
  }
  cout << sa << endl << sb << endl;
  cout << sa - sb << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: declaration of 'auto a' has no initializer
    8 |   for(auto a;con )
      |       ^~~~
a.cc:8:14: error: could not convert 'con' from 'std::vector<int>' to 'bool'
    8 |   for(auto a;con )
      |              ^~~
      |              |
      |              std::vector<int>
a.cc:8:17: error: expected ';' before ')' token
    8 |   for(auto a;con )
      |                 ^~
      |                 ;
Language: C++

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

int main() {
  int n ;
  cin >> n;
  array<int,n> con ;
  for(auto a;con )
    cin >> a;
  
  sort(con.begin(), con.end(), greater<int>());
  for(auto a:con)
  cout << a << endl;
  int sa,sb =0;
  for( auto i= 0;i< n;i++){
  cout << i << endl << con[i] <<endl;
    if( i % 2 ==0)
    {sa += con[i];}
    else{sb += con[i];}
  }
  cout << sa << endl << sb << endl;
  cout << sa - sb << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: the value of 'n' is not usable in a constant expression
    7 |   array<int,n> con ;
      |              ^
a.cc:5:7: note: 'int n' is not const
    5 |   int n ;
      |       ^
a.cc:7:14: note: in template argument for type 'long unsigned int'
    7 |   array<int,n> con ;
      |              ^
a.cc:8:7: error: declaration of 'auto a' has no initializer
    8 |   for(auto a;con )
      |       ^~~~
a.cc:8:17: error: expected ';' before ')' token
    8 |   for(auto a;con )
      |                 ^~
      |                 ;
a.cc:11:12: error: request for member 'begin' in 'con', which is of non-class type 'int'
   11 |   sort(con.begin(), con.end(), greater<int>());
      |            ^~~~~
a.cc:11:25: error: request for member 'end' in 'con', which is of non-class type 'int'
   11 |   sort(con.begin(), con.end(), greater<int>());
      |                         ^~~
a.cc:12:14: error: 'begin' was not declared in this scope
   12 |   for(auto a:con)
      |              ^~~
a.cc:12:14: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:12:14: error: 'end' was not declared in this scope
   12 |   for(auto a:con)
      |              ^~~
a.cc:12:14: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc:16:27: error: invalid types 'int[int]' for array subscript
   16 |   cout << i << endl << con[i] <<endl;
      |                           ^
a.cc:18:15: error: invalid types 'int[int]' for array subscript
   18 |     {sa += con[i];}
      |               ^
a.cc:19:19: error: invalid types 'int[int]' for array subscript
   19 |     else{sb += con[i];}
      |                   ^
Language: C++

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

int main() {
  int n;
  cin >> n ;
  vector<int> con(n);
  for (auto a: con)
    cin >> con.at(i);
  sort(con.begin(), con.end(), greater<int>());
  int sa,sb;
  for( auto i= 0;i< n;i++){
    if( i % 2 ==0)
    {sa += con[i];}
    else{sb += con[i];}
  }
  cout << sa - sb << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:19: error: 'i' was not declared in this scope
    9 |     cin >> con.at(i);
      |                   ^
Language: C++

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

int N;
int A[110];

int main()
{
  cin >> N;
  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){
    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:13:8: error: 'a' was not declared in this scope
   13 |   sort(a, a+N, greater<int>());
      |        ^
Language: C++

#include <iostream>
#include <string>
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,greater<int>());
  int A=0;
  int B=0;
  
  for (int i=0;i<N;++i){
    if (i%2==0) {
      A+=a[i];
    }
    else{
      B+=a[i];
    }
  }
  cout<<B-A<<endl;
}

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

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

int main() {
  int N;
  int a[110];
  cin >> N;
  for (int i=0;i<N;++i) cin >> a[i];

  std::sort(a,a+N,greater<int>());
  int A=0;
  int B=0;
  
  for (int i=0;i<N;++i){
    if (i%2==0) {
      A+=a[i];
    }
    else{
      B+=a[i];
    }
  }
  cout<<B-A<<endl;
}

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

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

int main() {
  int N,alice,bob;
  cin >> N;
  vector<int> cards(N);
  for (int i = 0; i < N; i++) cin >> cards.at(i)
  sort(cards.begin(), cards.end());
  reverse(cards.begin(), cards.end());
  for (int i = 0; i < N; i += 2) {
    alice += cards.at(i);
    bob += cards.at(i + 1);
  }
  cout << alice - bob << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:49: error: expected ';' before 'sort'
    8 |   for (int i = 0; i < N; i++) cin >> cards.at(i)
      |                                                 ^
      |                                                 ;
    9 |   sort(cards.begin(), cards.end());
      |   ~~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(void)
{
    int N,i;
    int a[110];
    cin>>N;
    for(i=0;i<N;i++){
        cin>>a[i];
    }
    sort(a,a+N,greater<int>());
    int A=0,B=0,j;
    for(j=0;j<N;j++){
        if(j%2==0)
        A+=a[j];
        else
        B+=a[j];
    }
    cout<<A-B<<endl;
    return 0;
}

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

#include<iostream>
#include <algorithm>

using namespace std;

int N;
int A[110];

int main(){
	cin >> N;
  	for(int i; 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++){
    	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:14: error: 'a' was not declared in this scope
   12 |         sort(a, a+N, greater<int>());
      |              ^
Language: C++

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

int N;

int main(){
cin>>N;

int A[N];

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++){
    Alice +=A[i];
    i++;
    Bob+=A[i];
}
cout<<Alice-Bob<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:1: error: expected ',' or ';' before 'int'
   15 | int Bob=0;
      | ^~~
a.cc:19:5: error: 'Bob' was not declared in this scope
   19 |     Bob+=A[i];
      |     ^~~
a.cc:21:13: error: 'Bob' was not declared in this scope
   21 | cout<<Alice-Bob<<endl;
      |             ^~~
Language: C++

#include<iostream>
using namespace std;

int N;
int A[N];

int main(){
cin>>N;
for(int i=0;i<N;i++)cin>>A[i];
sort(A,A+N,greater<int>());
int Alice=0,Bob=0;
for(i=0;i<N;i++){
    Alice +=A[i];
    i++;
    Bob+=A[i];
}
d = Alice-Bob;
cout<<d;
}

Compiler output:
a.cc:5:7: error: size of array 'A' is not an integral constant-expression
    5 | int A[N];
      |       ^
a.cc: In function 'int main()':
a.cc:10:1: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 | sort(A,A+N,greater<int>());
      | ^~~~
      | short
a.cc:12:5: error: 'i' was not declared in this scope
   12 | for(i=0;i<N;i++){
      |     ^
a.cc:17:1: error: 'd' was not declared in this scope
   17 | d = Alice-Bob;
      | ^
Language: C++

#include<iostream>
using namespace std;

int N;
int A[N];

int main(){
cin>>N;
for(int i=0;i<N;i++)cin>>A[i];
sort(A,A+N,greater<int>());
int Alice=0,Bob=0;
for(i=0;i<N;i++){
    Alice +=A[i];
    i++;
    Bob+=A[i];
}
cout<<Alice-Bob;
}

Compiler output:
a.cc:5:7: error: size of array 'A' is not an integral constant-expression
    5 | int A[N];
      |       ^
a.cc: In function 'int main()':
a.cc:10:1: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 | sort(A,A+N,greater<int>());
      | ^~~~
      | short
a.cc:12:5: error: 'i' was not declared in this scope
   12 | for(i=0;i<N;i++){
      |     ^
Language: C++

#include<iostream>
using namespace std;

int N;
int A[N];

int main(){
cin>>N;
for(int i=0;i<N;i++)cin>>A[i];
sort(A,A+N,greater<int>());
int Alice=0,Bob=0;
for(i=0;i<N;i++){
    Alice +=A[i];
    i++;
    Bob+=A[i]
}
cout<<Alice-Bob
}

Compiler output:
a.cc:5:7: error: size of array 'A' is not an integral constant-expression
    5 | int A[N];
      |       ^
a.cc: In function 'int main()':
a.cc:10:1: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 | sort(A,A+N,greater<int>());
      | ^~~~
      | short
a.cc:12:5: error: 'i' was not declared in this scope
   12 | for(i=0;i<N;i++){
      |     ^
a.cc:17:16: error: expected ';' before '}' token
   17 | cout<<Alice-Bob
      |                ^
      |                ;
   18 | }
      | ~
Language: C++

#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
using ll = long long int;
int main() {
  int n;
  cin>>n;
  vector<int> a(n+3);
  for (int i=0;i<n;i++) cin>>a.at(i);
  sort(a.begin(), a.end());
  int bob=0;
  int alice=0;
  for (int i=0;i<n+3;i+=2;){
	bob+=a.at(i+1);
	alice+=a.at(i);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   11 |   sort(a.begin(), a.end());
      |   ^~~~
      |   sqrt
a.cc:14:26: error: expected ')' before ';' token
   14 |   for (int i=0;i<n+3;i+=2;){
      |       ~                  ^
      |                          )
a.cc:14:27: error: expected primary-expression before ')' token
   14 |   for (int i=0;i<n+3;i+=2;){
      |                           ^
Language: C++

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

int main(){
  int N;
  vector<int> a(10000); 
  cin >> N;
  
  int i;
  for(i = 0;i < N;i++){
    cin >> a.at(i);
  }
  
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
 
  int alice = 0;
  int j;
  for(j = 0;j < N;j += 2){
    alice += a.at(j);
  }
  
  int bob = 0;
  int k;
  for(k = 1;k < N;k += 2){
    bob += a.at(k);
  }
  
  int sa = alice - bob;
  cout << sa << endl;
}
  

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int> a(10000);
      |   ^~~~~~
a.cc:6:10: error: expected primary-expression before 'int'
    6 |   vector<int> a(10000);
      |          ^~~
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> N;
      |   ^~~
a.cc:11:12: error: 'a' was not declared in this scope
   11 |     cin >> a.at(i);
      |            ^
a.cc:14:8: error: 'a' was not declared in this scope
   14 |   sort(a.begin(),a.end());
      |        ^
a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |   sort(a.begin(),a.end());
      |   ^~~~
      |   short
a.cc:15:3: error: 'reverse' was not declared in this scope
   15 |   reverse(a.begin(),a.end());
      |   ^~~~~~~
a.cc:30:3: error: 'cout' was not declared in this scope
   30 |   cout << sa << endl;
      |   ^~~~
a.cc:30:17: error: 'endl' was not declared in this scope
   30 |   cout << sa << endl;
      |                 ^~~~
Language: C++

#include<iostream>
using namespace std;

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



Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |                 if(i%2==0)      ans += a[i];
      |                                 ^~~
      |                                 abs
a.cc:25:33: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |                 else            ans -= a[i];
      |                                 ^~~
      |                                 abs
a.cc:28:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

#include <iostream>
#include <algorithm>
#include <functional>

#define rep(i,a,n) for(int (i) = (a);(i) < (n);(i)++)
using namespace std;

int main(){
  	int n,a[100],Bob = 0,Alice = 0;
    cin >> n;
  	
  	rep(i,0,n) cin >> a[i];
  
  	sort(a,a+n,greater<int>);
  
  	rep(i,0,n){
      if(i % 2 == 0){
        Alice += a[i];
      }
      else{
      	Bob += a[i];
      }
    }
  
  	cout << Alice - Bob << endl;
  	return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:32: error: expected primary-expression before ')' token
   14 |         sort(a,a+n,greater<int>);
      |                                ^
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());
  reverse (v);
  int a=0, b=0;
  for (int i=0; i<N; i++){
  	if (i%2==0) a+=v[i];
    else b+=v[i];
  }
  cout << a-b <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: no matching function for call to 'reverse(std::vector<int>&)'
   12 |   reverse (v);
      |   ~~~~~~~~^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
 1083 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note:   candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include <iostream>
using namespace std;

int main() {
    int N, A[100];

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

    // 降順にソート
    sort(A, A+N, greater<int>());

    int alice_score = 0, bob_score = 0;
    for (int i=0; i<N; i++) {
        if (i % 2 == 0) alice_score += A[i];
        else bob_score += A[i];
    }
    cout << alice_score - bob_score << endl;
}

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

import numpy as np

n = int(input())
a_list = list(map(int, input().split()))

alice_point = 0
bob_point = 0
for i in range(n):
    argmax_a = np.argmax(a_list)
    max_a = np.max(a_list)
    if i % 2 == 0: # If Alice takes a card
        alice_point += max_a
    else: # If Bob takes a card
        bob_point += max_a
    del a_list[argmax_a] # No confidence -> Review how to delete list element!

print(alice_point - bob_point)

Compiler output:
a.cc:11:20: error: stray '#' in program
   11 |     if i % 2 == 0: # If Alice takes a card
      |                    ^
a.cc:13:11: error: stray '#' in program
   13 |     else: # If Bob takes a card
      |           ^
a.cc:15:26: error: stray '#' in program
   15 |     del a_list[argmax_a] # No confidence -> Review how to delete list element!
      |                          ^
a.cc:1:1: error: 'import' does not name a type
    1 | import numpy as np
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <iostream>
#include <vector>
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());
    int Alice=0, Bob=0;
    for (int i=0; i<N; i++){
        if (i%2 == 0) Alice += a.at(N-i-1);
        else Bob += a.at(N-i-1);
    }
    cout << Alice - Bob << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |     sort(a.begin(), a.end());
      |     ^~~~
      |     short
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, greater<int>());

  int A=0;
  int B=0;

  for(int i=0; i<N; i++){
    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:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |   sort(a, a+N, greater<int>());
      |   ^~~~
      |   short
Language: C++

#include<iostream>
using namespace std;

int main(void){
  int N, Alice = 0, Bob = 0;
  int a[100];
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  //ソートして奇数番目の数字の和を求める
  sort(a, a + N, greater<int>());
  for(int i = 0; i < N; i++){
    if(i % 2 == 0){Alice += a[i];}
    else {Bob += a[i];}
  }
  cout << Alice - Bob << endl;
  return 0;
}


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(a, a + N, greater<int>());
      |   ^~~~
      |   short
Language: C++

#include<iostream>
using namespace std;

int main(void){
  int N, Alice = 0, Bob = 0;
  int a[100];
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  //ソートして奇数番目の数字の和を求める
  sort(a.begin(), a.end(), greater<int>());
  for(int i = 0; i < N; i++){
    if(i % 2 == 0){Alice += a[i];}
    else {Bob += a[i];}
  }
  cout << Alice - Bob << endl;
  return 0;
}


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 [100]'
   12 |   sort(a.begin(), a.end(), greater<int>());
      |          ^~~~~
a.cc:12:21: error: request for member 'end' in 'a', which is of non-class type 'int [100]'
   12 |   sort(a.begin(), a.end(), greater<int>());
      |                     ^~~
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |   sort(a.begin(), a.end(), greater<int>());
      |   ^~~~
      |   short
Language: C++

#include <iostream>

using namespace std;

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

int main() {

    int N;
    scanf("%d", &N);

    int A[N];
    REP(i, N){
        scanf("%d", &A[i]);
    }

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

    int ans = 0;

    REP(i, N){
        if (i % 2 == 0) {
            ans += A[i];
        } else {
            ans -= A[i];
        }
    }

    printf("%d\n", ans);
}


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

#include <iostream>
#include <vector>
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());
  int ans=0;
  for (int i=N-1; i>=0; i--){
    if ((N-1)%2 == (i)%2) ans += A[i];
    else ans -= A[i];
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |   sort(A.begin(), A.end());
      |   ^~~~
      |   short
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 ++) {
    int ai;
    cin >> ai;
    a[i] = ai;
  }//配列aを作成
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end()); //aの要素を大きい順に並べ替え
  int sum_Alice = 0;
  int sum_Bob = 0;
  for (int j = 0; j < N; j ++) sum_Alice += a[j];
  for (int k = 0; k < N; k ++) sum_Bob += a[k];
  cout << sum_Alice - sum_Bob << endl;
}

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:21: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   12 |   sort(a.begin(), a.end());
      |                     ^~~
a.cc:13:13: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   13 |   reverse(a.begin(), a.end()); //aの要素を大きい順に並べ替え
      |             ^~~~~
a.cc:13:24: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   13 |   reverse(a.begin(), a.end()); //aの要素を大きい順に並べ替え
      |                        ^~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: no match for call to '(std::vector<int>) (int)'
   14 |     sum += vec(0);
      |            ~~~^~~
a.cc:15:14: error: no match for call to '(std::vector<int>) (int)'
   15 |   cout << vec(0);
      |           ~~~^~~
Language: C

	#include <stdio.h>
	#include <stdlib.h>
int compare(const void *a,const void *c){
    return *(int*)c-*(int*)a;
}
int main(){
	    int x,y,r=0,t=1;
	    int arr[999];
scanf("%d",&n);
for(y=0;y<x;y++)scanf("%d",&arr[y]);
qsort(arr,x,4,compare);
for(y=0;y<x;y++){
        r+=t*arr[y];
        t=-t;
    }
    printf("%d\n",r);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:13: error: 'n' undeclared (first use in this function)
    9 | scanf("%d",&n);
      |             ^
main.c:9:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: lvalue required as left operand of assignment
   13 |     if(i % 2 = 0) r += a[i];
      |        ~~^~~
Language: C++

// Card Game for Two

#include <iostream>

using namespace std;

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

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

	int Alice = 0, Bob = 0;

	for(int i = 0; i < N; ++i){
		if (i % 2)
			Bob += a[i];
		else
			Alice += a[i];
	}

	cout << Alice - Bob << endl;

	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int main()
int a[70000];
{
int a;
int n;
int t;
cin>>n;
int si,maxi,wa;
si=0;
maxi=0;
wa=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
maxi+=a[i];
}
sort(a,a+n);
int s=0;
if(n%2==0)
for(int i=0;i<n;i+=2)
s=s+a[i];
else
for(int i=1;i<n;i+=2)
s=s+a[i];
cout<<maxi-s-s;
return 0;
}

Compiler output:
a.cc:4:1: error: expected initializer before 'int'
    4 | int a[70000];
      | ^~~
a.cc:5:1: error: expected unqualified-id before '{' token
    5 | {
      | ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

public class Max {
    public static void main(String[] args) {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        int n = 0;
        String aInput = "";

        try {
            n = Integer.parseInt(bufferedReader.readLine());
            aInput = bufferedReader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }

        String[] aArray = aInput.split(" ");
        List<Integer> aList = new ArrayList<>();
        for (String aString : aArray) {
            aList.add(Integer.parseInt(aString));
        }
        int alice = 0;
        int bob = 0;
        int i = 0;
        while (aList.size() > 0) {
            int max =  getMaxValue(aList);
            if (i % 2 == 0) {
                alice += max;
            } else {
                bob += max;
            }
            aList.remove(Integer.valueOf(max));
            i++;
        }

        System.out.println(alice - bob);
    }

    private static int getMaxValue(List<Integer> list) {
        Optional<Integer> max = list.stream().max(Integer::compareTo);
        return max.get();
    }
}

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

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

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

  vector<int>number(N); //配列初期化
  for(int i = 0; i < N; i++){
    cin >> number.at(i); //配列に代入
  }
  sort(number.begin(), number.end()); //ソートする
  reverse(number.begin(), number.end()); //降順に並べる

  //Aliceの得点
  int sum_A = 0;
  for(int k = 0; k < N; k += 2){
     sum_A += number.st(k);
  }

  //Bobの得点
  int sum_B = 0;
  for(int k = 1; k < N; k += 2){
    sum_B += number.st(k);
  }

  cout << sum_A - sum_B << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:22: error: 'class std::vector<int>' has no member named 'st'; did you mean 'at'?
   18 |      sum_A += number.st(k);
      |                      ^~
      |                      at
a.cc:24:21: error: 'class std::vector<int>' has no member named 'st'; did you mean 'at'?
   24 |     sum_B += number.st(k);
      |                     ^~
      |                     at
Language: C++

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

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

  for(int i = 0; i < N; i++){
    vector<int>number(N); //配列初期化
    cin >> number.at(i); //配列に代入
  }
  sort(number.begin(), number.end()); //ソートする
  reverse(number.begin(), number.end()); //降順に並べる

  //Aliceの得点
  int sum_A = 0;
  for(int k = 0; k < N; k += 2){
     sum_A += number.st(k);
  }

  //Bobの得点
  int sum_B = 0;
  for(int k = 1; k < N; k += 2){
    sum_B += number.st(k);
  }

  cout << sum_A - sum_B << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: 'number' was not declared in this scope
   12 |   sort(number.begin(), number.end()); //ソートする
      |        ^~~~~~
Language: Java

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int n;
		int[] numbers;
		try (Scanner scanner = new Scanner(System.in)) {
			n = scanner.nextInt();

			numbers = new int[n];
			for (int i = 0; i < n; i++) {
				numbers[i] = scanner.nextInt();
			}
		}

		Arrays.sort(numbers);

		int difference = 0;
		for (int i = 0; i < n; i++) {
			difference = numbers[i] - difference;
		}

		System.out.println(difference);
	}
}

Compiler output:
Main.java:16: error: cannot find symbol
		Arrays.sort(numbers);
		^
  symbol:   variable Arrays
  location: class Main
1 error
Language: C++

#include <iostream>
#include <vector>

using namespace std;

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

  int sum_a = 0;
  int sum_b = 0;
  for (int i = 0; i < n; i++) {
    int num = a.front();
    a.erase(a.begin());
    if (i % 2 == 0) {
      sum_a += num;
    } else {
      sum_b += num;
    }
  }
  cout << sum_a - sum_b << endl;
}


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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: expected unqualified-id before 'if'
   13 |   if(N%2==0){
      |   ^~
a.cc:13:14: error: expected '}' at end of input
   13 |   if(N%2==0){
      |              ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<vector>
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());
        reverse(c.begin(),c.end());
    }
    int a=0,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<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |         sort(c.begin(),c.end());
      |         ^~~~
      |         short
a.cc:11:9: error: 'reverse' was not declared in this scope
   11 |         reverse(c.begin(),c.end());
      |         ^~~~~~~
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, greater<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:8:18: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
    8 |   for (int i =0; i < N: ++i) cin >>a[i];
      |                  ^
a.cc:8:23: error: expected ';' before ':' token
    8 |   for (int i =0; i < N: ++i) cin >>a[i];
      |                       ^
      |                       ;
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(a, a + N, greater<int>());
      |   ^~~~
      |   short
a.cc:11:3: error: expected primary-expression before 'int'
   11 |   int Alice = 0;
      |   ^~~
a.cc:10:34: error: expected ')' before 'int'
   10 |   sort(a, a + N, greater<int>());
      |                                  ^
      |                                  )
   11 |   int Alice = 0;
      |   ~~~                             
a.cc:8:7: note: to match this '('
    8 |   for (int i =0; i < N: ++i) cin >>a[i];
      |       ^
a.cc:15:7: error: 'Alice' was not declared in this scope
   15 |       Alice +=a[i];
      |       ^~~~~
a.cc:18:18: error: expected ';' before '}' token
   18 |       Bob += a[i]
      |                  ^
      |                  ;
   19 |     }
      |     ~             
a.cc:21:11: error: 'Alice' was not declared in this scope
   21 |   cout << Alice - Bob <<endl;}
      |           ^~~~~
Language: Java

import java.util.*;
public class Main2 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int score_Alice=0;
        int score_Bob = 0;
        int N = sc.nextInt();
        ArrayList<Integer> List = new ArrayList<Integer>();
        for(int a=0;a<N;a++){
            List.add(sc.nextInt());
        }
        Collection<Integer> num_List = new ArrayList<Integer>(List);

        for(int a=0;a<N;a++){
            int score = Collections.max(num_List);
           if(a%2==0){
               score_Alice +=score;
           }
           else{
               score_Bob +=score;
           }
           num_List.remove(score);
        }
        int score = score_Alice - score_Bob;
        System.out.println(score);
    }
}

Compiler output:
Main.java:2: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error
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,a+N,greater<int>());
  	int Alice = 0;
  	int Bob = 0;
  	
  	for(int i=0; i<N; i++9{
      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:15:30: error: expected ')' before numeric constant
   15 |         for(int i=0; i<N; i++9{
      |            ~                 ^
      |                              )
a.cc:15:31: error: expected ';' before '{' token
   15 |         for(int i=0; i<N; i++9{
      |                               ^
      |                               ;
Language: C++

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

int main()
int N;
int a[200];
cin >> N;
for (int i=0; i<N; ++i)
cin >> a[i]
sort(a, a+N, greater<int>());
int A = 0;
int B = 0;
for (int i=0; i<N; ++i){
if(i%2==0){
A+=a[i];
}
else
B+=a[i];
cout<<A-B<<endl:
}


Compiler output:
a.cc:2:10: fatal error: alglrithm: No such file or directory
    2 | #include <alglrithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>
int main(void)
{
        int n,a[100],i,j,tmp,s=0;
        scanf("%d",&n);
        for(i=0;i<n;i++) scanf("%d",&a[i]);
        for(i=1;i<n;i++){
                j=i;
                while((j>0)&&(a[j]>a[j-1])){
                        tmp=a[j]; a[j]=a[j-1]; a[j-1]=tmp;
                        j=j-1;
                }
        }
        for(i=0;i<n;i++){
                if(i%2==0) s+=a[i];
                else s-=a[i];
        }
        printf("%d\n",abs(s));
        return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:23: error: 'abs' was not declared in this scope
   18 |         printf("%d\n",abs(s));
      |                       ^~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
	int n;
	cin>>n;
	int point;
	vector<int>a(200);

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

	for(int i=0;i<n;i+=2){
		point+=a.at(i);
		point-=a.at(i+1);
	}
	cout<<point<<endl;
	return 0;
}

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

#include <iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
	int n;
	cin>>n;
	int point;
	vector<int>a(200);

	for(int i=0;i<n;i++){
		cin>>a.at(i);
	}
	std::sort(a.begin(),a.end());
	std::reverse(a.begin(),a.end());

	for(int i=0;i<n;i+=2){
		point+=a.at(i);
		point-=a.at(i+1);
	}
	cout<<point<<endl;
	return 0;
}

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

#include <iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
	int n;
	cin>>n;
	int point;
	vector<int>a(200);

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

	for(int i=0;i<n;i+=2){
		point+=a.at(i);
		point-=a.at(i+1);
	}
	cout<<point<<endl;
	return 0;
}

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

#include <iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
	int n;
	cin>>n;
	int point;
	vector<int>a;

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

	for(int i=0;i<n;i+=2){
		point+=a.at(i);
		point-=a.at(i+1);
	}
	cout<<point<<endl;
	return 0;
}

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

#include <iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
	int n;
	cin>>n;
	int point;
	vector<int>a;

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

	for(int i=0;i<n;i+=2){
		point+=a.at(i);
		point-=a.at(i+1);
	}
	cout<<point<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:29: error: expected ';' before '}' token
   12 |                 cin>>a.at(i)
      |                             ^
      |                             ;
   13 |         }
      |         ~                    
a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |         sort(a.begin(),a.end());
      |         ^~~~
      |         short
a.cc:15:9: error: 'reverse' was not declared in this scope
   15 |         reverse(a.begin(),a.end());
      |         ^~~~~~~
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main(){
	int N, alice = 0, bob = 0;
  	cin >> N;
  	vector<int> a(N);
  	sort(a.begin(),a.end());
  	for(int i = N-1 ; i >= 0 ; i--){
    	alice += a[i];
      	if(i-1>=0){i--; bob += a[1]}
    }
  	cout << alice - bob << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |         sort(a.begin(),a.end());
      |         ^~~~
      |         short
a.cc:13:36: error: expected ';' before '}' token
   13 |         if(i-1>=0){i--; bob += a[1]}
      |                                    ^
      |                                    ;
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main(){
	int N, alice = 0, bob = 0;
  	cin >> N;
  	vector<int> a(N);
  	a.sort()
  	for(int i = N-1 ; i >= 0 ; i--){
    	alice += a[i];
      	if(i-1>=0){i--; bob += a[1]}
    }
  	cout << alice - bob << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: 'class std::vector<int>' has no member named 'sort'
   10 |         a.sort()
      |           ^~~~
a.cc:11:27: error: 'i' was not declared in this scope
   11 |         for(int i = N-1 ; i >= 0 ; i--){
      |                           ^
Language: C++

#include<iostream>
using namespace std;

void sort(int* a,int n){
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(a[i]<a[j]){
        int temp=a[i];
        a[i]=a[j];
        a[j]=temp;
      }
    }
  }
}

int main(){
  
  int a,b;
  int a=b=0;
  
  int N;
  cin>>N;
  int d[101];
  for(int i=0;i<N;i++)cin>>d[i];  
  
  sort(d,N);
  for(int i=0;i<N;i++){
    if(i%2==0)a+=d[i];
    else b+=d[i];
  }
  cout<<a-b;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:7: error: redeclaration of 'int a'
   19 |   int a=b=0;
      |       ^
a.cc:18:7: note: 'int a' previously declared here
   18 |   int a,b;
      |       ^