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

#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N;cin>>N;
  vector<ll> a(3*N);
  ll i,j,k;
  rep(i,3*N){
    cin>>a[i];
  }
  ll ans = 0;
  rep(i,N) ans += a[i];
  for(i=2*N;i<3*N;i++) ans -= a[i];
  // cout<<ans<<endl;

  vector<ll> b(N),c(N);
  //bに関して
  rep(i,N){
    b[i] = a[i];
  }
  sort(b.begin(),b.end());
  rep(i,N){
    b[i] = a[i+N] - b[i];
    if(b[i]<0) b[i] = 0;
  }
  //cに関して
  for(i=2*N;i<3*N;i++){
    c[i-2*N] = a[i];
  }
  sort(c.begin(),c.end(),greater<ll>());

  //O(n^2)の解法
  if(N>1000) return -1:
  ans = -INF;
  vector<ll> pre,aft;
  for(i=N;i<=2*N;i++){
    pre.clear();aft.clear();
    ll tmp = 0;
    rep(j,i){
      pre.pb(a[j]);
    }
    for(j=i;j<3*N;j++){
      aft.pb(a[j]);
    }
    SORT(pre);
    SORT(aft);
    ll x = pre.size();
    ll y = aft.size();
    for(j=x-1;j>=x-N;j--){
      tmp += pre[j];
    }
    rep(j,N){
      tmp -= aft[j];
    }
    // cout<<tmp<<endl;
    ans = max(ans,tmp);
  }
  cout<<ans<<endl;

  //O(nlogn)の解法





}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:23: error: expected ';' before ':' token
   61 |   if(N>1000) return -1:
      |                       ^
      |                       ;
a.cc:61:23: error: expected primary-expression before ':' token
Language: C++

#include <array>
#include <cstddef>
#include <cstdint>
#include <vector>

using usize = std::size_t;
using u64 = long long;

struct foldable_wavelet_matrix {
	static constexpr usize BitLen = static_cast<usize>(4);

	struct bitvector {
		struct node_type {
			usize count;
			u64 sum;
		};

		std::vector<node_type> vector;

		bitvector() : vector() {}

		void resize(const usize size) { vector.resize(size+1); }
		void set(const usize index) { vector[index+1].count = static_cast<usize>(1); }
		void build(const std::vector<u64> &a) {
			const usize size = a.size();
			for (usize i = static_cast<usize>(0); i != size; ++i) {
				vector[i + static_cast<usize>(1)].count += vector[i].count;
				vector[i + static_cast<usize>(1)].sum = vector[i].sum + a[i];
			}
		}

		usize count(const usize index) const { return vector[index].count; }
		usize zeros() const { return vector.size()-1 - vector.back().count; }
		u64 fold(const usize first, const usize last) const {
			return vector[last].sum - vector[first].sum;
		}
	};

	std::array<bitvector, BitLen> matrix;

	explicit foldable_wavelet_matrix(std::vector<u64> a) {
		const usize size = a.size();
		std::vector<u64> b(size);
		usize bitpos = BitLen;
		while (bitpos != static_cast<usize>(0)) {
			--bitpos;
			bitvector &v = matrix[bitpos];
			v.resize(size);
			auto zero_itr = b.begin(), one_itr = b.end();
			for (usize i = static_cast<usize>(0); i != size; ++i) {
				if ((a[i] >> bitpos & static_cast<u64>(1)) == static_cast<u64>(1)) {
					v.set(i);
					--one_itr;
					*one_itr = a[i];
				}
				else {
					*zero_itr = a[i];
					++zero_itr;
				}
			}
			std::reverse(one_itr, b.end());
			v.build(b);
			std::swap(a, b);
		}
	}

	u64 fold_topk(usize first, usize last, usize k) const {
		u64 ret = static_cast<u64>(0);
		usize bitpos = BitLen;
		while (bitpos != static_cast<usize>(0)) {
			--bitpos;
			const bitvector &v = matrix[bitpos];
			const usize f_cnt = v.count(first), l_cnt = v.count(last),
				zeros = v.zeros();
			if (k < l_cnt - f_cnt) {
				first = zeros + f_cnt;
				last = zeros + l_cnt;
			}
			else {
				k -= l_cnt - f_cnt;
				ret += v.fold(zeros + f_cnt, zeros + l_cnt);
				first -= f_cnt;
				last -= l_cnt;
			}
		}
		return ret + matrix.front().fold(last - k, last);
	}
};

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

int main() {

	usize n;
	std::cin >> n;
	std::vector<u64> a(3*n );
	for (auto &e : a) {
		std::cin >> e;
	}
	foldable_wavelet_matrix fwm(a);

	u64 max = -1000000000LL * 100000LL;
	for (int i = n;i <= 2 * n;++i) {
		max = std::max(max,
			fwm.fold_topk(0, i, n) 
			- (fwm.fold_topk(i, 3 * n, 3 * n - i) 
				- fwm.fold_topk(i, 3 * n, 3 * n - i - n)));
	}
	std::cout << max << std::endl;

	return 0;
}


Compiler output:
a.cc: In constructor 'foldable_wavelet_matrix::foldable_wavelet_matrix(std::vector<long long int>)':
a.cc:61:30: error: 'reverse' is not a member of 'std'
   61 |                         std::reverse(one_itr, b.end());
      |                              ^~~~~~~
Language: Java

import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int m = n * 3;
        long[] a = new long[m];
        for (int i = 0; i < m; i++) {
            a[i] = scanner.nextInt();
        }
        PriorityQueue<Long> queue = new PriorityQueue<>();
        long[] max = new long[n + 1];
        long sum = 0;
        for (int i = 0; i < m; i++) {
            queue.add(a[i]);
            if (i >= n && i <= n * 2) {
                max[i - n] = sum;
                sum -= queue.poll();
            }
            sum += a[i];
        }

        queue = new PriorityQueue<>(Comparator.reverseOrder());
        long[] min = new long[n + 1];
        sum = 0;
        for (int i = m; i > 0; i--) {
            queue.add(a[i - 1]);
            Utils.println(i, sum, queue);
            if (i >= n && i <= n * 2) {
                min[i - n] = sum;
                sum -= queue.poll();
            }
            sum += a[i - 1];
        }
        long ans = Integer.MIN_VALUE;
        for (int i = 0; i <= n; i++) {
            ans = Math.max(ans, max[i] - min[i]);
        }
        System.out.println(ans);
    }
}

Compiler output:
Main.java:30: error: cannot find symbol
            Utils.println(i, sum, queue);
            ^
  symbol:   variable Utils
  location: class Main
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf (int)1e16
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
int n;
int a[114514 * 3];
vector<int>ansl, ansr;
priority_queue<int, vector<int>, greater<int>())l;
priority_queue<int>r;
int suml = 0, sumr = 0;
int ans = -inf;
signed main() {
	cin >> n;
	rep(i, n * 3) {
		cin >> a[i];
		if (i < n) {
			l.push(a[i]);
			suml += a[i];

		}
		else if (2 * n <= i) {
			r.push(a[i]);
			sumr += a[i];
		}
	}
	ansl.push_back(suml);
	for (int i = n; i < 2 * n; i++) {
		l.push(a[i]);
		suml += a[i];
		suml -= l.top();
		l.pop();
		ansl.push_back(suml);
	}
	ansr.push_back(sumr);
	for (int i = 2 * n - 1; i >= n; i--) {
		r.push(a[i]);
		sumr += a[i];
		sumr -= r.top();
		r.pop();
		ansr.push_back(sumr);
	}
	reverse(ansr.begin(), ansr.end());
	for (int i = n; i < 2 * n; i++) {
		ans = max(ans, ansl[i - n] - ansr[i - n]);
	}
	cout << ans << endl;
}

Compiler output:
a.cc:9:47: error: type/value mismatch at argument 3 in template parameter list for 'template<class _Tp, class _Sequence, class _Compare> class std::priority_queue'
    9 | priority_queue<int, vector<int>, greater<int>())l;
      |                                               ^
a.cc:9:47: note:   expected a type, got 'std::greater<long long int>{std::binary_function<long long int, long long int, bool>()}'
a.cc:9:48: error: expected unqualified-id before ')' token
    9 | priority_queue<int, vector<int>, greater<int>())l;
      |                                                ^
a.cc: In function 'int main()':
a.cc:18:25: error: 'l' was not declared in this scope
   18 |                         l.push(a[i]);
      |                         ^
a.cc:29:17: error: 'l' was not declared in this scope
   29 |                 l.push(a[i]);
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
#include <iomanip>
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;

void print(const std::vector<long long> &v) {
    std::for_each(v.begin(), v.end(),
                  [](long long x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N;
    cin >> N;
    vector<long long> a(3 * N);
    REP(i, 3 * N) cin >> a[i];
    vector<long long> S(N * 2 + 1, 0);
    priority_queue<long long, vector<long long>, greater<long long>> que1;
    for(int i = 0; i < N; i++) { //はじめにN個で初期化計算
        S[i + 1] = S[i] + a[i];  //累積和
        que1.push(a[i]);
    }
    for(int i = N; i < N * 2; i++) {
        long long mi = que.top();
        if(a[i] > mi) {
            S[i + 1] = S[i] + a[i] - mi;
            que1.pop();
            que1.push(a[i]);
        } else
            S[i + 1] = S[i];
    }

    vector<long long> T(N * 2 + 1, 0);
    prioroity_queue<long long> que2;
    //初期化処理
    for(int i = 0; i < N; i++) {
        T[i + 1] = T[i] + a[N * 3 - 1 - i];
        que2.pop();
        que2.push(a[N * 3 - 1 - i]);
    }
    for(int i = N; i < N * 2; ++i) {
        long long ma = que2.top();
        if(a[N * 3 - 1 - i] < ma) {
            T[i + 1] = T[i] - ma + a[N * 3 - 1 - i];
            que2.pop();
            que2.push(a[N * 3 - 1 - i]);
        } else
            T[i + 1] = T[i];
    }
    long long res = -INF;
    for(int i = N; i <= N * 2; i++) {
        res = max(res, S[i] - T[N * 3 - i]);
    }
    cout << res << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:24: error: 'que' was not declared in this scope; did you mean 'que1'?
   46 |         long long mi = que.top();
      |                        ^~~
      |                        que1
a.cc:56:5: error: 'prioroity_queue' was not declared in this scope
   56 |     prioroity_queue<long long> que2;
      |     ^~~~~~~~~~~~~~~
a.cc:56:21: error: expected primary-expression before 'long'
   56 |     prioroity_queue<long long> que2;
      |                     ^~~~
a.cc:60:9: error: 'que2' was not declared in this scope; did you mean 'que1'?
   60 |         que2.pop();
      |         ^~~~
      |         que1
a.cc:64:24: error: 'que2' was not declared in this scope; did you mean 'que1'?
   64 |         long long ma = que2.top();
      |                        ^~~~
      |                        que1
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
int n,a[333333],sum,c[333333],d[333333],ans=-1e15;
priority_queue<int,vector<int>,greater<int>>q;
priority_queue<int,vector<int>>Q;
signed main(){
	cin>>n;
	rep(i,3*n)cin>>a[i];
	rep(i,n){
		q.push(a[i]);
		sum+=a[i];
	}
	c[n-1]=sum;
	for(int i=n;i<2*n;i++){
		int p=q.top();
		if(p<a[i]){
			q.pop();
			q.push(a[i]);
			sum+=a[i]-p;
		}
		c[i]=sum;
	}
	sum=0;
	for(int i=3*n-1;i>=2*n;i--){
		Q.push(a[i]);
		sum+=a[i];
	}
	d[2*n-1]=sum;
	for(int i=2*n-1;i>=n;i--){
		int p=Q.top();
		if(p>a[i]){
			Q.pop();
			Q.push(a[i]);
			sum+=a[i]-p;
		}
		d[i]=sum;
	}
	for(int i=n;i<2*n;i++){ans=max(ans,c[i-1]-d[i]);
	cout<<ans<<endl;
	return 0;
}


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

#include <iostream>
#include <queue>
#include <vector>
#include <list>

using namespace std;

int a[300000];
int main()
{
	int N;
	priority_queue<int, vector<int>, greater<int>> pf, cf;
	priority_queue<int> ps, cs;  
	int sum_f, sum_s;
	queue<int> dif_f;
	vector<int> dif_s;
	long long int max;
	sum_f = sum_s = 0;
	max = - (long long int)pow(10, 9);
	

	cin >> N;

	for (int i = 0; i < N * 3; i++)
	{
		cin >> a[i];
		if (i < N)
		{
			pf.push(a[i]);
			sum_f += a[i];
		}
		else if(2 * N <= i)
		{
			ps.push(a[i]);
			sum_s += a[i];
		}
	}

	for (int i = N; i <= 2 * N; i++)
	{
		dif_f.push(sum_f);
		pf.push(a[i]);
		sum_f += a[i];
		sum_f -= pf.top();
		pf.pop();
	}

	for (int i = 2 * N - 1; i >= N - 1; i--)
	{
		dif_s.push_back(sum_s);
		ps.push(a[i]);
		sum_s += a[i];
		sum_s -= ps.top();
		ps.pop();
	}

	for (int i = 0; i < (int)dif_f.size(); i++)
	{
		if (max < dif_f.front() - dif_s.back())
			max = dif_f.front() - dif_s.back();
		dif_f.pop();
		dif_s.pop_back();
	}

	cout << max << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:32: error: 'pow' was not declared in this scope
   19 |         max = - (long long int)pow(10, 9);
      |                                ^~~
Language: C++

#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(void)
{
  LL n;
  vector<LL> a(n*3);
  for(auto &x:a) cin >> x;
  vector<LL> l(n+2),r(n+2);
  priority_queue<LL> lp,rp;
  REP(i,n) {
    l[0]+=x[i];
    lp.push(-x[i]);
    r[n+1]+=x[i+n*2];
    rp.push(x[i]);
  }
  REP(i,n+1) {
    lp.push(-x[n+i]);
    l[i+n]=l[i+n-1]+x[n+i]+lp.top();
    lp.pop();
    rp.push(x[n*2-i-1]);
    r[n-i]=r[n-i+1]+x[n*2-i-1]-rp.top();
    rp.pop();
  }
  LL answer=l[0]-r[0];
  REP(i,n+2) {
    answer=max(answer,l[i]-r[i]);
  }
  cout << answer << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:11: error: 'x' was not declared in this scope
   16 |     l[0]+=x[i];
      |           ^
a.cc:22:14: error: 'x' was not declared in this scope
   22 |     lp.push(-x[n+i]);
      |              ^
Language: C++

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

typedef long long ll;

#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

int main() {
    int N; cin >> N;
    ll a[300100]; FOR(i, 0, 3 * N) cin >> a[i];

    priority_queue<ll, vector<ll>, greater<ll>> pque_front;
    priority_queue<ll> pque_back;

    ll sum1i= 0, sum2i = 0;

    FOR(j, 0, N) {
        sum1i += a[j];
        pque_front.push(a[j]);
    }

    FOR(j, 2 * N , 3 * N) {
        sum2i += a[j];
        pque_back.push(a[j]);
    }

    ll sum1[300100], sum2[300100];

    sum1[N - 1] = sum1i;
    sum2[2 * N] = sum2i;

    ll ans = sum1 - sum2;

    FOR(j, N , 2 * N ){
        sum1[j] = sum[j - 1] + a[j];
        pque_front.push(a[j]);
        sum1[j] = sum[j - 1] - pque_front.top();
        pque_front.pop();
        
        sum2[3 * N - 1 - j] = sum2[3 * N - j] + a[3 * N - 1 - j];
        pque_back.push(a[j]);
        sum2[3 * N - 1 - j] = sum2[3 * N - j] - pque_back.top();
        pque_back.pop();
    }
    
    FOR(j, N , 2 * N ){
        ll sum = sum1[j] - sum2[3 * N - 1 - j];
        ans = max(ans, sum);
    }


    printf("%lld\n", ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:19: error: 'sum' was not declared in this scope; did you mean 'sum2'?
   37 |         sum1[j] = sum[j - 1] + a[j];
      |                   ^~~
      |                   sum2
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstdio>
#include <stack>
#include <functional>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

#define _SI(arr) (sizeof(arr)/sizeof(arr[0])

int main() {
	ll N;
	cin >> N;
	vector<ll> a(3 * N), v1, v2;
	for (ll i = 0; i < 3 * N; i++)cin >> a[i];

	priority_queue<ll, vector<ll>, greater<ll>> que1; // 昇順
	priority_queue<ll, vector<ll>> que2; // 降順

	ll cnt1 = 0, cnt2 = 0, max = LLONG_MIN;

	for (ll i = 0; i < N; i++)
	{
		que1.push(a[i]);
		cnt1 += a[i];
		que2.push(a[3 * N - i - 1]);
		cnt2 += a[3 * N - i - 1];
	}
	v1.push_back(cnt1);
	v2.push_back(cnt2);

	for (ll i = N; i < 2 * N; i++)
	{
		que1.push(a[i]);
		cnt1 += a[i] - que1.top();
		que1.pop();
		v1.push_back(cnt1);
		que2.push(a[3 * N - i - 1]);
		cnt2 += a[3 * N - i - 1] - que2.top();
		que2.pop();
		v2.push_back(cnt2);
	}

	for (ll i = 0; i <= N; i++)
	{
		if (max < v1[i] - v2[N - i])
		{
			max = v1[i] - v2[N - i];
		}
	}

	cout << max << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:38: error: 'LLONG_MIN' was not declared in this scope
   26 |         ll cnt1 = 0, cnt2 = 0, max = LLONG_MIN;
      |                                      ^~~~~~~~~
a.cc:11:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   10 | #include <map>
  +++ |+#include <climits>
   11 |
Language: C++


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repr(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<(int)(n);i++)
#define INF 9999999999

    /*Solve*/
int main(){
    int n;
    cin >> n;
    ll a[100010];
    ll ans=0;
    rep(i,3*n){
        cin >> a[i];
    }
    ll tmp=0;
    FOR(i,n,2*n+1){
        priority_queue<pair<ll,ll>> fhlf;
        priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<>> shlf;
        tmp=0;
            rep(j,3*n){
            if(j<i){

                fhlf.push({a[j],j});
            }else{shlf.push({a[j],j});}
        }
        rep(i,n){
            tmp+=fhlf.top().first-shlf.top().first;
            fhlf.pop();
            shlf.pop();
        }
        if(ans<tmp)ans=tmp;
    }

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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n;
  cin>>n;
  ll a[n*3],bb[n+1],cc[n+1];
  bb[0]=0,cc[n]=0;
  priority_queue<ll> c;
  priority_queue<ll,vector<ll>,greater<ll>> b;
  for(int i=0;i<n*3;i++){
    cin>>a[i];
    if(i<n){
      b.push(a[i]);
      bb[0]+=a[i];
    }
    else if(i>=n*2){
      c.push(a[i]);
      cc[n]+=a[i];
    }
  }
  for(int i=1;i<=n;i++){
    b.push(a[i+n-1]);
    bb[i]=bb[i-1]+a[i+n-1]-b.top();
    b.pop();
  }

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

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,a,summa1=0,summa2=0;
	cin>>n;
	set<pair<long long int,long long int> > s1;
	set<pair<long long int,long long int> > s2;
	vector<pair<long long int,long long int> > v;
	for(long long int i=1;i<=3*n;i++)
	{
		cin>>a;
		if(i<=3*n/2)
		{
			pair<long long int,long long int> p;
			p=make_pair(a,i);
		s1.insert(p);
		v.push_back(p);
	}
		else
		{
		pair<long long int,long long int> p;
		p=make_pair(a,i);
		s2.insert(p);
		//s2.insert(a);
	}
}
	set<pair<long long int,long long int> >::iterator itit=s2.end();
	itit--;
	if(n%2==1)
	{
		//cout<<1;
	s2.erase(itit);
	}
//cout<<" "<<it->first<<" ";
	long long int count=0;
	while(count<n/2)
	{
				set<pair<long long int,long long int> >::iterator it=s2.end();
		it--;
		//cout<<it->first;
		long long int sum1=it->first-s1.begin()->first;
		//cout<<sum1<<" ";
			vector<pair<long long int,long long int> >::iterator op=v.end();
			opt--;
		long long int sum2=it->first+(--it)->first-2*opt->first;
		//cout<<sum2;
		if(sum2>sum1)
		{
			pair<long long int,long long int> p;
			//pair<long long int,long long int> p1;
			//	pair<long long int,long long int> p2;
			vector<pair<long long int,long long int> >::iterator op=v.end();
			op--;
			p=make_pair(op->first,op->second);
			s1.erase(s1.find(p));
			
			//s1.erase(p);
			//p1=make_pair(s2.end()->first,s2.end()->second);
			//p2=make_pair((s2.end()-1)->first,(s2.end-1)->second);
			//s2.erase(p1);
			//s2.erase(p2);
			it++;
			s2.erase(it);
			it--;
			s2.erase(it);
			s2.insert(p);
			v.erase(op);
		}
		else
		{
			it++;
			s1.erase(s1.begin());
			s2.erase(it);
			long long int k=s1.begin()->second;
			v.erase(v.begin()+k-1);
		}
		count++;
	}
	set<pair<long long int,long long int> >::iterator itr1;
	{
		for(itr1=s1.begin();itr1!=s1.end();itr1++)
		{
			summa1+=itr1->first;
		}
		for(itr1=s2.begin();itr1!=s2.end();itr1++)
		{
			summa2+=itr1->first;
		}
	}
	cout<<summa1-summa2;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:25: error: 'opt' was not declared in this scope; did you mean 'op'?
   46 |                         opt--;
      |                         ^~~
      |                         op
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <stack>
#include <queue>
#include <functional>
#include <limits>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)

//変数
int N;
vector<int> a;

//解法
void solve() {

	ll ans = LLONG_MIN;
	rep(i, N + 1) {
		vector<int> front, back;
		rep(j, N*3) {
			if (j < N + i) {
				front.emplace_back(a[j]);
			}
			else {
				back.emplace_back(a[j]);
			}
		}

		sort(front.begin(), front.end(), less<int>());
		sort(back.begin(), back.end(), greater<int>());

		front.erase(front.begin(), front.begin() + i);
		back.erase(back.begin(), back.begin() + (N - i));

		int size = front.size();
		ll sum1=0, sum2=0,sum;
		rep(j, size) sum1 += front[j];
		size = back.size();
		rep(j, size) sum2 += back[j];

		sum = sum1 - sum2;
		if (ans < sum) ans = sum;
	}

	cout << ans;

	return;
}

int main() {
	//入力
	cin >> N;
	a.resize(3*N);
	rep(i, 3*N) cin >> a[i];
	solve();
	cout << endl;
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:23:18: error: 'LLONG_MIN' was not declared in this scope
   23 |         ll ans = LLONG_MIN;
      |                  ^~~~~~~~~
a.cc:9:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include <functional>
  +++ |+#include <climits>
    9 | #include <limits>
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <stack>
#include <queue>
#include <functional>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)

//変数
int N;
vector<int> a;

//解法
void solve() {

	ll ans = LLONG_MIN;
	rep(i, N + 1) {
		vector<int> front, back;
		rep(j, N*3) {
			if (j < N + i) {
				front.emplace_back(a[j]);
			}
			else {
				back.emplace_back(a[j]);
			}
		}

		sort(front.begin(), front.end(), less<int>());
		sort(back.begin(), back.end(), greater<int>());

		front.erase(front.begin(), front.begin() + i);
		back.erase(back.begin(), back.begin() + (N - i));

		int size = front.size();
		ll sum1=0, sum2=0,sum;
		rep(j, size) sum1 += front[j];
		size = back.size();
		rep(j, size) sum2 += back[j];

		sum = sum1 - sum2;
		if (ans < sum) ans = sum;
	}

	cout << ans;

	return;
}

int main() {
	//入力
	cin >> N;
	a.resize(3*N);
	rep(i, 3*N) cin >> a[i];
	solve();
	cout << endl;
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:22:18: error: 'LLONG_MIN' was not declared in this scope
   22 |         ll ans = LLONG_MIN;
      |                  ^~~~~~~~~
a.cc:9:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include <functional>
  +++ |+#include <climits>
    9 | using namespace std;
Language: C++

#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl;
#define pno cout << "no" << endl;
#define pYe cout << "Yes" << endl;
#define pNo cout << "No" << endl;
#define pYE cout << "YES" << endl;
#define pNO cout << "NO" << endl;
#define prin(num) cout << num << endl;
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 100000000000
#define MOD 1000000007LL
#define MAX_V 10005
#define MAX_E 30005
#define NIL -1
#define WHITE 0
#define BLACK 1
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll N;
ll a[300001];
ll sm[2][100001];

int main(void) {
    cin >> N;
    ll i;
    for(i=0; i<N*3; i++) {
        cin >> a[i];
    }
    priority_queue<ll, greater<ll>> pque1;
    for(i=0; i<N; i++) {
        sm[0][0]+=a[i];
        pque1.push(a[i]);
    }
    for(i=0; i<N; i++) {
        sm[0][i+1]=sm[0][i];
        sm[0][i+1]+=a[N+i];
        sm[0][i+1]-=pque1.top();
        pque1.pop();
    }
    priority_queue<ll> pque2;
    for(i=0; i<N; i++) {
        sm[1][N]+=a[N*2+i];
        pque2.push(a[N*2+i]);
    }
    for(i=0; i<N; i++) {
        sm[1][N-1-i]=sm[1][N-i];
        sm[1][N-1-i]+=a[N*2-i-1];
        sm[1][N-1-i]-=pque2.top();
        pque2.pop();
    }
    
    ll ans=-INF;
    for(i=0; i<=N; i++) {
        ans=max(ans, sm[0][i]-sm[1][i]);
    }
    
    prin(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:34: error: no type named 'value_type' in 'struct std::greater<long long int>'
   46 |     priority_queue<ll, greater<ll>> pque1;
      |                                  ^~
a.cc:46:34: error: template argument 3 is invalid
a.cc:49:15: error: request for member 'push' in 'pque1', which is of non-class type 'int'
   49 |         pque1.push(a[i]);
      |               ^~~~
a.cc:54:27: error: request for member 'top' in 'pque1', which is of non-class type 'int'
   54 |         sm[0][i+1]-=pque1.top();
      |                           ^~~
a.cc:55:15: error: request for member 'pop' in 'pque1', which is of non-class type 'int'
   55 |         pque1.pop();
      |               ^~~
Language: C++

#include <bits/stdc++.h>
#include <windows.h>
#define change_read() freopen("C:\\Users\\Administrator\\Desktop\\in.txt","r",stdin)
#define change_write() freopen("C:\\Users\\Administrator\\Desktop\\out.txt","w",stdout)
#define creat_read() freopen("C:\\Users\\Administrator\\Desktop\\out.txt","w",stdout)
using namespace std;
const int maxm = 1e5+10;
int num[maxm];
long long sum[maxm];
long long les[maxm];
long long bet[maxm];
priority_queue<int>que2;
priority_queue<int,vector<int>,greater<int> >que1;
int main() {
//    change_read();
    cin.tie(0);
    ios::sync_with_stdio(false);
    int len;
    cin>>len;
    len = (len+1)<<1;
    int x = len/3;
    for(int i = 1;i<=len;i++){
        cin>>num[i];
        sum[i] = sum[i-1]+num[i];
        if(i<=x) que1.push(num[i]);
        else if(i>=(x<<1)) que2.push(num[i]);
    }
    bet[x] = sum[x];
    for(int i = 1;i<=x;i++){
        que1.push(num[i+x]);
        bet[i+x] = bet[i+x-1]+num[i+x]-que1.top();
        que1.pop();
    }
    les[x<<1] = sum[len]-sum[x<<1];
    for(int i = 1;i<=x;i++){
        que2.push(num[len-x-i]);
        les[len-x-i] = les[len-x-i+1]-que2.top()+num[len-x-i+1];
        que2.pop();
    }
    long long ans = -1e18;
    for(int i = x;i<(x<<1);i++){
        ans = max(ans,bet[i]-les[i]);
    }
    cout<<ans<<endl;
    return 0;
}

//3 1 4 1 5 9
//3 4 7 7 9 14
//2 2 5 6 14 9







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

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

using namespace std;

int main(){
	long long i,n,x,ans=0,j,k;
	priority_queue <long long> front,last;
	cin >> n;
	long long a[n],b[n];
	for(i=0;i<n;i++){
		cin >> x;
		ans += x;
		front.push(-x);
	}
	
	for(i=0;i<n;i++){
		cin >> x;
		a[i] = x;
		b[n-1-i] = x;
	}
	
	for(i=0;i<n;i++){
		cin >> x;
		ans -= x;
		last.push(x);
	}
	j = 0;
	k = 0;
	for(i=0;i<n;i++){
		if(front.top()+a[j] > last.top()-b[k]){
			ans += front.top()+a[j];
			front.pop();
			front.push(a[j]);
			j++;
		}else{
			ans += last.top()-b[k];
			last.pop();
			last.pop(b[k]);
			k++;
		}
	}
	
	cout << ans << endl;
}
		
		

Compiler output:
a.cc: In function 'int main()':
a.cc:40:33: error: no matching function for call to 'std::priority_queue<long long int>::pop(long long int&)'
   40 |                         last.pop(b[k]);
      |                         ~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_queue.h:771:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::pop() [with _Tp = long long int; _Sequence = std::vector<long long int, std::allocator<long long int> >; _Compare = std::less<long long int>]'
  771 |       pop()
      |       ^~~
/usr/include/c++/14/bits/stl_queue.h:771:7: note:   candidate expects 0 arguments, 1 provided
Language: C++

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




using namespace std;
bool vcmp(int a,int b){
	return a>b;
}
int resultUtil(vector<int> &a,int m){
	int n=a.size()/3;
	vector<int> left(m);
	vector<int> right(3*n-m);
	int i=0;
	for(i=0;i<left.size();i++){
		left[i]=a[i];
	}
	for(int j=0;j<right.size();j++){
		right[j]=a[i];
		i++;
	}
	sort(left.begin(),left.end(),vcmp);
	sort(right.begin(),right.end());
	int sumLeft=0,sumRight=0;
	for(int i=0;i<n;i++){
		sumLeft+=left[i];
		sumRight+=right[i];
	}
	return sumLeft-sumRight;
}
int result(vector<int> &a){
	int fresult=INT_MIN;
	int n=a.size()/3;
	for(int m=n;m<=2*n;m++){
		fresult=max(fresult,resultUtil(a,m));
	}
	return fresult;
}
int main(){
	int n;
	cin>>n;
	vector<int> a(3*n);
	for(int i=0;i<3*n;i++)
		cin>>a[i];
	cout<<result(a);
}

Compiler output:
a.cc: In function 'int result(std::vector<int>&)':
a.cc:34:21: error: 'INT_MIN' was not declared in this scope
   34 |         int fresult=INT_MIN;
      |                     ^~~~~~~
a.cc:4:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<algorithm>
  +++ |+#include <climits>
    4 |
Language: C++

#include<bits/stdc++.h>
#define INF 1e9
using ll = long long;
#define int ll
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repr(i,a,b) for(int i=(a);i>=(b);i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
int main(){
	int n; cin >> n;
	vector<int> v(3*n),lv,sv;
	rep(i,0,3*n)	cin >> v[i];
	priority_queue<int,vector<int>,greater<int>>lque;
	priority_queue<int,vector<int>>sque;
	int ls=0,ss=0;
	rep(i,0,n){
		lque.push(v[i]);
		sque.push(v[2*n+i]);
		ls+=v[i];
		ss+=v[2*n+i];
	}
	lv.push_back(ls);
	sv.push_back(ss);
	int ans=-INF*INF;
	ans = max(ans,ls-ss);
	rep(i,0,n){
		lque.push(v[n+i]);
		sque.push(v[2*n-i-1]);
		ls+=(v[n+i]-lque.top()); //min change
		ss+=(v[2*n-i-1]-sque.top()); //max change
		lv.push_back(ls);
		sv.push_back(ss);
		sque.pop();
		lque.pop();
	}
	rep(i,0,lv.size())	ans = max(ans,lv[i]-sv[n-i]);
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:4:13: error: '::main' must return 'int'
    4 | #define int ll
      |             ^~
a.cc:9:1: note: in expansion of macro 'int'
    9 | int main(){
      | ^~~
Language: C++

#include <queue>
#include <limits>
using namespace std;

int arr[300005];
long long int prefNSum[300005];		//arr[1] ~ arr[i] 중 가장 큰 N개의 합
long long int suffNSum[300005];		//arr[i] ~ arr[N] 중 가장 작은 N개의 합
priority_queue<int, vector<int>, greater<int> > minHeap;
priority_queue<int> maxHeap;
int main(){
	int N, tmp;
	scanf("%d", &N);
	for(int i=1; i<=3*N; ++i)
		scanf("%d", arr+i);
	for(int i=1; i<=N; ++i){
		minHeap.push(arr[i]);	
		prefNSum[N] += arr[i];
	}
	for(int i=N+1; i<=2*N; ++i){
		tmp = minHeap.top();
		if(arr[i] >= tmp){
			prefNSum[i] = prefNSum[i-1] - tmp + arr[i];
			minHeap.pop();
			minHeap.push(arr[i]);
		}else{
			prefNSum[i] = prefNSum[i-1];
		}
	}

	for(int i=3*N; i>2*N; --i){
		maxHeap.push(arr[i]);
		suffNSum[2*N+1] += arr[i];
	}
	for(int i=2*N; i>N; --i){
		tmp = maxHeap.top();
		if(arr[i] <= tmp){
			suffNSum[i] = suffNSum[i+1] - tmp + arr[i];
			maxHeap.pop();
			maxHeap.push(arr[i]);
		}else{
			suffNSum[i] = suffNSum[i+1];
		}
	}
	long long int ans = numeric_limits<long long int>::min();
	for(int i=N; i<=2*N; ++i){
		ans = max(ans, prefNSum[i] - suffNSum[i+1]);
	}
	printf("%lld\n", ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'scanf' was not declared in this scope
   12 |         scanf("%d", &N);
      |         ^~~~~
a.cc:48:9: error: 'printf' was not declared in this scope
   48 |         printf("%lld\n", ans);
      |         ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <limits>
  +++ |+#include <cstdio>
    3 | using namespace std;
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>
#include <numeric>

using namespace std;

typedef long long ll;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;
    vector<ll> A(3 * N);
    for (auto&& a : A) {
        cin >> a;
    }

    vector<ll> dp(N + 1);
    dp[0] = accumulate(A.begin(), A.begin() + N, 0LL);
    priority_queue<ll, vector<ll>, greater<ll> > que;
    for_each(A.begin(), A.begin() + N, [&](ll a) { que.push(a); });

    for (ll i = 1; i <= N; i++) {
        ll top = que.top();
        ll val = A[i + N - 1];
        dp[i] = dp[i - 1];
        if (top < val) {
            dp[i] += val - top;
            que.pop();
        }
    }

    vector<ll> dp2(N + 1);
    dp2[0] = accumulate(A.rbegin(), A.rbegin() + N, 0LL);
    priority_queue<ll> que2;
    for_each(A.rbegin(), A.rbegin() + N, [&](ll a) { que2.push(a); });

    for (ll i = 1; i <= N; i++) {
        ll top = que2.top();
        ll val = A[2 * N - i];
        ll dp2[i] = dp2[i - 1];
        if (top > val) {
            dp2[i] += val - top;
            que2.pop();
        }
    }

    ll ans = -1e18;
    for (ll i = 0; i <= N; i++) {
        ans = max(ans, dp[i] - dp2[N - i]);
    }

    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:52:30: error: array must be initialized with a brace-enclosed initializer
   52 |         ll dp2[i] = dp2[i - 1];
      |                     ~~~~~~~~~^
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#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 MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
using namespace std;
//
int A[300000];
long long sum[300000];
long long ssum[300000];
PGQ que1;
PQ que2;
int main(){
  int N;
  cin>>N;
  FOR(i,0,3*N){
    cin>>A[i];
  }
  long long x=0,y=0;
  FOR(i,0,N){
    que1.push(A[i]);
    x+=A[i];
  }
  sum[N-1]=x;
  FOR(i,N,2*N){
    que1.push(A[i]);
    x+=A[i];
    x-=que1.top();
    que1.pop();
    sum[i]=x;
  }
  FOR(i,2*N,3*N){
    que2.push(A[i]);
    y+=A[i];
  }
  ssum[2*N-1]=y;　
  ROF(i,N,2*N){
    que2.push(A[i]);
    y+=A[i];
    y-=que2.top();
    que2.pop();
    ssum[i-1]=y;
  }
  long long M=-1e15;
  FOR(i,N-1,2*N){
    M=max(M,sum[i]-ssum[i]);
  }
  cout<<M<<endl;
  return 0;
}


Compiler output:
a.cc:54:17: error: extended character 　 is not valid in an identifier
   54 |   ssum[2*N-1]=y;　
      |                 ^
a.cc: In function 'int main()':
a.cc:54:17: error: '\U00003000' was not declared in this scope
   54 |   ssum[2*N-1]=y;　
      |                 ^~
a.cc:55:7: error: 'i' was not declared in this scope
   55 |   ROF(i,N,2*N){
      |       ^
a.cc:10:34: note: in definition of macro 'ROF'
   10 | #define ROF(i,a,b) for(int i=b-1;i>=a;i--)
      |                                  ^
Language: C

#include<bits/stdc++.h>

using namespace std;

const int MAXN = 1e5+10;
int n ,  a[MAXN];
long long ans = -1e18 , f[MAXN] , r[MAXN];

int main()
{
    scanf("%d",&n);
    for(int i = 1 ; i<=3*n ; i++)
        scanf("%d",&a[i]);
    priority_queue<int , vector<int> , greater<int> > q;
    for(int i = 1 ; i<=n ; i++)
    {
        q.push(a[i]);
        f[n] += a[i];
    }
    for(int i = n+1 ; i<=2*n ; i++)
    {
        if(a[i] <= q.top()) f[i]  = f[i-1];
        else
        {
            f[i]= f[i-1] + a[i] - q.top();
            q.pop();
            q.push(a[i]);
        }
    }

    priority_queue<int> qq;

    for(int i = 3*n ; i>=2*n+1 ; i--)
    {
        r[2*n+1] += a[i];
        qq.push(a[i]);
    }

    for(int i = 2*n ; i>=n+1 ; i--)
    {
        if(a[i] >= qq.top()) r[i] = r[i+1];
        else
        {
            r[i] = r[i+1] + a[i] - qq.top();
            qq.pop();
            qq.push(a[i]);
        }
    }

    for(int i = n ; i <= 2*n ; i++)
        ans = max(ans , f[i] - r[i+1]);

    printf("%lld",ans);

    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 <bits/stdc++.h>
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define ll long long
#define mp make_pair
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define eps 1e-9
#define all(x) (x).begin(), (x).end()
using namespace std;
const int inf = 1 << 28;
const int N = 100010;
const double pi=acos(-1.0);
int n;
int num[N * 3];
ll Ml[N], Mr[N];
int main()
{
    int a, b;
    n = read();
    rep(i, 0, n * 3 - 1) num[i] = read();
    priority_queue<int, vector<int>, greater<int> > Q1;
    priority_queue<int> Q2;
    rep(i, 0, n - 1)
    {
        Ml[0] += num[i];
        Q1.push(num[i]);
        Mr[n + 1] += num[n * 3 - 1 - i];
        Q2.push(num[n * 3 - 1 - i]);
    }
    rep(i, 1, n)
    {
        Q1.push(num[n + i - 1]);
        Ml[i] = Ml[i - 1] + num[n + i - 1] - Q1.top();
        Q1.pop();
 
        Q2.push(num[n * 2 - i]);
        Mr[n + 1 - i] = Mr[n + 1 - i + 1] + num[n * 2 - i] - Q2.top();
        Q2.pop();
    }
    ll ans;
    rep(i, 0, n)
        if(!i) ans = Ml[i] - Mr[i + 1];
        else ans = max(ans, Ml[i] - Mr[i + 1]);
    printf("%lld\n",ans);
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:13: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   28 |     n = read();
      |         ~~~~^~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:1:
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
a.cc:29:39: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   29 |     rep(i, 0, n * 3 - 1) num[i] = read();
      |                                   ~~~~^~
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
Language: Java


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ArrayReconstruction {

	/**
	 * @param args
	 * @throws IOException
	 */

	static int[] zeroes;
	public static void main(String[] args) throws IOException {
		BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));

		String input = scan.readLine();
		int changes = Integer.parseInt(input);
		//conChanges = changes;
		input = scan.readLine();
		 String[] array = input.split(" ");
		 zeroes = new int[changes];
		 set(changes);
		 System.out.println(max(0, changes, array));

	}

	public static int max(int index, int changes, String[] array) {
		if (changes == 0) {
			return cal(array);
		}

		if (index >= array.length && changes != 0 || (changes < 0)) {
			return (int) -10e9;
		}
		int choice1 = (int) -10e9;
		int choice2 = (int) -10e9;

		choice1 = max(index+1, changes, array);
		if (changes > 0) {
			zeroes[changes - 1] = index;
			choice2 = max(index+1, changes - 1, array);

		}
		return Math.max(choice1, choice2);
	}

	public static int cal(String[] array) {
		int number = (((array.length)- zeroes.length)/2);
		int taken = 0;
		int sum1 = 0;
		int sum2 = 0;
		int i = 0;
		for (i = 0; taken < number; i++) {
			if (!include(i)) {
				sum1 += Integer.parseInt(array[i]);
				taken++;
			}

		}
		int start = i;
		for (i = start; i <array.length; i++) {
			if (!include(i)) {
				sum2 += Integer.parseInt(array[i]);
			}

		}


		return sum1 - sum2;
	}

	public static boolean include(int number) {
		for (int i = 0; i < zeroes.length; i++) {
			if (number == zeroes[i]) {
				return true;
			}
		}
		return false;
	}

	public static void set(int changes) {
		for (int i = 0; i <changes; i++) {
			zeroes[i] = -1;
		}
	}

}


Compiler output:
Main.java:6: error: class ArrayReconstruction is public, should be declared in a file named ArrayReconstruction.java
public class ArrayReconstruction {
       ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author Personal
 *
 */
public class ArrayReconstruction {

	/**
	 * @param args
	 * @throws IOException
	 */
	//static int conChanges;

	static int[] zeroes;
	public static void main(String[] args) throws IOException {
		BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));

		String input = scan.readLine();
		int changes = Integer.parseInt(input);
		//conChanges = changes;
		input = scan.readLine();
		 String[] array = input.split(" ");
		 zeroes = new int[changes];
		 set(changes);
		 System.out.println(max(0, changes, array));

	}

	public static int max(int index, int changes, String[] array) {
		if (changes == 0) {
			return cal(array);
		}

		if (index >= array.length && changes != 0 || (changes < 0)) {
			return (int) -10e9;
		}
		int choice1 = (int) -10e9;
		int choice2 = (int) -10e9;

		choice1 = max(index+1, changes, array);
		if (changes > 0) {
			zeroes[changes - 1] = index;
			choice2 = max(index+1, changes - 1, array);

		}
		return Math.max(choice1, choice2);
	}

	public static int cal(String[] array) {
		int number = (((array.length)- zeroes.length)/2);
		int taken = 0;
		int sum1 = 0;
		int sum2 = 0;
		int i = 0;
		for (i = 0; taken < number; i++) {
			if (!include(i)) {
				sum1 += Integer.parseInt(array[i]);
				taken++;
			}

		}
		int start = i;
		for (i = start; i <array.length; i++) {
			if (!include(i)) {
				sum2 += Integer.parseInt(array[i]);
			}

		}


		return sum1 - sum2;
	}

	public static boolean include(int number) {
		for (int i = 0; i < zeroes.length; i++) {
			if (number == zeroes[i]) {
				return true;
			}
		}
		return false;
	}

	public static void set(int changes) {
		for (int i = 0; i <changes; i++) {
			zeroes[i] = -1;
		}
	}

}


Compiler output:
Main.java:9: error: class ArrayReconstruction is public, should be declared in a file named ArrayReconstruction.java
public class ArrayReconstruction {
       ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ArrayReconstruction {

	/**
	 * @param args
	 * @throws IOException
	 */

	static int[] zeroes;
	public static void main(String[] args) throws IOException {
		BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));

		String input = scan.readLine();
		int changes = Integer.parseInt(input);
		//conChanges = changes;
		input = scan.readLine();
		 String[] array = input.split(" ");
		 zeroes = new int[changes];
		 set(changes);
		 System.out.println(max(0, changes, array));

	}

	public static int max(int index, int changes, String[] array) {
		if (changes == 0) {
			return cal(array);
		}

		if (index >= array.length && changes != 0 || (changes < 0)) {
			return (int) -10e9;
		}
		int choice1 = (int) -10e9;
		int choice2 = (int) -10e9;

		choice1 = max(index+1, changes, array);
		if (changes > 0) {
			zeroes[changes - 1] = index;
			choice2 = max(index+1, changes - 1, array);

		}
		return Math.max(choice1, choice2);
	}

	public static int cal(String[] array) {
		int number = (((array.length)- zeroes.length)/2);
		int taken = 0;
		int sum1 = 0;
		int sum2 = 0;
		int i = 0;
		for (i = 0; taken < number; i++) {
			if (!include(i)) {
				sum1 += Integer.parseInt(array[i]);
				taken++;
			}

		}
		int start = i;
		for (i = start; i <array.length; i++) {
			if (!include(i)) {
				sum2 += Integer.parseInt(array[i]);
			}

		}


		return sum1 - sum2;
	}

	public static boolean include(int number) {
		for (int i = 0; i < zeroes.length; i++) {
			if (number == zeroes[i]) {
				return true;
			}
		}
		return false;
	}

	public static void set(int changes) {
		for (int i = 0; i <changes; i++) {
			zeroes[i] = -1;
		}
	}

}

Compiler output:
Main.java:5: error: class ArrayReconstruction is public, should be declared in a file named ArrayReconstruction.java
public class ArrayReconstruction {
       ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class ArrayReconstruction {

	static int[] zeroes;
	public static void main(String[] args) throws IOException {
		BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));

		String input = scan.readLine();
		int changes = Integer.parseInt(input);
		//conChanges = changes;
		input = scan.readLine();
		 String[] array = input.split(" ");
		 zeroes = new int[changes];
		 set(changes);
		 System.out.println(max(0, changes, array));

	}

	public static int max(int index, int changes, String[] array) {
		if (changes == 0) {
			return cal(array);
		}

		if (index >= array.length && changes != 0 || (changes < 0)) {
			return (int) -10e9;
		}
		int choice1 = (int) -10e9;
		int choice2 = (int) -10e9;

		choice1 = max(index+1, changes, array);
		if (changes > 0) {
			zeroes[changes - 1] = index;
			choice2 = max(index+1, changes - 1, array);

		}
		return Math.max(choice1, choice2);
	}

	public static int cal(String[] array) {
		int number = (((array.length)- zeroes.length)/2);
		int taken = 0;
		int sum1 = 0;
		int sum2 = 0;
		int i = 0;
		for (i = 0; taken < number; i++) {
			if (!include(i)) {
				sum1 += Integer.parseInt(array[i]);
				taken++;
			}

		}
		int start = i;
		for (i = start; i <array.length; i++) {
			if (!include(i)) {
				sum2 += Integer.parseInt(array[i]);
			}

		}


		return sum1 - sum2;
	}

	public static boolean include(int number) {
		for (int i = 0; i < zeroes.length; i++) {
			if (number == zeroes[i]) {
				return true;
			}
		}
		return false;
	}

	public static void set(int changes) {
		for (int i = 0; i <changes; i++) {
			zeroes[i] = -1;
		}
	}

}

Compiler output:
Main.java:6: error: class ArrayReconstruction is public, should be declared in a file named ArrayReconstruction.java
public class ArrayReconstruction {
       ^
1 error