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

#include<cstdio>

int main(){
  int h,w;
  int a = 0;
  scanf("%d %d", &h,&w);

  if(w>h){
    int tmp=h;
    h=w;
    w=tmp;
  }

  if(!(h%3==0||w%3==0)){
    if(h%2==0||w%2==0){
      // if(w%2==1){
        // int tmp=h;
        // h=w;
        // w=tmp;
      // }
      int s=(h+1)/3;
      int ss=s*w-(h-s)*(w/2);
      a = (ss>0) ? ss : -ss;
    }else {
      int s=(h+1)/3;
      int sk=s*w;
      int ss=(h-s)*(w/2);
      int se=(h-s)*(w/2+1);
      if(ss>sk){
        a=se-sk;
      }else{
        if(se>sk){
          a=se-ss;
        }else{
          a=sk-ss;
        }
      }
    }
  }
  printf("%d\n",a);

  return 0;
}

　

Compiler output:
a.cc:45:1: error: extended character 　 is not valid in an identifier
   45 | 　
      | ^
a.cc:45:1: error: '\U00003000' does not name a type
   45 | 　
      | ^~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>

using namespace std;

void solve(long long h, long long w) {
    vector<long long> differs;
    long long min_of_3;
    long long max_of_3;
    if (h%3 == 0 || w%3 == 0) {
        std::cout << 0 << std::endl;
    } else {
        if (h%3 == 1) {
            min_of_3 = w * (h/3);
            if (w%2 == 0) {
                differs.push_back((h-(h/3))/2*w - min_of_3);
            } else {
                if (w < h-(h/3)) {
                    differs.push_back(w);
                } else {
                    differs.push_back(((h-(h/3))/2 +1)*w - min_of_3);
                }
            }
        } else {
            max_of_3 = w * ((h/3)+1);
            if (w%2 == 0) {
                differs.push_back(max_of_3 - (h-((h/3)+1))*(w/2));
            } else {
                if (w < h-((h/3)+1)) {
                    differs.push_back(w);
                } else {
                    differs.push_back(max_of_3 - (h-((h/3)+1))*(w/2+1));
                }
            }
        }
        long long tmp = w;
        w = h;
        h = tmp;
        if (h%3 == 1) {
            min_of_3 = w * (h/3);
            if (w%2 == 0) {
                differs.push_back((h-(h/3))*(w/2) - min_of_3);
            } else {
                if (w < h-(h/3)) {
                    differs.push_back(w);
                } else {
                    differs.push_back((h-(h/3))*(w/2+1) - min_of_3);
                }
            }
        } else {
            max_of_3 = w * ((h/3)+1);
            if (w%2 == 0) {
                differs.push_back(max_of_3 - (h-((h/3)+1))*(w/2));
            } else {
                if (w < h-((h/3)+1)) {
                    differs.push_back(w);
                } else {
                    differs.push_back(max_of_3 - (h-((h/3)+1))*(w/2+1));
                }
            }
        }
        std::cout << *min_element(differs.begin(), differs.end()) << std::endl;
    }
}

long long main() {
    struct timeval start,end;
    long long span;
    long long h,w;

    gettimeofday(&start,NULL);

    std::cin >> h >> w;
    solve(h, w);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <iostream>
using namespace std;

int main(void)
{
	int H, W;
	cin >> H >> W;

	if (H % 3 == 0 || W % 3 == 0) {
		cout << "0" << endl;
		return 0;
	}

	long long min, max;
	if (H > W) {
		if (H % 3 == 2) {
			max = (H / 3 + 1)*W;
			H -= H / 3 + 1;
			if (W % 2 != 0 && H > W) {
				min = (H / 2)*W;
			}
			else {
				min = (W / 2)*H;
			}
		} else {
			max = (H / 3)*W;
			H -= H / 3;
			if (W % 2 != 0 && H > W) {
				min = round(H / 2.0)*W;
			}
			else {
				min = round(W / 2.0)*H;
			}
		}
	} else if (W > H) {
		if (W % 3 == 2) {
			max = (W / 3 + 1)*H;
			W -= W / 3 + 1;
			if (W % 2 != 0 && H > W) {
				min = (H / 2)*W;
			}
			else {
				min = (W / 2)*H;
			}
		} else {
			max = (W / 3)*H;
			W -= W / 3;
			if (W % 2 != 0 && H > W) {
				min = round(H / 2.0)*W;
			}
			else {
				min = round(W / 2.0)*H;
			}
		}
	} else {
		if (W % 3 == 1) {
			max = (H / 3)*W;
			H -= H / 3;
			min = (W / 2)*H;
		} else {
			max = (H / 3 + 1)*W;
			H -= H / 3 + 1;
			min = (W / 2)*H;
		}
	}

	cout << abs(max - min) << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:39: error: 'round' was not declared in this scope
   29 |                                 min = round(H / 2.0)*W;
      |                                       ^~~~~
a.cc:32:39: error: 'round' was not declared in this scope
   32 |                                 min = round(W / 2.0)*H;
      |                                       ^~~~~
a.cc:49:39: error: 'round' was not declared in this scope
   49 |                                 min = round(H / 2.0)*W;
      |                                       ^~~~~
a.cc:52:39: error: 'round' was not declared in this scope
   52 |                                 min = round(W / 2.0)*H;
      |                                       ^~~~~
Language: C++

#include <vector>
#include <algorithm>
#include <iostream>
#include <chrono>
#include<bitset>
#include<deque>
#include <map>
#define vint vector<int>
#define vint2 vector<vint>
#define vchar vector<char>
#define vchar2 vector<vchar> 
#define vchar3 vector<vchar2> 
#define pr pair<int,int>
#define vpr vector<pr>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define int long int
using namespace std;

int H, W;
int h, w;

int mymin(int a, int b, int c){
	int mi = a, ma = a;
	if (mi > b)mi = b; if (mi > c)mi = c;
	if (ma < b)ma = b; if (ma < c)ma = c;
	return ma - mi;

}
int f(int a, int b, int c){
	int mi = a; if (mi > b)mi = b; if (mi > c)mi = c;
	return mi;

}

int A(int y){
	int a = y*W;
	int b = (H - y)*(W / 2);
	int c = (H - y)*(W - W / 2);
	return mymin(a, b, c);
}
int B(int y){
	int a = y*W;
	int b = (H - y)/2*(W );
	int c = (H - y-(H-y)/2)*(W );
	return mymin(a, b, c);
}

int Y(int y){
	int a = A(y);
	int b = B(y);
	return (a < b ? a : b);
}

int C(int x){
	int a = x*H;
	int b = (W - x)*(H / 2);
	int c = (W - x)*(H - H / 2);
	return mymin(a, b, c);
}
int D(int x){
	int a = x*H;
	int b = (W - x) / 2 * (H);
	int c = (W - x - (W - x) / 2)*(H);
	return mymin(a, b, c);
}
int X(int x){
	int a = C(x);
	int b = D(x);
	return (a < b ? a : b);
}


int main(){

	cin >> H >> W;

	int h = H % 3;
	int w = W % 3;

	if (h == 0 || w == 0){ cout << 0 << endl; return 0; }
	int a, b, c;

	a = Y(H / 3);
	b = Y(H / 3 + 1);
	c = Y(H / 3 + 2);
	int xmin = f(a, b, c);

	a = X(H / 3);
	b = X(H / 3 + 1);
	c = X(H / 3 + 2);
	int ymin = f(a, b, c);

	cout << (xmin < ymin ? xmin : ymin) << endl;

	//cerr << "mijissou" << endl;

	return 0;
}

//int mainB(){
//	int H, W;
//	cin >> H >> W;
//
//	REP(j, W + 2)cout << "#"; cout << endl;
//	REP(i, H){
//		cout << "#";
//		REP(j, W){ char c; cin >> c; cout << c; }
//		cout << "#"; cout << endl;
//
//	}
//	REP(j, W + 2)cout << "#"; cout << endl;
//
//	return 0;
//}


//int mainA(){
//	int a[] = { 1, 3, 5, 7, 8, 10, 12 };
//	int b[] = { 4, 6, 9, 11 };
//	int c[] = { 2 };
//
//	int x, y;
//	cin >> x >> y;
//	int xx = -1, yy = -1;
//
//	REP(i, 7){
//		if (x == a[i])xx = 0;
//		if (y == a[i])yy = 0;
//	}
//	REP(i, 4){
//		if (x == b[i])xx = 1;
//		if (y == b[i])yy = 1;
//	}
//	
//		if (x == 2)xx = 2;
//		if (y == 2)yy = 2;
//		cout << ((xx == yy) ? "Yes" : "No") << endl;
//	
//
//	return 0;
//}



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

#include<iostream>
#include<algorithm>
using namespace std;
long long n,m;
int main()
{

    while(cin>>n>>m)
    {
        long long s[3];
         if(n%3==0||m%3==0)
        cout<<0<<endl;
    else
    {
        long long r1=m/2;
        long long r2=m-r1;
        long long mind=INT_MAX,maxd=INT_MIN;
        long long ans=INT_MAX;
       for(int i=1;i<=n;i++)
       {
           s[0]=r1*(n-i);
           s[1]=r2*(n-i);
           s[2]=m*i;
           sort(s,s+3);
           ans=min(ans,s[2]-s[0]);
       }
        r1=n/2;
        r2=n-r1;
        mind=INT_MAX,maxd=INT_MIN;
        for(int i=1;i<=m;i++)
        {
            s[0]=r1*(m-i);
            s[1]=r2*(m-i);
            s[2]=n*i;
            sort(s,s+3);
            ans=min(ans,s[2]-s[0]);
        }
        cout<<ans<<endl;
    }
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: error: 'INT_MAX' was not declared in this scope
   17 |         long long mind=INT_MAX,maxd=INT_MIN;
      |                        ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include<algorithm>
  +++ |+#include <climits>
    3 | using namespace std;
a.cc:29:22: error: 'maxd' was not declared in this scope
   29 |         mind=INT_MAX,maxd=INT_MIN;
      |                      ^~~~
a.cc:29:27: error: 'INT_MIN' was not declared in this scope
   29 |         mind=INT_MAX,maxd=INT_MIN;
      |                           ^~~~~~~
a.cc:29:27: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <stdio.h>
#include <cmath>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <cassert>

#define ll long long
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define vi vector<int>
#define vl vector<long long>
#define sz size()
#define x first
#define y second
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

ll n, m;
ll ans = (ll)1e18;

int main() {
                        
	cin >> n >> m;	
	
	ans = min(h, w);

	if(n % 3 == 0 || m % 3 == 0) {
		cout << 0;
		return 0;
	}

	for(ll i = 1; i <= m; i++) {
 		{
			ll part1 = n * i;
			ll left = n * (m - i);		
		     ll part2, part3;			
			part2 = (m - i) / 2  * n;
			part3 = n * m - part1 - part2;						
		     if(part1 == 0 || part2 == 0 || part3 == 0) continue;

			assert(part1 + part2 + part3 == n * m);
			ans = min(ans, max(abs(part1 - part2), max(abs(part1 - part3), abs(part3 - part2))));
		}

		{
			ll part1 = n * i;
			ll left = n * (m - i);		
		     ll part2, part3;
			part2 = n/2 * (m - i);
			part3 = n * m - part1 - part2;
			if(part1 == 0 || part2 == 0 || part3 == 0) continue;
			assert(part1 + part2 + part3 == n * m);			
			ans = min(ans, max(abs(part1 - part2), max(abs(part1 - part3), abs(part3 - part2))));
		}
	}


	for(ll i = 1; i <= n; i++) {
		{
			ll part1 = m * i;
			ll left = m * (n - i);		
		     ll part2, part3;			
			part2 = (n - i) / 2  * m;
			part3 = n * m - part1 - part2;						
		     if(part1 == 0 || part2 == 0 || part3 == 0) continue;
			assert(part1 + part2 + part3 == n * m);
			ans = min(ans, max(abs(part1 - part2), max(abs(part1 - part3), abs(part3 - part2))));
		}

		{
			ll part1 = m * i;
			ll left = m * (n - i);		
		     ll part2, part3;
			part2 = m/2 * (n - i);
			part3 = n * m - part1 - part2;
			if(part1 == 0 || part2 == 0 || part3 == 0) continue;
			assert(part1 + part2 + part3 == n * m);			
			ans = min(ans, max(abs(part1 - part2), max(abs(part1 - part3), abs(part3 - part2))));
		}
	}

	//cout << ans << endl;

	cout << ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:19: error: 'h' was not declared in this scope
   37 |         ans = min(h, w);
      |                   ^
a.cc:37:22: error: 'w' was not declared in this scope
   37 |         ans = min(h, w);
      |                      ^
Language: C++

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

int main(){
  long long int h,w;
  cin>>h>>w;
  if(h%3==0||w%3==0){
    cout<<0<<endl;
    return 0;
  }

  long long int ans = h*w;

  for(int i = 1;i<h;i++){
    vector<long long int> x(3);
    x[0]=i*w;
    long long int w2=w/2;
    x[1]=w2*(h-i);
    x[2]=(w-w2)*(h-i);
    sort(x.begin(),x.end());
    long long int ans2 = x[2]-x[0];

    ans=min(ans,ans2);
  }

  for(int i = 1;i<w;i++){
    vector<long long int> x(3);
    x[0]=i*h;
    long long int w2=h/2;
    x[1]=w2*(w-i);
    x[2]=(h-w2)*(w-i);
    sort(x.begin(),x.end());
    long long int ans2 = x[2]-x[0];

    ans=min(ans,ans2);
  }

  long long int ans2 = (h*w/3)-(h*(w-(w/3)));
  min(ans,ans2);
  long long int ans2 = (w*h/3)-(w*(h-(h/3)));
  min(ans,ans2);

  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:6: warning: ignoring return value of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = long long int]', declared with attribute 'nodiscard' [-Wunused-result]
   43 |   min(ans,ans2);
      |   ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: declared here
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:44:17: error: redeclaration of 'long long int ans2'
   44 |   long long int ans2 = (w*h/3)-(w*(h-(h/3)));
      |                 ^~~~
a.cc:42:17: note: 'long long int ans2' previously declared here
   42 |   long long int ans2 = (h*w/3)-(h*(w-(w/3)));
      |                 ^~~~
a.cc:45:6: warning: ignoring return value of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = long long int]', declared with attribute 'nodiscard' [-Wunused-result]
   45 |   min(ans,ans2);
      |   ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: declared here
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>


using namespace std;

typedef long long ll;


ll res=LLONG_MAX;
void check(int x,int y)
{
    for(int i=1;i<x;i++)
    {
        ll s1=(ll)i*y;
        ll s2,s3;
        ll tx=x-i,ty=y;
        for(int j=0;j<2;j++)
        {
            if(j)
            {
                s2=(ll)(tx/2)*ty;
                s3=(ll)(tx-tx/2)*ty;
                ll mi=min(s1,min(s2,s3));
                ll ma=max(s1,max(s2,s3));
                if(abs(ma-mi)<res) res=abs(ma-mi);
            }
            else
            {
                swap(tx,ty);
                s2=(ll)(tx/2)*ty;
                s3=(ll)(tx-tx/2)*ty;
                ll mi=min(s1,min(s2,s3));
                ll ma=max(s1,max(s2,s3));
                if(abs(ma-mi)<res) res=abs(ma-mi);
            }
        }
    }
}

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    if(n%3==0||m%3==0)
    {
        cout<<"0"<<endl;
        return 0;
    }
    check(n,m);
    check(m,n);
    cout<<res<<endl;
    return 0;
}

Compiler output:
a.cc:17:8: error: 'LLONG_MAX' was not declared in this scope
   17 | ll res=LLONG_MAX;
      |        ^~~~~~~~~
a.cc:10:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    9 | #include <set>
  +++ |+#include <climits>
   10 |
Language: C

#include<stdio.h>
int main(){
	int a.b;
	printf("%d\n",a*b%3);
}

Compiler output:
main.c: In function 'main':
main.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    3 |         int a.b;
      |              ^
main.c:3:14: error: expected expression before '.' token
main.c:4:23: error: 'a' undeclared (first use in this function)
    4 |         printf("%d\n",a*b%3);
      |                       ^
main.c:4:23: note: each undeclared identifier is reported only once for each function it appears in
main.c:4:25: error: 'b' undeclared (first use in this function)
    4 |         printf("%d\n",a*b%3);
      |                         ^
Language: C++

import sys
import heapq

def main():
	N = int(input())
	a = list(map(int, input().split()))

	left = a[0 : N]
	right = a[N*2 : N*3]

	for i in range(N):
		right[i] *= -1

	left_sum = 0
	right_sum = 0

	heap_left = []
	heap_right = []

	for i in range(N):
		left_sum += left[i]
		heapq.heappush(heap_left, left[i])
		right_sum += right[i]
		heapq.heappush(heap_right, right[i])

	temp1 = [0] * (N + 1)
	temp2 = [0] * (N + 1)

	temp1[0] = left_sum
	temp2[N] = right_sum

	for i in range(0, N):
		left_sum += a[N+i]
		heapq.heappush(heap_left, a[N+i])
		left_sum -= heapq.heappop(heap_left)
		temp1[i+1] = left_sum

	for i in range(0, N):
		right_sum -= a[N*2-1-i]
		heapq.heappush(heap_right, -a[N*2-1-i])
		right_sum -= heapq.heappop(heap_right)
		temp2[N - 1 - i] = right_sum

	ans = -1000000000
	for i in range(0, N + 1):
		x = temp1[i] + temp2[i]
		if(ans < x):
			ans = x
	print(ans)
main()

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

N = int(input())
a = list(map(int, input().split()))

left = a[0 : N]
right = a[N*2 : N*3]

for i in range(N):
	right[i] *= -1

left_sum = 0
right_sum = 0

heap_left = []
heap_right = []

for i in range(N):
	left_sum += left[i]
	heapq.heappush(heap_left, left[i])
	right_sum += right[i]
	heapq.heappush(heap_right, right[i])

temp1 = [0] * (N + 1)
temp2 = [0] * (N + 1)

temp1[0] = left_sum
temp2[N] = right_sum

for i in range(0, N):
	left_sum += a[N+i]
	heapq.heappush(heap_left, a[N+i])
	left_sum -= heapq.heappop(heap_left)
	temp1[i+1] = left_sum

for i in range(0, N):
	right_sum -= a[N*2-1-i]
	heapq.heappush(heap_right, -a[N*2-1-i])
	right_sum -= heapq.heappop(heap_right)
	temp2[N - 1 - i] = right_sum

ans = -1000000000
for i in range(0, N + 1):
	x = temp1[i] + temp2[i]
	if(ans < x):
		ans = x
print(ans)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: C++

def main():
	N = int(input())
	a = list(map(int, input().split()))

	left = a[0 : N]
	right = a[N*2 : N*3]

	for i in range(N):
		right[i] *= -1

	left_sum = 0
	right_sum = 0

	heap_left = []
	heap_right = []

	for i in range(N):
		left_sum += left[i]
		heapq.heappush(heap_left, left[i])
		right_sum += right[i]
		heapq.heappush(heap_right, right[i])

	temp1 = [0] * (N + 1)
	temp2 = [0] * (N + 1)

	temp1[0] = left_sum
	temp2[N] = right_sum

	for i in range(0, N):
		left_sum += a[N+i]
		heapq.heappush(heap_left, a[N+i])
		left_sum -= heapq.heappop(heap_left)
		temp1[i+1] = left_sum

	for i in range(0, N):
		right_sum -= a[N*2-1-i]
		heapq.heappush(heap_right, -a[N*2-1-i])
		right_sum -= heapq.heappop(heap_right)
		temp2[N - 1 - i] = right_sum

	ans = -1000000000
	for i in range(0, N + 1):
		x = temp1[i] + temp2[i]
		if(ans < x):
			ans = x
	print(ans)
main()

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

import sys
import heapq

def main():
	N = int(input())
	a = list(map(int, input().split()))

	left = a[0 : N]
	right = a[N*2 : N*3]

	for i in range(N):
		right[i] *= -1

	left_sum = 0
	right_sum = 0

	heap_left = []
	heap_right = []

	for i in range(N):
		left_sum += left[i]
		heapq.heappush(heap_left, left[i])
		right_sum += right[i]
		heapq.heappush(heap_right, right[i])

	temp1 = [0] * (N + 1)
	temp2 = [0] * (N + 1)

	temp1[0] = left_sum
	temp2[N] = right_sum

	for i in range(0, N):
		left_sum += a[N+i]
		heapq.heappush(heap_left, a[N+i])
		left_sum -= heapq.heappop(heap_left)
		temp1[i+1] = left_sum

	for i in range(0, N):
		right_sum -= a[N*2-1-i]
		heapq.heappush(heap_right, -a[N*2-1-i])
		right_sum -= heapq.heappop(heap_right)
		temp2[N - 1 - i] = right_sum

	ans = -1000000000;
	for i in range(0, N + 1):
		x = temp1[i] + temp2[i]
		if(ans < x):
			ans = x
	print(ans)
main()

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:45:9: error: expected unqualified-id before 'for'
   45 |         for i in range(0, N + 1):
      |         ^~~
Language: C++

#include <iostream>
#include <vector>


using namespace std;

int main() {
    int N; cin >> N;
    vector<long long> a(N*3);
    for (int i = 0; i < N*3; ++i) 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) {
        S[i+1] = S[i] + a[i];
        que1.push(a[i]);
    }
    for (int i = N; i < N*2; ++i) {
        long long mi = que1.top();
        if (a[i] > mi) {
            S[i+1] = S[i] - mi + a[i];
            que1.pop();
            que1.push(a[i]);
        }
        else S[i+1] = S[i];
    }

   
    vector<long long> T(N*2+ 1, 0);
    priority_queue<long long> que2;
    for (int i = 0; i < N; ++i) {
        T[i+1] = T[i] + a[N*3-1 - i];
        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];
    }

   //左の消す個数をkこと固定しておく。それの最大をかんがえるので
  
    long long res = -(1LL<<60);
    for (int i = N; i <= N*2; ++i) {
        res = max(res, S[i] - T[N*3-i]);
    }
    cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'priority_queue' was not declared in this scope
   14 |     priority_queue<long long, vector<long long>, greater<long long> > que1;
      |     ^~~~~~~~~~~~~~
a.cc:3:1: note: 'std::priority_queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
    2 | #include <vector>
  +++ |+#include <queue>
    3 | 
a.cc:14:20: error: expected primary-expression before 'long'
   14 |     priority_queue<long long, vector<long long>, greater<long long> > que1;
      |                    ^~~~
a.cc:17:9: error: 'que1' was not declared in this scope
   17 |         que1.push(a[i]);
      |         ^~~~
a.cc:20:24: error: 'que1' was not declared in this scope
   20 |         long long mi = que1.top();
      |                        ^~~~
a.cc:31:20: error: expected primary-expression before 'long'
   31 |     priority_queue<long long> que2;
      |                    ^~~~
a.cc:34:9: error: 'que2' was not declared in this scope
   34 |         que2.push(a[N*3-1 - i]);
      |         ^~~~
a.cc:37:24: error: 'que2' was not declared in this scope
   37 |         long long ma = que2.top();
      |                        ^~~~
Language: C++

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

using namespace std;

int main() {
    int n;
  	cin >> n;
    vector<long long> v(n);
  	for (int& i: v) cin >> i;
    vector<long long> ans(n + 1);
    long long left(0), right(0);
    priority_queue<long long> min_q;
    priority_queue<long long, vector<long long>, greater<long long>> max_q;
    for (int i = 0; i < n; ++i) {
        max_q.push(v[i]);
        min_q.push(v[i + 2 * n]);
        left += v[i];
        right += v[i + 2 * n];
    };
    ans[0] = left;
    ans.back() = -right;
    for (int i = n; i < 2 * n; ++i) {
        max_q.push(v[i]);
        left += v[i] - max_q.top();
        max_q.pop();
        ans[i-n+1] += left;
        min_q.push(v[3 * n - 1 - i]);
        right += v[3 * n - i - 1] - min_q.top();
        min_q.pop();
        ans[2 * n - i - 1] -= right;
    }
    long long res(-1e14);
    for (const long long& i: ans) res = max(res, i);
    cout << res;
    return 0;
};

Compiler output:
a.cc: In function 'int main()':
a.cc:12:22: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int'
   12 |         for (int& i: v) cin >> i;
      |                      ^
Language: C++

#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1<<29
#define LLINF 1LL<<60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modfact(ll a){ll b=1;FOR(i,2,a)b=b*i%MOD;return b;}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}
ll modcomb(ll n, ll k){ll b=1;k=min(n-k,k);DOWN(i,n,n-k+1)b=b*i%MOD;return b*modpow(modfact(k),MOD-2)%MOD;}
ac
ll N;
 
int main() {
    cin >> N;
    vector<ll> A(3*N);
    REP(i, 3*N) cin >> A[i];
    priority_queue<ll> Pl, Pr;
    ll sl = 0, sr = 0;
    FOR(i, 0, N-1) {
        sl += A[i];
        Pl.push(-A[i]);
        sr += A[2*N+i];
        Pr.push(A[2*N+i]);
    }
    vector<ll> left(N+1), right(N+1);
    left[0] = sl;
    right[N] = sr;
    FOR(i, 0, N-1) {
        Pl.push(-A[N+i]);
        sl = sl + A[N+i] + Pl.top();
        left[i+1] = sl;
        Pl.pop();
    }
    DOWN(i, N-1, 0) {
        Pr.push(A[N+i]);
        sr = sr + A[N+i] - Pr.top();
        right[i] = sr;
        Pr.pop();
    }
    ll ans = -LLINF;
    FOR(i, 0, N) ans = max(ans, left[i] - right[i]);
    cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:27:1: error: 'ac' does not name a type
   27 | ac
      | ^~
a.cc: In function 'int main()':
a.cc:31:12: error: 'N' was not declared in this scope
   31 |     cin >> N;
      |            ^
Language: C++

#include<bits/stdc++.h>

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

using namespace std;

int main(){
  ll n;cin>>n;
  ll a[n];
  ll lsums[100001];
  ll rsums[100001];
  lsums[0]=0, rsums[n]=0;

  rep(i,3*n)cin>>a[i];

  priority_queue<int, vector<int>, greater<int>> lq;
  priority_queue<int> rq;

  rep(i,n){
    lq.push(a[i]);
    lsums[0]+=a[i];

    rq.push(a[3*n-1-i]);
    rsums[n]+=a[3*n-1-i];
  }

  rep(i,n){
    lq.push(a[i+n]);
    lsums[i+1]=(lsums[i]+a[i+n]-lq.top());
    lq.pop();

    rq.push(a[2*n-1-i]);
    rsums[n-1-i]=(rsums[n-i]+a[2*n-1-i]-rq.top());
    rq.pop();
  }


//cout<<lsums[0]<<' '<<rsums[0]<<endl;
  int result = lsums[0]-rsums[0];
  rep(i,n){
    result=max(result, lsums[i+1]-rsums[i+1]);
  }

  cout<<result;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:15: error: no matching function for call to 'max(int&, long long int)'
   42 |     result=max(result, lsums[i+1]-rsums[i+1]);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:42:15: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   42 |     result=max(result, lsums[i+1]-rsums[i+1]);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:42:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   42 |     result=max(result, lsums[i+1]-rsums[i+1]);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<iostream>

using namespace std;

template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
using ll = long long;

 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
    cin>>n;
  ll sum=0;
  ll resum=0;
  vector<ll> A(3*n);
  priority_queue<ll> front;
  priority_queue<ll> back;

  for(int i=0;i<3*n;++i){
    cin>>A[i];
    if(i<n){
      front.push(-A[i]);
      sum+=A[i];
    }

    if(2*n-1<i){
      back.push(A[i]);
      resum+=A[i];
    }
  }

  vector<pair<ll,ll>> ans(n+1);
  ans[0].first=sum;
  ans[n].second=resum;
  
  for(int i=n;i<2*n;i++){
    front.push(-A[i]);
    sum+=A[i];

    ll a=front.top();
    sum+=a;
    front.pop();
    ans[i-n+1].first=sum;
  }

  for(int i=(2*n-1);n<=i;i--){
    back.push(A[i]);
    resum+=A[i];

    ll a=back.top();
    resum-=a;
    back.pop();
    ans[i-n].second=resum;
  }

  ll Ans=-INF;
  FOR(i,0,n+1){
    ll now=ans[i].first-ans[i].second;
    chmax(Ans,now);
  }
  cout<<Ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:74:7: error: 'i' was not declared in this scope
   74 |   FOR(i,0,n+1){
      |       ^
a.cc:74:3: error: 'FOR' was not declared in this scope
   74 |   FOR(i,0,n+1){
      |   ^~~
Language: C++

#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<iostream>

using namespace std;

template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
using ll = long long;

 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
    cin>>n;
  ll sum=0;
  ll resum=0;
  vector<ll> A(3*n);
  priority_queue<ll> front;
  priority_queue<ll> back;

  FOR(i,0,3*n){
    cin>>A[i];
    if(i<n){
      front.push(-A[i]);
      sum+=A[i];
    }

    if(2*n-1<i){
      back.push(A[i]);
      resum+=A[i];
    }
  }

  vector<pair<ll,ll>> ans(n+1);
  ans[0].first=sum;
  ans[n].second=resum;
  
  for(int i=n;i<2*n;i++){
    front.push(-A[i]);
    sum+=A[i];

    ll a=front.top();
    sum+=a;
    front.pop();
    ans[i-n+1].first=sum;
  }

  for(int i=(2*n-1);n<=i;i--){
    back.push(A[i]);
    resum+=A[i];

    ll a=back.top();
    resum-=a;
    back.pop();
    ans[i-n].second=resum;
  }

  ll Ans=-INF;
  FOR(i,0,n+1){
    ll now=ans[i].first-ans[i].second;
    chmax(Ans,now);
  }
  cout<<Ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:7: error: 'i' was not declared in this scope
   36 |   FOR(i,0,3*n){
      |       ^
a.cc:36:3: error: 'FOR' was not declared in this scope
   36 |   FOR(i,0,3*n){
      |   ^~~
Language: C++

#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<iostream>

using namespace std;

template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
using ll = long long;

 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
    cin>>n;
  ll sum=0;
  ll resum=0;
  vector<ll> A(3*n);
  priority_queue<ll> front;
  priority_queue<ll> back;

  FOR(i,0,3*n){
    cin>>A[i];
    if(i<n){
      front.push(-A[i]);
      sum+=A[i];
    }

    if(2*n-1<i){
      back.push(A[i]);
      resum+=A[i];
    }
  }

  vector<pair<ll,ll>> ans(n+1);
  ans[0].first=sum;
  ans[n].second=resum;
  
  for(int i=n;i<2*n;i++){
    front.push(-A[i]);
    sum+=A[i];

    ll a=front.top();
    sum+=a;
    front.pop();
    ans[i-n+1].first=sum;
  }

  for(int i=(2*n-1);n<=i;i--){
    back.push(A[i]);
    resum+=A[i];

    ll a=back.top();
    resum-=a;
    back.pop();
    ans[i-n].second=resum;
  }

  ll Ans=-INF;
  FOR(i,0,n+1){
    ll now=ans[i].first-ans[i].second;
    chmax(Ans,now);
  }
  co(Ans)
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:7: error: 'i' was not declared in this scope
   36 |   FOR(i,0,3*n){
      |       ^
a.cc:36:3: error: 'FOR' was not declared in this scope
   36 |   FOR(i,0,3*n){
      |   ^~~
a.cc:78:3: error: 'co' was not declared in this scope; did you mean 'cos'?
   78 |   co(Ans)
      |   ^~
      |   cos
Language: C++

#include <iostream>
#include <tuple>
#include <vector>
#include <queue>
#include <functional>

int main(){
  int N;
  std::cin >> N;

  std::vector<int> a_arr(3*N);
  for(int i = 0; i < 3*N; i++) std::cin >> a_arr[i];

  std::priority_queue<int, std::vector<int>, std::function<bool(int,int)>> left([&](int l, int r){return a_arr[l]>a_arr[r];}), right([&](int l, int r){return a_arr[l]>a_arr[r];});
  for(int i = 0; i < N; i++) left.push(i);

  std::vector<int> right_index(2*N);
  std::vector<int> remove_arr(3*N);
  for(int i = N; i < 3*N; i++) right_index[i-N] = i;
  std::sort(right_index.begin(), right_index.end(), [&](int l, int r){return a_arr[l]>a_arr[r];});
  for(int i = 0; i < N; i++){
    right.push(right_index[i]);
    remove_arr[right_index[i]] = 1;
  }
  long long sum_left = 0, sum_right = 0;
  for(int i = 0; i < N; i++) sum_left += a_arr[i];
  for(int i = N; i < 2*N; i++) sum_right += a_arr[right_index[i]];

  long long max_sum_diff = sum_left-sum_right;
  for(int th = N; th < 2*N; th++){
    if(remove_arr[th] == 0){
      int ri;
      while(true){
        ri = right.top();
        right.pop();
        if(ri > th) break;
      }
      remove_arr[ri] = 0;
      sum_right += a_arr[ri] - a_arr[th];
    }
    left.push(th);
    int li = left.top();
    left.pop();
    sum_left += a_arr[th] - a_arr[li];
    max_sum_diff = std::max(max_sum_diff, sum_left-sum_right);
  }

  std::cout << max_sum_diff << std::endl;

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   20 |   std::sort(right_index.begin(), right_index.end(), [&](int l, int r){return a_arr[l]>a_arr[r];});
      |        ^~~~
      |        qsort
Language: C++

#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONGLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions
template <typename T>
using priority_queue_lo = priority_queue<T, vector<T>, greater<T>>;
#endif


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

    int N;  cin >> N;
    vl A(N*3);
    REP(i, N*3) cin >> A[i];

    priority_queue_lo<ll> pql;
    ll sum1 = 0;
    REP(i, N) {
        pql.push(A[i]);
        sum1 += A[i];
    }

    priority_queue<ll> pq;
    ll sum2 = 0;
    FOR(i, N*2, N*3) {
        pq.push(A[i]);
        sum2 += A[i];
    }

    vl sumL(N+1,0);
    sumL[0] = sum1;
    FOR(k,N,2*N) {
        pql.push(A[k]);
        sum1 += A[k];
        sum1 -= pql.top();
        sumL[k-N+1] = sum1;
        pql.pop();
    }

    vl sumR(N+1,0);
    sumR[N] = sum2;
    for (int k = 2 * N - 1; k >= N; k--) {
        pq.push(A[k]);
        sum2 += A[k];
        sum2 -= pq.top();
        sumR[k-N] = sum2;
        pq.pop();
    }

    ll ans = -LINF;
    REP(i,N) {
        ans = max(ans, sumL[i] - sumR[i]);
    }

    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: 'LONGLONG_MAX' was not declared in this scope; did you mean 'LONG_LONG_MAX'?
   13 | #define LINF (LONGLONG_MAX/2)
      |               ^~~~~~~~~~~~
a.cc:71:15: note: in expansion of macro 'LINF'
   71 |     ll ans = -LINF;
      |               ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
typedef long long ll;
const ll INF = 1e15;

int main(){
  int n;
  cin >> n;
  ll a[3*n];
  rep(i, 3*n) cin >> a[i];
  ll suml[n+1], sumr[n+1];
  suml[0] = 0, sumr[0] = 0;
  priority_queue<ll, greater<ll>> sl;
  priority_queue<ll> sr;
  rep(i, n){
    sl.push(a[i]); suml += a[i];
    sr.push(a[3*n-1-i]); sumr += a[3*n-i-1];
  rep(i, n){
    sl.push(a[n+i]);
    suml[i+1] = snml[i] + a[n+i] - sl.front();
    sl.pop();
    sr.push(a[2*n-1-i]);
    suml[i+1] = snml[i] + a[2*n-1-i] - sr.front();
    sr.pop();
  }
  ll ans = -INF;
  rep(i, n+1) ans = max(ans, suml[i]-sr[n-i]);
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:32: error: no type named 'value_type' in 'struct std::greater<long long int>'
   14 |   priority_queue<ll, greater<ll>> sl;
      |                                ^~
a.cc:14:32: error: template argument 3 is invalid
a.cc:17:8: error: request for member 'push' in 'sl', which is of non-class type 'int'
   17 |     sl.push(a[i]); suml += a[i];
      |        ^~~~
a.cc:17:25: error: incompatible types in assignment of 'll' {aka 'long long int'} to 'll [(n + 1)]' {aka 'long long int [(n + 1)]'}
   17 |     sl.push(a[i]); suml += a[i];
      |                    ~~~~~^~~~~~~
a.cc:18:31: error: incompatible types in assignment of 'll' {aka 'long long int'} to 'll [(n + 1)]' {aka 'long long int [(n + 1)]'}
   18 |     sr.push(a[3*n-1-i]); sumr += a[3*n-i-1];
      |                          ~~~~~^~~~~~~~~~~~~
a.cc:20:8: error: request for member 'push' in 'sl', which is of non-class type 'int'
   20 |     sl.push(a[n+i]);
      |        ^~~~
a.cc:21:17: error: 'snml' was not declared in this scope; did you mean 'suml'?
   21 |     suml[i+1] = snml[i] + a[n+i] - sl.front();
      |                 ^~~~
      |                 suml
a.cc:21:39: error: request for member 'front' in 'sl', which is of non-class type 'int'
   21 |     suml[i+1] = snml[i] + a[n+i] - sl.front();
      |                                       ^~~~~
a.cc:22:8: error: request for member 'pop' in 'sl', which is of non-class type 'int'
   22 |     sl.pop();
      |        ^~~
a.cc:24:43: error: 'class std::priority_queue<long long int>' has no member named 'front'
   24 |     suml[i+1] = snml[i] + a[2*n-1-i] - sr.front();
      |                                           ^~~~~
a.cc:28:40: error: no match for 'operator[]' (operand types are 'std::priority_queue<long long int>' and 'int')
   28 |   rep(i, n+1) ans = max(ans, suml[i]-sr[n-i]);
      |                                        ^
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

from heapq import*
n,*a=map(int,open(0).read().split())
#print(a)
ans=-float("inf")
for i in range(n,2*n+1):
    score=0
    tmp=a[:i]
    heapify(tmp)
#    print(tmp)
    for j in range(i-n):
        heappop(tmp)
    score+=sum(tmp)
    tmp=a[i:]
    heapify(tmp)
#    print(tmp)
    score-=sum(heappop(tmp)for r in range(n))

    ans=max(score,ans)
print(ans)

Compiler output:
a.cc:3:2: error: invalid preprocessing directive #print
    3 | #print(a)
      |  ^~~~~
a.cc:9:6: error: invalid preprocessing directive #print
    9 | #    print(tmp)
      |      ^~~~~
a.cc:15:6: error: invalid preprocessing directive #print
   15 | #    print(tmp)
      |      ^~~~~
a.cc:1:1: error: 'from' does not name a type
    1 | from heapq import*
      | ^~~~
Language: C++

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

int n;
ll a[3 * MAX_N];

priority_queue<ll, vector<ll>, greater<ll>> leftpq;
priority_queue<ll> rightpq;

ll l, r;
ll scorel[3 * MAX_N];
ll scorer[3 * MAX_N];
ll ans;

int main(void){
    // Here your code !
    scanf("%d", &n);
    for (int i = 0; i < 3 * n; ++i) {
      scanf("%lld", &a[i]);
    }

    for (int i = 0; i < n; ++i) {
      leftpq.push(a[i]);
      l += a[i];
    }
    scorel[n] = l;

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

    for (int i = n; i < 2 * n; ++i) {
      leftpq.push(a[i]);
      l += a[i];
      l -= leftpq.top();
      leftpq.pop();
      scorel[i + 1] = l;
    }

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

    ans = scorel[n] - scorer[n];
    for (int i = n; i <= 2 * n; ++i) {
      ans = max(ans, scorel[i] - scorer[i]);
    }

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


Compiler output:
a.cc:10:10: error: 'MAX_N' was not declared in this scope; did you mean 'MAX'?
   10 | ll a[3 * MAX_N];
      |          ^~~~~
      |          MAX
a.cc:16:15: error: 'MAX_N' was not declared in this scope; did you mean 'MAX'?
   16 | ll scorel[3 * MAX_N];
      |               ^~~~~
      |               MAX
a.cc:17:15: error: 'MAX_N' was not declared in this scope; did you mean 'MAX'?
   17 | ll scorer[3 * MAX_N];
      |               ^~~~~
      |               MAX
a.cc: In function 'int main()':
a.cc:24:22: error: 'a' was not declared in this scope
   24 |       scanf("%lld", &a[i]);
      |                      ^
a.cc:28:19: error: 'a' was not declared in this scope
   28 |       leftpq.push(a[i]);
      |                   ^
a.cc:31:5: error: 'scorel' was not declared in this scope
   31 |     scorel[n] = l;
      |     ^~~~~~
a.cc:34:20: error: 'a' was not declared in this scope
   34 |       rightpq.push(a[i]);
      |                    ^
a.cc:37:5: error: 'scorer' was not declared in this scope
   37 |     scorer[2 * n] = r;
      |     ^~~~~~
a.cc:40:19: error: 'a' was not declared in this scope
   40 |       leftpq.push(a[i]);
      |                   ^
a.cc:48:20: error: 'a' was not declared in this scope
   48 |       rightpq.push(a[i]);
      |                    ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
#define int ll
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<int> v(3*n);
    REP(i,3*n) cin>>v[i];
    priority_queue<int, vector<int>,greater<int>> lque;
    priority_queue<int, vector<int>> sque;
    int ls=0,ss=0;
    vector<int> lv;
    vector<int> sv;
    REP(i,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,n){
        lque.push(v[n+i]);
        sque.push(v[2*n-i-1]);
        ls += v[n+i] - lque.top();
        ss += v[2*n - i - 1] - sque.top();
        lv.push_back(ls);
        sv.push_back(ss);
        sque.pop();
        lque.pop();
    }
    REP(i,lv.size()) ans=max(ans,lv[i]-sv[n-i]);
    cout<<ans<<endl;

}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:43:19: warning: integer overflow in expression of type 'int' results in '1486618624' [-Woverflow]
   43 |     int ans = -INF*INF;
      |                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n),b(n),c(n);
  int amin=1000000001,cmax=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    amin=min(amin,a[i]);
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
  }
  for(int i=0;i<n;i++){
    cin>>c[i];
    cmax=max(cmax,c[i]);
  }
  

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

#include<bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define INF (1<<30)
#define ll long long
using namespace std;
ll f(vector<int> a,vector<ll>s,int t){
  int e=a.size();
  int n=e/3;

  sort(&a[0],&a[t]);
  sort(&a[t],&a[e],greater<int>());
  //rep(i,7)cout<<s[i]<<endl;

  ll ret=s[t];
  //cout<<ret<<endl;
  rep(i,t-n)ret-=a[i];
  //cout<<ret<<endl;
  ret-=s[3*n]-s[t];
  //cout<<ret<<endl;

  rep(i,2*n-t)ret+=a[t+i];
  //cout<<ret<<endl;

  return ret;
}
int main(){
  int n;
  cin>>n;
  vector<int> a
  vector<ll>s;
  s.push_back(0);
  rep(i,3*n){int t; cin>>t; a.push_back(t);s.push_back(s.back()+t);}
  ll  ans=-INF;//f(a,s,3);
  for (int i=n;i<=2*n;i++) ans=max(ans,f(a,s,i));
    cout<<ans<<endl;;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:3: error: expected initializer before 'vector'
   30 |   vector<ll>s;
      |   ^~~~~~
a.cc:31:3: error: 's' was not declared in this scope
   31 |   s.push_back(0);
      |   ^
a.cc:32:29: error: 'a' was not declared in this scope
   32 |   rep(i,3*n){int t; cin>>t; a.push_back(t);s.push_back(s.back()+t);}
      |                             ^
a.cc:34:42: error: 'a' was not declared in this scope
   34 |   for (int i=n;i<=2*n;i++) ans=max(ans,f(a,s,i));
      |                                          ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define INF (1<<30)
#define ll long long
using namespace std;
ll f(vector<int> a,vector<ll>s,int t){
  int e=a.size();
  int n=e/3;

  sort(&a[0],&a[t]);
  sort(&a[t],&a[e],greater<int>());
  //rep(i,7)cout<<s[i]<<endl;

  ll ret=s[t];
  //cout<<ret<<endl;
  rep(i,t-n)ret-=a[i];
  //cout<<ret<<endl;
  ret-=s[3*n]-s[t];
  //cout<<ret<<endl;

  rep(i,2*n-t)ret+=a[t+i];
  //cout<<ret<<endl;

  return ret;
}
int main(){
  int n;
  cin>>n;
  vector<int> a
  vecotr<ll>s;
  s.push_back(0);
  rep(i,3*n){int t; cin>>t; a.push_back(t);s.push_back(s.back()+t);}
  ll  ans=-INF;//f(a,s,3);
  for (int i=n;i<=2*n;i++) ans=max(ans,f(a,s,i));
    cout<<ans<<endl;;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:3: error: expected initializer before 'vecotr'
   30 |   vecotr<ll>s;
      |   ^~~~~~
a.cc:31:3: error: 's' was not declared in this scope
   31 |   s.push_back(0);
      |   ^
a.cc:32:29: error: 'a' was not declared in this scope
   32 |   rep(i,3*n){int t; cin>>t; a.push_back(t);s.push_back(s.back()+t);}
      |                             ^
a.cc:34:42: error: 'a' was not declared in this scope
   34 |   for (int i=n;i<=2*n;i++) ans=max(ans,f(a,s,i));
      |                                          ^