criyle/codenet-compile-errors huggingface dataset:
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 alice,bob;
  for (int i = 0;i < N;i++){
    alice += vec.at(i*2);
    bob += vec.at(i*2 + 1);
  }
  cout << alice - bob << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: no matching function for call to 'sort(<unresolved overloaded function type>, std::vector<int>::iterator)'
   11 |   sort(vec.begin,vec.end()));
      |   ~~~~^~~~~~~~~~~~~~~~~~~~~
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: 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:32: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<int*, std::vector<int> >'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |          ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
/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:   candidate expects 3 arguments, 2 provided
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, 2 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:   candidate expects 3 arguments, 2 provided
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 alice,bob;
  for (int i = 0;i < N;i++){
    alice += vec.at(i*2);
    bob += vec.at(i*2 + 1);
  }
  cout << alice - bob << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: expected initializer before '<' token
    7 |   vector<int> vec<N>;
      |                  ^
a.cc:9:12: error: 'vec' was not declared in this scope
    9 |     cin >> vec.at(i);
      |            ^~~
a.cc:11:8: error: 'vec' was not declared in this scope
   11 |   sort(vec.begin,vec.end()));
      |        ^~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: expected initializer before '<' token
    7 |   vector<int> vec<N>;
      |                  ^
a.cc:8:12: error: expected unqualified-id before '=' token
    8 |   for (int = 0; i < N;i++){
      |            ^
a.cc:8:11: error: expected ';' before '=' token
    8 |   for (int = 0; i < N;i++){
      |           ^~
      |           ;
a.cc:8:12: error: expected primary-expression before '=' token
    8 |   for (int = 0; i < N;i++){
      |            ^
a.cc:8:17: error: 'i' was not declared in this scope
    8 |   for (int = 0; i < N;i++){
      |                 ^
a.cc:8:22: error: expected ')' before ';' token
    8 |   for (int = 0; i < N;i++){
      |       ~              ^
      |                      )
a.cc:8:23: error: 'i' was not declared in this scope
    8 |   for (int = 0; i < N;i++){
      |                       ^
a.cc:11:8: error: 'vec' was not declared in this scope
   11 |   sort(vec.begin,vec.end()));
      |        ^~~
a.cc:14:12: error: expected unqualified-id before '=' token
   14 |   for (int = 0;i < N;i++){
      |            ^
a.cc:14:11: error: expected ';' before '=' token
   14 |   for (int = 0;i < N;i++){
      |           ^~
      |           ;
a.cc:14:12: error: expected primary-expression before '=' token
   14 |   for (int = 0;i < N;i++){
      |            ^
a.cc:14:21: error: expected ')' before ';' token
   14 |   for (int = 0;i < N;i++){
      |       ~             ^
      |                     )
Language: C++

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


main()
{
	int n;
	cin >> n;
	priprity_queue<int>Q;
	for(int i=0;i<n;i++)
	{
		int a;
		cin >> a;
		Q.push(a);
	}
	int s1=0,s2=0;
	for(int i=0;i<n;i++)
	{
		if(i%2==0)
		{
			s1+=Q.top();
		}
		else
		{
			s2+=Q.top();
		}
		Q.pop();
	}
	cout << abs(s1-s2);
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:9:9: error: 'priprity_queue' was not declared in this scope
    9 |         priprity_queue<int>Q;
      |         ^~~~~~~~~~~~~~
a.cc:9:24: error: expected primary-expression before 'int'
    9 |         priprity_queue<int>Q;
      |                        ^~~
a.cc:14:17: error: 'Q' was not declared in this scope
   14 |                 Q.push(a);
      |                 ^
a.cc:21:29: error: 'Q' was not declared in this scope
   21 |                         s1+=Q.top();
      |                             ^
a.cc:25:29: error: 'Q' was not declared in this scope
   25 |                         s2+=Q.top();
      |                             ^
a.cc:27:17: error: 'Q' was not declared in this scope
   27 |                 Q.pop();
      |                 ^
Language: C++

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


main()
{
	int n;
	cin >> n;
	priprity_queue<int>Q;
	for(int i=0;i<n;i++)
	{
		int a;
		cin >> a;
		Q.push(a);
	}
	int s1=0,s2=0;
	for(int i=0;i<n;i++)
	{
		if(i%2==0)
		{
			s1+=Q.front();
		}
		else
		{
			s2+=Q.front();
		}
		Q.pop();
	}
	cout << abs(s1-s2);
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:9:9: error: 'priprity_queue' was not declared in this scope
    9 |         priprity_queue<int>Q;
      |         ^~~~~~~~~~~~~~
a.cc:9:24: error: expected primary-expression before 'int'
    9 |         priprity_queue<int>Q;
      |                        ^~~
a.cc:14:17: error: 'Q' was not declared in this scope
   14 |                 Q.push(a);
      |                 ^
a.cc:21:29: error: 'Q' was not declared in this scope
   21 |                         s1+=Q.front();
      |                             ^
a.cc:25:29: error: 'Q' was not declared in this scope
   25 |                         s2+=Q.front();
      |                             ^
a.cc:27:17: error: 'Q' was not declared in this scope
   27 |                 Q.pop();
      |                 ^
Language: C++

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

int main(){
int n;
int A=0,B=0;
  vecter<int> a(n);
  sort(a.begin(),a.end());
  for(int i=0; i<n; i++){
  if(n%2==0) A += a[i];
  else B += a[i];
  }
  cout<<A-B<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vecter' was not declared in this scope
    8 |   vecter<int> a(n);
      |   ^~~~~~
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vecter<int> a(n);
      |          ^~~
a.cc:9:8: error: 'a' was not declared in this scope
    9 |   sort(a.begin(),a.end());
      |        ^
Language: C++

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

int main(){
  int N,A,B;
  cin>>N;
  int a[N];
  for(int i;i<N;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  for(int i;i<N;i++){
    A+=a[i];
    B+=a[i+1];
  }
  cout<<A-B<<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());
      |                    ^~~
a.cc:16:19: error: expected '}' at end of input
   16 |   cout<<A-B<<endl;
      |                   ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: expected initializer before 'b'
    7 |   int a[N] b[N];
      |            ^
a.cc:9:10: error: 'a' was not declared in this scope
    9 |     cin>>a[i];
      |          ^
a.cc:11:8: error: 'a' was not declared in this scope
   11 |   sort(a.begin(),a.end());
      |        ^
a.cc:16:19: error: expected '}' at end of input
   16 |   cout<<A-B<<endl;
      |                   ^
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];
  cin >> N;
  for (int i = 0; i<N; ++i) cin >> a[i];
  
  sort(a,a+N,grater<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:11:14: error: 'grater' was not declared in this scope
   11 |   sort(a,a+N,grater<int>());
      |              ^~~~~~
a.cc:11:21: error: expected primary-expression before 'int'
   11 |   sort(a,a+N,grater<int>());
      |                     ^~~
Language: C++

//author: dazhong_feliks

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

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

   vector<int> vec(N);
   cin >> vec.at(i);
  
   sort(vec.begin(), vec.end());
   reverse(vec.begin(), vec.end());

   int ansA = 0;
   int ansB = 0;

   for(int i = 0; i < N; i = i + 2){
     ansA += vec.at(i)
    }
    for(int i = 1; i < N; i = i + 2 ){
      ansB += vec.at(i)
    }
   cout << ansA - ansB << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: 'i' was not declared in this scope
   11 |    cin >> vec.at(i);
      |                  ^
a.cc:20:23: error: expected ';' before '}' token
   20 |      ansA += vec.at(i)
      |                       ^
      |                       ;
   21 |     }
      |     ~                  
a.cc:23:24: error: expected ';' before '}' token
   23 |       ansB += vec.at(i)
      |                        ^
      |                        ;
   24 |     }
      |     ~
Language: C++

//author: dazhong_feliks

#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());

   int ansA = 0;
   int ansB = 0;

   for(int i = 0; i < N; i = i + 2){
     cin >> vec.at(i);
     ansA += vec.at(i)
    }
    for(int i = 1; i < N; i = i + 2 ){
      cin >> vec.at(i);
      ansB += vec.at(i)
    }
   
   cout << ansA - ansB << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:23: error: expected ';' before '}' token
   20 |      ansA += vec.at(i)
      |                       ^
      |                       ;
   21 |     }
      |     ~                  
a.cc:24:24: error: expected ';' before '}' token
   24 |       ansB += vec.at(i)
      |                        ^
      |                        ;
   25 |     }
      |     ~
Language: C++

#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
    int N;
    int a[100];
    scanf("%d", &N);
    for(int i = 0; i < N; i++){
        scanf("%d", &a[i]);
    }

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

    int ans = 0;

    for(int i = 0; i < N; i++){
        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:14:20: error: 'greater' was not declared in this scope
   14 |     sort(a, a + N, greater<int>());
      |                    ^~~~~~~
a.cc:14:28: error: expected primary-expression before 'int'
   14 |     sort(a, a + N, greater<int>());
      |                            ^~~
Language: C++

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

int main(){
  int N,A,B;
  cin>>N;
  A,B=0;
  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());
  for(int i=0;i<N;i+=2){
    A +=a.at(i);
    B +=a.at(i+1);
  }
  cout<<A-B<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'int\U0000ff1e' was not declared in this scope
    8 |   vector<int＞ a(N);
      |          ^~~~~
a.cc:8:19: error: template argument 1 is invalid
    8 |   vector<int＞ a(N);
      |                   ^
a.cc:8:19: error: template argument 2 is invalid
a.cc:10:10: error: 'a' was not declared in this scope
   10 |     cin>>a.at(i);
      |          ^
a.cc:12:8: error: 'a' was not declared in this scope
   12 |   sort(a.begin(),a.end());
      |        ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'int\U0000ff1e' was not declared in this scope
    8 |   vector<int＞ a(N);
      |          ^~~~~
a.cc:8:19: error: template argument 1 is invalid
    8 |   vector<int＞ a(N);
      |                   ^
a.cc:8:19: error: template argument 2 is invalid
a.cc:10:10: error: 'a' was not declared in this scope
   10 |     cin>>a[i];
      |          ^
a.cc:12:8: error: 'a' was not declared in this scope
   12 |   sort(a.begin(),a.end());
      |        ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'int\U0000ff1ea' was not declared in this scope
    8 |   vector<int＞a(N,0);
      |          ^~~~~~
a.cc:8:20: error: template argument 1 is invalid
    8 |   vector<int＞a(N,0);
      |                    ^
a.cc:8:20: error: template argument 2 is invalid
a.cc:10:10: error: 'a' was not declared in this scope
   10 |     cin>>a[i];
      |          ^
a.cc:12:8: error: 'a' was not declared in this scope
   12 |   sort(a.begin(),a.end());
      |        ^
Language: C++

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

int main(){
  int N,A,B;
  cin>>N;
  A,B=0;
  int a[N];
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  for(int i=0;i<N;i+=2){
    A +=a[i];
    B +=a[i+1];
  }
  cout<<B-A<<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:20: 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.cc:13:23: 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;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  int s=0;
  for(int i=0;i<N;i++){
    int c=0;
    for(int j=0;j<N;j++){
      if(vec.at(i)<=vec.at(j)){
        c++;
      }
    }
    for(int k=i;k<N;k++){
      if(vec.at(i)==vec.at(k)){
        c++;
      }
    }
    s+=vec.at(i)*(-1)**c;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:23: error: invalid type argument of unary '*' (have 'int')
   24 |     s+=vec.at(i)*(-1)**c;
      |                       ^~
Language: C

#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>

using namespace std;
int main(void){
    int N, tmp, score[] = {0,0};
    scanf("%d", &N);
    priority_queue<int> A;

    for(int i = 0; i < N; i++){
        scanf("%d", &tmp);
        A.push(tmp);
    }

    tmp = 0;

    while(!A.empty()){
        score[tmp % 2] += A.top();
        A.pop();
        tmp++;
    }

    cout << score[0] - score[1] << endl;
    return 0;
}

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

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;  //これで"std::cout"が"cout"と書ける

//MACRO
typedef long long ll;                  //64bit以上を表現可能な型
#define INF 100000000                  //ほぼ無限
#define itn int                        //タイポ対策
#define ALL(x) (x).begin(), (x).end()  //sort(all(x))などとする
#define SZ(x) ((int)(x).size())        //size()簡略化
//repetition
#define FOR(i, p, b) for (int i = (p); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define repR(i, n) for (int i = n; i >= 0; i--)
//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \<< " " << __FILE__ << endl;
template <class T>
bool chMAX(T &a, const T &b) {  //aよりbが大きければaに代入
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chMIN(T &a, const T &b) {  //aよりbが小さければaに代入
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

//
//
//

int main() {
    int n, alice_pt = 0, bob_pt = 0;
    cin >> n;
    int a[n];

    rep(i, n) {
        cin >> a[i];
    }

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

    rep(i, n) {
        if (i % 2 == 0) {  //配列が0から始まるので奇数偶数が反転する
            alice_pt += a[i];
        } else {
            bob_pt += a[i];
        }
    }
    cout << alice_pt - bob_pt << endl;


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

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

int main(){
    int n,a=0,b=0;
    cin >> n;
    vector<int> vec(n);

    for(int i = 0; i < n; i++){
        cin >> vec.at(i);
    }

    sort(vec.begin(), vec.end());

    if(n % 2 == 0){
        for(int i = 0; i < n-1; i++){
            a += vec.at(i+1);
            b += vec.at(i);
        }
    }else{
        for(int i = 0; i < (n/2)+1; i++){
            b += vec.at(i);
            a += vec.at(n-(i+1));
        }
    }


    cout << a - b;
}

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

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

Compiler output:
main.c: In function 'main':
main.c:21:3: error: implicit declaration of function 'quicksort' [-Wimplicit-function-declaration]
   21 |   quicksort(arr,n,4,compare);
      |   ^~~~~~~~~
Language: C

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

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

int main(void)
{
  int n,i,r=0,t=1;
  int arr[999];

  scanf("%d",&n);
  for(i=0;i<n;i++){
scanf("%d",arr[i]);
}

  quicksort(arr,n,4,compare);
    for(i=0;i<n;i++)
    {
      r+=t*arr[i];
      t=-t;
    }
  printf("%d\n",r);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:3: error: implicit declaration of function 'quicksort' [-Wimplicit-function-declaration]
   19 |   quicksort(arr,n,4,compare);
      |   ^~~~~~~~~
Language: C

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

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

int main(void)
{
  int n,i,r=0,t=1;
  int arr[999];

  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",arr[i]);

  quicksort(arr,n,4,compare);
    for(i=0;i<n;i++)
    {
      r+=t*arr[i];
      t=-t;
    }
  printf("%d\n",r);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:3: error: implicit declaration of function 'quicksort' [-Wimplicit-function-declaration]
   17 |   quicksort(arr,n,4,compare);
      |   ^~~~~~~~~
Language: C

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

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

int main(int argc, char const *argv[])
{
  int n,i,r=0,t=1;
  int arr[999];

  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",arr[i]);

  quicksort(arr,n,4,compare);
    for(i=0;i<n;i++)
    {
      r+=t*arr[i];
      t=-t;
    }
  printf("%d\n",r);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:3: error: implicit declaration of function 'quicksort' [-Wimplicit-function-declaration]
   17 |   quicksort(arr,n,4,compare);
      |   ^~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main() {
    int a,Alice=0,Bob=0;
    cin>>a;
    vector<int> number(a);

    for (int i = 0;i<a;i++){
cin>>number.at(i);
    }

    sort(number.begin(),number.end());
    reverse(number.begin(),number.end());

for(int i = 0;i<a;i++){
    if(i==0|i%2==0) {
        Alice +=number.at(i);
    }
    else if(i%2!=0){
        Bob += number.at(i);
    }
}
cout<<Alice-Bob<<endl;
    return 0;
}

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

#include <algorithm>
#include <iostream>
#include <functional>
using namespace std;
 
int main(){
	int N, a[110], i;
  	cin >> N;
  	for(i=0;i<=N;i++) cin >> a[i];
  	
  	sort(a,a+N,greater<int>());
	
  	for(i=0;i<N;i++){
      if(i%2==1){
    	S1+=a[2*i+1];
      }else{
      	S2+=a[2*i];
      }
    }
  
  	cout << abs(S1-S2) << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'S1' was not declared in this scope
   15 |         S1+=a[2*i+1];
      |         ^~
a.cc:17:9: error: 'S2' was not declared in this scope
   17 |         S2+=a[2*i];
      |         ^~
a.cc:21:21: error: 'S1' was not declared in this scope
   21 |         cout << abs(S1-S2) << endl;
      |                     ^~
a.cc:21:24: error: 'S2' was not declared in this scope
   21 |         cout << abs(S1-S2) << endl;
      |                        ^~
Language: C++

#include <algorithm>
#include <iostream>
#include <functional>
using namespace std;
 
int main(){
	int N, a[110], i, S1, S2;
  	cin >> N;
  	for(i=0;i<=N;i++) cin >> a[i];
  	
  	sort(a,a+N,greater<int>());
	
  	for(i=0;i<N;i++){
      if(i%2==1){
    	S1+=a[2*i+1];
      }else{
      	S2+=a[2*i];
      }
    }
  
  	cout << abs(S1-S2) << endl;
}
}

Compiler output:
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
Language: C++

#include <algorithm>
#include <iostream>
#include <functional>
using namespace std;
 
int main(){
	int N, a[110], i;
  	cin >> N;
  	for(i=0;i<=N;i++) cin >> a[i];
  	
  	sort(a,a+N,greater<int>());
	
  	for(i=0;i<N;i++){
      if(i%2==1){
    	S1+=a[2*i+1];
      }else{
      	S2+=a[2*i];
      }
    }
  
  	cout << abs(S1-S2) << endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'S1' was not declared in this scope
   15 |         S1+=a[2*i+1];
      |         ^~
a.cc:17:9: error: 'S2' was not declared in this scope
   17 |         S2+=a[2*i];
      |         ^~
a.cc:21:21: error: 'S1' was not declared in this scope
   21 |         cout << abs(S1-S2) << endl;
      |                     ^~
a.cc:21:24: error: 'S2' was not declared in this scope
   21 |         cout << abs(S1-S2) << endl;
      |                        ^~
a.cc: At global scope:
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
Language: C++

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

int main(){

  int N,alice,bob;
  
  cin >> N;
  vector<int> card(N);
  rep(i,N) cin >> card.at(i);
  
  reverse(sort(card.begin(),card.end()));
  rep(i,N){
    if(i%2) alice += card.at(i);
    else bob += card.at(i);
  }
  cout << alice-bob << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: invalid use of void expression
   13 |   reverse(sort(card.begin(),card.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[i];
  }
  
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  int alice=0, bob= 0;
  for( i = 0; i < vec.size(); i+=2){
    alice += vec[i];
     bob += vec[i+1];
  }
	cout << alice - bob << endl;
}
    

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

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

int main() {
  int N;
  int a[110];
  cin >> N;
  for (i = 0; i < N; i++) cin >> a[i];
  sort(a, a + N, greater<int>());
  int Alice = 0;
  int Bob = 0;
  for (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:9:8: error: 'i' was not declared in this scope
    9 |   for (i = 0; i < N; i++) cin >> a[i];
      |        ^
a.cc:13:8: error: 'i' was not declared in this scope
   13 |   for (i = 0; i < N; i++) {
      |        ^
Language: C++

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

int main() {
  int N;
  int a[110];
  cin >> N;
  for (int = 0; i < N; i++) cin >> a[i];
  sort(a, a + N, greater<int>());
  int Alice = 0;
  int Bob = 0;
  for (int = 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:9:12: error: expected unqualified-id before '=' token
    9 |   for (int = 0; i < N; i++) cin >> a[i];
      |            ^
a.cc:9:11: error: expected ';' before '=' token
    9 |   for (int = 0; i < N; i++) cin >> a[i];
      |           ^~
      |           ;
a.cc:9:12: error: expected primary-expression before '=' token
    9 |   for (int = 0; i < N; i++) cin >> a[i];
      |            ^
a.cc:9:17: error: 'i' was not declared in this scope
    9 |   for (int = 0; i < N; i++) cin >> a[i];
      |                 ^
a.cc:9:22: error: expected ')' before ';' token
    9 |   for (int = 0; i < N; i++) cin >> a[i];
      |       ~              ^
      |                      )
a.cc:9:24: error: 'i' was not declared in this scope
    9 |   for (int = 0; i < N; i++) cin >> a[i];
      |                        ^
a.cc:13:12: error: expected unqualified-id before '=' token
   13 |   for (int = 0; i < N; i++) {
      |            ^
a.cc:13:11: error: expected ';' before '=' token
   13 |   for (int = 0; i < N; i++) {
      |           ^~
      |           ;
a.cc:13:12: error: expected primary-expression before '=' token
   13 |   for (int = 0; i < N; i++) {
      |            ^
a.cc:13:22: error: expected ')' before ';' token
   13 |   for (int = 0; i < N; i++) {
      |       ~              ^
      |                      )
Language: C++

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

int main(){
int n,c,d=0;
  cin>>n;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
  }
  
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
      if(vec.at(i)<vec.at(j){
        c=vec.at(i);
        vec.at(i)=vec.at(j);
        vec.at(j)=c;
      }
         }
         }
        for(int i=0;i<n;i++){
          if(i%2==0){
          d+=vec.at(i);
          }else{
            d-=vec.at(i);
          }
        }
         cout<<d;
         }
         

Compiler output:
a.cc: In function 'int main()':
a.cc:14:29: error: expected ')' before '{' token
   14 |       if(vec.at(i)<vec.at(j){
      |         ~                   ^
      |                             )
a.cc:19:10: error: expected primary-expression before '}' token
   19 |          }
      |          ^
Language: C++

#include <iostream.h>
using namespace std;

int main(){
  int num=0;
  cin >> num;
	int a[num];
  for(int i = 0; i < num;i++){
    cin >> a[i];
  }
  a = sort(a);
  
  
  
  int p1Score=0, p2Score=0;
  for(int i = 0; i < num; i++){
    if(i % 2== 0){
    p1Score += a[i]/**/;
    }else{
      p2Score += a[i]/**/;
    }
  }
  cout << p1Score - p2Score/**/ << endl;
}

int[] sort(int[] array){
  int maxnum = array[0];
  int N = sizeof(array) / sizeof(array[0]);
  for(int i = 0; i < N;i++){
    for(int j = i; j < N; j++){
    	if(maxnum < array[j]){
        	int tmp = array[i];
          	int maxnum = array[j];
          	array[i] = maxnum;
          	array[j] = tmp;
        }
    }
  }
}

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: no matching function for call to 'std::vector<int>::at()'
    8 |   cin>>vec.at();}
      |        ~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1180:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1180 |       at(size_type __n)
      |       ^~
/usr/include/c++/14/bits/stl_vector.h:1180:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::at(size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
 1199 |       at(size_type __n) const
      |       ^~
/usr/include/c++/14/bits/stl_vector.h:1199:7: note:   candidate expects 1 argument, 0 provided
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:30: error: expected ';' before 'reverse'
    7 |   sort(vec.begin(),vec.end())
      |                              ^
      |                              ;
    8 |   reverse(vec.begin(),vec.end())
      |   ~~~~~~~                     
a.cc:12:5: error: 'alice' was not declared in this scope
   12 |     alice+=vec.at(i)
      |     ^~~~~
a.cc:15:10: error: 'alice' was not declared in this scope
   15 |   cout >>alice-bob >>endl;
      |          ^~~~~
Language: C++

#include <vector>
#include <iostream>

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

  std::vector<int> a;
  for(int i = 0; i < n; ++i) {
    int x;
    std::cin >> x;
    a.push_back(x);
  }

  int alice { 0 };
  int bob { 0 };

  std::sort(std::begin(a), std::end(a), std::greater<int>());
  for(int i = 0; i < a.size(); ++i) {
    if(i % 2 == 0) {
      alice += a[i];
    } else {
      bob += a[i];
    }
  }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:18:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   18 |   std::sort(std::begin(a), std::end(a), std::greater<int>());
      |        ^~~~
      |        qsort
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);
    reo(i, n) 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];
    }

    cout << alice - bob << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'i' was not declared in this scope
    8 |     reo(i, n) cin >> a[i];
      |         ^
a.cc:8:5: error: 'reo' was not declared in this scope; did you mean 'rep'?
    8 |     reo(i, n) cin >> a[i];
      |     ^~~
      |     rep
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 a,b;
  for(int i=0;i<n;i++){
    if(i%2==0) a+=vec.at(i);
    else b+=vec.at(i);
  }
  cout << a-b <<endl;

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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> Num(N);
  for(int i=0;i<N;i++){
  cin>>Num.at(i);
  }
  sort(Num.begin(),Num.end());
  reverse(Num.begin(),Num.end());
  int a=0;
  int A=0;
  while(a<N){
    A+=Num.at(a);
    a+=2;
  }
  int b=1;
  int B=0;
  while (b<N){
    B+=Num.at(b);
    b+=2;
  }
  cout<<A-B<<ebdl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:14: error: 'ebdl' was not declared in this scope
   24 |   cout<<A-B<<ebdl;
      |              ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <boost/foreach.hpp>
using namespace std;

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

	int tmp,i=0;
	vector<int> cards;
	while(cin >> tmp){
		cards.push_back(tmp);
		i++;
		if(i>=n){
			break;
		}
	}
	i=1;
	int a=0,b=0;
	sort(cards.begin(),cards.end());
	BOOST_FOREACH(int card,cards){
		if(i%2 == 0){
			a += card;
		}
		else {
			b += card;
		}
		i++;
	}
	cout << abs(a-b) << endl;
}

Compiler output:
a.cc:3:10: fatal error: boost/foreach.hpp: No such file or directory
    3 | #include <boost/foreach.hpp>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

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

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: no match for call to '(std::vector<int>) (int&)'
   10 |     cin>>vec(i);
      |          ~~~^~~
a.cc:23:29: error: expected '}' at end of input
   23 |     cout<< Alice-Bob <<endl;
      |                             ^
a.cc:16:23: note: to match this '{'
   16 |   for(int i=0;i<N;i++){
      |                       ^
a.cc:23:29: error: expected '}' at end of input
   23 |     cout<< Alice-Bob <<endl;
      |                             ^
a.cc:4:15: note: to match this '{'
    4 | int main(void){
      |               ^
Language: C++

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

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

  


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vecotr' was not declared in this scope
    7 |   vecotr<int> vec(N);
      |   ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vecotr<int> vec(N);
      |          ^~~
a.cc:9:12: error: 'vec' was not declared in this scope
    9 |     cin >> vec[i];
      |            ^~~
a.cc:11:8: error: 'vec' was not declared in this scope
   11 |   sort(vec.begin(),vec.end());
      |        ^~~
Language: C++

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

int main(){
  int N;
  cin >> N;
  vecotr<int> vec(N);
  for (i=0;i<N;i++)
    cin >> vec[i];
  
  sort(vec.begin(),vec.end());
  int Alice=0;
  int Bob = 0;
  
  for (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:7:3: error: 'vecotr' was not declared in this scope
    7 |   vecotr<int> vec(N);
      |   ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vecotr<int> vec(N);
      |          ^~~
a.cc:8:8: error: 'i' was not declared in this scope
    8 |   for (i=0;i<N;i++)
      |        ^
a.cc:9:12: error: 'vec' was not declared in this scope
    9 |     cin >> vec[i];
      |            ^~~
a.cc:11:8: error: 'vec' was not declared in this scope
   11 |   sort(vec.begin(),vec.end());
      |        ^~~
a.cc:15:8: error: 'i' was not declared in this scope
   15 |   for (i=0;i<N;i++){
      |        ^
Language: C++

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

int main() {
  int num, sumA, sumB;
  cin >> num;
  vector<int> cards(num);
  sumA, smB = 0;
  
  for(int i = 0; i < num; i++)
    cin >> cards.at(i);
  
  sort(cards.begin(), cards.end());		//カードは小さい順にソート
  reverse(cards.begin(), cards.end());	//カードをリバース(大きい順に並び替え)
  
  for(int i=0; i < num; i++)
  {
    //偶数時(Aliceの手番)
    if(i%2 == 0)
      sumA += cards.at(i);
    if(i%2 == 1)
      sumB += cards.at(i);
  }
  cout << sumA - sumB << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'smB' was not declared in this scope; did you mean 'sumB'?
    8 |   sumA, smB = 0;
      |         ^~~
      |         sumB
Language: C++

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

int main() {
  int num, sum_A, sum_B;
  cin >> num;
  vector<int> cards(num);
  
  for(int num_i = 0; num_i < num; num_i++)
    cin >> cards(num_i);
  
  sort(cards.begin(), cards.end());		//カードは小さい順にソート
  reverse(cards.begin(), cards.end());	//カードをリバース(大きい順に並び替え)
  
  for(int i=0; i < num; i++)
  {
    //偶数時(Aliceの手番)
    if(i%2 == 0)
      sum_A += cards.at(i);
    if(i%2 == 1)
      sum_B += cards.at(i);
  }
  cout << sum_A - sum_B << endl;
}


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

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

int main() {
  int num, sum_A, sum_B;
  cin >> num;
  vector<int> cards(num)
  
  for(int num_i = 0; num_i < num; num_i++)
    cin >> cards(num_i);
  
  sort(cards.begin(), cards.end());		//カードは小さい順にソート
  reverse(cards.begin(), cards.end());	//カードをリバース(大きい順に並び替え)
  
  for(int i=0; i < num; i++)
  {
    //偶数時(Aliceの手番)
    if(i%2 == 0)
      sum_A += cards.at(i);
    if(i%2 == 1)
      sum_B += cards.at(i);
  }
  cout << sum_A - sum_B << endl;
}


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

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

int main() {
  int num, sum_A, sum_B;
  cin >> num;
  vector<int> cards(num)
  
  for(int num_i; num_i < num; num_i++)
    cin >> cards(num_i);
  
  sort(card.begin(), cards.end());		//カードは小さい順にソート
  reverse(cards.begin(), cards.end());	//カードをリバース(大きい順に並び替え)
  
  for(int i=0; i < num; i++)
  {
    //偶数時(Aliceの手番)
    if(i%2 == 0)
      sum_A += cards.at(i);
    if(i%2 == 1)
      sum_B += cards.at(i);
  }
  cout << sum_A - sum_B << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'for'
    9 |   for(int num_i; num_i < num; num_i++)
      |   ^~~
a.cc:9:18: error: 'num_i' was not declared in this scope
    9 |   for(int num_i; num_i < num; num_i++)
      |                  ^~~~~
a.cc:12:8: error: 'card' was not declared in this scope; did you mean 'cards'?
   12 |   sort(card.begin(), cards.end());              //カードは小さい順にソート
      |        ^~~~
      |        cards
Language: C++

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

int main() {
  int num;
  cin >> num;
  vecotr<int> cards(num);
  
  for(int num_i; num_i < num; num_i++)
    cin >> cards(num_i);
  
  sort(card.begin(), cards.end());		//カードは小さい順にソート
  reverse(cards.begin(), cards.end());	//カードをリバース(大きい順に並び替え)
  
  for(int i=0; i < num; i++)
  {
    int sum_A,sum_B;
    //偶数時(Aliceの手番)
    if(i%2 == 0)
      sum_A += cards.at(i);
    if(i%2 == 1)
      sum_B += cards.at(i);
  }
  cout << sum_A - sum_B << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vecotr' was not declared in this scope
    7 |   vecotr<int> cards(num);
      |   ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vecotr<int> cards(num);
      |          ^~~
a.cc:10:12: error: 'cards' was not declared in this scope
   10 |     cin >> cards(num_i);
      |            ^~~~~
a.cc:12:8: error: 'card' was not declared in this scope
   12 |   sort(card.begin(), cards.end());              //カードは小さい順にソート
      |        ^~~~
a.cc:12:22: error: 'cards' was not declared in this scope
   12 |   sort(card.begin(), cards.end());              //カードは小さい順にソート
      |                      ^~~~~
a.cc:24:11: error: 'sum_A' was not declared in this scope
   24 |   cout << sum_A - sum_B << endl;
      |           ^~~~~
a.cc:24:19: error: 'sum_B' was not declared in this scope
   24 |   cout << sum_A - sum_B << endl;
      |                   ^~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(void)
{
  int n;
  cin >> n;
  vector<int> card(n);
  for (int i = 0; i < n; i++)
  {
    cin >> card.at(i);
  }
  sort(card.begin(), card.end());
  reverse(card.begin(), card.end());
  int sum = 0;
  for (int i = 0; i < n; i++)
  {
    if (i % 2 == 0)
    {
      sum += card[i];
    }
    else
    {
      sum -= card[i];
    }
  }
  cout << sum << endl;

  return 0;
}

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

#include <iostream>
#include <vector>
using namespace std;
int main(void)
{
  int n;
  cin >> n;
  vector<int> card(n);
  for (int i = 0; i < n; i++)
  {
    cin >> card[i];
  }
  sort(card.begin(), card.end());
  reverse(card.begin(), card.end());
  int sum = 0;
  for (int i = 0; i < n; i++)
  {
    if (i % 2 == 0)
    {
      sum += card[i];
    }
    else
    {
      sum -= card[i];
    }
  }
  cout << sum << endl;

  return 0;
}

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

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

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

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   18 |     for(j=1; j<a.size; j+=2)
      |                ~~^~~~
      |                      ()
Language: C++

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

int main(){
  int N,i;
  int A = 0;
  
  cin >> N;
  vector <int> a(N);
 
  for(i=0; i<N; i++){
      cin >> a.at(i); // 2 7 4
  }
  sort(a.begin(),a.end()); //2 4 7
  reverse(a.begin(),a.end()); // 7 4 2
  
  for(i=0; i<N; i+=2){
    for(j=1; j<N; j+=2)
      A = A + a.at(i); 
      A = A - a.at(j); 
    }
  cout << A << endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'j' was not declared in this scope
   18 |     for(j=1; j<N; j+=2)
      |         ^
a.cc:20:20: error: 'j' was not declared in this scope
   20 |       A = A - a.at(j);
      |                    ^
Language: C++

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

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

return 0;
}

Compiler output:
a.cc:24:3: error: 'cout' does not name a type
   24 |   cout << A << endl;
      |   ^~~~
a.cc:26:1: error: expected unqualified-id before 'return'
   26 | return 0;
      | ^~~~~~
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^