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

#include <stdio.h>

int main () 
{
int n,x,sub,tmp;
int a[110];

scanf("%d",&n);

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

int j = n-1;
while(1)
{
    int max = 0;
    for(i=0;i<j;i++)
    {    
        if(max<a[i])
        {
            max = a[i];
            x = i;
        }
    }
    tmp = a[j];
    a[j] = a[x];
    a[x] = tmp;
    j--;
    if(j == 0)
    break;
}
    int alice,bob;
for(i=n-1;i>=0;)
{
    alice += a[i];
    bob += a[i-1];
    i = i-2;
}
sub = alice - bob;
printf("%d",sub);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:9: error: 'i' undeclared (first use in this function)
   19 |     for(i=0;i<j;i++)
      |         ^
main.c:19:9: 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> card();
    int A = 0, B = 0,ans = 0;
    for(int i = 0;i < N ;i++) cin >> card.at(i);

    for(int i = 0;i < N ;i += 2){
        A += card.at(i);
    }
    for(int i = 1;i < N ;i += 2){
        B += card.at(i);
    }
    if(A < B){
        ans = B - A;
    }
    else
    {
        ans = A - B;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:21: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
    6 |     vector<int> card();
      |                     ^~
a.cc:6:21: note: remove parentheses to default-initialize a variable
    6 |     vector<int> card();
      |                     ^~
      |                     --
a.cc:8:43: error: request for member 'at' in 'card', which is of non-class type 'std::vector<int>()'
    8 |     for(int i = 0;i < N ;i++) cin >> card.at(i);
      |                                           ^~
a.cc:11:19: error: request for member 'at' in 'card', which is of non-class type 'std::vector<int>()'
   11 |         A += card.at(i);
      |                   ^~
a.cc:14:19: error: request for member 'at' in 'card', which is of non-class type 'std::vector<int>()'
   14 |         B += card.at(i);
      |                   ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main (void){
    int N;
    cin >> N;
    vector<int> card();
    int A = 0, B = 0,ans = 0;
    for(i = 0;i < N ;i++) cin >> card.at(i);

    for(i = 0;i < N ;i += 2){
        A += card.at(i);
    }
    for(i = 1;i < N ;i += 2){
        B += card.at(i);
    }
    if(A < B){
        ans = B - A;
    }
    else
    {
        ans = A - B;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:21: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
    6 |     vector<int> card();
      |                     ^~
a.cc:6:21: note: remove parentheses to default-initialize a variable
    6 |     vector<int> card();
      |                     ^~
      |                     --
a.cc:8:9: error: 'i' was not declared in this scope
    8 |     for(i = 0;i < N ;i++) cin >> card.at(i);
      |         ^
a.cc:8:39: error: request for member 'at' in 'card', which is of non-class type 'std::vector<int>()'
    8 |     for(i = 0;i < N ;i++) cin >> card.at(i);
      |                                       ^~
a.cc:10:9: error: 'i' was not declared in this scope
   10 |     for(i = 0;i < N ;i += 2){
      |         ^
a.cc:11:19: error: request for member 'at' in 'card', which is of non-class type 'std::vector<int>()'
   11 |         A += card.at(i);
      |                   ^~
a.cc:13:9: error: 'i' was not declared in this scope
   13 |     for(i = 1;i < N ;i += 2){
      |         ^
a.cc:14:19: error: request for member 'at' in 'card', which is of non-class type 'std::vector<int>()'
   14 |         B += card.at(i);
      |                   ^~
Language: C++


#include <algorithm>
using namespace std;

int main(void){
    int n;
    int a[100];

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

    int ans = 0;

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

    for (int i=0; i <= (n/2); i++) {
        if ((2*i+1) >= n) {
            ans += a[2*i];
        } else {
            ans += (a[2*i] - a[2*i+1]);
        }
    }

    cout << ans;

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >> n;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:14:19: error: 'greater' was not declared in this scope
   14 |     sort (a, a+n, greater<int>());
      |                   ^~~~~~~
a.cc:14:27: error: expected primary-expression before 'int'
   14 |     sort (a, a+n, greater<int>());
      |                           ^~~
a.cc:24:5: error: 'cout' was not declared in this scope
   24 |     cout << ans;
      |     ^~~~
a.cc:24:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:17: error: expected '}' at end of input
   24 |     cout << ans;
      |                 ^
a.cc:5:15: note: to match this '{'
    5 | int main(void){
      |               ^
Language: C++

#include <iostream>
using namespace std;

int main(void){
    int n;
    int a[100];

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

    int ans = 0;

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

    for (int i=0; i <= (n+1)/2; i++) {
        if ((2*i+1) > n) {
            ans += a[2*n];
        } else {
            ans += (a[2*i] - a[2*i+1]);
        }
    }

    cout << ans;
    cout << "\n";
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int N;
	int alicePoints = 0;
	int bobPoints = 0;
	
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++) cin >> a.at(i);
	
	sort( a.begin(), a.end(), greater<int>() ); // 降順にソート

	for (int i = 0; i < N; i++) {
		
		if (i % 2 == 0) {
			alicePoints += a(i);
		}
		else {
			bobPoints += a(i);
		}

	}
	
	cout << alicePoints - bobPoints << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:41: error: no match for call to '(std::vector<int>) (int&)'
   19 |                         alicePoints += a(i);
      |                                        ~^~~
a.cc:22:39: error: no match for call to '(std::vector<int>) (int&)'
   22 |                         bobPoints += a(i);
      |                                      ~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int N;
	int alicePoints = 0;
	int bobPoints = 0;
	
	cin >> N;
	vector<int> a(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) {
			alicePoints += a(i);
		}
		else {
			bobPoints += a(i);
		}

	}
	
	cout << alicePoints - bobPoints << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:45: error: no match for call to '(std::vector<int>) (int&)'
   12 |         for (int i = 0; i < N; i++) cin >> a(i);
      |                                            ~^~~
a.cc:19:41: error: no match for call to '(std::vector<int>) (int&)'
   19 |                         alicePoints += a(i);
      |                                        ~^~~
a.cc:22:39: error: no match for call to '(std::vector<int>) (int&)'
   22 |                         bobPoints += a(i);
      |                                      ~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int N;
	int alicePoints = 0;
	int bobPoints = 0;
	
	cin >> N;
	int vector<int> a(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) {
			alicePoints += a(i);
		}
		else {
			bobPoints += a(i);
		}

	}
	
	cout << alicePoints - bobPoints << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: invalid declarator before 'a'
   11 |         int vector<int> a(N);
      |                         ^
a.cc:12:44: error: 'a' was not declared in this scope
   12 |         for (int i = 0; i < N; i++) cin >> a(i);
      |                                            ^
a.cc:14:15: error: 'a' was not declared in this scope
   14 |         sort( a.begin(), a.end(), greater<int>() ); // 降順にソート
      |               ^
Language: C++

#include <stdio.h>

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

int main() {
    int N;
    vector<int> a(N);

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

    sort(a.begin(), a.end(), std::greater<int>());

    int sum_a = 0;
    int sum_b = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            sum_a += a[i];
        } else {
            sum_b += a[i];
        }
    }
    cout << sum_a - sum_b << endl;

    return 0;
}


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

import java.util.*;
 
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Integer a[] = new Integer[N];
    
    for(int i=0; i<N; i++){
      a[i]  = sc.nextInt();
    }
    
    Arrays.sort(a,Comparator.reverseOder());
    
    int Alice = 0;
    int Bob = 0;
    
    for(int i = 0; i<N; i+=2){
      Alice += a[i];
    }
    for(int i = 1; i<N; i+=2){
      Bob += a[i];
    }
    
    System.out.println(Alice-Bob);
  }
}

Compiler output:
Main.java:13: error: cannot find symbol
    Arrays.sort(a,Comparator.reverseOder());
                            ^
  symbol:   method reverseOder()
  location: interface Comparator
1 error
Language: Java

mport java.util.*;
 
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Integer a[] = new Integer[N];
    
    for(int i=0; i<N; i++){
      a[i]  = sc.nextInt();
    }
    
    Arrays.sort(a,Comparator.reverseOder());
    
    int Alice = 0;
    int Bob = 0;
    
    for(int i = 0; i<N; i+=2){
      Alice += a[i];
    }
    for(int i = 1; i<N; i+=2){
      Bob += a[i];
    }
    
    System.out.println(Alice-Bob);
  }
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
Language: Java

import java.util.*;
 
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Integer a[] = new Integer[N];
    
    for(int i=0; i<N; i++){
      a[i]  = sc.nextInt();
    }
    
    Arrays.sort(a,Comparater.reverseOder());
    
    int Alice = 0;
    int Bob = 0;
    
    for(int i = 0; i<N; i+=2){
      Alice += a[i];
    }
    for(int i = 1; i<N; i+=2){
      Bob += a[i];
    }
    
    System.out.println(Alice-Bob);
  }
}

Compiler output:
Main.java:13: error: cannot find symbol
    Arrays.sort(a,Comparater.reverseOder());
                  ^
  symbol:   variable Comparater
  location: class Main
1 error
Language: Java

import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Integer a[] = new Integer[N];
    
    for(int i=0; i<N; i++){
      a[i]  = sc.nextInt();
    }
    
    Array.sort(a,Comparater.reverseOder());
    
    int Alice = 0;
    int Bob = 0;
    
    for(int i = 0; i<N; i+=2){
      Alice += a[i];
    }
    for(int i = 1; i<N; i+=2){
      Bob += a[i];
    }
    
    System.out.println(Alice-Bob);
  }
}

Compiler output:
Main.java:13: error: cannot find symbol
    Array.sort(a,Comparater.reverseOder());
    ^
  symbol:   variable Array
  location: class Main
Main.java:13: error: cannot find symbol
    Array.sort(a,Comparater.reverseOder());
                 ^
  symbol:   variable Comparater
  location: class Main
2 errors
Language: Java

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Integer a[] = new Integer[N];
    
    for(int i=0; i<N; i++){
      a[i]  = sc.nextInt();
    }
    
    Array.sort(a,Comparater.reverseOder());
    
    int Alice = 0;
    int Bob = 0;
    
    for(int i = 0; i<N; i+=2){
      Alice += a[i];
    }
    for(int i = 1; i<N; i+=2){
      Bob += a[i];
    }
    
    System.out.println(Alice-Bob);
  }
}

Compiler output:
Main.java:3: error: cannot find symbol
    Scanner sc = new Scanner(System.in);
    ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
    Scanner sc = new Scanner(System.in);
                     ^
  symbol:   class Scanner
  location: class Main
Main.java:11: error: cannot find symbol
    Array.sort(a,Comparater.reverseOder());
    ^
  symbol:   variable Array
  location: class Main
Main.java:11: error: cannot find symbol
    Array.sort(a,Comparater.reverseOder());
                 ^
  symbol:   variable Comparater
  location: class Main
4 errors
Language: C++

#include <iostream>
#include<algorithm>//ソート用知識
using namespace std;

int main() {
	int N;
	int a[100];
	cin>>N;
	for(int i=0;i<N;i++)cin>>a[i];
	
	sort(a,a+N,greater<int>());
	int A=0,B=0;
	for(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:13:13: error: 'i' was not declared in this scope
   13 |         for(i=0;i<N;i++){
      |             ^
a.cc:17:27: error: expected primary-expression before '=' token
   17 |                         B;=a[i];
      |                           ^
Language: C++

#include <iostream>
#include<algorithm>//ソート用知識
using namespace std;

int main() {
	int N;
	int a[100];
	cin>>N;
	for(int i=0;i<N;i++)cin>>a[i];
	
	sort(a,a+N,greater<int>());
	int A=0,B=0;
	for(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:13:13: error: 'i' was not declared in this scope
   13 |         for(i=0;i<n;i++){
      |             ^
a.cc:13:19: error: 'n' was not declared in this scope
   13 |         for(i=0;i<n;i++){
      |                   ^
a.cc:17:27: error: expected primary-expression before '=' token
   17 |                         B;=a[i];
      |                           ^
a.cc:21:17: error: 'b' was not declared in this scope
   21 |         cout<<A-b<<endl;
      |                 ^
Language: C++

#if defined(__GNUC__)
#include <bits/stdc++.h>
// __GNUC__
#else
#include "bits/stdc++.h"
#endif
using namespace std;

#define int long long

#if defined(__GNUC__)
#define __int32 __int32_t
#endif // __GNUC__

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); ++(i))
#define REP2(i, x, n) for(itn (i) = x; (i) < (n); ++(i))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) std::sort(ALL(x))
#define RSORT(x, T) std::sort(ALL(x), greater<T>())
#define REVERCE(x) std::reverce(ALL(x))

#define INT_POW(x, y) [](int a, int b) -> int {int c = a; REP(i, b - 1){c *= a;} return c;}(x, y)
#define INT_POWM(x, y, m) [](int a, int b, int m) -> int {int c = a; REP(i, b - 1){c *= a; c %= m;} return c;}(x, y, m)

struct md {
	int y;
	int x;
};

itn main() {
	std::ios::sync_with_stdio(false);

	itn n;

	cin >> n;

	vector<itn> a(n);

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

	RSORT(a);

	vector<itn> score(2, 0);

	REP(i, n) {
		score[i % 2] = a[i];
	}

	cout << score[0] - score[1];

	return 0;
}

Compiler output:
a.cc:45:16: error: macro "RSORT" requires 2 arguments, but only 1 given
   45 |         RSORT(a);
      |                ^
a.cc:21:9: note: macro "RSORT" defined here
   21 | #define RSORT(x, T) std::sort(ALL(x), greater<T>())
      |         ^~~~~
a.cc: In function '__int32_t main()':
a.cc:45:9: error: 'RSORT' was not declared in this scope
   45 |         RSORT(a);
      |         ^~~~~
Language: C++

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

int main() {

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


Compiler output:
a.cc: In function 'int main()':
a.cc:11:38: error: expected primary-expression before ')' token
   11 |   sort(A.begin(),A.end(),greater<int>);
      |                                      ^
Language: C++

#include<iostream>
#include<vector>

using namespace std;

static const int MAX_N = 100;

int main() {
    int N;
    vector<int> a;
    int t;

    cin >> N;

    for (int i = 0; i < N; i++) {
        cin >> t;
        a.push_back(t);
    }

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

    int w = 0;
    int s_a = 0;
    int s_b = 0;
    for (auto s : a) {
        if (w == 0) {
            s_a += s;
            w = 1;
        } else {
            s_b += s;
            w = 0;
        }
    }
    cout << s_a - s_b << endl;

    return 0;
}


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

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

int main() {
  int n=0;
  cin>>n;
  vector<int> vec;
  rep(i,n){
    int c;
    cin>>c;
    vec.push_back(c);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  int sum=0;
  rep(i,(n+1)/2){
    sum+=vec.at(2*i);
  }
  cout<<sum<<endl;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n=0;
  cin>>n;
  vector<int> vec;
  rep(i,n){
    int c;
    cin>>c;
    vec.push_back(c);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  int sum=0;
  rep(i,n){
    if(i%2){
      sum-=vec.at(i);
    } else{
      sum+=vec.at(i);
    }
        
  }
  cout<<sum<<endl;
}


Compiler output:
a.cc:26:5: error: redefinition of 'int main()'
   26 | int main() {
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main() {
      |     ^~~~
Language: C++

l=list(map(int,input().split())).sort()
for i in range(n):
    if i%2==1:
        l[i]=(-1)*l[i]
print(sum(l))

Compiler output:
a.cc:1:1: error: 'l' does not name a type
    1 | l=list(map(int,input().split())).sort()
      | ^
Language: C++

#include <iostream>
#include <array>
#include <algorithm>
using namespace std;
int main(){
  int N, i;
  int ret = 0;
//  int a[100];
  cin >> N;
  array<int, N> s;
  for (i=0;i<N;++i){
    cin >> a[i];
  }
  sort(s.begin(), s.end());
  for (i=0;i<N;i+=2){
    int A_point = a[i];
    int B_point = a[i+1];
    ret += (A_point - B_point);
  }
  cout << ret;
  
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: the value of 'N' is not usable in a constant expression
   10 |   array<int, N> s;
      |               ^
a.cc:6:7: note: 'int N' is not const
    6 |   int N, i;
      |       ^
a.cc:10:15: note: in template argument for type 'long unsigned int'
   10 |   array<int, N> s;
      |               ^
a.cc:12:12: error: 'a' was not declared in this scope
   12 |     cin >> a[i];
      |            ^
a.cc:14:10: error: request for member 'begin' in 's', which is of non-class type 'int'
   14 |   sort(s.begin(), s.end());
      |          ^~~~~
a.cc:14:21: error: request for member 'end' in 's', which is of non-class type 'int'
   14 |   sort(s.begin(), s.end());
      |                     ^~~
a.cc:16:19: error: 'a' was not declared in this scope
   16 |     int A_point = a[i];
      |                   ^
Language: C++

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

int main(){
  int num;
  cin >> num;
  vector<int> deck(num);
  int alice = 0;
  int bob = 0;
  int flag = 0;//0:alice, 1:bob

  for(int i = 0; i < num; i++){
    cin >> deck.at(i);
    //int x;
    //cin >> x;
    //deck.push_back(x);
  }

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

  for(int i = num - 1; 0 < i; i--){
    if(flag == 0){
      alice += deck[i];
      flag = 1;
    }
    if(flag == 1){
      bob += deck[i];
      flag = 0;
    }

    cout << alice - bob << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:19:11: error: 'Alice' was not declared in this scope
   19 |   cout << Alice - Bob << endl;
      |           ^~~~~
a.cc:19:19: error: 'Bob' was not declared in this scope
   19 |   cout << Alice - Bob << endl;
      |                   ^~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: missing template arguments before '(' token
    7 |   vector(int) vec(100);
      |         ^
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector(int) vec(100);
      |          ^~~
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());
      |        ^~~
a.cc:19:11: error: 'Alice' was not declared in this scope
   19 |   cout << Alice - Bob << endl;
      |           ^~~~~
a.cc:19:19: error: 'Bob' was not declared in this scope
   19 |   cout << Alice - Bob << endl;
      |                   ^~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: missing template arguments before '(' token
    7 |   vector(int),vec(100);
      |         ^
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector(int),vec(100);
      |          ^~~
a.cc:7:15: error: 'vec' was not declared in this scope
    7 |   vector(int),vec(100);
      |               ^~~
a.cc:19:11: error: 'Alice' was not declared in this scope
   19 |   cout << Alice - Bob << endl;
      |           ^~~~~
a.cc:19:19: error: 'Bob' was not declared in this scope
   19 |   cout << Alice - Bob << endl;
      |                   ^~~
Language: C++

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

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

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

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

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



Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: expected ';' before ')' token
    8 |   for(int i=0;i<N,i++){
      |                      ^
      |                      ;
Language: C++

import sys
import math
input = sys.stdin.readline


def main():
    sc = Scan()
    N = sc.intarr()[0]
    A = sc.intarr()

    new = sorted(A, reverse=True)
    alice = 0

    for i in range(0, N):
        if i % 2 == 0:
            alice += new[i]
        else:
            alice -= new[i]

    print(alice)


class Scan():

    def intarr(self):
        num_array = list(map(int, input().split()))
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


def display(array):
    for a in range(len(array)):
        if len(array) - a != 1:
            print(array[a], end=' ')
        else:
            print(array[a])


def gcd(a, b):  # 最大公約数
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):  # 最小公倍数
    return a * b // gcd(a, b)


main()


Compiler output:
a.cc:47:17: error: stray '#' in program
   47 | def gcd(a, b):  # 最大公約数
      |                 ^
a.cc:53:17: error: stray '#' in program
   53 | def lcm(a, b):  # 最小公倍数
      |                 ^
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

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

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  
  int ans=0;
  for(int i=0; i<N; i++) {
    if(!(i%2)) ans += a[i];
    else       ans -= a[i];
  }
  
  cout << ans << endl;
}


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

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

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

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  
  int ans=0;
  for(int i=0; i<N; i++) {
    if(!(i%2)) ans += a[i];
    else       ans -= a[i];
  }
  
  cout << ans << endl;
}

Compiler output:
a.cc:2:20: error: expected ';' before 'int'
    2 | using namespace std
      |                    ^
      |                    ;
    3 | 
    4 | int main() {
      | ~~~                 
a.cc: In function 'int main()':
a.cc:14:10: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   14 |   sort(a.begin(), a.end());
      |          ^~~~~
a.cc:14:21: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   14 |   sort(a.begin(), a.end());
      |                     ^~~
a.cc:15:13: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   15 |   reverse(a.begin(), a.end());
      |             ^~~~~
a.cc:15:24: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   15 |   reverse(a.begin(), a.end());
      |                        ^~~
Language: C++

#include <iostream>

using namespace std;
int a[109];

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    for (int i = 0; i < N; i++)
        cin >> a[i];
    sort(a, a + N, greater<int>());
    int s = 0;
    for (int i = 0; i < N; i++)
    {
        if ((i & 1) == 0)
        {
            s += a[i];
        }
        else
        {
            s -= a[i];
        }
    }
    cout << s << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
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 <vector>
// #include <map>

// #include <algorithm>
// #include <functional>

using namespace std;

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    int a[109];
    for (int i = 0; i < N; i++)
        cin >> a[i];
    sort(a, a + N, greater<int>());
    int s = 0;
    for (int i = 0; i < N; i++)
    {
        if ((i & 1) == 0)
        {
            s += a[i];
        }
        else
        {
            s -= a[i];
        }
    }
    cout << s << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
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>

using namespace std;

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    int a[N];
    for (int i = 0; i < N; i++)
        cin >> a[i];
    sort(a, a + N, greater<int>());
    int s = 0;
    for (int i = 0; i < N; i++)
    {
        if ((i & 1) == 0)
        {
            s += a[i];
        }
        else
        {
            s -= a[i];
        }
    }
    cout << s << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
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 <vector>
#include <map>

using namespace std;

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++)
        cin >> a.at(i);
    sort(a.rbegin(), a.rend());
    int s = 0;
    for (int i = 0; i < N; i++)
    {
        if (i % 2 == 0)
        {
            s += a.at(i);
        }
        else
        {
            s -= a.at(i);
        }
    }
    cout << s << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |     sort(a.rbegin(), a.rend());
      |     ^~~~
      |     short
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  vector<int> a;
  int s,d,f,g;
  cin >> s;
  for(int i=0;i<s;i++){
    cin >> d;
    a.push_back(d);
  }
  std::sort(a.begin(),a.end(), std::greater<int>());
  f=0;
  g=0;
  d =0;
  for(int i=0;i<s;i++){
	if(d){
    f += a.at[i];
    d=1;
    }else{
    g += a.at[i];
	d=0;
    }
  }
    cout << g-f << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   19 |     f += a.at[i];
      |              ^
a.cc:22:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   22 |     g += a.at[i];
      |              ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  vector<int> a;
  int s,d,f,g;
  cin >> s;
  for(int i=0;i<s;i++){
    cin >> d;
    a.push_back(d);
  }
  std::sort(a.begin(),a.end(), std::greater<int>());
  f=0;
  g=0;
  d =0;
  for(int i=0;i<s;i++){
	if(d){
    f += v.at[i];
    d=1;
    }else{
    g += v.at[i];
	d=0;
    }
  }
    cout << g-f << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:10: error: 'v' was not declared in this scope
   19 |     f += v.at[i];
      |          ^
a.cc:22:10: error: 'v' was not declared in this scope
   22 |     g += v.at[i];
      |          ^
Language: C++

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

int main() {
  vector<int> score;
  int N;
  int ret[2] = {0,0};
  
  cin >> N;
  score = vector<int>(N);
  for (int i=0;i<N;i++) cin >> score.at(i);
  
  sort(score.begin(), score.end());
  reverse(score.begin(), score.end());
  
  for (int i=0;i<N;i++) ret[i%2] += score.at(i);
  
  cout << ret.at[0] - ret[1] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: request for member 'at' in 'ret', which is of non-class type 'int [2]'
   18 |   cout << ret.at[0] - ret[1] << endl;
      |               ^~
Language: C++

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

int main() {
  vector<int> score;
  int N;
  int ret[2] = {0,0};
  
  cin >> N;
  score = vector<int>(N);
  for (int i=0;i<N;i++) cin >> score.at(i);
  
  sort(score.begin(), score.end());
  reverse(score.begin(), score.end());
  
  for (int i=0;i<N;i++) ret[i%2] += score.at(i);
  
  cout << ret.at(0) - ret.at(1) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: request for member 'at' in 'ret', which is of non-class type 'int [2]'
   18 |   cout << ret.at(0) - ret.at(1) << endl;
      |               ^~
a.cc:18:27: error: request for member 'at' in 'ret', which is of non-class type 'int [2]'
   18 |   cout << ret.at(0) - ret.at(1) << endl;
      |                           ^~
Language: C++

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

int main() {
  vector<int> score;
  int N;
  int ret[2] = {0,0};
  
  cin >> N;
  score = vector<int>(N);
  for (int i=0;i<N;i++) cin >> score.at(i);
  
  sort(score.begin(), score.end());
  reverse(score.begin(), score.end());
  
  for (int i=0;i<N;i++) ret.at(i%2) += score.at(i);
  
  cout << ret.at(0) - ret.at(1) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:29: error: request for member 'at' in 'ret', which is of non-class type 'int [2]'
   16 |   for (int i=0;i<N;i++) ret.at(i%2) += score.at(i);
      |                             ^~
a.cc:18:15: error: request for member 'at' in 'ret', which is of non-class type 'int [2]'
   18 |   cout << ret.at(0) - ret.at(1) << endl;
      |               ^~
a.cc:18:27: error: request for member 'at' in 'ret', which is of non-class type 'int [2]'
   18 |   cout << ret.at(0) - ret.at(1) << endl;
      |                           ^~
Language: C++

#include<algorithm>
using namespace std;

int main() {
	int n;
	int a[101];
	cin >> n;
	int al=0,bo=0;
	bool flag=false;
	for(int i=0;i<n;i++)
		cin >> a[i];
	sort(a,a+n);
	for(int i=0;i<n;i++){
		if(!flag)al+=a[i];
		if(flag)bo+=a[i];
		flag=!flag;
	}
	
	cout << abs(al-bo) << endl;	
	return 0;
}	

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<algorithm>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:19:9: error: 'cout' was not declared in this scope
   19 |         cout << abs(al-bo) << endl;
      |         ^~~~
a.cc:19:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:31: error: 'endl' was not declared in this scope
   19 |         cout << abs(al-bo) << endl;
      |                               ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<algorithm>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int n,a,sum_a=0,sum_b=0;
    std::deque<int> deq;
    cin>>n;
    for (int i=0;i<n;i++) {
        cin>>a;
        deq.emplace_back(a);
    }
    sort(deq.begin(),deq.end(),greater);
    for (int j=0;j<n;j++) {
        if (j%2==0) {
            sum_a=sum_a+deq[j];
        } else {
            sum_b=sum_b+deq[j];
        }
    }
    cout<<sum_a-sum_b<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:39: error: missing template arguments before ')' token
   11 |     sort(deq.begin(),deq.end(),greater);
      |                                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, N;
  cin >> N;
  vector<int> card(N);
  for(int i = 0; i < N; i++){
  	cin >> card[i];
  } 
  sort(card.begin(), card.end()); 
  reverce(card.begin(), card.end());
  for(int i = 0; i < N; i++){
  	if(i % 2 != 0){
    	A += card[i];
    }else {
    	B += card[i];
    }   
  } 
  cout << A - B <<endl;
  
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, N;
  cin >> N;
  vector<int> card(N);
  for(int i = 0; i < N; i++){
  	cin >> card[i];
  } 
  sort(card.begin(), card.end()); 
  reverce(card.begin());
  for(int i = 0; i < N; i++){
  	if(i % 2 != 0){
    	A += card[i];
    }else {
    	B += card[i];
    }   
  } 
  cout << A - B <<endl;
  
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, N;
  cin >> N;
  vector<int> card(N);
  for(int i = 0; i < N; i++){
  	cin >> card[i];
  } 
  sort(card.begin()); 
  reverce(card.begin());
  for(int i = 0; i < N; i++){
  	if(i % 2 != 0){
    	A += card[i];
    }else {
    	B += card[i];
    }   
  } 
  cout << A - B <<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: no matching function for call to 'sort(std::vector<int>::iterator)'
   11 |   sort(card.begin());
      |   ~~~~^~~~~~~~~~~~~~
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, 1 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:   candidate expects 3 arguments, 1 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, 1 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, 1 provided
a.cc:12:3: error: 'reverce' was not declared in this scope
   12 |   reverce(card.begin());
      |   ^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, N;
  cin >> N;
  vector<int> card(N);
  for(int i = 0; i < N; i++){
  	cin >> card[i];
  } 
  reverce(sort(card.begin()).begin);
  for(int i = 0; i < N; i++){
  	if(i % 2 != 0){
    	A += card[i];
    }else {
    	B += card[i];
    }   
  } 
  cout << A - B <<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: no matching function for call to 'sort(std::vector<int>::iterator)'
   11 |   reverce(sort(card.begin()).begin);
      |           ~~~~^~~~~~~~~~~~~~
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, 1 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:   candidate expects 3 arguments, 1 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, 1 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, 1 provided
a.cc:11:3: error: 'reverce' was not declared in this scope
   11 |   reverce(sort(card.begin()).begin);
      |   ^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, N;
  cin >> N;
  vector<int> card(N)
  for(int i = 0; i < N; i++){
  	cin >> card[i];
  } 
  reverce(sort(card.begin()).begin);
  for(int i = 0; i < N; i++){
  	if(i % 2 != 0){
    	A += card[i];
    }else {
    	B += card[i];
    }   
  } 
  cout << A - B <<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: expected ',' or ';' before 'for'
    8 |   for(int i = 0; i < N; i++){
      |   ^~~
a.cc:8:18: error: 'i' was not declared in this scope
    8 |   for(int i = 0; i < N; i++){
      |                  ^
a.cc:11:15: error: no matching function for call to 'sort(std::vector<int>::iterator)'
   11 |   reverce(sort(card.begin()).begin);
      |           ~~~~^~~~~~~~~~~~~~
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, 1 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:   candidate expects 3 arguments, 1 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, 1 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, 1 provided
a.cc:11:3: error: 'reverce' was not declared in this scope
   11 |   reverce(sort(card.begin()).begin);
      |   ^~~~~~~
Language: C++

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

// N枚のカードがあり、2人のプレイヤーAlice,Bobがいる。
// 交互に一番大きい数のカードを取っていたとき、2人の点数差を出力する。
// 8
// >> 145 1 170
// 169
int main() {
    int AliceScore = 0;
    int BobScore = 0;
    int cardNum;
    cin >> cardNum;

    vector<int> cardValues(cardNum);

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

    for (int i = 0; i < cardNum; i++)
    {
        if(i % 2 == 0)
            AliceScore += cardValues.at(i);
        else
            BobScore += cardValues.at(i);
    }

    cout << AliceScore - BobScore << endl;
}

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