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

#include<iostream>

void sort(int a[], int n)
{
	int i,j,temp;

	for(i=0;i<n-1;i++){
		for(j=i;j<n-1;j++){
			if(a[j+1]>a[j]){
				temp = a[j];
				a[j] = a[j+1];
				a[j+1] = temp;
			}
		}
	}
}

int main(void)
{
	int N,a[N],i=0;
	int Alice=0,Bob=0;

	cin >> N;

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

	sort(a , N);
	
	for(i=0;i<=N/2;i++){
		if(2*i<=N){
			Alice += a[2*i];
		}
		if(2*i+1<=N){
			Bob += a[2*i+1];
		}
	}

	cout << Alice - Bob;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   23 |         cin >> N;
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:41:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   41 |         cout << Alice - Bob;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int i;
int N;
int Alice,Bob;
cin >>N;

int A[N];
for(i=1;i<=N;i++){
cin >>A[i];
}
sort(A;N);
for(i=N;i>=1;i=i-2){
Alice=Alice+A[i];
}
for(i=N-1;i>=1;i=i-2){
Bob=Bob+A[i];
}
cout>>alice-Bob>>endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: expected ')' before ';' token
   14 | sort(A;N);
      |     ~ ^
      |       )
a.cc:14:9: error: expected ';' before ')' token
   14 | sort(A;N);
      |         ^
      |         ;
a.cc:21:7: error: 'alice' was not declared in this scope; did you mean 'Alice'?
   21 | cout>>alice-Bob>>endl;
      |       ^~~~~
      |       Alice
Language: C++


#include <iostream>
int a[110];
int main(void) {
    // insert code here...
    int N;
    std::cin>>N;
    for(int  i=0; i<N; i++) std::cin>>a[i];
    std::sort(a,a+N);
    std::reverse(a,a+N);
    int A=0,B=0;
    for(int i=0;i<N;i++){
    if(i%2==0){
        A+=a[i];
    }else{
        B+=a[i];
    }
    }
    std::cout<<A-B<<std::endl;
    return 0;
}

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

int main(void) {
    // insert code here...
    int a[110];
    int N;
    cin>>N;
    for(int  i=0; i<N; i++) cin>>a[i];
    sort(a,a+N);
    reverse(a,a+N);
    int A=0,B=0;
    for(int i=0;i<N;i++){
    if(i%2==0){
        A+=a[i];
    }else{
        B+=a[i];
    }
    }
    cout<<A-B<<endl;
    return 0;
}


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


int main(void) {
    // insert code here...
    int a[110];
    int N;
    std::cin>>N;
    for(int  i=0; i<N; i++) std::cin>>a[i];
    std::sort(a,a+N);
    std::reverse(a,a+N);
    int A=0,B=0;
    for(int i=0;i<N;i++){
    if(i%2==0){
        A+=a[i];
    }else{
        B+=a[i];
    }
    }
    std::cout<<A-B<<std::endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: 'cin' is not a member of 'std'
    6 |     std::cin>>N;
      |          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | 
a.cc:7:34: error: 'cin' is not a member of 'std'
    7 |     for(int  i=0; i<N; i++) std::cin>>a[i];
      |                                  ^~~
a.cc:7:34: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:10: error: 'sort' is not a member of 'std'
    8 |     std::sort(a,a+N);
      |          ^~~~
a.cc:9:10: error: 'reverse' is not a member of 'std'
    9 |     std::reverse(a,a+N);
      |          ^~~~~~~
a.cc:18:10: error: 'cout' is not a member of 'std'
   18 |     std::cout<<A-B<<std::endl;
      |          ^~~~
a.cc:18:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:26: error: 'endl' is not a member of 'std'
   18 |     std::cout<<A-B<<std::endl;
      |                          ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 |
Language: C++

    // insert code here...
    int a[110];
    int N;
    std::cin>>N;
    for(int  i=0; i<N; i++) std::cin>>a[i];
    std::sort(a,a+N);
    std::reverse(a,a+N);
    int A=0,B=0,i;
    for(int i=0;i<N;i++){
    if(i%2==0){
        A+=a[i];
    }else{
        B+=a[i];
}
    std::cout<<A-B<<std::endl;
    return 0;
}

Compiler output:
a.cc:4:10: error: 'cin' in namespace 'std' does not name a type
    4 |     std::cin>>N;
      |          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 |     // insert code here...
a.cc:5:5: error: expected unqualified-id before 'for'
    5 |     for(int  i=0; i<N; i++) std::cin>>a[i];
      |     ^~~
a.cc:5:19: error: 'i' does not name a type
    5 |     for(int  i=0; i<N; i++) std::cin>>a[i];
      |                   ^
a.cc:5:24: error: 'i' does not name a type
    5 |     for(int  i=0; i<N; i++) std::cin>>a[i];
      |                        ^
a.cc:6:14: error: expected constructor, destructor, or type conversion before '(' token
    6 |     std::sort(a,a+N);
      |              ^
a.cc:7:17: error: expected constructor, destructor, or type conversion before '(' token
    7 |     std::reverse(a,a+N);
      |                 ^
a.cc:9:5: error: expected unqualified-id before 'for'
    9 |     for(int i=0;i<N;i++){
      |     ^~~
a.cc:9:17: error: 'i' does not name a type
    9 |     for(int i=0;i<N;i++){
      |                 ^
a.cc:9:21: error: 'i' does not name a type
    9 |     for(int i=0;i<N;i++){
      |                     ^
Language: C++

#include <stdio.h>
#include <algorithm>

using namespace std;

int main() {
    int n;
    int res = 0;
    int a[100];

    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d ", &a[i]);
    }
    sort(a, a + n, greater<int>());
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            res += a[i];
        } else {
            res -= a[i];
        }
    }
    printf("%d", res);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: 'greater' was not declared in this scope
   15 |     sort(a, a + n, greater<int>());
      |                    ^~~~~~~
a.cc:15:28: error: expected primary-expression before 'int'
   15 |     sort(a, a + n, greater<int>());
      |                            ^~~
Language: Java

import java.util.Scanner;
public class B_88 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] cards = new int[N];
		
		for(int i=0; i<cards.length; i++) 
			cards[i] = sc.nextInt();
		
		int work;
		for(int i= 0 ;i< N; i++) 
			for(int k= i;k< N;k++) 
				if(cards[i] < cards[k])
				{
					work = cards[i];
					cards[i] = cards[k];
					cards[k] = work;
				}
		
		int sum=0;
		for(int i=0; i< N ;i++) 
			if(i % 2 ==0) sum+=cards[i];
			else			  sum-=cards[i];
		
		System.out.println(sum);
	}

}


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

#include <iostream>
using namespace std;
int N;
int C[100];
int a, b;
int main() {
	for (int i = 0; i < 100; ++i){
		C[i]=0;
	}
	cin >> N;
	for (i = 0; i < N; ++i){
		cin >> C[i];
	}
	for (i = 0; i < N;i=i+2){
		a=a+C[i];
		b=a+C[i+1];
	}
	cout << (a-b) << endl;
	return 0;
}

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

#include <iostream>
using namespace std;
int N;
int C[100];
int a, b;
int main() {
	for (int i = 0; i < 100; ++i){
		C[i]=0;
	}
	cin >> N;
	for (int i = 0; i < N; ++i){
		cin >> C[i];
	}
	for (i = 0; i < N;i=i+2){
		a=a+C[i];
		b=a+C[i+1];
	}
	cout << (a-b) << endl;
	return 0;
}

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

//
//  main.cpp
//  prog
//
//  Created by Niko Huang on 2018/02/22.
//  Copyright © 2018年 Niko Huang. All rights reserved.
//

#include <iostream>
#include <fstream>
#include <vector>
#include <string>

using namespace std;

ifstream in("data.txt");
ofstream out("result.txt");

int main(int argc, const char * argv[]) {
    // insert code here...
    int n, temp;
    vector < int > a;
    cin >> n;
    
    for (int i = 0; i < n; i++){
        cin >> temp;
        a.push_back(temp);
    }
    
    sort(a.begin(), a.end(), greater<int>());
    unsigned long long alice = 0,bob = 0;
    
    for(unsigned long i = 0; i < a.size(); i++){
        if (i % 2 == 0) alice += a[i];
        else bob += a[i];
    }
    cout << alice - bob << endl;
    return 0;
}


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

#include<iostream>
using namespace std;
int main()
{
	int N;
	int Alice=0,Bob=0;
	vector<int> card;
	cin>>N;
	for(int i=0;i<N;i++)
	{
		cin>>temp;
		card.push_back(temp);
	}
	sort(card.begin(),card.end());
	reverse(card.begin(),card.end());
	for(int =0;i<x;i++){
		if(i%2){
			Bob=Bob+card[i];
		}
		else Alice=Alice+card[i];
	}
	cout<<Alice-Bob<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'vector' was not declared in this scope
    7 |         vector<int> card;
      |         ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:7:16: error: expected primary-expression before 'int'
    7 |         vector<int> card;
      |                ^~~
a.cc:11:22: error: 'temp' was not declared in this scope; did you mean 'tm'?
   11 |                 cin>>temp;
      |                      ^~~~
      |                      tm
a.cc:12:17: error: 'card' was not declared in this scope
   12 |                 card.push_back(temp);
      |                 ^~~~
a.cc:14:14: error: 'card' was not declared in this scope
   14 |         sort(card.begin(),card.end());
      |              ^~~~
a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |         sort(card.begin(),card.end());
      |         ^~~~
      |         short
a.cc:15:9: error: 'reverse' was not declared in this scope
   15 |         reverse(card.begin(),card.end());
      |         ^~~~~~~
a.cc:16:17: error: expected unqualified-id before '=' token
   16 |         for(int =0;i<x;i++){
      |                 ^
a.cc:16:16: error: expected ';' before '=' token
   16 |         for(int =0;i<x;i++){
      |                ^~
      |                ;
a.cc:16:17: error: expected primary-expression before '=' token
   16 |         for(int =0;i<x;i++){
      |                 ^
a.cc:16:20: error: 'i' was not declared in this scope
   16 |         for(int =0;i<x;i++){
      |                    ^
a.cc:16:22: error: 'x' was not declared in this scope
   16 |         for(int =0;i<x;i++){
      |                      ^
a.cc:16:23: error: expected ')' before ';' token
   16 |         for(int =0;i<x;i++){
      |            ~          ^
      |                       )
a.cc:16:24: error: 'i' was not declared in this scope
   16 |         for(int =0;i<x;i++){
      |                        ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
	int N;
	int Alice=0,Bob=0;
	cin>>N;
	for(int i=0;i<N;i++)
	{
		cin>>temp;
		card.push_back(temp);
	}
	sort(card.begin(),card.end());
	reverse(card.begin(),card.end());
	for(int =0;i<x;i++){
		if(i%2==0){
			Bob=Bob+card[i];
		}
		else Alice=Alice+card[i];
	}
	cout<<Alice-Bob<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: 'temp' was not declared in this scope; did you mean 'tm'?
   10 |                 cin>>temp;
      |                      ^~~~
      |                      tm
a.cc:11:17: error: 'card' was not declared in this scope
   11 |                 card.push_back(temp);
      |                 ^~~~
a.cc:13:14: error: 'card' was not declared in this scope
   13 |         sort(card.begin(),card.end());
      |              ^~~~
a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |         sort(card.begin(),card.end());
      |         ^~~~
      |         short
a.cc:14:9: error: 'reverse' was not declared in this scope
   14 |         reverse(card.begin(),card.end());
      |         ^~~~~~~
a.cc:15:17: error: expected unqualified-id before '=' token
   15 |         for(int =0;i<x;i++){
      |                 ^
a.cc:15:16: error: expected ';' before '=' token
   15 |         for(int =0;i<x;i++){
      |                ^~
      |                ;
a.cc:15:17: error: expected primary-expression before '=' token
   15 |         for(int =0;i<x;i++){
      |                 ^
a.cc:15:20: error: 'i' was not declared in this scope
   15 |         for(int =0;i<x;i++){
      |                    ^
a.cc:15:22: error: 'x' was not declared in this scope
   15 |         for(int =0;i<x;i++){
      |                      ^
a.cc:15:23: error: expected ')' before ';' token
   15 |         for(int =0;i<x;i++){
      |            ~          ^
      |                       )
a.cc:15:24: error: 'i' was not declared in this scope
   15 |         for(int =0;i<x;i++){
      |                        ^
Language: C++

        #include<iostream>
        #include<vector>
        #include<algorithm>
        using namespace std;
        int main(){
        int N,i,sumA=0,sumB=0;
        cin>>N;
        vector<int> a(N);
        for(i=0;i<N;i++){
         cin>>a[i];
        }
        sort(a.begin(),a.end());
        for(i=N-1;i>=0;i=i-2) sumA+=a[i];
        for(i=N-2;i>=0;i=i-2) sumB+=a[i];
        cout<<sumA-sumB<<endl;
        }
        return 0;
        }

Compiler output:
a.cc:17:9: error: expected unqualified-id before 'return'
   17 |         return 0;
      |         ^~~~~~
a.cc:18:9: error: expected declaration before '}' token
   18 |         }
      |         ^
Language: C++

    #include<iostream>
    #include<vector>
    #include<algorithm>
    using namespace std;
    int main(){
    int N,i,sumA=0,sumB=0;
    cin>>N;
    vector<int> a(N);
    for(i=0;i<N;i++){
     cin>>a[i];
    }
    sort(a.begin(),a.end());
    for(i=a.end();i>=0;i=i-2) sumA+=a[i];
    for(i=a.end()-1;i>=0;i=i-2) sumB+=a[i];
    cout<<sumA-sumB<<endl;
    }
    return 0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: cannot convert 'std::vector<int>::iterator' to 'int' in assignment
   13 |     for(i=a.end();i>=0;i=i-2) sumA+=a[i];
      |           ~~~~~^~
      |                |
      |                std::vector<int>::iterator
a.cc:14:18: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in assignment
   14 |     for(i=a.end()-1;i>=0;i=i-2) sumB+=a[i];
      |           ~~~~~~~^~
      |                  |
      |                  __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc: At global scope:
a.cc:17:5: error: expected unqualified-id before 'return'
   17 |     return 0;
      |     ^~~~~~
a.cc:18:5: error: expected declaration before '}' token
   18 |     }
      |     ^
Language: C++

#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

const int MAX = 101;

int main() {
	int N;
	int cards[MAX] = { 0 };

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

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

	int alice = 0;
	int bob = 0;

	for (int i = 0; i < N; i++) {
		if (i % 2 == 0)alice += cards[i];
		else bob += cards[i];
	}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:39:18: error: expected '}' at end of input
   39 |         return 0;
      |                  ^
a.cc:19:12: note: to match this '{'
   19 | int main() {
      |            ^
Language: Java

import java.util.Scanner;

import java.util.Arrays;
class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int N =scan.nextInt();
        int[] a = IntStream.range(0,N).map(i->scan.nextInt()).toArray();
        Arrays.sort(a);
        int ans =0;
        for(int i=a.length-1;i>=0;i-=2)ans+=a[i];
        for(int i=a.length-2;i>=0;i-=2)ans-=a[i];
        System.out.println(ans);
    }
}

Compiler output:
Main.java:8: error: cannot find symbol
        int[] a = IntStream.range(0,N).map(i->scan.nextInt()).toArray();
                  ^
  symbol:   variable IntStream
  location: class Main
1 error
Language: Java

import java.util.*;

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

		int n = Integer.parseInt(s.next());
		int[] cards = new int[n];

		for (int i=0; i<n; i++) {
			cards[i] = Integer.parseInt(s.next());
		}

		Arrays.sort(cards);

		int[] total = {0, 0};
		for (int i=0; i<n; i++) {
			total[i%2]++;
		}

		System.out.println(a[0]-a[1]);
	}
}

Compiler output:
Main.java:21: error: cannot find symbol
		System.out.println(a[0]-a[1]);
		                   ^
  symbol:   variable a
  location: class Main
Main.java:21: error: cannot find symbol
		System.out.println(a[0]-a[1]);
		                        ^
  symbol:   variable a
  location: class Main
2 errors
Language: Java

import java.util.*;

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

		int n = Integer.parseInt(s.next());
		int[] cards = new int[n];

		for (int i=0; i<n; i++) {
			cards[i] = Integer.parseInt(s.next());
		}

		Arrays.sort(cards);

		int[] total = {0, 0}
		for (int i=0; i<n; i++) {
			total[i%2]++;
		}

		System.out.println(a[0]-a[1]);
	}
}

Compiler output:
Main.java:16: error: ';' expected
		int[] total = {0, 0}
		                    ^
1 error
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
#include<cstdio>
#include <cmath>
#include<string>
#include<cmath>
using namespace std;

int main()
{
	int n, aa[100], a, b;

	cin >> n;

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

	a = b = 0;

	for (int i = 0; i < n; i++){
		if (i % 2 == 1)
			a+=aa[i];
		else
			b+=aa[i];
	}

	cout << a - b << endl;


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

#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define FI first
#define SE second
#define SI size()
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PF push_front
#define PB push_back
#define VE vector<int>
#define VP vector<PA>
#define LL long long
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=MOD=1e9+7;
//
int main(){
  int N;
  int A[100];
  cin>>N;
  FOR(i,0,N){
    cin>>A[i];
  }
  sort(A,A+N,greater<int>());
  int a=0,b=0;
  FOR(i,0,N){
    if(i%2==0){
      a+=A[i];
    }else{
      b+=A[i];
    }
  }
  cout<<a-b<<endl;
  return 0;
}


Compiler output:
a.cc:26:15: error: 'MOD' was not declared in this scope
   26 | const int INF=MOD=1e9+7;
      |               ^~~
Language: C++

#include<iostream>
using namespace std;
int main(){
    int N,tmp,G1=0,G2=0;
    cin >>N;
    int a[N];
    for(int i=0; i<N; i++){
        cin >> a[i];
    }
    for(int i=0; i<N; i++){
        for(int j= i+1; j<N; j++){
            if( a[i] < a[j]){
                tmp = a[j];
                a[j] = a[i];
                a[i] = tmp;
                }
            }
        }
        for(int j=0; j<N; j++){
        if( k % 2 == 0){
            G1 += a[k];
        } else {
            G2 += a[k];
        }
    }
    cout << G1 - G2 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: 'k' was not declared in this scope
   20 |         if( k % 2 == 0){
      |             ^
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#define HMAX 52
#define WMAX 52

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

ll N;
static const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
vector<ll> v;

int main(){
	cin >> N;
	for (int i = 0; i < N; ++i)
	{
		int a;
		cin >> a;
		v.push_back(a);
	}
	sort(v.begin(), v.end(),greater<>() );
	int ans = 0;
	for (int i = 0; i < v.size(); ++i)
	{
		ans += (i%2 == 0 ? v[i] : -v[i]);
	}
	cout << ans << endl;
	return 0;
}

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

package beginner088;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class B {
	public static void main(String[] args) throws Exception {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String buf = br.readLine();
		int n = Integer.valueOf(buf);

		buf = br.readLine();
		String[] a = buf.split(" ", 0);

		List<Integer> aList = Stream.of(a)
		    .map(Integer::valueOf)
		    .sorted(Comparator.reverseOrder())
		    .collect(Collectors.toList());

		int alice = 0;
		int bob = 0;
		for (int i = 0; i < aList.size(); i++) {
			if (i % 2 == 0) {
				alice += aList.get(i);
			} else {
				bob += aList.get(i);
			}
		}

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

}


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

#include <iostream>
#include <cmath>
using namespace std;
int main()
{int N,A,B;
int a[100],num[100];
A=0;
B=0;
for(int i=0;i<N:i++)
{
    cin>>a[i];
}
for (int i = 0; i < N - 1; i++) {
        int min = num[i];                 /* i 番目の要素を暫定的に最小値とし */
       int  k = i;                        /* 添字を保存 */
        for (int j = i + 1; j < N; j++) {
            if (num[j] > min) {       /* より小さい値が現れたら */
                min = num[j];         /* 最小値の入れ替え */
                k = j;                /* 添字を保存 */
            }
        }                             /* このループを抜けるとk に最小値の添字が入っている */
        int temp = num[i];                /* i 番目の要素と最小値の交換 */
        num[i] = num[k];
        num[k] = temp;
        for(int i=0;i<N;i++)
        {   if(i%2!=0)
        {
           B =B+ num[i+1];
            }
            if(i%2==0)
    {
        A = A+num[i+1];
    }
    cout<<A-B;
        }
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
    9 | for(int i=0;i<N:i++)
      |             ^
a.cc:9:16: error: found ':' in nested-name-specifier, expected '::'
    9 | for(int i=0;i<N:i++)
      |                ^
      |                ::
a.cc:9:15: error: 'N' is not a class, namespace, or enumeration
    9 | for(int i=0;i<N:i++)
      |               ^
a.cc:13:1: error: expected primary-expression before 'for'
   13 | for (int i = 0; i < N - 1; i++) {
      | ^~~
a.cc:12:2: error: expected ';' before 'for'
   12 | }
      |  ^
      |  ;
   13 | for (int i = 0; i < N - 1; i++) {
      | ~~~
a.cc:13:1: error: expected primary-expression before 'for'
   13 | for (int i = 0; i < N - 1; i++) {
      | ^~~
a.cc:12:2: error: expected ')' before 'for'
   12 | }
      |  ^
      |  )
   13 | for (int i = 0; i < N - 1; i++) {
      | ~~~
a.cc:9:4: note: to match this '('
    9 | for(int i=0;i<N:i++)
      |    ^
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {int N,A,B;
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main (){
  int N;
  int tmp;
  vector<int> arr;
  int A=0;
  int B=0;

  cin >> N;
  for(int i;i<N;i++){
    cin >> tmp;
    arr.push_back(tmp);
  }
  sort(arr.begin(),data.end());

  for(int i; i<N;i++){
    if(i%2 == 0){
      A += arr[i];
    }
    if(i%2 == 1){
      B += arr[i];
    }
  }
  cout << A - B << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: overloaded function with no contextual type information
   19 |   sort(arr.begin(),data.end());
      |                         ^~~
Language: C

#include<stdio.h>

int main(void){
int N;
int arr[];
int A = 0, B = 0;
int m = 0, f = 0;
int i, j;
scanf("%d", &N);
for(i=0;i<N;i++){
scanf("%d", &arr[i]);
}
for(i=0;i<N;i++){
for(j=0;j<N;j++){
if(m<arr[j]){
m = arr[j];
f = j;
}
}
if(i%2){
B += m;
}else{
A += m;
}
m = 0;
arr[f] = 0;
}
printf("%d", A - B);
return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:5: error: array size missing in 'arr'
    5 | int arr[];
      |     ^~~
Language: C++

#include<iostream>
#include<vector>

int main()
{
    std::vector<int> v;
    v.clear();
    
    int a, n;
    std::cin >> n;
    for(int i=0; i<n; i++)
    {
        std::cin >> a;
        v.push_back(a);
    }
    
    std::sort(v.begin(), v.end());
    
    int s=0;
    for(int i=1; i<=n; i++)
    {
        s += i%2 == 0 ?  -v[n-i] : v[n-i];
    }
    
    std::cout << s << std::endl;
    
    return 0;
}


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

import scala.io.StdIn._
object Main{
  def main(args:Array[String]){
    val N = readInt
    val a = readLine.split(' ').map(x=>x.toInt).sorted.reverse
    val sum = a.sum
    var x = 0;
    for(i <- 0 until N if i%2==0){
      x += a(i)
    }
    val y = sum - x
    println(x-y)
  }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import scala.io.StdIn._
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

int main() {
	int N, a[100];
	int x = 0, y = 0;
	int max;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int i = 1; i <= N; i++) {
		max = 0;
		for (int j = 0; j < N; j++) {
			if (max <= a[j]) {
				max = a[j];
			}
		}
		for (int j = 0; j < N; j++) {
			if (a[j] == max) {
				a[j] = 0;
				break;
			}
		}
		switch (i % 2) {
		case 1: x += max; break;
		case 0: y += max; break;
		}
	}
	cout << x - y << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin >> N;
      |         ^~~
a.cc:27:9: error: 'cout' was not declared in this scope
   27 |         cout << x - y << endl;
      |         ^~~~
a.cc:27:26: error: 'endl' was not declared in this scope
   27 |         cout << x - y << endl;
      |                          ^~~~
Language: C

#include<stdio.h>

int main(){
  int n,a[100],temp,j,i,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      if(a[i]<a[j]){
        temp=a[i];
        a[i]=a[j];
        a[j]=temp
      }
    }
  }
  for(i=0;i<n;i++){
    if(i%2==0) sum+=a[i];
    else sum-=a[i];
  }
  printf("%d\n",sum);
}

Compiler output:
main.c: In function 'main':
main.c:13:18: error: expected ';' before '}' token
   13 |         a[j]=temp
      |                  ^
      |                  ;
   14 |       }
      |       ~
Language: C++

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
int a[105];
int ans,ana,anb,n;
bool cmp(int a,int b){
	return a > b;
}

int main()
{
	cin >> n;
	for(int i = 0 ; i < n ; i++){
		cin >> a[i];
	}
	sort(a,a + n,cmp);
	for(int i = 0 ; i < n ; i++){
		if(i % 2 == 0) ana += a[i];
		else anb += a[i];
	}
	an = ana - anb;
	cout << an << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'an' was not declared in this scope; did you mean 'yn'?
   25 |         an = ana - anb;
      |         ^~
      |         yn
Language: C++

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


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

#include"stdio.h"
#include"algorithm"
int main(){
int n;
scanf("%d",&n);
int a[n];
for(int i=0;i<n;i++)scanf("%d",&a[i]);
sort(a,a+n);
int ans=0;
for(int i=0;i<n;i++)ans+=a[i]*(i%2?1:-1);
if(ans<0)ans*=-1;
printf("%d",ans);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:1: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
    8 | sort(a,a+n);
      | ^~~~
      | std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
Language: C++

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

const int MAX = 100;
int main() {
	int N, a[MAX];
	cin >> N;
	for (int i = 0;i < N;i ++) cin >> a[i];
	sort(a, a + N); // 先頭が小さい点に注意
	
	int score[2];
	score[0] = 0; // Alice
	score[1] = 0; // Bob
	for (int i = 0;i < N;i ++) {
		score[i % 2] += a[N - i - 1];
	}
	cout << score[0] - score[1];
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

もしもi < jのときa_i > a_j なら、当然だが皆先頭から順に取る
よってこの順になるようにソートしておけばいい
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |         sort(a, a + N); // 先頭が小さい点に注意
      |         ^~~~
      |         short
Language: C++

// ConsoleApplication2.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	int i;
	int alice = 0;
	int bob = 0;
	int num = 0;

	cin >> n;

	vector<int> a(n);
	
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	while (1) {
		sort(a.begin(), a.end());
		reverse(a.begin(), a.end());

		alice += a[0];
		a[0] = 0;
		num++;
		if (num == n) break;
		bob += a[1];
		a[1] = 0;
		num++;
		if (num == n) break;
	}

	cout << alice - bob << "\n";

    return 0;
}



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

#include<stdio.h>
#include<stdlib.h>
int main()
{
int N, a[100];
//input
scanf("%d", &N);
for(int i=0;i<N;i++)
scanf("%d", &a[i]);
int sum[2]={};
int tmp;
//sort
for(i=0;i<N;i++)
for(j=i+1;j<N;j++)
if(a[i]>a[j])
{
tmp=a[i];
a[i]=a[j];
a[j]=tmp;
}
//calc
for(i=0;i<N;i++)
sum[i%2]+=a[i];
printf("%d". abs(sum[0]-sum[2]);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'i' was not declared in this scope
   13 | for(i=0;i<N;i++)
      |     ^
a.cc:14:5: error: 'j' was not declared in this scope
   14 | for(j=i+1;j<N;j++)
      |     ^
a.cc:22:5: error: 'i' was not declared in this scope
   22 | for(i=0;i<N;i++)
      |     ^
a.cc:24:14: error: request for member 'abs' in '"%d"', which is of non-class type 'const char [3]'
   24 | printf("%d". abs(sum[0]-sum[2]);
      |              ^~~
Language: C++

#include<bits/stdc++.h>

using namespace std;	

int main() 
{
	int n;
	cin >> n;
	int array1[n],array[n];
	for (int i=0;i<n;i++)
	{
		cin >> array1[i];
	}
	sort(array1,array1+n);

	for (int i=0;i<n;i++)
	{
		array[i] = array1[n-1-i]
	}

	int alice=0,bob=0;

	for (int i=0;i<n;i+=2)
	{
		alice += array[i];
	}
	for (int i=1;i<n;i+=2)
	{
		bob += array[i];
	}
	cout << alice-bob;

   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:41: error: expected ';' before '}' token
   18 |                 array[i] = array1[n-1-i]
      |                                         ^
      |                                         ;
   19 |         }
      |         ~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

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

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

///
// File:  b.go
// Author: ymiyamoto
//
// Created on Sun Feb 18 21:01:52 2018
//
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scan(&N)
	arr := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&arr[i])
	}
	sort.Ints(arr)

	alice := 0
	bob := 0
	count := 0
	for i := N - 1; i >= 0; i-- {
		if count%2 == 0 {
			alice = arr[i]
		} else {
			bob = arr[i]
		}
	}
	fmt.Println(alice - bob)
}


Compiler output:
a.cc:7:1: error: 'package' does not name a type
    7 | package main
      | ^~~~~~~
Language: C++

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	cin>>n;
	int out=0;
	rep(i,n){
		int a;cin>>a;
		if(i%2==0)out+=a;
		else out-=b;
	}
	cout<<out<<endl;
}








Compiler output:
a.cc: In function 'int main()':
a.cc:59:27: error: 'b' was not declared in this scope
   59 |                 else out-=b;
      |                           ^
Language: C++

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

int main(){

vector<vector<int>> c(3,vector<int>(3))
for(int i=0;i<3;i++){
 for(int j=0;j<3;j++){
 cin >> c[i][j]; 
 }
}
 bool flag = false;
 for(int j=0;j<2;j++){
if(c[0][j]-c[0][j+1]==c[1][j]-c[1][j+1] && c[1][j]-c[1][j+1]==c[2][j]-c[2][j+1]){
flag=true;
}
if(flag) cout << "Yes" << endl;
   else cout << "No"    << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:1: error: expected ',' or ';' before 'for'
    7 | for(int i=0;i<3;i++){
      | ^~~
a.cc:7:13: error: 'i' was not declared in this scope
    7 | for(int i=0;i<3;i++){
      |             ^
a.cc:19:2: error: expected '}' at end of input
   19 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>

#define Nfori(N) for(int i=0;i<N;i++)
#define Nforj(N) for(int j=0;j<N;j++)
using namespace std;

int main(){
  	int c[3][3];
  	Nfori(3){
      	Nforj(3) cin >> c[i][j];
    }
  	int difi[2][3];
  	int difj[3][2];
  	Nfori(2){
      	Nforj(3){
          	difi[i][j]=c[i][j]-c[i+1][j];
          	difj[j][i]=c[j][i]-c[j][i+1];
        }
    }
  	string ans = "Yes";
  	Nfori(2){
      	if(difi[i][0]!=difi[i][1] || difi[i][1]!=difi[i][2] || difj[0][i]!=difj[1][i] || difj[1][j]!=difj[2][j]){
          	ans="No";
        }
    }
  	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:98: error: 'j' was not declared in this scope
   22 |         if(difi[i][0]!=difi[i][1] || difi[i][1]!=difi[i][2] || difj[0][i]!=difj[1][i] || difj[1][j]!=difj[2][j]){
      |                                                                                                  ^
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
int a[3],b[3];
int c[3][3];
int main() {
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }
    int a1, a2, a3, b1, b2, b3;
    for(int i = 0; i <= 100; i++){
        a1 = i;
        b1 = c[0][0] - a1;
        b2 = c[0][1] - a1;
        b3 = c[0][2] - a1;
        a2 = c[1][0] - b1;
        a3 = c[2][0] - b1;
        //cout << a1 << a2 << a3 << b1 << b2 << b3;
        if(a2 + ba2 == c[1][1] && a2 + b2 == c[2][2]){
            if(a3 + b2 == c[2][1] && a3 + b3 == c[2][2]){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: 'ba2' was not declared in this scope; did you mean 'b2'?
   23 |         if(a2 + ba2 == c[1][1] && a2 + b2 == c[2][2]){
      |                 ^~~
      |                 b2
Language: C++



#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
//#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007
//#define N 12
#define sz 1000*1000

 int main(){

  int c[3][3];

   for(int i=0;i<3;i++){
      for(int j=0;j<3;j++)
            cin>>c[i][j];
   }

if(c[0][0]-c[0][1]==c[1][0]-c[1][1])
	{
		if(c[1][0]-c[1][1]==c[2][0]-c[2][1])
		{
			x=1;
		}
	}
	if(c[0][1]-c[0][2]==c[1][1]-c[1][2])
	{
		if(c[1][1]-c[1][2]==c[2][1]-c[2][2])
		{
			y=1;
		}
	}

	if(x == 1 && y == 1)
            cout<<"Yes"<<endl;
      else
            cout<<"No"<<endl;

 return 0;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:35:25: error: 'x' was not declared in this scope
   35 |                         x=1;
      |                         ^
a.cc:42:25: error: 'y' was not declared in this scope
   42 |                         y=1;
      |                         ^
a.cc:46:12: error: 'x' was not declared in this scope
   46 |         if(x == 1 && y == 1)
      |            ^
a.cc:46:22: error: 'y' was not declared in this scope
   46 |         if(x == 1 && y == 1)
      |                      ^
Language: C++




#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
//#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007
//#define N 12
#define sz 1000*1000

 int main(){

  int ani[3][3];

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

if(c[0][0]-c[0][1]==c[1][0]-c[1][1])
	{
		if(c[1][0]-c[1][1]==c[2][0]-c[2][1])
		{
			x=1;
		}
	}
	if(c[0][1]-c[0][2]==c[1][1]-c[1][2])
	{
		if(c[1][1]-c[1][2]==c[2][1]-c[2][2])
		{
			y=1;
		}
	}

	if(x == 1 && y == 1)
            cout<<"Yes"<<endl;
      else
            cout<<"No"<<endl;

 return 0;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:29:18: error: 'a' was not declared in this scope
   29 |             cin>>a[i][j];
      |                  ^
a.cc:32:4: error: 'c' was not declared in this scope
   32 | if(c[0][0]-c[0][1]==c[1][0]-c[1][1])
      |    ^
a.cc:36:25: error: 'x' was not declared in this scope
   36 |                         x=1;
      |                         ^
a.cc:39:12: error: 'c' was not declared in this scope
   39 |         if(c[0][1]-c[0][2]==c[1][1]-c[1][2])
      |            ^
a.cc:43:25: error: 'y' was not declared in this scope; did you mean 'yn'?
   43 |                         y=1;
      |                         ^
      |                         yn
a.cc:47:12: error: 'x' was not declared in this scope
   47 |         if(x == 1 && y == 1)
      |            ^
a.cc:47:22: error: 'y' was not declared in this scope; did you mean 'yn'?
   47 |         if(x == 1 && y == 1)
      |                      ^
      |                      yn
Language: C++

#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  vvi c(n, vi(n));
  rep(i,3){
    rep(j,3) cin >> c.at(i).at(j);
  }
  
  rep(i,2){
    int p = c.at(i).at(2) - c.at(i+1).at(2);
    rep(j,2){
      if(p == c.at(i).at(j) - c.at(i+1).at(j)) continue;
      NO;
      return 0;
    }
  }
  rep(j,2){
    int p = c.at(2).at(j) - c.at(2).at(j+1);
    rep(i,2){
      if(p == c.at(i).at(j) - c.at(i).at(j+1)) continue;
      NO;
      return 0;
    }
  }
  YES;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'n' was not declared in this scope
   26 |   vvi c(n, vi(n));
      |         ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int ar[3][3];
  for(int i = 0; i < 3; ++i)
    for(int j = 0; j < 3; ++j)
      cin >> a[i][j];
  bool f = true;
  for(int i = 0; i < 2; ++i){
    f &= a[i][0] - a[i+1][0] == a[i][1] - a[i+1][1];
    f &= a[i][0] - a[i+1][0] == a[i][2] - a[i+1][2];
  }
  cout << (f ? "Yes" : "No") << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:14: error: 'a' was not declared in this scope
   43 |       cin >> a[i][j];
      |              ^
a.cc:46:10: error: 'a' was not declared in this scope
   46 |     f &= a[i][0] - a[i+1][0] == a[i][1] - a[i+1][1];
      |          ^
Language: C++

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


int c1, c2,c3,c4,c5,c6,c7,c8,c9;
int sum_1,sum_2,sum_3;
int main(){
  cin>>c1>>c2>>c3;
  cin>>c4>>c5>>c6;
  cin>>c7>>c8>>c9;
  sum_1 = c1+c5+c9;
  sum_2 = c2+c6+c7;
  sum_3 = c3+c4+c8;
  if(sum_1 == sum_2 == sum_3){
    cout<< "Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


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

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


int c1, c2,c3,c4,c5,c6,c7,c8,c9;
int sum_1,sum_2,sum_3;
int main{
  cin>>c1>>c2>>c3;
  cin>>c4>>c5>>c6;
  cin>>c7>>c8>>c9;
  sum_1 = c1+c5+c9;
  sum_2 = c2+c6+c7;
  sum_3 = c3+c4+c8;
  if(sum_1 == sum_2 == sum_3){
    cout<< "Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


Compiler output:
a.cc:7:5: error: cannot declare '::main' to be a global variable
    7 | int main{
      |     ^~~~
a.cc:8:18: error: expected '}' before ';' token
    8 |   cin>>c1>>c2>>c3;
      |                  ^
a.cc:7:9: note: to match this '{'
    7 | int main{
      |         ^
a.cc:8:14: error: invalid user-defined conversion from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' [-fpermissive]
    8 |   cin>>c1>>c2>>c3;
      |   ~~~~~~~~~~~^~~~
In file included from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/istream:40,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_ios.h:121:16: note: candidate is: 'std::basic_ios<_CharT, _Traits>::operator bool() const [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  121 |       explicit operator bool() const
      |                ^~~~~~~~
/usr/include/c++/14/bits/basic_ios.h:121:16: note:   return type 'bool' of explicit conversion function cannot be converted to 'int' with a qualification conversion
a.cc:9:3: error: 'cin' does not name a type
    9 |   cin>>c4>>c5>>c6;
      |   ^~~
a.cc:10:3: error: 'cin' does not name a type
   10 |   cin>>c7>>c8>>c9;
      |   ^~~
a.cc:11:3: error: 'sum_1' does not name a type
   11 |   sum_1 = c1+c5+c9;
      |   ^~~~~
a.cc:12:3: error: 'sum_2' does not name a type
   12 |   sum_2 = c2+c6+c7;
      |   ^~~~~
a.cc:13:3: error: 'sum_3' does not name a type
   13 |   sum_3 = c3+c4+c8;
      |   ^~~~~
a.cc:14:3: error: expected unqualified-id before 'if'
   14 |   if(sum_1 == sum_2 == sum_3){
      |   ^~
a.cc:17:3: error: expected unqualified-id before 'else'
   17 |   else{
      |   ^~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^