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

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[] sum = new long[n];
    long sumb = 0;
    for(int i = 0; i < n; i++) {
      long a = sc.nextLong();
      long b = sc.nextLong();
      sum[i] = (a + b);
      sumb += b;
    }
    Arrays.sort(sum);
    long ans = ((-1) * b);
    for(int i = 1; i <= n - 1; i++) {
      if(i % 2 == 1) ans += sum[i];
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:16: error: cannot find symbol
    long ans = ((-1) * b);
                       ^
  symbol:   variable b
  location: class Main
1 error
Language: C++

// In The Name Of Allah
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e10;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
const ll mod = 1e9 + 7;

 
void faster()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

const ll M = 500 + 10;
const ll N = 200 * 1000 + 10;

pii a[N];

bool sortme(pii b, pii c)
{
	return b.first + b.second >= c.first + c.second
}

int main()	
{
	faster();
	ll n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i].first >> a[i].second;
	}
	sort(a, a + n, sortme);
	ll ans = 0;
	for (int i = 0; i < n; i++)
	{
		if(i % 2 == 0)
			ans += a[i].first;
		else
			ans -= a[i].second;
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'bool sortme(pii, pii)':
a.cc:25:56: error: expected ';' before '}' token
   25 |         return b.first + b.second >= c.first + c.second
      |                                                        ^
      |                                                        ;
   26 | }
      | ~
Language: C++

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

const int MAXN = 1e5 + 21;

int a[MAXN], b[MAXN];
int n;
long long ans;

int main() {
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		c[i].first = a[i] + b[i];
		c[i].second = i;
	}

	sort(c, c + n);

	for (int i = n - 1; i >= -; i -= 2)
		ans += a[c[i].second];
	for (int i = n - 2; i >= 0; i -= 2)
		ans -= a[c[i].second];
	cout << ans << '\n';
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'c' was not declared in this scope
   15 |                 c[i].first = a[i] + b[i];
      |                 ^
a.cc:19:14: error: 'c' was not declared in this scope
   19 |         sort(c, c + n);
      |              ^
a.cc:21:35: error: expected primary-expression before ';' token
   21 |         for (int i = n - 1; i >= -; i -= 2)
      |                                   ^
Language: C++

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

const int MAXN = 1e5 + 21;

int a[MAXN], b[MAXN];
int n;

int main() {
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		c[i].first = a[i] + b[i];
		c[i].second = i;
	}

	sort(c, c + n);

	for (int i = n - 1; i >= -; i -= 2)
		ans += a[c[i].second];
	for (int i = n - 2; i >= 0; i -= 2)
		ans -= a[c[i].second];
	cout << ans << '\n';
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: 'c' was not declared in this scope
   14 |                 c[i].first = a[i] + b[i];
      |                 ^
a.cc:18:14: error: 'c' was not declared in this scope
   18 |         sort(c, c + n);
      |              ^
a.cc:20:35: error: expected primary-expression before ';' token
   20 |         for (int i = n - 1; i >= -; i -= 2)
      |                                   ^
a.cc:21:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |                 ans += a[c[i].second];
      |                 ^~~
      |                 abs
a.cc:23:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |                 ans -= a[c[i].second];
      |                 ^~~
      |                 abs
a.cc:24:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |         cout << ans << '\n';
      |                 ^~~
      |                 abs
Language: C++

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) cout << (x) << endl;
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INF = 1<<29;
const int MOD = 1000000007;
 
void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};


int main(void){
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i,n) cin >> a[i] >> b[i];
    vector<ll> order;
    rep(i,n) order.push_back(i);
    sort(all(order), [&](int a, int b){ return A[a]+B[a] > A[b]+B[b];});

    ll ans = 0;
    rep(i,n){
      if(i%2 == 0){
        ans += A[order[i]];
      }else{
        ans -= B[order[i]];
      }
    }
    print(ans);
}

Compiler output:
a.cc: In lambda function:
a.cc:38:48: error: 'A' was not declared in this scope
   38 |     sort(all(order), [&](int a, int b){ return A[a]+B[a] > A[b]+B[b];});
      |                                                ^
a.cc:38:53: error: 'B' was not declared in this scope
   38 |     sort(all(order), [&](int a, int b){ return A[a]+B[a] > A[b]+B[b];});
      |                                                     ^
a.cc: In function 'int main()':
a.cc:43:16: error: 'A' was not declared in this scope
   43 |         ans += A[order[i]];
      |                ^
a.cc:45:16: error: 'B' was not declared in this scope
   45 |         ans -= B[order[i]];
      |                ^
Language: C++

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
int main(){
  ll N; cin >>N;
  vector<ll> A(N); vector<ll> B(N);
  vector<pair<ll,ll>> Sum(N);
  for(ll i = 0; i < N; i++){ cin >> A[i] >> B[i]; 
     Sum[i].first = A[i]+B[i]; Sum[i].second = i;}
  
   sort(Sum.rbegin(),Sum.rend());
  ll t = 0; ll a = 0;
  for(ll i = 0; i < N; i++){
    if(i%2){// Takahashi
      t += A[Sum[i].second];}
    else{
      a += B[Sum[i].second];}
  }

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

#include <bits/stdc++.h>

using namespace std;

const unsigned long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % MOD;
       base = base * base % MOD;
    }
    return tot;
}


vector<vector<long long>> da;

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n; cin >> n;

    for(int i = 0; i < n; ++i){
        long long j, k; cin >> j >> k;
        da.push_back({-j - k, j, -k});
    }

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

    long long a = 0;

    for(int i = 0; i < n; ++i)
        a += da[i][i % 2 + 1];

    cout << ah << "\n";

    return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:13: error: 'ah' was not declared in this scope; did you mean 'a'?
   40 |     cout << ah << "\n";
      |             ^~
      |             a
Language: C++

#include <cmath>
#include <map>
#include <set>

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

  std::vector<int> a(n), b(n);
  std::map<int, int> a_cnt, b_cnt;
  std::set<std::pair<int, int> > t_ureshii;
  for(int i=0; i<n; i++){
    std::cin >> a[i] >> b[i];
    if(a_cnt.find(a[i]) == a_cnt.end()) a_cnt[a[i]] = 0;
    if(b_cnt.find(b[i]) == b_cnt.end()) b_cnt[b[i]] = 0;
    a_cnt[a[i]]++;
    b_cnt[b[i]]++;
    t_ureshii.insert(std::make_pair(a[i] + b[i], i));
  }


  long result = 0;
  for(int i=0; i<n; i++){
    if(i%2==0){
      result += a[(*t_ureshii.rbegin()).second];
      t_ureshii.erase(*t_ureshii.rbegin());
    }else{
      result -= b[(*t_ureshii.rbegin()).second];
      t_ureshii.erase(*t_ureshii.rbegin());
    }
  }
  std::cout << result << std::endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: 'cin' is not a member of 'std'
    7 |   std::cin >> n;
      |        ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <set>
  +++ |+#include <iostream>
    4 | 
a.cc:9:8: error: 'vector' is not a member of 'std'
    9 |   std::vector<int> a(n), b(n);
      |        ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <set>
  +++ |+#include <vector>
    4 | 
a.cc:9:15: error: expected primary-expression before 'int'
    9 |   std::vector<int> a(n), b(n);
      |               ^~~
a.cc:13:10: error: 'cin' is not a member of 'std'
   13 |     std::cin >> a[i] >> b[i];
      |          ^~~
a.cc:13:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:17: error: 'a' was not declared in this scope
   13 |     std::cin >> a[i] >> b[i];
      |                 ^
a.cc:13:25: error: 'b' was not declared in this scope
   13 |     std::cin >> a[i] >> b[i];
      |                         ^
a.cc:25:17: error: 'a' was not declared in this scope
   25 |       result += a[(*t_ureshii.rbegin()).second];
      |                 ^
a.cc:28:17: error: 'b' was not declared in this scope
   28 |       result -= b[(*t_ureshii.rbegin()).second];
      |                 ^
a.cc:32:8: error: 'cout' is not a member of 'std'
   32 |   std::cout << result << std::endl;
      |        ^~~~
a.cc:32:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:31: error: 'endl' is not a member of 'std'
   32 |   std::cout << result << std::endl;
      |                               ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <set>
  +++ |+#include <ostream>
    4 |
Language: C++

#include <cmath>
#include <map>
#include <set>

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

  std::vector<int> a(n), b(n);
  std::map<int, int> a_cnt, b_cnt;
  std::set<std::pair<int, int> > t_ureshii;
  for(int i=0; i<n; i++){
    std::cin >> a[i] >> b[i];
    if(a_cnt.find(a[i]) == a_cnt.end()) a_cnt[a[i]] = 0;
    if(b_cnt.find(b[i]) == b_cnt.end()) b_cnt[b[i]] = 0;
    a_cnt[a[i]]++;
    b_cnt[b[i]]++;
    t_ureshii.insert(std::make_pair(a[i] + b[i], i));
  }


  long result = 0;
  for(int i=0; i<n; i++){
    if(i%2==0){
      //takahashi
      result += a[(*t_ureshii.rbegin()).second];
      //std::cout <<(*t_ureshii.rbegin()).first << " " << (*t_ureshii.rbegin()).second << std::endl;
      t_ureshii.erase(*t_ureshii.rbegin());
    }else{
      //aoki
      result -= b[(*t_ureshii.rbegin()).second];
      //std::cout <<(*t_ureshii.rbegin()).first << " " << (*t_ureshii.rbegin()).second << std::endl;                       
      t_ureshii.erase(*t_ureshii.rbegin());
    }
  }
  std::cout << result << std::endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: 'cin' is not a member of 'std'
    7 |   std::cin >> n;
      |        ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <set>
  +++ |+#include <iostream>
    4 | 
a.cc:9:8: error: 'vector' is not a member of 'std'
    9 |   std::vector<int> a(n), b(n);
      |        ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <set>
  +++ |+#include <vector>
    4 | 
a.cc:9:15: error: expected primary-expression before 'int'
    9 |   std::vector<int> a(n), b(n);
      |               ^~~
a.cc:13:10: error: 'cin' is not a member of 'std'
   13 |     std::cin >> a[i] >> b[i];
      |          ^~~
a.cc:13:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:17: error: 'a' was not declared in this scope
   13 |     std::cin >> a[i] >> b[i];
      |                 ^
a.cc:13:25: error: 'b' was not declared in this scope
   13 |     std::cin >> a[i] >> b[i];
      |                         ^
a.cc:26:17: error: 'a' was not declared in this scope
   26 |       result += a[(*t_ureshii.rbegin()).second];
      |                 ^
a.cc:31:17: error: 'b' was not declared in this scope
   31 |       result -= b[(*t_ureshii.rbegin()).second];
      |                 ^
a.cc:36:8: error: 'cout' is not a member of 'std'
   36 |   std::cout << result << std::endl;
      |        ^~~~
a.cc:36:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:36:31: error: 'endl' is not a member of 'std'
   36 |   std::cout << result << std::endl;
      |                               ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <set>
  +++ |+#include <ostream>
    4 |
Language: C++

#include <cmath>
#include <map>
#include <set>

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

  std::vector<int> a(n), b(n);
  std::map<int, int> a_cnt, b_cnt;
  std::set<std::pair<int, int> > t_ureshii;
  for(int i=0; i<n; i++){
    std::cin >> a[i] >> b[i];
    if(a_cnt.find(a[i]) == a_cnt.end()) a_cnt[a[i]] = 0;
    if(b_cnt.find(b[i]) == b_cnt.end()) b_cnt[b[i]] = 0;
    a_cnt[a[i]]++;
    b_cnt[b[i]]++;
    t_ureshii.insert(std::make_pair(a[i] + b[i], i));
  }


  long result = 0;
  for(int i=0; i<n; i++){
    if(i%2==0){
      //takahashi
      result += a[(*t_ureshii.rbegin()).second];
      //std::cout <<(*t_ureshii.rbegin()).first << " " << (*t_ureshii.rbegin()).second << std::endl;
      t_ureshii.erase(*t_ureshii.rbegin());
    }else{
      //aoki
      result -= b[(*t_ureshii.rbegin()).second];
      //std::cout <<(*t_ureshii.rbegin()).first << " " << (*t_ureshii.rbegin()).second << std::endl;                       t_ureshii.erase(*t_ureshii.rbegin());
    }
  }
  std::cout << result << std::endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: 'cin' is not a member of 'std'
    7 |   std::cin >> n;
      |        ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <set>
  +++ |+#include <iostream>
    4 | 
a.cc:9:8: error: 'vector' is not a member of 'std'
    9 |   std::vector<int> a(n), b(n);
      |        ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <set>
  +++ |+#include <vector>
    4 | 
a.cc:9:15: error: expected primary-expression before 'int'
    9 |   std::vector<int> a(n), b(n);
      |               ^~~
a.cc:13:10: error: 'cin' is not a member of 'std'
   13 |     std::cin >> a[i] >> b[i];
      |          ^~~
a.cc:13:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:17: error: 'a' was not declared in this scope
   13 |     std::cin >> a[i] >> b[i];
      |                 ^
a.cc:13:25: error: 'b' was not declared in this scope
   13 |     std::cin >> a[i] >> b[i];
      |                         ^
a.cc:26:17: error: 'a' was not declared in this scope
   26 |       result += a[(*t_ureshii.rbegin()).second];
      |                 ^
a.cc:31:17: error: 'b' was not declared in this scope
   31 |       result -= b[(*t_ureshii.rbegin()).second];
      |                 ^
a.cc:35:8: error: 'cout' is not a member of 'std'
   35 |   std::cout << result << std::endl;
      |        ^~~~
a.cc:35:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:35:31: error: 'endl' is not a member of 'std'
   35 |   std::cout << result << std::endl;
      |                               ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <set>
  +++ |+#include <ostream>
    4 |
Language: C++


Copy
Copy
import numpy as np
N = int(input())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i], B[i] = map(int, input().split())
 
a = np.array(A)
b = np.array(B)
 
# cはaとbの要素をすべて足したもの
c = a + b
# 降順にソート
csorted = np.sort(c)[::-1]
# bの総和
bsum = np.sum(b)
# csortedの奇数番目を足していって最後にbsumの値を引けば求まる。
csum = 0
for i in range(N):
    if i % 2 == 0:
        csum += int(csorted[i])
 
ans = csum - bsum
 
print(ans)

Compiler output:
a.cc:14:3: error: invalid preprocessing directive #c\U0000306fa\U00003068b\U0000306e\U00008981\U00007d20\U00003092\U00003059\U00003079\U00003066\U00008db3\U00003057\U0000305f\U00003082\U0000306e
   14 | # cはaとbの要素をすべて足したもの
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:16:3: error: invalid preprocessing directive #\U0000964d\U00009806\U0000306b\U000030bd\U000030fc\U000030c8
   16 | # 降順にソート
      |   ^~~~~~~~~~~~
a.cc:18:3: error: invalid preprocessing directive #b\U0000306e\U00007dcf\U0000548c
   18 | # bの総和
      |   ^~~~~~~
a.cc:20:3: error: extended character 。 is not valid in an identifier
   20 | # csortedの奇数番目を足していって最後にbsumの値を引けば求まる。
      |   ^
a.cc:20:3: error: invalid preprocessing directive #csorted\U0000306e\U00005947\U00006570\U0000756a\U000076ee\U00003092\U00008db3\U00003057\U00003066\U00003044\U00003063\U00003066\U00006700\U00005f8c\U0000306bbsum\U0000306e\U00005024\U00003092\U00005f15\U00003051\U00003070\U00006c42\U0000307e\U0000308b\U00003002
   20 | # csortedの奇数番目を足していって最後にbsumの値を引けば求まる。
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:2:1: error: 'Copy' does not name a type
    2 | Copy
      | ^~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,a,b,c[100000];
  long long ans=0
    cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a >> b;
    ans+=a;
    c[i]=a+b;
  }
  sort(c,c+n,greater<int>());
  for(int i=1; i<n; i+=2) {
    ans-=c[i];
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: expected ',' or ';' before 'cin'
    8 |     cin >> n;
      |     ^~~
Language: C++

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<int, pii> pipii;

bool piisort(pii a, pii b) {
  return a.first - b.second > b.first - a.second;
}

void solve() {
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> l[i].first >> l[i].second;
  }
  sort(l, l+n, piisort);
  ll ret = 0;
  for(int i = 0; i < n; i++) {
    if(i%2) ret -= l[i].second;
    else ret += l[i].first;
  }
  cout << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:28:12: error: 'l' was not declared in this scope
   28 |     cin >> l[i].first >> l[i].second;
      |            ^
a.cc:30:8: error: 'l' was not declared in this scope
   30 |   sort(l, l+n, piisort);
      |        ^
Language: C++

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<int, pii> pipii;

bool piiasort(pii a, pii b) {
  return a.first - b.second > b.first - a.second;
}

void solve() {
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> l[i].first >> l[i].second;
  }
  sort(l, l+n, piisort);
  ll ret = 0;
  for(int i = 0; i < n; i++) {
    if(i%2) ret -= l[i].second;
    else ret += l[i].first;
  }
  cout << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:28:12: error: 'l' was not declared in this scope
   28 |     cin >> l[i].first >> l[i].second;
      |            ^
a.cc:30:8: error: 'l' was not declared in this scope
   30 |   sort(l, l+n, piisort);
      |        ^
a.cc:30:16: error: 'piisort' was not declared in this scope; did you mean 'piiasort'?
   30 |   sort(l, l+n, piisort);
      |                ^~~~~~~
      |                piiasort
Language: C++

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

vector<long long> R;
long long ans, sa, sb;
int n;

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long a, b;
  	cin >> a >> b; 
    R.push_back(a + b);
    sa += a, sb += b;
  }
  sort(R.begin(), R.end());
  for (int i = 0; i < n; i++) {
  	if (i % 2 == 0)
      ans += R[i];
    else
      ans -= R[i];
  }
  cout << (ans + a - b) / 2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:18: error: 'a' was not declared in this scope; did you mean 'sa'?
   25 |   cout << (ans + a - b) / 2;
      |                  ^
      |                  sa
a.cc:25:22: error: 'b' was not declared in this scope; did you mean 'sb'?
   25 |   cout << (ans + a - b) / 2;
      |                      ^
      |                      sb
Language: C++

#include <bits/stdc++.h>
#define ff first
#define ss second

using namespace std ;

long double PI = 3.14159265 ;
const int N = 2e6 + 1000 ;
long long int ans , ans1 , ans2 , ans3 ;
long long int n , m , h ;
long long int a[N] ;
long long int b[N] ;
long long int c[n] ;
string s , t ;

int main (){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin >> n ;
	for(int i = 0 ; i < n ; i++){
		cin >> a[i] >> b[i] ;
		c[i] = a[i] - b[i] ;
	}
	sort(c,c+n) ;
	for(int i = 0; i < n / 2 ; i++){
		ans -= c[i] ;
	}
	for(int i = n / 2 ; i < n ; i++){
		ans += c[i] ;
	}
	cout << ans;
 	return 0 ;
}
	

Compiler output:
a.cc:13:17: error: size of array 'c' is not an integral constant-expression
   13 | long long int c[n] ;
      |                 ^
Language: C

#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    scanf("%d", &N);
    int SUM[N];
    int TAK, AOK;
    long long answer=0, sumAOK=0;
    int i;

    
    for(i=0; i<N; i++){
        scanf("%d %d", &TAK, &AOK);
        SUM[i] = TAK + AOK;
        sumAOK += AOK;
    }
    sort(SUM, SUM+N, greater<int>());
    for(i=0; i<N; i++){
        if(i%2==0){
            answer += SUM[i];
        }
    }
    answer -= sumAOK;
    printf("%lld", answer);
    return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <stdlib.h>
#include <stdio.h>
int compare(const void *a,const void *b){
    if(*(int *)a> *(int *)breturn -1;
    return 1;
}
int main()
{   int n;
    scanf("%d",&n);
    int a[n],b[n],c[n];
    long long takahashi=0,aoki=0;
    for(int i=0;i<n;i++){
        scanf("%d%d",&a[i],&b[i]);
        c[i]=a[i]+b[i];
        aoki+=b[i];
    }
    qsort(c,n,sizeof(int),compare);
    for(int i=0;i<n;i++){
        if(i%2==0){
            takahashi+=c[i];
        }
    }
    printf("%lld",takahashi-aoki);
    return 0;
}


Compiler output:
main.c: In function 'compare':
main.c:4:27: error: 'breturn' undeclared (first use in this function)
    4 |     if(*(int *)a> *(int *)breturn -1;
      |                           ^~~~~~~
main.c:4:27: note: each undeclared identifier is reported only once for each function it appears in
main.c:4:37: error: expected ')' before ';' token
    4 |     if(*(int *)a> *(int *)breturn -1;
      |       ~                             ^
      |                                     )
main.c:6:1: error: expected expression before '}' token
    6 | }
      | ^
Language: C

#include <stdlib.h>
#include <stdio.h>
int compare(const void *a,const void *b){
    if(*(int *)a>*(int *b)return -1;
    return 1;
}
int main()
{   int n;
    scanf("%d",&n);
    int a[n],b[n],c[n];
    long long takahashi=0,aoki=0;
    for(int i=0;i<n;i++){
        scanf("%d%d",&a[i],&b[i]);
        c[i]=a[i]+b[i];
        aoki+=b[i];
    }
    qsort(c,n,sizeof(int),compare);
    for(int i=0;i<n;i++){
        if(i%2==0){
            takahashi+=c[i];
        }
    }
    printf("%lld",takahashi-aoki);
    return 0;
}


Compiler output:
main.c: In function 'compare':
main.c:4:25: error: expected ')' before 'b'
    4 |     if(*(int *)a>*(int *b)return -1;
      |                   ~     ^
      |                         )
main.c:4:27: error: expected expression before 'return'
    4 |     if(*(int *)a>*(int *b)return -1;
      |                           ^~~~~~
main.c:6:1: error: expected expression before '}' token
    6 | }
      | ^
Language: C++

#include<iostream>
#include<stdint>
#include<algorithm>
using namespace std; // 575

const int MAX = 100000;
int main() {
	int N, A, B;
	static int p[MAX];
	int64_t ans = 0;
	cin >> N;
	for (int i = 0;i < N;++ i) {
		cin >> A >> B;
		p[i] = -(A + B);
		ans -= B;
	}
	sort(p, p+N);
	for (int i = 0;i < N;i += 2) ans -= p[i];
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

*/

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

#include<iostream>
#include<stdint>
#include<algorithm>
using namespace std; // 575

const int MAX = 100000;
int main() {
	int N, A, B;
	static int p[MAX];
	int64_t ans = 0;
	cin >> N;
	for (int i = 0;i < N;++ i) {
		cin >> A >> B;
		p[i] = A + B;
		ans -= B;
	}
	sort(p, p+N);
	for (int i = 0;i < N;i += 2) ans += p[i];
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

*/

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

#include <stdio.h>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long int int;
#define F first
#define S second
const int N=1e5+10;
int main(){
int n;
  long long int ans=0;
  bool f=true;
  pair<int,int> a[N];
  scanf("%d",&n);
  for(int i=0;i<n;i++){scanf("%d%d",&a[i].F,&a[i].S);
                      a[i].F+=a[i].S;}
  sort(a,a+n);
  for(int i=n-1;i>=0;i--){
    if(f){
    ans+=a[i].F-a[i].S;
    }
    else ans-=a[i].S;
    f=!f;
  }
  printf("%lld\n",ans);
}

Compiler output:
a.cc:5:19: error: multiple types in one declaration
    5 | typedef long long int int;
      |                   ^~~
a.cc:5:23: error: declaration does not declare anything [-fpermissive]
    5 | typedef long long int int;
      |                       ^~~
Language: C++

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

int nextInt();

int N, i;
int A, B, C[100000];
long long int a, b;

int main(){
	N=nextInt();
	for(i=0; i<N; i++){
		A=nextInt();
		B=nextInt();
		C[i] = A + B;
		b += B;
	}
	std::sort(C, C+N, CompareInt());
	for(i=0; i<N; i+=2){
		a += C[i];
	}
	printf("%lld\n", a-b);
	return 0;
}

int nextInt(){
	int f=0; char c=getchar();
	while((c<'0')||('9'<c)){c=getchar();}
	while((c>='0')&&(c<='9')){f=f*10+(c-'0'); c=getchar();}
	return f;
}
class CompareInt{
public:
  bool operator()(const int& a, const int& b) const{
    return a > b;
  }
};

Compiler output:
a.cc: In function 'int main()':
a.cc:18:27: error: 'CompareInt' was not declared in this scope
   18 |         std::sort(C, C+N, CompareInt());
      |                           ^~~~~~~~~~
Language: C++

#include<stdio.h>

int nextInt();

int N, i;
int A, B, C[100000];
long long int a, b;

int main(){
	N=nextInt();
	for(i=0; i<N; i++){
		A=nextInt();
		B=nextInt();
		C[i] = A + B;
		b += B;
	}
	std::sort(C, C + N, [&] (const int &a, const int &b){
        return a > b;
    });
	for(i=0; i<N; i+=2){
		a += C[i];
	}
	printf("%lld\n", a-b);
	return 0;
}

int nextInt(){
	int f=0; char c=getchar();
	while((c<'0')||('9'<c)){c=getchar();}
	while((c>='0')&&(c<='9')){f=f*10+(c-'0'); c=getchar();}
	return f;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: 'sort' is not a member of 'std'
   17 |         std::sort(C, C + N, [&] (const int &a, const int &b){
      |              ^~~~
Language: C++

#include<bits/stdc++.h>
#define pb push_back
#define int ll
using namespace std;
typedef long long ll;
int32_t main(){
	int n;
  cin >> n;
    vector<pair<int,int> > v;
  for (int i = 0;i < n;i++){
  	int a,b;
    cin >> a >> b;
    v.pb({a+b,b});
  }
  sort(v.rbegin(),v.rend());
	int s1 = 0,s2=  0;
  for (int i = 0;i < n;i++){
  	if (i %2)s2 += v[i].S;
    else s1 += v[i].F - v[i].S;
  }
  cout << s1 - s2 << endl;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:18:29: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'S'
   18 |         if (i %2)s2 += v[i].S;
      |                             ^
a.cc:19:21: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'F'
   19 |     else s1 += v[i].F - v[i].S;
      |                     ^
a.cc:19:30: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'S'
   19 |     else s1 += v[i].F - v[i].S;
      |                              ^
Language: C++

#include<bits/stdc++.h>
#define pb push_back
#define int ll
using namespace std;

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


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:3:13: error: 'll' was not declared in this scope
    3 | #define int ll
      |             ^~
a.cc:7:9: note: in expansion of macro 'int'
    7 |         int n;
      |         ^~~
a.cc:8:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    8 |   cin >> n;
      |          ^
      |          yn
a.cc:9:15: error: template argument 2 is invalid
    9 |     vector<int> v;
      |               ^
a.cc:10:12: error: expected ';' before 'i'
   10 |   for (int i = 0;i < n;i++){
      |            ^
a.cc:10:18: error: 'i' was not declared in this scope
   10 |   for (int i = 0;i < n;i++){
      |                  ^
a.cc:11:13: error: expected ';' before 'a'
   11 |         int a,b;
      |             ^
a.cc:12:12: error: 'a' was not declared in this scope
   12 |     cin >> a >> b;
      |            ^
a.cc:12:17: error: 'b' was not declared in this scope
   12 |     cin >> a >> b;
      |                 ^
a.cc:2:12: error: request for member 'push_back' in 'v', which is of non-class type 'int'
    2 | #define pb push_back
      |            ^~~~~~~~~
a.cc:13:7: note: in expansion of macro 'pb'
   13 |     v.pb(a + b);
      |       ^~
a.cc:15:10: error: request for member 'begin' in 'v', which is of non-class type 'int'
   15 |   sort(v.begin(),v.end());
      |          ^~~~~
a.cc:15:20: error: request for member 'end' in 'v', which is of non-class type 'int'
   15 |   sort(v.begin(),v.end());
      |                    ^~~
a.cc:16:13: error: expected ';' before 's1'
   16 |         int s1 = 0,s2=  0;
      |             ^~
a.cc:17:12: error: expected ';' before 'i'
   17 |   for (int i = 0;i < n;i++){
      |            ^
a.cc:17:18: error: 'i' was not declared in this scope
   17 |   for (int i = 0;i < n;i++){
      |                  ^
a.cc:18:18: error: 's2' was not declared in this scope
   18 |         if (i %2)s2 += v[i];
      |                  ^~
a.cc:19:10: error: 's1' was not declared in this scope; did you mean 'y1'?
   19 |     else s1 += v[i];
      |          ^~
      |          y1
a.cc:21:11: error: 's1' was not declared in this scope; did you mean 'y1'?
   21 |   cout << s1 - s2 << endl;
      |           ^~
      |           y1
a.cc:21:16: error: 's2' was not declared in this scope
   21 |   cout << s1 - s2 << endl;
      |                ^~
Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> as;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    as.emplace_back(a + b, a);
  }
  sort(as.rbegin(), as.rend());
  long long ans = 0;
  for (int i = 0; i < n; i += 2) {
    ans += as[i].second;
  }
  cout << ans << endl;
}

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

#include<iostream>
2.#include<algorithm>
3.#include<functional>
4.#include<cstdint>
5.#include <bits/stdc++.h>
6.using namespace std;
7. 
8.int main() {
9.	int N;
10.	cin >> N;
11.	vector <int> A(N), B(N), C(N);
12.	long long int sum_T, sum_A, sum;
13.	sum = 0;
14.	sum_T = 0;
15.	sum_A = 0;
16.	for (int i=0; i<N; i++){
17.		cin >> A.at(i) >> B.at(i); //数字の読み込み
18.		C.at(i)=A.at(i)-B.at(i);
19.	}
20.	pair <int, int> D[N];
21.	pair <int, int> E[N];
22.	for (int i=0; i<N; i++){
23.		D[i].first = C[i];
24.		E[i].first = C[i];
25.		D[i].second = A[i];
26.		E[i].second = B[i];
27.	}
28.	sort(D, D+N, greater<pair<int, int> >());
29.	sort(E, E+N, greater<pair<int, int> >());
30.	for (int i=0; i<N; i++){
31.		if (i%2==0){
32.			sum_T += D[i].second;
33.		}
34.		if (i%2==1){
35.			sum_A += E[i].second;
36.		}
37. 
38.		
39.	}
40.	sum = sum_T - sum_A;
41.	cout << sum << endl;
42.	
43.	return 0;
44.}

#include<iostream>
#include<algorithm>
#include<functional>
#include<cstdint>
#include <bits/stdc++.h>
using namespace std;

int main() {
	int N;
	cin >> N;
	vector <int> A(N), B(N), C(N);
	long long int sum_T, sum_A, sum;
	sum = 0;
	sum_T = 0;
	sum_A = 0;
	for (int i=0; i<N; i++){
		cin >> A.at(i) >> B.at(i); //数字の読み込み
		C.at(i)=A.at(i)+B.at(i);
	}
	pair <int, int> D[N];
	pair <int, int> E[N];
	for (int i=0; i<N; i++){
		D[i].first = C[i];
		E[i].first = C[i];
		D[i].second = A[i];
		E[i].second = B[i];
	}
	sort(D, D+N, greater<pair<int, int> >());
	sort(E, E+N, greater<pair<int, int> >());
	for (int i=0; i<N; i++){
		if (i%2==0){
			sum_T += D[i].second;
		}
		if (i%2==1){
			sum_A += E[i].second;
		}

		
	}
	sum = sum_T - sum_A;
	cout << sum << endl;
	
	return 0;
}



Compiler output:
a.cc:2:3: error: stray '#' in program
    2 | 2.#include<algorithm>
      |   ^
a.cc:3:3: error: stray '#' in program
    3 | 3.#include<functional>
      |   ^
a.cc:4:3: error: stray '#' in program
    4 | 4.#include<cstdint>
      |   ^
a.cc:5:3: error: stray '#' in program
    5 | 5.#include <bits/stdc++.h>
      |   ^
a.cc:2:1: error: expected unqualified-id before numeric constant
    2 | 2.#include<algorithm>
      | ^~
a.cc:7:1: error: expected unqualified-id before numeric constant
    7 | 7.
      | ^~
Language: C++

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

typedef long long ll;

int main() {
	int n;
	cin >> n;
	vector<pair<ll, ll>> vp;
	for (int i = 0; i < n; i++) {
		ll a, b;
		cin >> a >> b;
		vp.emplace_back(a + b, a);
	}
	sort(vp.rbegin(), vp.rend());
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) ans += vp[i].second;
		else ans -= vp[i].first -vp[i].second;
	}
	cout << ans;
	
	return 0;
}

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

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

typedef long long ll;

int main() {
	int n;
	cin >> n;
	vector<pair<ll, ll>> vp;
	for (int i = 0; i < n; i++) {
		ll a, b;
		cin >> a >> b;
		vp.emplace_back(a + b, a);
	}
	sort(vp.rbegin(), vp.rend());
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) ans += vp[i].second;
		else ans -= vp[i].first -vp[i].second;
	}
	cout << ans;
	
	return 0;
}


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

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

const int maxn = 1e5+5;
int n;
int a[maxn], b[maxn];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> n;
    ll ans = 0;
    vector<pair<int,int>> as;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        ans -= b[i];
        as.push_back({a[i],b[i]});
    }
    sort(as.begin(),as.end(),[](auto x, auto y) { return x.first + x.second > y.first + y.second; });
    for (int i = 0; i < n; i += 2) {
        ans += as[i].first + as[i].second;
    }
    cout << ans << '\n';

    return 0;
}

~


Compiler output:
a.cc:29:2: error: expected class-name at end of input
   29 | ~
      |  ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;
int main() {
    int N;
    cin >> N;

    long A, B;
    vector<vector<long>> values;
    for(int i = 0; i < N; i++){
        cin >> A >> B;
        values.push_back({A+B, A, B});
    }

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

    int p = 1;
    long tTotal = 0;
    long aTotal = 0;
    for(int i = 0 ; i < N; i ++){
        if(p == 1){
            tTotal += values[i][1];
        }
        else{
            aTotal += values[i][2];
        }
        p *= -1;
    }

    cout << tTotal - aTotal;

    return 0;
}

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

#include <iostream>
#include <vector>

using namespace std;
bool temp(vector<long> a, vector<long> b){ return a[0] > b[0]; };
int main() {
    int N;
    cin >> N;

    long A, B;
    vector<vector<long>> values;
    for(int i = 0; i < N; i++){
        cin >> A >> B;
        values.push_back({A+B, A, B});
    }

    std::sort(values.begin(), values.end(), &temp);

    int p = 1;
    long tTotal = 0;
    long aTotal = 0;
    for(int i = 0 ; i < N; i ++){
        if(p == 1){
            tTotal += values[i][1];
        }
        else{
            aTotal += values[i][2];
        }
        p *= -1;
    }

    cout << tTotal - aTotal;

    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(values.begin(), values.end(), &temp);
      |          ^~~~
      |          qsort
Language: C++

#include <iostream>
#include <vector>

using namespace std;
int main() {
    int N;
    cin >> N;

    long A, B;
    vector<vector<long>> values;
    for(int i = 0; i < N; i++){
        cin >> A >> B;
        values.push_back({A+B, A, B});
    }

    std::sort(values.begin(), values.end(), [](vector<long> a, vector<long> b){return a[0] > b[0]; });

    int p = 1;
    long tTotal = 0;
    long aTotal = 0;
    for(int i = 0 ; i < N; i ++){
        if(p == 1){
            tTotal += values[i][1];
        }
        else{
            aTotal += values[i][2];
        }
        p *= -1;
    }

    cout << tTotal - aTotal;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   16 |     std::sort(values.begin(), values.end(), [](vector<long> a, vector<long> b){return a[0] > b[0]; });
      |          ^~~~
      |          qsort
Language: C++

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

signed main(){
    int n; cin >> n;
    using pii = pair<int,int>;
    vector<pii>v,u;
    for(int i = 0; i < n;i++){
        pii t; cin >> t.first >> t.second;
        u.push_back(t);
        v.push_back(pii(t.first + t.second,i));
    }
    sort(v.begin(),v.end(),greater<>());
    int ans = 0;
    for(int i = 0;i < n;i++){
        if(i % 2 == 0) ans += u[v[i].second].first;
        else ans -= u[v[i].second].second;
    }
    cout << ans << endl;
}


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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<tuple<long long int,long long int,long long int> > ab;
  int a,b;
  for(int i=0; i<n; i++){
    cin >> a >> b;
    ab.emplace_back(a+b,a,b);
  }
  sort(ab.begin(),ab.end());
  reverse(ab.begin(),ab.end());
  bool t = true;
  long long int a=0,b=0;
  for(int i=0; i<n; i++){
    if(t){
      a += get<1>(ab[i]);
    }
    else{
      b += get<2>(ab[i]);
    }
    t = !t;
  }
  cout << a-b << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: conflicting declaration 'long long int a'
   15 |   long long int a=0,b=0;
      |                 ^
a.cc:7:7: note: previous declaration as 'int a'
    7 |   int a,b;
      |       ^
a.cc:15:21: error: conflicting declaration 'long long int b'
   15 |   long long int a=0,b=0;
      |                     ^
a.cc:7:9: note: previous declaration as 'int b'
    7 |   int a,b;
      |         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
vector<ll> vec;



int main()
{
    ll a, b;
    int n;
    cin >> n;
    ll ans = 0LL;
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
        ans -= b[i];
        vec.push_back(a + b);
    }
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());
    for(int i = 0; i < n; i++){
        if (i % 2 == 1){
            continue;
        } else {
            ans += vec[i];
        }
    }
    cout << ans;
    return 0;
}


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

#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  int N;
  vector<int> A, B;
  vector<pair<int, int>> pairs(N);
  ll result = 0;
  cin >> N;
  rep(i, N) {
    cout << i << endl;
    int a, b, c;
    cin >> a >> b;
    c = a + b;
    A.push_back(a);
    B.push_back(b);
    pairs.push_back(make_pair(c, i));
  }

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

  rep(i, N) {
    if (i % 2 == 0) {
      // turn for A
      result += A[pairs[i].second];
      // cout << "turn A"
      //      << " index:" << pairs[i].second << " value" << A[pairs[i].second]
      //      << endl;
    } else {
      // turn for B
      result -= B[pairs[i].second];
    // cout << "turn B"
    //      << " index:" << pairs[i].second << " value" << B[pairs[i].second]


Compiler output:
a.cc: In function 'int main()':
a.cc:51:36: error: expected '}' at end of input
   51 |       result -= B[pairs[i].second];
      |                                    ^
a.cc:49:12: note: to match this '{'
   49 |     } else {
      |            ^
a.cc:51:36: error: expected '}' at end of input
   51 |       result -= B[pairs[i].second];
      |                                    ^
a.cc:42:13: note: to match this '{'
   42 |   rep(i, N) {
      |             ^
a.cc:51:36: error: expected '}' at end of input
   51 |       result -= B[pairs[i].second];
      |                                    ^
a.cc:24:12: note: to match this '{'
   24 | int main() {
      |            ^
Language: C++

#include<iostream>
using namespace std;

int main(void){
    int N;
    cin>>N;
    long long A[N+1],B[N+1];
    pair<int,int> C[N+1];
    long long T;
    T=0;
    for(int i=1;i<=N;i++){
        cin>>A[i]>>B[i];
        C[i] = make_pair(A[i] + B[i],i);
    }

    sort(C+1, C+N+1);
    reverse(C+1,C+N+1);



    for(int i=1;i<N+1;i++){
        if(i%2==1){
            T=T+A[C[i].second];
        }else{
            T=T-B[C[i].second];
        }



        
    }

    cout<<T<<endl;


    return 0;
}

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

#include <iostream>
#include <vector>

using namespace std;
int main() {
    int N;
    cin >> N;

    long A, B;
    vector<vector<long>> values;
    for(int i = 0; i < N; i++){
        cin >> A >> B;
        values.push_back({A+B, A, B});
    }

    sort(values.begin(), values.end(), [](vector<long> a, vector<long> b){return a[0] > b[0]; });

    int p = 1;
    long tTotal = 0;
    long aTotal = 0;
    for(int i = 0 ; i < N; i ++){
        if(p == 1){
            tTotal += values[i][1];
        }
        else{
            aTotal += values[i][2];
        }
        p *= -1;
    }

    cout << tTotal - aTotal;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |     sort(values.begin(), values.end(), [](vector<long> a, vector<long> b){return a[0] > b[0]; });
      |     ^~~~
      |     short