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

import java.math.*;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Map<Integer, Integer[]> map = new HashMap<Integer, Integer[]>();

		Scanner sc = new Scanner(System.in);
		int length = Integer.parseInt(sc.nextLine());

		for (int count = 0; count < length; count++) {
			String point[] = sc.nextLine().split(" ");
		    Integer points[] = new Integer[]{Integer.parseInt(point[0]),Integer.parseInt(point[1])};
            map.put(count, points);
		}

        List<Entry<Integer, Integer[]>> list_entries = new ArrayList<Entry<Integer, Integer[]>>(map.entrySet());
        Collections.sort(list_entries, new Comparator<Entry<Integer, Integer[]>>() {
            public int compare(Entry<Integer, Integer[]> obj1, Entry<Integer, Integer[]> obj2) {
                // 4. 昇順
            	Integer sum1 = obj1.getValue()[0] + obj1.getValue()[1];
            	Integer sum2 = obj2.getValue()[0] + obj2.getValue()[1];
                return sum1.compareTo(sum2) * -1;
            }
        });

        int idx = 0;
        BigDecimal sum1 = BigDecimal.ZERO;
        BigDecimal sum2 = BigDecimal.ZERO;
        for (Entry<Integer, Integer[]> entry : list_entries) {
        	if (idx % 2 == 0) {
        		sum1 = sum1.add(new BigDecimal(entry.getValue()[0]));
        	} else {
        		sum2 = sum2.add(new BigDecimal(entry.getValue()[1]));
        	}
        	idx++;
        }

		System.out.println(sum1.subtract(sum2));
	}

}

Compiler output:
Main.java:18: error: cannot find symbol
        List<Entry<Integer, Integer[]>> list_entries = new ArrayList<Entry<Integer, Integer[]>>(map.entrySet());
             ^
  symbol:   class Entry
  location: class Main
Main.java:18: error: cannot find symbol
        List<Entry<Integer, Integer[]>> list_entries = new ArrayList<Entry<Integer, Integer[]>>(map.entrySet());
                                                                     ^
  symbol:   class Entry
  location: class Main
Main.java:19: error: cannot find symbol
        Collections.sort(list_entries, new Comparator<Entry<Integer, Integer[]>>() {
                                                      ^
  symbol:   class Entry
  location: class Main
Main.java:20: error: cannot find symbol
            public int compare(Entry<Integer, Integer[]> obj1, Entry<Integer, Integer[]> obj2) {
                               ^
  symbol: class Entry
Main.java:20: error: cannot find symbol
            public int compare(Entry<Integer, Integer[]> obj1, Entry<Integer, Integer[]> obj2) {
                                                               ^
  symbol: class Entry
Main.java:31: error: cannot find symbol
        for (Entry<Integer, Integer[]> entry : list_entries) {
             ^
  symbol:   class Entry
  location: class Main
6 errors
Language: Java

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;

import Main.Dish;

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

		int N = sc.nextInt();
		ArrayList<Dish> dish = new ArrayList<Dish>();

		long A_point = 0;
		long B_point = 0;

		for (int i = 0; i < N; i++) {
			int A =sc.nextInt();
			int B =sc.nextInt();
			dish.add(new Dish(A,B,i));
		}
		
		Comparator<Dish> comp = new Comparator<Dish>() {
			@Override
			public int compare(Dish o1, Dish o2) {
				return (int)((long)o1.A + (long)o1.B - ((long)o2.A + (long)o2.B));
			}
		};
		
		dish.sort(comp);
		
		for(int i = 0;i<N;i++) {
			if(i % 2 == 0) {
				A_point += dish.get(i).A;
			}else {
				B_point += dish.get(i).B;
			}
		}
		
		System.out.println(A_point - B_point);

	}

	static class Dish{
		int A;
		int B;
		int index;
		Dish(int a,int b,int in){
			A=a;
			B=b;
			index=in;
		}
	}
	
}


Compiler output:
Main.java:5: error: package Main does not exist
import Main.Dish;
           ^
1 error
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: request for member 'begin' in 'C', which is of non-class type 'int [N]'
   17 |   reverse(C.begin(),C.end());
      |             ^~~~~
a.cc:17:23: error: request for member 'end' in 'C', which is of non-class type 'int [N]'
   17 |   reverse(C.begin(),C.end());
      |                       ^~~
a.cc:18:26: error: expected ')' before ';' token
   18 |   for(int i=0; i<N; i=i+2;){
      |      ~                   ^
      |                          )
a.cc:18:27: error: expected primary-expression before ')' token
   18 |   for(int i=0; i<N; i=i+2;){
      |                           ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
/*
struct data_abc{
	long long int _a;
	long long int _b;
	long long int _c;

	bool operator<(const data_abc& right) const {
		return _c > right._c; 
	}
};
*/
main(){
	long long int n;
	long long int total_B=0;

	cin >> n;
	long long int a[n],b[n],c[n];
	//vector<data_abc> data;
	//vector<long long int>
	for(int i=0;i<n;i++){
		cin >> a[i] >> b[i];
		total_B+=b[i];
		c[i]=a[i]+b[i];
		//data.puch_back(data_abc(a[i],b[i],c[i]));
	}
	//sort(data.begin(),data.end());
	sort(c[i])
	long long int taka=0;
	long long int aoki=0;

	for(int i=n;i>=0;i--){
		if((n-i)%2==0){
			taka+=c[i];
		}
	}
	cout << taka-total_B <<endl;


}



Compiler output:
a.cc:16:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   16 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:31:16: error: 'i' was not declared in this scope
   31 |         sort(c[i])
      |                ^
a.cc:37:25: error: 'taka' was not declared in this scope
   37 |                         taka+=c[i];
      |                         ^~~~
a.cc:40:17: error: 'taka' was not declared in this scope
   40 |         cout << taka-total_B <<endl;
      |                 ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int main(){
    int n; cin >> n;
    ll a, b;
    vector<ll> v;
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        cin >> a >> b;
        v.push_back(a+b);
        ans -= b[i];
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    for(ll i = 0; i < n; i++){
        if(i % 2 == 0){
            ans += v[i];
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   23 |         ans -= b[i];
      |                 ^
Language: Java

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

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

        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        List<Integer> alist = new ArrayList<>();
        List<Integer> blist = new ArrayList<>();
        int takahashi = 0;
        int aoki = 0;

        for (int i = 0; i < n; i++) {
            alist.add(sc.nextInt());
            blist.add(sc.nextInt());
        }
        int now = 0;
        while (alist.size() > 0) {
            int max_a = alist.get(0);
            int max_b = blist.get(0);
            int num_a = 0;
            int num_b = 0;
            int other_a = 0;
            int other_b = 0;
            for (int i = 0; i < alist.size(); i++) {
                if (max_a < alist.get(i)) {
                    max_a = alist.get(i);
                    other_b = blist.get(i);
                    num_a = i;
                }
                if (max_b < blist.get(i)) {
                    max_b = blist.get(i);
                    other_a = alist.get(i);
                    num_b = i;
                }
            }

            System.out.println(num_a);
            System.out.println(num_b);
            System.out.println(max_a);
            System.out.println(max_b);

            int sa_a = Math.abs(alist.get(num_a) - blist.get(num_a));
            int sa_b = Math.abs(alist.get(num_b) - blist.get(num_b));

            if (now % 2 == 0) {
                if (sa_a <= sa_b) {
                    takahashi = takahashi + max_a;
                    alist.remove(num_a);
                    blist.remove(num_a);
                    now++;
                } else {
                    takahashi = takahashi + other_a;
                    alist.remove(num_b);
                    blist.remove(num_b);
                    now++;
                }
            } else {
                if (sa_a <= sa_b) {
                    aoki = aoki + other_b;
                    alist.remove(num_a);
                    blist.remove(num_a);
                    now++;
                } else {
                    aoki = aoki + max_b;
                    alist.remove(num_b);
                    blist.remove(num_b);
                    now++;

                }


            }
            System.out.println("takahashi is " + takahashi);
            System.out.println("aoki is " + aoki);

        }
        System.out.println(takahashi - aoki);


    }
}



\\とちゅうのやつ

Compiler output:
Main.java:91: error: illegal character: '\'
\\???????
^
Main.java:91: error: illegal character: '\'
\\???????
 ^
Main.java:91: error: reached end of file while parsing
\\???????
  ^
3 errors
Language: C++

Copy
Copy
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int N = Integer.parseInt(br.readLine());
        List<List<Long>> list = new ArrayList<>();
        long ans = 0;
        for (int i = 0; i < N; i++) {
            String[] arr =  br.readLine().split(" ");
            list.add(Arrays.asList(
                Long.parseLong(arr[0]),
                Long.parseLong(arr[1]),
                Long.parseLong(arr[0]) + Long.parseLong(arr[1])
            ));
        }
        list.sort((a, b) -> {
                if (a.get(2) - b.get(2) != 0) {
                    return b.get(2) - a.get(2) > 0 ? 1 : -1;
                } else {
                    return b.get(0) - a.get(0) > 0 ? 1 : -1;
                }
            }
        );
        for (int i = 0; i < N; i++) {
            if (i % 2 == 0) {
                ans += list.get(i).get(0); 
            } else {
                ans -= list.get(i).get(1);
            }
        }
        out.println(ans);
        out.close();
    }
}

Compiler output:
a.cc:1:1: error: 'Copy' does not name a type
    1 | Copy
      | ^~~~
a.cc:4:1: error: 'import' does not name a type
    4 | import java.io.InputStreamReader;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.io.PrintWriter;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import java.util.*;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: expected unqualified-id before 'public'
    8 | public class Main {
      | ^~~~~~
Language: C

#include <stdio.h>

int main(void)
{
	int n,b[100001],c[100001],i=0,bigb=0,bigc=0,p,j;
	long long int sumb=0,sumc=0;
	scanf("%d",&n);
	for(i;i<n;i++){
		scanf("%d %d",&b[i],&c[i]);
	}
	
	for(j=0;j<n+1/2;j++){
		bigb=0;
		bigc=0;
		for(i=0;i<n;i++){
			if(bigc<=c[i] && c[i]!=0){
				if(bigc==c[i]){
					if(b[i]>b[p])p=i;
				}
				bigc=c[i];
				p=i;
			}
		sumb=sumb+b[p];
		c[p]=0;
		b[p]=0;
		for(i=0;i<n;i++){
			if(bigb<=b[i] && b[i]!=0){
				if(bigb==b[i]){
					if(c[i]>c[p])p=i;
				}
				bigb=b[i];
				p=i;
			}
		sumc=sumc+c[p];
		c[p]=0;
		b[p]=0;
	}
	printf("%lld\n",sumb-sumc);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:41:1: error: expected declaration or statement at end of input
   41 | }
      | ^
main.c:41:1: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>

int main(void)
{
	int N;
	int t;
	int A[100],B[100];
	int i,g;
	scanf("%d",&N);
	printf("%d\n",N);
	int Amax=0,Bmax=0;
	int AP=0,BP=0;
	
	for(i=0;i<N:i++){
	scanf("%d%d",&A[i],&B[i]);
	}
	
	for(g=0;g<N;g++){
	    if(t=1){
	for(i=0;i<N;i++){
	if(A[Amax]<=A[i]){
		Amax=i;
		B[i]=0;
		AP+=A[Amax];
		A[Amax]=0;
		}
	}
	        t=0;
	    }
	else{
	for(i=0;i<N;i++){
	if(B[Bmax]<=B[i]){
		Bmax=i;
		A[i]=0;
		BP+=B[Bmax];
		B[Bmax]=0;
		}
	}t=1;
	}
	}
	printf("%d",AP-BP);
}


Compiler output:
main.c: In function 'main':
main.c:14:20: error: expected ';' before ':' token
   14 |         for(i=0;i<N:i++){
      |                    ^
      |                    ;
Language: C++

#include<iostream>
#include<vector>
#define ll long long
using namespace std;

struct AB{
    ll A;
    ll B;
    ll ApB;
};

bool cmp(const AB &a, const AB &b)
{
    return a.ApB > b.ApB;
}

int main(){
    ll N;
    cin >> N;
    vector<AB> ab(N);
    for(int i=0;i<N;i++){
        cin >> ab[i].A >> ab[i].B;
        ab[i].ApB = ab[i].A + ab[i].B;
    }
    sort(ab.begin(), ab.end(), cmp);
    ll ans = 0;
    for(int i=0;i<N-1;i+=2){
        ans += ab[i].A - ab[i+1].B;
        if (i==N-3){
            ans += ab[N-1].A;
        }
    }
    cout << ans << endl;
}

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

#include<iostream>
#include<vector>
#define ll long long
using namespace std;

struct AB{
    ll A;
    ll B;
    ll ApB;
};

bool cmp(const AB &a, const AB &b)
{
    return a.ApB > b.ApB;
}

int main(){
    ll N;
    cin >> N;
    vector<AB> ab(N);
    for(int i=0;i<N;i++){
        cin >> ab[i].A >> ab[i].B;
        ab[i].ApB = ab[i].A + ab[i].B;
    }
    std:sort(ab.begin(), ab.end(), cmp);
    ll ans = 0;
    for(int i=0;i<N-1;i+=2){
        ans += ab[i].A - ab[i+1].B;
        if (i==N-3){
            ans += ab[N-1].A;
        }
    }
    cout << ans << endl;
}

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

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long int ll;

bool sortbysec(const pair<ll, ll> &a, const pair<ll, ll> &b) {
  return (a.second < b.second);
}

int main() {
  ll N;
  cin >> N;
  vector< pair< ll, ll > > ABs;
  rep (i, N) {
    ll A, B;
    cin >> A >> B;
    pair<ll, ll> AB = mp(A, B);
    ABs.pb(AB);
  }

  bool by_first = true;
  ll ans = 0;
  rep (i, N) {
    if (by_first) {
      sort(all(ABs));
    }
    else {
      sort(all(ABs), sortbysec);
    }

    if (by_first) {
      ans += ABs.back().first;
    else {
      ans -= ABs.back().second;
    }
    ABs.pop_back();
    by_first = !by_first;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:5: error: expected '}' before 'else'
   57 |     else {
      |     ^~~~
a.cc:55:19: note: to match this '{'
   55 |     if (by_first) {
      |                   ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
#define ll long long

struct AB{
    ll A;
    ll B;
    ll ApB;
};

bool cmp(const AB &a, const AB &b)
{
    return a.ApB > b.ApB;
}

int main(){
    ll N;
    cin >> N;
    vector<AB> ab(N);
    for(int i=0;i<N;i++){
        cin >> ab[i].A >> ab[i].B;
        ab[i].ApB = ab[i].A + ab[i].B;
    }
    std:sort(ab.begin(), ab.end(), cmp);
    ll ans = 0;
    for(int i=0;i<N-1;i+=2){
        ans += ab[i].A - ab[i+1].B;
        if (i==N-3){
            ans += ab[N-1].A;
        }
    }
    cout << ans << endl;
}

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

#include<iostream>
#include<vector>
using namespace std;
#define ll long long

struct AB{
    ll A;
    ll B;
    ll ApB;
};

bool cmp(const AB &a, const AB &b)
{
    return a.ApB > b.ApB;
}

int main(){
    ll N;
    cin >> N;
    vector<AB> ab(N);
    for(int i=0;i<N;i++){
        cin >> ab[i].A >> ab[i].B;
        ab[i].ApB = ab[i].A + ab[i].B;
    }
    sort(ab.begin(), ab.end(), cmp);
    ll ans = 0;
    for(int i=0;i<N-1;i+=2){
        ans += ab[i].A - ab[i+1].B;
        if (i==N-3){
            ans += ab[N-1].A;
        }
    }
    cout << ans << endl;
}

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

#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <conio.h>
#include <vector>

using namespace std;

int N,i,j,k,A_point = 0,B_point = 0,A_max,index_A_max,B_max_in_A,index_B_max_in_A,B_max,index_B_max,A_max_in_B,index_A_max_in_B;

int main() {
    cin >> N;
    int A[100000],B[100000] // 高橋 ， 青木
    for (int i = 0; i < N; ++i) cin >> A[i] >> B[i];
    for (int i = 0; i < N; ++i){
        A_max = std::max_element(A, A+N);
        index_A_max = std::distance(A, A_max);
        B_max_in_A = std::max_element(B[index_A_max], B[index_A_max]+N);
        index_B_max_in_A = std::distance(B, B_max_in_A)[0];
        A_point += A[index_B_max_in_A];
        A[index_B_max_in_A] == 0;
        B[index_B_max_in_A] == 0;

        B_max = std::max_element(B, B+N);
        index_B_max = std::distance(B, B_max);
        A_max_in_B = std::max_element(A[index_B_max], A[index_B_max]+N);
        index_A_max_in_B = std::distance(A, A_max_in_A)[0];
        B_point += B[index_A_max_in_B];
        A[index_A_max_in_B] == 0;
        B[index_A_max_in_B] == 0;
    }
    cout << A_point - B_point << endl;
}


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

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

int N,i,j,k,A_point = 0,B_point = 0,A_max,index_A_max,B_max_in_A,index_B_max_in_A,B_max,index_B_max,A_max_in_B,index_A_max_in_B;

int main() {
    cin >> N;
    int A[100000],B[100000] // 高橋 ， 青木
    for (int i = 0; i < N; ++i) cin >> A[i] >> B[i];
    for (int i = 0; i < N; ++i){
        A_max = std::max_element(A, A+N);
        index_A_max = std::distance(A, A_max);
        B_max_in_A = std::max_element(B[index_A_max], B[index_A_max]+N);
        index_B_max_in_A = std::distance(B, B_max_in_A)[0];
        A_point += A[index_B_max_in_A];
        A[index_B_max_in_A] == 0;
        B[index_B_max_in_A] == 0;

        B_max = std::max_element(B, B+N);
        index_B_max = std::distance(B, B_max);
        A_max_in_B = std::max_element(A[index_B_max], A[index_B_max]+N);
        index_A_max_in_B = std::distance(A, A_max_in_A)[0];
        B_point += B[index_A_max_in_B];
        A[index_A_max_in_B] == 0;
        B[index_A_max_in_B] == 0;
    }
    cout << A_point - B_point << endl;
}


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

/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

// MACROS SAMPAH
#define Jehian using
#define Norman namespace
#define Saviero std

Jehian Norman Saviero;

// MACROS TYPE
typedef long l;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;

// MACROS FOR PRINT
#define nl printf("\n")
#define sp printf(" ")

// MACROS FOR ATTRIBUTE
#define fi first
#define se second

// MACROS FOR FUNCTION AND METHOD
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ALL(x) (x).begin(), (x).end()
#define ALLN(x,n) (x), (x)+(n)
#define CUBE(x) (SQR(x)*(x))
#define SET(x,y) fill_n(x, sizeof(x)/sizeof(x[0]), y)
#define SQR(x) ((x)*(x))
#define SSORT(x,sz) sort(ALLN(x,sz))
#define RESET(x) memset((x), 0, sizeof(x))
#define VSORT(x) sort(ALL(x))

// MACROS READ INPUT
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scf(x) scanf("%f", &x)
#define scd(x) scanf("%lf", &x)
#define scld(x) scanf("%Lf", &x)
#define scul(x) scl(x)
#define scull(x) scll(x)

int main() {
	int N;
	sci(N);
	pll arr[N];
	for (int i = 0; i < N; ++i) {
		scll(arr[i].fi), scll(arr[i].se);
	}
	sort(ALLN(arr, N), [](pi A, pi B){
		if (A.fi > B.fi) {
			return 1;
		} else if (A.fi == B.fi) {
			return A.se > B.se;
		} else {
			return 0;
		}
	});
	ll totA, totB;
	totA = totB = 0;
	for (int i = 0, j = 1; i < N; i += 2, j += 2) {
		if (i < N) {
			totA += arr[i].fi;
		}
		if (j < N) {
			totB += arr[j].se;
		}
	}
	printf("%lld\n", totA-totB);
	return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:70:37: error: inconsistent types 'int' and 'bool' deduced for lambda return type
   70 |                         return A.se > B.se;
      |                                     ^
Language: C++

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

int N,i,j,k,A_point = 0,B_point = 0,A_max,index_A_max,B_max_in_A,index_B_max_in_A,B_max,index_B_max,A_max_in_B,index_A_max_in_B;

int main() {
    cin >> N;
    int A[N],B[N] // 高橋 ， 青木
    for (int i = 0; i < N; ++i) cin >> A[i] >> B[i];
    for (int i = 0; i < N; ++i){
        A_max = std::max_element(A, A+N);
        index_A_max = std::distance(A, A_max);
        B_max_in_A = std::max_element(B[index_A_max], B[index_A_max]+N);
        index_B_max_in_A = std::distance(B, B_max_in_A)[0];
        A_point += A[index_B_max_in_A];
        A[index_B_max_in_A] == 0;
        B[index_B_max_in_A] == 0;

        B_max = std::max_element(B, B+N);
        index_B_max = std::distance(B, B_max);
        A_max_in_B = std::max_element(A[index_B_max], A[index_B_max]+N);
        index_A_max_in_B = std::distance(A, A_max_in_A)[0];
        B_point += B[index_A_max_in_B];
        A[index_A_max_in_B] == 0;
        B[index_A_max_in_B] == 0;
    }
    cout << A_point - B_point << endl;
}


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

#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
					  cerr << "\n\n" << "Time elapsed: " << \
					  (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
					  return 0
#define ll long long int
#define ull unsigned long long int
#define db long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define pii pair<int , int>
#define pdd pair<db , db>
#define pll pair<ll , ll>
#define vpl vector<pll >
#define vll vector<ll >
#define mod 1000000007
#define inf 100000000000000007
#define eps 0.000001
#define stp fixed<<setprecision(20)
#define endl '\n'
 
inline bool cmp1(pair<pll,ll> a,pair<pll,ll> b)
{
	if(a.ff.ff-a.ff.ss==b.ff.ff-b.ff.ss)
	{
		if(a.ff.ff==b.ff.ff)
			return a.ff.ss>b.ff.ss;
		return a.ff.ff>b.ff.ff;
	}
	return a.ff.ff-a.ff.ss<b.ff.ff-b.ff.ss 
}
 
inline bool cmp2(pair<pll,ll> a,pair<pll,ll> b)
{
	if(a.ff.ss==b.ff.ss)
		return a.ff.ff>b.ff.ff;
	return a.ff.ss>b.ff.ss;
}
 
int main()
{
	fastio;
	#ifdef APNA_IO
		start_routine();
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
 
	ll n;cin>>n;
	pair<pll,ll> a[n],b[n];
	for(ll i=0;i<n;i++)
	{
		cin>>a[i].ff.ff>>a[i].ff.ss;
		a[i].ss=i;
		b[i]=a[i];
	}
	sort(a,a+n,cmp1);
	sort(b,b+n,cmp2);
 
	// for(ll i=0;i<n;i++)
	// 	cout<<a[i].ff.ff<<" "<<a[i].ff.ss<<endl;
	// cout<<endl;
 
	// for(ll i=0;i<n;i++)
	// 	cout<<b[i].ff.ff<<" "<<b[i].ff.ss<<endl;
	// cout<<endl;
 
	ll sa=0,sb=0;
	for(ll i=0;i<n;i++)
	{
		if(i%2)
			sb+=a[i].ff.ss;
		else
			sa+=a[i].ff.ff;
	}
	cout<<sa-sb;
	
	#ifdef APNA_IO
		end_routine();
    #endif
}

Compiler output:
a.cc: In function 'bool cmp1(std::pair<std::pair<long long int, long long int>, long long int>, std::pair<std::pair<long long int, long long int>, long long int>)':
a.cc:38:1: error: expected ';' before '}' token
   38 | }
      | ^
Language: Java

import java.util.*;

public class Main {
    static class Q {
        int V[];
        int idx;

        public Q(int a, int b, int idx) {
            V = new int[2];
            V[0] = a;
            V[1] = b;
            this.idx = idx;
        }
    }

    static int compareQForA(Q q1, Q q2) {
        if (q1.V[0] == q2.V[0]) {
            return q2.V[1] - q1.V[1];
        }
        return q2.V[0] - q1.V[0];
    }


    static void proceed(PriorityQueue<Q> q, boolean taken[]) {
        for (;q.isEmpty();) {
            if (taken[q.peek().idx]) {
                q.poll();
            }
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Q qui[] = new Q[N];
        boolean taken[] = new boolean[N];
        List<PriorityQueue<Q>> que = new ArrayList<PriorityQueue<Q>>();
        que.add(new PriorityQueue<>(C::compareQForA));
        que.add(new PriorityQueue<>((q1, q2) -> -compareQForA(q1, q2)));

        for (int i = 0; i < N; i++) {
            qui[i] = new Q(sc.nextInt(), sc.nextInt(), i);
            que.get(0).add(qui[i]);
            que.get(1).add(qui[i]);
        }

        long val[] = new long[2];
        for (int i = 0; i < N; i++) {
            proceed(que.get(0), taken);
            proceed(que.get(1), taken);
            final int me = i%2;
            final int you = (i+1)%2;
            boolean last = i == N - 1;
            if (last) {
                que.get(0).poll();
                Q q = que.get(1).poll();
                val[me] += q.V[me];
                break;
            }

            Q qme = que.get(me).poll();
            Q qyou = que.get(you).poll();
            Q qyoutmp = null;
            if (qme.idx == qyou.idx) {
                qyoutmp = qyou;
                qyou = que.get(you).poll();
            }
            long vForMyMax = qme.V[me] - qyou.V[you];
            que.get(me).add(qme);
            que.get(you).add(qyou);
            if (qyoutmp != null) {
                que.get(you).add(qyoutmp);
            }
            qme = null;
            qyou = null;
            qyoutmp = null;

            qme = que.get(you).poll();
            qyou = que.get(you).poll();
            long vForYouMin = qme.V[me] - qyou.V[you];
            que.get(you).add(qme);
            que.get(you).add(qyou);

            qme = null;
            qyou = null;
            qyoutmp = null;

            if (vForMyMax > vForYouMin) {
                qme = que.get(me).poll();
            } else {
                qme = que.get(you).poll();
            }
            val[me] += qme.V[me];
            taken[qme.idx] = true;
        }
        System.out.println(val[0] - val[1]);
    }
}


Compiler output:
Main.java:38: error: cannot find symbol
        que.add(new PriorityQueue<>(C::compareQForA));
                                    ^
  symbol:   variable C
  location: class Main
1 error
Language: C++

#include <iostream>
#include <vector>
#define ll long long

struct ab {
    ll A;
    ll B;
};

bool compareDiff(ab a, ab b) {
    ll d1 = a.A - a.B;
    ll d2 = b.A - b.B;
    if (d1 == d2) {
        return a.A > b.A;
    } else {
        return d1 < d2;
    }
}

using namespace std;
int main(int argc, const char * argv[]) {
    ll N;
    vector<ab> AB;
    
    cin>>N;
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        ll a, b;
        cin>>a>>b;
        ab x;
        x.A = a;
        x.B = b;
        AB.push_back(x);
    }
    sort(AB.begin(), AB.end(), compareDiff);
    for (int i = 0; i < N; i++) {
        if ((i & 1) == 0) {
            ans += AB[i].A;
        } else {
            ans -= AB[i].B;
        }
    }
    
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:35:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   35 |     sort(AB.begin(), AB.end(), compareDiff);
      |     ^~~~
      |     short
Language: Java

import java.util.*;

public class Main {
    static class Q {
        int V[];
        int idx;

        public Q(int a, int b, int idx) {
            V = new int[2];
            V[0] = a;
            V[1] = b;
            this.idx = idx;
        }
    }

    static int compareQForA(Q q1, Q q2) {
        if (q1.V[0] == q2.V[0]) {
            return q2.V[1] - q1.V[1];
        }
        return q2.V[0] - q1.V[0];
    }


    static void proceed(PriorityQueue<Q> q, boolean taken[]) {
        for (;q.isEmpty();) {
            if (taken[q.peek().idx]) {
                q.poll();
            }
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Q qui[] = new Q[N];
        boolean taken[] = new boolean[N];
        List<PriorityQueue<Q>> que = new ArrayList<>();
        que.add(new PriorityQueue<>(C::compareQForA));
        que.add(new PriorityQueue<>((q1, q2) -> -compareQForA(q1, q2)));

        for (int i = 0; i < N; i++) {
            qui[i] = new Q(sc.nextInt(), sc.nextInt(), i);
            que.get(0).add(qui[i]);
            que.get(1).add(qui[i]);
        }

        long val[] = new long[2];
        for (int i = 0; i < N; i++) {
            proceed(que.get(0), taken);
            proceed(que.get(1), taken);
            final int me = i%2;
            final int you = (i+1)%2;
            boolean last = i == N - 1;
            if (last) {
                que.get(0).poll();
                Q q = que.get(1).poll();
                val[me] += q.V[me];
                break;
            }

            Q qme = que.get(me).poll();
            Q qyou = que.get(you).poll();
            Q qyoutmp = null;
            if (qme.idx == qyou.idx) {
                qyoutmp = qyou;
                qyou = que.get(you).poll();
            }
            long vForMyMax = qme.V[me] - qyou.V[you];
            que.get(me).add(qme);
            que.get(you).add(qyou);
            if (qyoutmp != null) {
                que.get(you).add(qyoutmp);
            }
            qme = null;
            qyou = null;
            qyoutmp = null;

            qme = que.get(you).poll();
            qyou = que.get(you).poll();
            long vForYouMin = qme.V[me] - qyou.V[you];
            que.get(you).add(qme);
            que.get(you).add(qyou);

            qme = null;
            qyou = null;
            qyoutmp = null;

            if (vForMyMax > vForYouMin) {
                qme = que.get(me).poll();
            } else {
                qme = que.get(you).poll();
            }
            val[me] += qme.V[me];
            taken[qme.idx] = true;
        }
        System.out.println(val[0] - val[1]);
    }
}


Compiler output:
Main.java:38: error: cannot find symbol
        que.add(new PriorityQueue<>(C::compareQForA));
                                    ^
  symbol:   variable C
  location: class Main
1 error
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
int n;
ll ans=0;
struct node{
	int a,b;
}q[110000];
bool cmp(node x,node y){
	return (x.a+x.b)<(y.a+y.b);
}
int main(){
  	scanf("%d",&n);
  	for(int i=1;i<=n;i++)
    	scanf("%d%d",&q[i].a,q[i].b);
 	sort(q+1,q+n+1,cmp)
   	for(int i=1;i<=(n/2);i++){
    	ans+=(ll)q[i*2-1].a;
      	ans-=(ll)q[i*2].b;
    }
  	if(n%2!=0)
      	ans+=(ll)(q[n].a);
 	printf("%lld",ans);
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:28: error: expected ';' before 'for'
   20 |         sort(q+1,q+n+1,cmp)
      |                            ^
      |                            ;
   21 |         for(int i=1;i<=(n/2);i++){
      |         ~~~                 
a.cc:21:21: error: 'i' was not declared in this scope
   21 |         for(int i=1;i<=(n/2);i++){
      |                     ^
Language: Java


import java.util.*;

public class Main {
    static class Q {
        int V[];
        int idx;

        public Q(int a, int b, int idx) {
            V = new int[2];
            V[0] = a;
            V[1] = b;
            this.idx = idx;
        }
    }

    static int compareQForA(Q q1, Q q2) {
        if (q1.V[0] == q2.V[0]) {
            return q2.V[1] - q1.V[1];
        }
        return q2.V[0] - q1.V[0];
    }


    static void proceed(PriorityQueue<Q> q, boolean taken[]) {
        for (;q.isEmpty();) {
            if (taken[q.peek().idx]) {
                q.poll();
            }
        }
    }

    static void proceedBoth(PriorityQueue<Q> q[], boolean taken[]) {
        proceed(q[0], taken);
        proceed(q[1], taken);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Q qui[] = new Q[N];
        boolean taken[] = new boolean[N];
        PriorityQueue<Q>[] que = new PriorityQueue[2];

        que[0] = new PriorityQueue<>(C::compareQForA);
        que[1] = new PriorityQueue<>((q1, q2) -> -compareQForA(q1, q2));

        for (int i = 0; i < N; i++) {
            qui[i] = new Q(sc.nextInt(), sc.nextInt(), i);
            que[0].add(qui[i]);
            que[1].add(qui[i]);
        }

        long val[] = new long[2];
        for (int i = 0; i < N; i++) {
            proceed(que[0], taken);
            proceed(que[1], taken);
            final int me = i%2;
            final int you = (i+1)%2;
            boolean last = i == N - 1;
            if (last) {
                que[0].poll();
                Q q = que[1].poll();
                val[me] += q.V[me];
                break;
            }

            Q qme = que[me].poll();
            Q qyou = que[you].poll();
            Q qyoutmp = null;
            if (qme.idx == qyou.idx) {
                qyoutmp = qyou;
                qyou = que[you].poll();
            }
            long vForMyMax = qme.V[me] - qyou.V[you];
            que[me].add(qme);
            que[you].add(qyou);
            if (qyoutmp != null) {
                que[you].add(qyoutmp);
            }
            qme = null;
            qyou = null;
            qyoutmp = null;

            qme = que[you].poll();
            qyou = que[you].poll();
            long vForYouMin = qme.V[me] - qyou.V[you];
            que[you].add(qme);
            que[you].add(qyou);

            qme = null;
            qyou = null;
            qyoutmp = null;

            if (vForMyMax > vForYouMin) {
                qme = que[me].poll();
            } else {
                qme = que[you].poll();
            }
            val[me] += qme.V[me];
            taken[qme.idx] = true;
        }
        System.out.println(val[0] - val[1]);
    }
}


Compiler output:
Main.java:45: error: cannot find symbol
        que[0] = new PriorityQueue<>(C::compareQForA);
                                     ^
  symbol:   variable C
  location: class Main
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java


import java.util.*;

public class C {
    static class Q {
        int V[];
        int idx;

        public Q(int a, int b, int idx) {
            V = new int[2];
            V[0] = a;
            V[1] = b;
            this.idx = idx;
        }
    }

    static int compareQForA(Q q1, Q q2) {
        if (q1.V[0] == q2.V[0]) {
            return q2.V[1] - q1.V[1];
        }
        return q2.V[0] - q1.V[0];
    }


    static void proceed(PriorityQueue<Q> q, boolean taken[]) {
        for (;q.isEmpty();) {
            if (taken[q.peek().idx]) {
                q.poll();
            }
        }
    }

    static void proceedBoth(PriorityQueue<Q> q[], boolean taken[]) {
        proceed(q[0], taken);
        proceed(q[1], taken);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Q qui[] = new Q[N];
        boolean taken[] = new boolean[N];
        PriorityQueue<Q>[] que = new PriorityQueue[2];

        que[0] = new PriorityQueue<>(C::compareQForA);
        que[1] = new PriorityQueue<>((q1, q2) -> -compareQForA(q1, q2));

        for (int i = 0; i < N; i++) {
            qui[i] = new Q(sc.nextInt(), sc.nextInt(), i);
            que[0].add(qui[i]);
            que[1].add(qui[i]);
        }

        long val[] = new long[2];
        for (int i = 0; i < N; i++) {
            proceed(que[0], taken);
            proceed(que[1], taken);
            final int me = i%2;
            final int you = (i+1)%2;
            boolean last = i == N - 1;
            if (last) {
                que[0].poll();
                Q q = que[1].poll();
                val[me] += q.V[me];
                break;
            }

            Q qme = que[me].poll();
            Q qyou = que[you].poll();
            Q qyoutmp = null;
            if (qme.idx == qyou.idx) {
                qyoutmp = qyou;
                qyou = que[you].poll();
            }
            long vForMyMax = qme.V[me] - qyou.V[you];
            que[me].add(qme);
            que[you].add(qyou);
            if (qyoutmp != null) {
                que[you].add(qyoutmp);
            }
            qme = null;
            qyou = null;
            qyoutmp = null;

            qme = que[you].poll();
            qyou = que[you].poll();
            long vForYouMin = qme.V[me] - qyou.V[you];
            que[you].add(qme);
            que[you].add(qyou);

            qme = null;
            qyou = null;
            qyoutmp = null;

            if (vForMyMax > vForYouMin) {
                qme = que[me].poll();
            } else {
                qme = que[you].poll();
            }
            val[me] += qme.V[me];
            taken[qme.idx] = true;
        }
        System.out.println(val[0] - val[1]);
    }
}


Compiler output:
Main.java:4: error: class C is public, should be declared in a file named C.java
public class C {
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

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

int main()
{
  int n, a, b;
  cin >> n;
  vector<pair<int, int>> va(n), vb(n);
  vector<bool> f(n);

  for (auto i = 0; i < n; i++) {
    cin >> a >> b;
    va[i].first = i;
    va[i].second = a;
    vb[i].first = i;
    vb[i].second = b;
    f[i] = false;
  }
  sort(begin(va), begin(va), [](auto&& e1, auto&& e2){return e1 > e2;});
  sort(begin(vb), begin(vb), [](auto&& e1, auto&& e2){return e1 > e2;});
  int x, y;
  x = y = 0;
  bool t = true;
  int64_t ans = 0;
  for (auto i = 0; i < n; i++) {
    if (t) {
      t = false;
      while (f[va[x].first]) {
        x++;
      }
      f[x] = true;
      ans += va[x].second;
    } else {
      t = true;
      while (f[vb[y].first]) {
        y++;
      }
      f[y] = true;
      ans -= vb[y].second;
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   20 |   sort(begin(va), begin(va), [](auto&& e1, auto&& e2){return e1 > e2;});
      |   ^~~~
      |   short
Language: C

#include<stdio.h>
#define L 100000
int main(void){
    int N,i,j,t,a=0,b=0;
    long long int A[L],B[L];
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d %d",&A[i],&B[i]);
    }
    for(i=0;i<N-1;i++){
        for(j=i+1;j<N;j++){
            if((A[i]-B[i])>(A[j]-B[j])){
                t=A[i];
                A[i]=A[j];
                a[j]=t;
                t=B[i];
                B[i]=B[j];
                B[j]=t;
            }
        }
    }
    for(i=0;i<N;i++){
        if((i+1)%2==1){
            a+=A[i];
        }else{
            b+=B[i];
        }
    }
    printf("%d\n",a-b);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:15:18: error: subscripted value is neither array nor pointer nor vector
   15 |                 a[j]=t;
      |                  ^
Language: C++

#include <iostream>
#include <vector>
#define ll long long

struct ab {
    ll A;
    ll B;
};

bool compareForTakahashi(ab a, ab b) {
    ll d1 = a.A - a.B;
    ll d2 = b.A - b.B;
    if (d1 == d2) {
        return a.A > b.A;
    } else {
        return d1 > d2;
    }
}

bool compareForAoki(ab a, ab b) {
    ll d1 = a.A - a.B;
    ll d2 = b.A - b.B;
    if (d1 == d2) {
        return a.A > b.A;
    } else {
        return d1 > d2;
    }
}

using namespace std;
int main(int argc, const char * argv[]) {
    ll N;
    vector<ab> AB;
    
    cin>>N;
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        ll a, b;
        cin>>a>>b;
        ab x;
        x.A = a;
        x.B = b;
        AB.push_back(x);
    }
    for (int i = 0; i < N; i++) {
        if ((i & 1) == 0) {
            sort(AB.begin(), AB.end(), compareForTakahashi);
            ans += AB[0].A;
        } else {
            sort(AB.begin(), AB.end(), compareForAoki);
            ans -= AB[0].B;
        }
        AB.erase(AB.begin());
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:47:13: error: 'sort' was not declared in this scope; did you mean 'short'?
   47 |             sort(AB.begin(), AB.end(), compareForTakahashi);
      |             ^~~~
      |             short
a.cc:50:13: error: 'sort' was not declared in this scope; did you mean 'short'?
   50 |             sort(AB.begin(), AB.end(), compareForAoki);
      |             ^~~~
      |             short
Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
int a[100001],b[100001],used[100001];
set<pair<pair<int,int>,int> > q1,q2;
int main(){
    cin>>n;
    long long ans=0;
    for(register int i=0;i<n;i++)
        scanf("%d%d",&a[i],&b[i]);
    for(register int i=0;i<n;i++){
        q1.insert(make_pair(make_pair(-a[i],-b[i]),i));
        q2.insert(make_pair(make_pair(-b[i],-a[i]),i));
    }
    for(int i=0;i<n;i++){
        if(i%2==0){
            int one;
            while(q1.size()){
                pair<pair<int,int>,int> now=*q1.begin();
                //cout<<now.first<<" "<<now.second<<endl;
                if(!used[now.second])
                    break;
                q1.erase(q1.begin());
            }
            pair<pair<int,int>,int> now=*q1.begin();
            one=now.first.first;
            ans-=one;
            used[now.second]=1;
        }
        else{
            int one;
            while(q2.size()){
                pair<pair<int,int>,int> now=*q2.begin();
                if(!used[now.second])
                    break;
                q2.erase(q2.begin());
            }
            pair<pair<int,int>,int> now=*q2.begin();
            one=now.first.first;
            ans+=one;
            used[now.second]=1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:10:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   10 |     for(register int i=0;i<n;i++)
      |                      ^
a.cc:12:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   12 |     for(register int i=0;i<n;i++){
      |                      ^
Language: Java

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

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            long[] A = new long[N];
            long[] B = new long[N];
            ArrayList<A> As = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                A[i] = in.nextInt();
                B[i] = in.nextInt();
                As.add(new A(A[i], B[i], i));
            }
            Collections.sort(As, new Comparator<A>() {
                @Override
                public int compare(nikkeiC.A o1, nikkeiC.A o2) {
                    if (o1.a - o1.b < o2.a - o2.b) {
                        return -1;
                    }
                    if (o1.a - o1.b > o2.a - o2.b) {
                        return 1;
                    }
                    if (o1.a < o2.a) {
                        return 1;
                    }
                    if (o1.a > o2.a) {
                        return -1;
                    }
                    return 0;
                }
            });

            long sum = 0;
            for (int i = 0; i < N; i++) {
                if (i % 2 == 0) {
                    sum += As.get(i).a;
                } else {
                    sum -= As.get(i).b;
                }
//                Utils.debug(i, sum, As.get(i).a, As.get(i).b, As.get(i).i);
            }

            System.out.println(sum);
        }
    }
}

class A {
    long a;
    long b;
    int i;

    public A(long a, long b, int i) {
        super();
        this.a = a;
        this.b = b;
        this.i = i;
    }
}

Compiler output:
Main.java:20: error: package nikkeiC does not exist
                public int compare(nikkeiC.A o1, nikkeiC.A o2) {
                                          ^
Main.java:20: error: package nikkeiC does not exist
                public int compare(nikkeiC.A o1, nikkeiC.A o2) {
                                                        ^
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
struct node{
    int val,num,sum;
    operator < (node c){
        return this->sum<c.sum;
    }
}a[100007];
struct nod{
    int val,num,sum;
    operator < (nod d){
        return this->sum>d.sum;
    }
}b[100007];
int vis[100007];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d%d",&a[i].val,&b[i].val);
        a[i].sum=a[i].val-b[i].val;
        b[i].sum=b[i].val-a[i].val;
        a[i].num=i;
        b[i].num=i;
    }
    sort(a+1,a+1+n);
    sort(b+1,b+1+n);
    long long sum1=0,sum2=0;
    int cnt1=1,cnt2=1;
    for(int i=1;i<=n;i++){
        if(i&1){
            for(int j=cnt1;j<=n;j++){
                if(vis[a[j].num]==0){
                    vis[a[j].num]=1;
                    sum1+=a[j].val;
                    cnt1=j+1;
                    break;
                }
            }
        }
        else{
            for(int j=cnt2;j<=n;j++){
                if(vis[b[j].num]==0){
                    vis[b[j].num]=1;
                    sum2+=b[j].val;
                    cnt2=j+1;
                    break;
                }
            }
        }
    }
    printf("%lld",sum1-sum2);
    return 0;
}


Compiler output:
a.cc:5:5: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
    5 |     operator < (node c){
      |     ^~~~~~~~
a.cc:11:5: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
   11 |     operator < (nod d){
      |     ^~~~~~~~