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

#include <stdio.h>
#include <math.h>

#define MAX 1000

int main(){
  int n,m;

  long long x[MAX] = {};
  long long y[MAX] = {};
  long long z[MAX] = {};

  long long ans = 0;

  scanf("%d%d", &n, &m);

  for(int i = 0; i < n; i++){
    scanf("%lld%lld%lld", &x[i],&y[i],&z[i]);
  }

  for(int i = 0; i < (1 << n); i++){ //bit全探索
    int count = 0;
    int digit = 0;
    long long tempx = 0, tempy = 0, tempz = 0, tempans = 0;

    for (int j = 1; j < 1 << n; j = j << 1){ //bit桁ごとに調べる
      if ((i & j) == j){
        //その桁にフラグが立っていたら
        count++; //フラグ数の検出
        tempx += x[digit];
        tempy += y[digit]; 　
        tempz += z[digit]; 　
      }
      digit++;
    }

    if(count == m){
      tempans = abs(tempx) + abs(tempy) + abs(tempz);
      if(ans < tempans) ans = tempans;
    }
  }

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


Compiler output:
main.c: In function 'main':
main.c:31:28: error: stray '\343' in program
   31 |         tempy += y[digit]; <U+3000>
      |                            ^~~~~~~~
main.c:32:28: error: stray '\343' in program
   32 |         tempz += z[digit]; <U+3000>
      |                            ^~~~~~~~
main.c:38:17: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   38 |       tempans = abs(tempx) + abs(tempy) + abs(tempz);
      |                 ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c:38:21: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   38 |       tempans = abs(tempx) + abs(tempy) + abs(tempz);
      |                     ^~~~~
<built-in>: note: built-in 'abs' declared here
main.c:38:34: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   38 |       tempans = abs(tempx) + abs(tempy) + abs(tempz);
      |                                  ^~~~~
<built-in>: note: built-in 'abs' declared here
main.c:38:47: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   38 |       tempans = abs(tempx) + abs(tempy) + abs(tempz);
      |                                               ^~~~~
<built-in>: note: built-in 'abs' declared here
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long[][] k = {{1, 1, 1}, {1, 1, -1}, {1, -1, 1}, {-1, 1, 1}, {-1, -1, 1}, {-1, 1, -1}, {1, -1, -1}, {-1, -1, -1}};
        long[][] sum = new long[8][n];

        for (int i = 0; i < n; i++) {
            for (int v = 0; v < 8; v++) {
                long x = sc.nextLong(), y = sc.nextLong(), z = sc.nextLong();
                sum[v][i] = x * k[v][0] + y * k[v][1] + z * k[v][2];
            }
        }

        long ans = 0;
        for (int v = 0; v < 8; v++) {
            Arrays.sort(sum[v]);
            long lower = 0, upper = 0;
            for (int i = 0, c = n - 1; i < m; i++, c--) {
                lower += sum[v][i];
                upper += sum[v][c];
            }
            ans = Math.max(ans, Math.max(Math.abs(lower), Math.abs(upper)));
        }

        System.out.println(ans);
    }

Compiler output:
Main.java:31: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char** argv){
    int N, M;
    cin >> N >> M;
    vector<long> cakes;
    for(int i=0; i < N; ++i){
        long x, y, z;
        cin >> x >> y >> z; 
        cakes.pushback(labs(x) + labs(y) + labs(z));
    }
    sort(cakes.begin(), cakes.end(), greater<long>());
    long total = 0;
    for(int i=0; i < M; ++i){
        total += cakes[i];
    }
    cout << total << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:17:15: error: 'class std::vector<long int>' has no member named 'pushback'; did you mean 'push_back'?
   17 |         cakes.pushback(labs(x) + labs(y) + labs(z));
      |               ^~~~~~~~
      |               push_back
Language: C

#include <stdio.h>
#define abs(x) (x>0) ? x : -x

int main(void){
  
  int a,i,j,k,n,m,pick;
  long long int posi[3],nega[3],ans,max,min,tmp[3],x[1000],y[1000],z[1000];
  
  scanf("%d %d",&n,&m);
  for( i=0; i<n; i++) scanf("%lld %lld %lld",&x[i],&y[i],&z[i]);
  
  for( posi[0]=0,posi[1]=0,posi[2]=0,j=0; j<m; j++){
    for( max=0, i=0, k=n; i<k; i++){
      tmp[0] = abs( posi[0] + x[i] );
      tmp[1] = abs( posi[1] + y[i] );
      tmp[2] = abs( posi[2] + z[i] );
      
      if( i==0 ){
        max += tmp[0];
        max += tmp[1];
        max += tmp[2];
        pick = 0;
      }
      else if( max < tmp[0] + tmp[1] +tmp[2] ){
        max = tmp[0] + tmp[1] +tmp[2];
        pick=i;
      }
    }
    posi[0] += x[pick];
    posi[1] += y[pick];
    posi[2] += z[pick];

    
    k--;
    x[pick] = x[k];
    y[pick] = y[k];
    z[pick] = z[k];
  }
  
  for( nega[0]=0,nega[1]=0,nega[2]=0,j=0; j<m; j++){
    for( min=0, i=0, k=n; i<k; i++){
      tmp[0] = abs( nega[0] + x[i] );
      tmp[1] = abs( nega[1] + y[i] );
      tmp[2] = abs( nega[2] + z[i] );
      
      if( i==0 ){
        max += tmp[0];
        max += tmp[1];
        max += tmp[2];
        pick = 0;
      }
      else if( max > tmp[0] + tmp[1] +tmp[2] ){
        min = tmp[0] + tmp[1] +tmp[2];
        pick=i;
      }
    }
    nega[0] += x[pick];
    nega[1] += y[pick];
    nega[2] += z[pick];
    
    k--;
    x[pick] = x[k];
    y[pick] = y[k];
    z[pick] = z[k];
  }
  
  
  ( nega[0] + nega[1] + nega[2] < posi[0] + posi[1] + posi[2] ) ?
    ans = posi[0] + posi[1] + posi[2] :
    ans = nega[0] + nega[1] + nega[2] ;
  printf("%lld",ans);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:70:9: error: lvalue required as left operand of assignment
   70 |     ans = nega[0] + nega[1] + nega[2] ;
      |         ^
Language: C++

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

int main() {
	int N, M, i, x, y, z;
	long long score[1000], max; 
	cin >> N >> M;
	for (i = 0; i < n; i++) {
		cin >> x >> y >> z;
		score[i] = long long(fabs(x) + fabs(y) + fabs(z));
	}
	sort(score, score + N, greater<long long>());
	
	max = 0;
	for (i = 0; i < M; i++;) {
		max += score[i];
	}
	cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: 'n' was not declared in this scope
   10 |         for (i = 0; i < n; i++) {
      |                         ^
a.cc:12:28: error: expected primary-expression before 'long'
   12 |                 score[i] = long long(fabs(x) + fabs(y) + fabs(z));
      |                            ^~~~
a.cc:17:31: error: expected ')' before ';' token
   17 |         for (i = 0; i < M; i++;) {
      |             ~                 ^
      |                               )
a.cc:17:32: error: expected primary-expression before ')' token
   17 |         for (i = 0; i < M; i++;) {
      |                                ^
Language: C++

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

int main() {
	int N, M, i, x, y, z,  max;
	long long score[1000]; 
	cin >> N >> M;
	for (i = 0; i < n; i++) {
		cin >> x >> y >> z;
		score[i] = long long(fabs(x) + fabs(y) + fabs(z));
	}
	sort(score, score + N, greater<long long>());
	
	max = 0;
	for (i = 0; i < M; i++;) {
		max += score[i];
	}
	cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: 'n' was not declared in this scope
   10 |         for (i = 0; i < n; i++) {
      |                         ^
a.cc:12:28: error: expected primary-expression before 'long'
   12 |                 score[i] = long long(fabs(x) + fabs(y) + fabs(z));
      |                            ^~~~
a.cc:17:31: error: expected ')' before ';' token
   17 |         for (i = 0; i < M; i++;) {
      |             ~                 ^
      |                               )
a.cc:17:32: error: expected primary-expression before ')' token
   17 |         for (i = 0; i < M; i++;) {
      |                                ^
Language: C++

#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int x[1010],y[1010],z[1010],ans,n,c,b,t,p;
void dfs(int i,int sum)
{
	int d=0;
	b+=x[i];
	t+=y[i];
	p+=z[i];
	if (abs(b)+abs(t)+abs(p)>sum)
	{
		sum=abs(b)+abs(t)+abs(p);
		c--;
		d=1;
	}
	if (c>0) void(i+1,sum);
	if (sum>ans) ans=sum;
	if (d==1)
		c++;
	b=b-x[i];
	t=t-y[i];
	p=p-z[i];
	return;
}
int main()
{
	scanf("%d%d",&n,&c);;
	for(int i=1;i<=n;i++)
	    scanf("%d%d%d",&x[i],&y[i],&z[i]);
	dfs(1,0);
	printf("%d",ans);
//	system("pause");
	return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:20:30: error: expression list treated as compound expression in functional cast [-fpermissive]
   20 |         if (c>0) void(i+1,sum);
      |                              ^
Language: C++

#include<iostream>

using namespace std;


 long int z(int i) {
	if (i == 0) {
		return 1;
	}
	else {
		return -1;
	}
}

int main() {
	int n,m;
	cin >> n >> m;
	 long int** x = new long long int*[n];
	for (int i = 0; i < n; i++) {
		x[i] = new  long int[3];
	}
	for (int i = 0; i < n; i++) {
		cin >> x[i][0] >> x[i][1] >> x[i][2];
	}
	 long int sumx = 0;
	 long int* y = new long long int[n];
	for (int j = 0; j < 2; j++) {
		for (int k = 0; k < 2; k++) {
			for (int l = 0; l < 2; l++) {
				for (int i = 0; i < n; i++) {
					y[i] = 0;
					y[i] = z(j)*x[i][0] + z(k)*x[i][1] + z(l)*x[i][2];
				}
				 long int sum = 0;
				for (int i = 0; i < m; i++) {
					int a;
					 long int max = 0;
					for (int j = 0; j < n; j++) {
						if (max < y[j]) {
							max = y[j];
							a = j;
						}
					}
					sum += max;
					y[a] = 0;
				}
				if (sum > sumx) {
					sumx = sum;
				}
			}
		}
	}
	cout << sumx;
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:45: error: invalid conversion from 'long long int**' to 'long int**' [-fpermissive]
   18 |          long int** x = new long long int*[n];
      |                                             ^
      |                                             |
      |                                             long long int**
a.cc:26:43: error: invalid conversion from 'long long int*' to 'long int*' [-fpermissive]
   26 |          long int* y = new long long int[n];
      |                                           ^
      |                                           |
      |                                           long long int*
Language: Java

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		int M=sc.nextInt();
		long[] x=new long[N],y=new long[N],z=new long[N];
		for(int i=0; i<N; i++) {
			x[i]=sc.nextLong();
			y[i]=sc.nextLong();
			z[i]=sc.nextLong();
		}
		long zf=-1;
		int[] select=new int[M];
		for(int i=0; i<M; i++) {select[i]=M-i;}
		for(;select[M-1]<N;select[0]++) {
			for(int k=0; k<M-1; k++) {
				if(select[k]>=N) {select[k]=0;select[k+1]++;}
			}
			if(select[M-1]==N)break;
			boolean breakf=false;
			for(int o=0; o<M; o++) {
				for(int p=0; p<M; p++) {
					if(p!=o&&select[p]==select[o]) {breakf=true;}
				}
			}
			if(breakf) {continue;}
 
			long scoreX=0,scoreY=0,scoreZ=0;
			for(int i=0; i<M; i++) {
				scoreX+=x[select[i]];
				scoreY+=y[select[i]];
				scoreZ+=z[select[i]];
			}
			long scoreT=Math.abs(scoreX)+Math.abs(scoreY)+Math.abs(scoreZ);
			//System.out.prlongln(scoreT);
			if(zf==-1||scoreT>zf) {
				zf=scoreT;
			}
		}
		System.out.println(zf);
	}
 
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
long long int a[1005][3];
long long int n,m,mx;
//xはこれまでの個数
//yは今検討中
//z1,2,3はこれまでの値
void dfs(long long int y,long long int x,long long int z1,long long int z2,long long int z3) {
	
	if (x == m) {mx = max(abs(z1)+abs(z2)+abs(z3),mx);}
	else if (y != n) {
		dfs(y+1,x+1,z1+a[y][0],z2+a[y][1],z3+a[y][2]);
		dfs(y+1,x,z1,z2,z3);
	}
	
}

long long int main() {
	mx = 0;
    cin >> n >> m;
    for (long long int i = 0;i < n;i++) {
    	for (long long int j = 0;j < 3;j++) cin >> a[i][j];
    }
	dfs(0,0,0,0,0);
	cout << mx;
}

Compiler output:
a.cc:20:11: error: '::main' must return 'int'
   20 | long long int main() {
      |           ^~~
Language: C++

/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const ll inf = 1<<54;
const int N =1100;
int n , m ;
int a,b,c;
bool vis[N][N];
ll mem[N][N];
ll x[N],y[N],z[N];
ll dp ( int i , int rem ) {
if ( rem == 0 ) {
    return mem[i][j]=0LL ;
}
if  (i == n+1 ) {
    return -inf ;
}
if ( vis[i][rem] ) return mem[i][rem] ;
  vis[i][rem] =  1 ;
  mem[i][rem] = dp ( i+1 , rem );
  return mem[i][rem] = max ( mem[i][rem] , dp(i+1,rem-1)+a*x[i]+b*y[i]+c*z[i] );
}
int main ( )
{
    scanf("%d %d",&n,&m);
    for(int i= 1; i<=n; i++)scanf("%lld %lld %lld",x+i,y+i,z+i);
    ll ANS =0;

    for(a=-1; a<2; a+=2)
        for(b=-1; b<2; b+=2)
            for(c=-1; c<2; c+=2)
            {
                memset(vis,0,sizeof vis);
                ANS=max(ANS,dp(1,m));
            }
    printf("%lld\n",ANS);
    return 0 ;
}


Compiler output:
a.cc:15:17: warning: left shift count >= width of type [-Wshift-count-overflow]
   15 | const ll inf = 1<<54;
      |                ~^~~~
a.cc: In function 'll dp(int, int)':
a.cc:24:19: error: 'j' was not declared in this scope
   24 |     return mem[i][j]=0LL ;
      |                   ^
Language: C++

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

int N, M;
long* X;
long* Y;
long* Z ;
long LONG_MIN = –2147483648;

long saiki(int left, int start, long x, long y, long z){
    if(left == 0){
        return abs(x) + abs(y) + abs(z);
    }
    else if(N - start == left){
        for(int i = start; i < N; i ++){
            x += X[i];
            y += Y[i];
            z += Z[i];
        }
        return abs(x) + abs(y) + abs(z);
    }
    else{
        // eat
        long eat = saiki(left - 1, start + 1, x + X[start], y + Y[start], z + Z[start]);
        // not eat
        long notEat = saiki(left, start + 1, x, y, z);
        if(eat > notEat){
            return eat;
        }
        else{
            return notEat;
        }
    }
}

int main(){

    cin >> N >> M;
    X = new long[N];
    Y = new long[N];
    Z = new long[N];
    for(int i = 0; i < N; i ++){
        cin >> X[i] >> Y[i] >> Z[i];
    }

    long max = LONG_MIN;


    for(long x_fugou = -1; x_fugou < 2; x_fugou += 2){
        for(long y_fugou = -1; y_fugou < 2; y_fugou += 2){
            for(long z_fugou = -1; z_fugou < 2; z_fugou += 2){
                long result = 0;
                long* scores = new long[N];
                for(long i = 0; i < N; i ++){
                    scores[i] = X[i] * x_fugou + Y[i] * y_fugou + Z[i] * z_fugou;
                }
                sort(scores, scores+N);
                long finalScore = 0;
                for(long i = 0; i < M; i ++){
                    finalScore += scores[N - i - 1];
                }
                if(max < finalScore){
                    max = finalScore;
                }
            }
        }
    }

    //long result = saiki(M, 0, 0, 0, 0);

    cout << max << endl;  
    
    return 0;
}

Compiler output:
a.cc:10:17: error: extended character – is not valid in an identifier
   10 | long LONG_MIN = –2147483648;
      |                 ^
a.cc:10:17: error: '\U000020132147483648' was not declared in this scope
   10 | long LONG_MIN = –2147483648;
      |                 ^~~~~~~~~~~
Language: C++

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

int N, M;
long* X;
long* Y;
long* Z ;

long saiki(int left, int start, long x, long y, long z){
    if(left == 0){
        return abs(x) + abs(y) + abs(z);
    }
    else if(N - start == left){
        for(int i = start; i < N; i ++){
            x += X[i];
            y += Y[i];
            z += Z[i];
        }
        return abs(x) + abs(y) + abs(z);
    }
    else{
        // eat
        long eat = saiki(left - 1, start + 1, x + X[start], y + Y[start], z + Z[start]);
        // not eat
        long notEat = saiki(left, start + 1, x, y, z);
        if(eat > notEat){
            return eat;
        }
        else{
            return notEat;
        }
    }
}

int main(){

    cin >> N >> M;
    X = new long[N];
    Y = new long[N];
    Z = new long[N];
    for(int i = 0; i < N; i ++){
        cin >> X[i] >> Y[i] >> Z[i];
    }

    long max = LONG_MIN;


    for(long x_fugou = -1; x_fugou < 2; x_fugou += 2){
        for(long y_fugou = -1; y_fugou < 2; y_fugou += 2){
            for(long z_fugou = -1; z_fugou < 2; z_fugou += 2){
                long result = 0;
                long* scores = new long[N];
                for(long i = 0; i < N; i ++){
                    scores[i] = X[i] * x_fugou + Y[i] * y_fugou + Z[i] * z_fugou;
                }
                sort(scores, scores+N);
                long finalScore = 0;
                for(long i = 0; i < M; i ++){
                    finalScore += scores[N - i - 1];
                }
                if(max < finalScore){
                    max = finalScore;
                }
            }
        }
    }

    //long result = saiki(M, 0, 0, 0, 0);

    cout << max << endl;  
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:16: error: 'LONG_MIN' was not declared in this scope
   47 |     long max = LONG_MIN;
      |                ^~~~~~~~
a.cc:4:1: note: 'LONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C

#include <stdio.h>
#include <algorithm.h>
using namespace std;

int main(void) {
	int n, m;
	long long x[1005], y[1005], z[1005];
	scanf("%d%d", &n, &m);
	for(int i=0; i<n; i++){
		scanf("%lld%lld%lld", &x[i], &y[i], & z[i]);
	}

		long long sum[1005],ans=0,max=0;
	//+++
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = x[i] + y[i] + z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//++-
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = x[i] + y[i] - z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//+-+
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = x[i] - y[i] + z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//+--
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = x[i] - y[i] - z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//-++
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = (-1) * x[i] + y[i] + z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//-+-
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = (-1) * x[i] + y[i] - z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//--+
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = (-1) * x[i] - y[i] + z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//---
	max=0;
		for(int i=0; i<n; i++){
		sum[i] = (-1) * x[i] - y[i] - z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}

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

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

#include <iostream>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef std::pair<std::pair<ll,ll>,ll> tuple;
int N, M;
ll x[1001], y[1001], z[1001];
ll ans=0;
ll solve(int i, int chonum, ll nowx, ll nowy, ll nowz){
  if(chonum == M)return ans=std::max(ans, abs(nowx)+abs(nowy)+ abs(nowz));
  else if(i==N) return 0;
  ll s=solve(i+1,chonum+1,nowx+x[i], nowy+y[i], nowz+z[i]);
  ll s2=solve(i+1,chonum, nowx, nowy, nowz);
  ll val=std::max(s,s2);
  return val;

}
  

int main(){
  std::cin>>N>>M;
  for(int i=0;i<N;++i){

    std::cin>>x[i]>>y[i]>>z[i];
  }
  std::cout<<solve(0,0,0,0,0)<<std::endl;

  return 0;
}


Compiler output:
a.cc: In function 'll solve(int, int, ll, ll, ll)':
a.cc:11:37: error: no matching function for call to 'max(ll&, int)'
   11 |   if(chonum == M)return ans=std::max(ans, abs(nowx)+abs(nowy)+ abs(nowz));
      |                             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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: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:11:37: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   11 |   if(chonum == M)return ans=std::max(ans, abs(nowx)+abs(nowy)+ abs(nowz));
      |                             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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,
                 from a.cc:3:
/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:11:37: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   11 |   if(chonum == M)return ans=std::max(ans, abs(nowx)+abs(nowy)+ abs(nowz));
      |                             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include <stdio.h>
#include <algorithm>
using namespace std;

int main(void) {
	int n, m;
	long long x[1005], y[1005], z[1005];
	scanf("%d%d", &n, &m);
	for(int i=0; i<n; i++){
		scanf("%lld%lld%lld", &x[i], &y[i], & z[i]);
	}

		long long sum[1005],ans=0,max=0;
	//+++
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = x[i] + y[i] + z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//++-
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = x[i] + y[i] - z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//+-+
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = x[i] - y[i] + z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//+--
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = x[i] - y[i] - z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//-++
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = (-1) * x[i] + y[i] + z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//-+-
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = (-1) * x[i] + y[i] - z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//--+
	max=0;
	for(int i=0; i<n; i++){
		sum[i] = (-1) * x[i] - y[i] + z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}
	//---
	max=0;
		for(int i=0; i<n; i++){
		sum[i] = (-1) * x[i] - y[i] - z[i];
	}
	sort(sum, sum+n);
	for(int i=n-1; i>=n-m; i--){
		max += sum[i];
	}
	if(max >= ans){
		ans = max;
	}

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

Compiler output:
main.c:2:10: fatal error: algorithm: No such file or directory
    2 | #include <algorithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
using namespace std;
int main()
{
	//int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	long long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0, k = 0, l = 0, ans = 0;
	//cout << LONG_MAX << endl;
	//string s[1001];
	long long n, m;
	long long x[1001] = {}, y[1001] = {}, z[1001] = {}, num[1001] = {};
	cin >> n;
	cin >> m;
	for ( a = 0; a < n; a++)
	{
		cin >> x[a];
		cin >> y[a];
		cin >> z[a];
	}
	c = LLONG_MIN;
	for (a = 0; a < n; a++)
	{
		num[a] = x[a] + y[a] + z[a];
	}
	sort(num, num + n, greater<int>());
	b = 0;
	for (a = 0; a < m; a++)
	{
		b += num[a];
	}
	c = max(c,abs(b));
	for (a = 0; a < n; a++)
	{
		num[a] = x[a] + y[a] - z[a];
	}
	sort(num, num + n, greater<int>());
	b = 0;
	for (a = 0; a < m; a++)
	{
		b += num[a];
	}
	c = max(c,abs(b));
	for (a = 0; a < n; a++)
	{
		num[a] = x[a] - y[a] + z[a];
	}
	sort(num, num + n, greater<int>());
	b = 0;
	for (a = 0; a < m; a++)
	{
		b += num[a];
	}
	c = max(c,abs(b));
	for (a = 0; a < n; a++)
	{
		num[a] = x[a] - y[a] - z[a];
	}
	sort(num, num + n, greater<int>());
	b = 0;
	for (a = 0; a < m; a++)
	{
		b += num[a];
	}
	c = max(c,abs(b));
	for (a = 0; a < n; a++)
	{
		num[a] = -x[a] + y[a] + z[a];
	}
	sort(num, num + n, greater<int>());
	b = 0;
	for (a = 0; a < m; a++)
	{
		b += num[a];
	}
	c = max(c,abs(b));
	for (a = 0; a < n; a++)
	{
		num[a] = -x[a] + y[a] - z[a];
	}
	sort(num, num + n, greater<int>());
	b = 0;
	for (a = 0; a < m; a++)
	{
		b += num[a];
	}
	c = max(c,abs(b));
	for (a = 0; a < n; a++)
	{
		num[a] = -x[a] - y[a] + z[a];
	}
	sort(num, num + n, greater<int>());
	b = 0;
	for (a = 0; a < m; a++)
	{
		b += num[a];
	}
	c = max(c,abs(b));
	for (a = 0; a < n; a++)
	{
		num[a] = -x[a] - y[a] - z[a];
	}
	sort(num, num + n, greater<int>());
	b = 0;
	for (a = 0; a < m; a++)
	{
		b += num[a];
	}
	c = max(c,abs(b));


	/*for ( a = 0; a < m; a++)
	{
		cout << num[a] << endl;
	}
*/
	cout<<c <<endl;




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

Compiler output:
a.cc: In function 'int main()':
a.cc:24:13: error: 'LLONG_MIN' was not declared in this scope
   24 |         c = LLONG_MIN;
      |             ^~~~~~~~~
a.cc:7:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <functional>
  +++ |+#include <climits>
    7 | using namespace std;
Language: C++


typedef long long ll;
typedef std::pair<std::pair<ll,ll>,ll> tuple;
int N, M;
ll x[1001], y[1001], z[1001];
ll ans=0;
ll solve(int i, int chonum, ll nowx, ll nowy, ll nowz){
  if(chonum == M)return ans=std::max(ans, abs(nowx)+abs(nowy)+ abs(nowz));
  else if(i==N) return 0;
  ll s=solve(i+1,chonum+1,nowx+x[i], nowy+y[i], nowz+z[i]);
  ll s2=solve(i+1,chonum, nowx, nowy, nowz);
  ll val=std::max(s,s2);
  return val;

}
  

int main(){
  std::cin>>N>>M;
  for(int i=0;i<N;++i){

    std::cin>>x[i]>>y[i]>>z[i];
  }
  std::cout<<solve(0,0,0,0,0)<<std::endl;

  return 0;
}


Compiler output:
a.cc:3:14: error: 'pair' in namespace 'std' does not name a template type
    3 | typedef std::pair<std::pair<ll,ll>,ll> tuple;
      |              ^~~~
a.cc:1:1: note: 'std::pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
  +++ |+#include <utility>
    1 | 
a.cc: In function 'll solve(int, int, ll, ll, ll)':
a.cc:8:34: error: 'max' is not a member of 'std'
    8 |   if(chonum == M)return ans=std::max(ans, abs(nowx)+abs(nowy)+ abs(nowz));
      |                                  ^~~
a.cc:8:43: error: 'abs' was not declared in this scope; did you mean 'ans'?
    8 |   if(chonum == M)return ans=std::max(ans, abs(nowx)+abs(nowy)+ abs(nowz));
      |                                           ^~~
      |                                           ans
a.cc:12:15: error: 'max' is not a member of 'std'
   12 |   ll val=std::max(s,s2);
      |               ^~~
a.cc: In function 'int main()':
a.cc:19:8: error: 'cin' is not a member of 'std'
   19 |   std::cin>>N>>M;
      |        ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | 
a.cc:22:10: error: 'cin' is not a member of 'std'
   22 |     std::cin>>x[i]>>y[i]>>z[i];
      |          ^~~
a.cc:22:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:8: error: 'cout' is not a member of 'std'
   24 |   std::cout<<solve(0,0,0,0,0)<<std::endl;
      |        ^~~~
a.cc:24:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:37: error: 'endl' is not a member of 'std'
   24 |   std::cout<<solve(0,0,0,0,0)<<std::endl;
      |                                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 |
Language: C++

#include <iostream>
#include <cmath>

typedef long long ll;
typedef std::pair<std::pair<ll,ll>,ll> tuple;
int N, M;
ll x[1001], y[1001], z[1001];
ll ans=0;
ll solve(int i, int chonum, ll nowx, ll nowy, ll nowz){
  if(chonum == M)return ans=std::max(ans, abs(nowx)+abs(nowy)+ abs(nowz));
  else if(i==N) return 0;
  ll s=solve(i+1,chonum+1,nowx+x[i], nowy+y[i], nowz+z[i]);
  ll s2=solve(i+1,chonum, nowx, nowy, nowz);
  ll val=std::max(s,s2);
  return val;

}
  

int main(){
  std::cin>>N>>M;
  for(int i=0;i<N;++i){

    std::cin>>x[i]>>y[i]>>z[i];
  }
  std::cout<<solve(0,0,0,0,0)<<std::endl;

  return 0;
}


Compiler output:
a.cc: In function 'll solve(int, int, ll, ll, ll)':
a.cc:10:37: error: no matching function for call to 'max(ll&, int)'
   10 |   if(chonum == M)return ans=std::max(ans, abs(nowx)+abs(nowy)+ abs(nowz));
      |                             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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: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:10:37: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   10 |   if(chonum == M)return ans=std::max(ans, abs(nowx)+abs(nowy)+ abs(nowz));
      |                             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
Language: C++

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) ((a < b) ? a : b)
#define abs(a) ((a < 0) ? -(a) : a)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

typedef struct {
	s64 x;
	s64 y;
	s64 z;
	int num;
} Cake;

static inline int ri() {
	int a;
	scanf("%d", &a);
	return a;
}

int comp_max(const void* a, const void* b) {
	const Cake* aa = (const Cake*) a;
	const Cake* bb = (const Cake*) b;
	
	s64 aaa = aa->x + aa->y + aa->z;
	s64 bbb = bb->x + bb->y + bb->z;
	
	return (aaa - bbb < 0) ? 1 : (aaa - bbb == 0) ? 0 : -1;
}

int main() {
	int n = ri();
	int m = ri();
	
	Cake cs[n];
	for (int i = 0; i < n; i++) {
		cs[i].num = i;
		
		scanf("%ld", &cs[i].x);
		scanf("%ld", &cs[i].y);
		scanf("%ld", &cs[i].z);
		/*
		scanf("%I64d", &cs[i].x);
		scanf("%I64d", &cs[i].y);
		scanf("%I64d", &cs[i].z);*/
	}
	
	u64 res = 0;
	// i : x
	// j : y
	// k : z
	// 0 : -, 1 : +
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 2; j++) {
			for (int k = 0; k < 2; k++) {
				Cake css[n];
				for (int l = 0; l < n; l++) {
					css[l].x = cs[l].x * (i ? -1 : 1);
					css[l].y = cs[l].y * (j ? -1 : 1);
					css[l].z = cs[l].z * (k ? -1 : 1);
					css[l].num = cs[l].num;
				}
				qsort(css, n, sizeof(Cake), comp_max);
				s64 x_p = 0;
				s64 y_p = 0;
				s64 z_p = 0;
				for (int l = 0; l < m; l++) {
					x_p += css[l].x;
					y_p += css[l].y;
					z_p += css[l].z;
				}
				if (x_p < 0 || y_p < 0 || z_p < 0) continue;
				else res = (u64)max((s64)res, x_p+y_p+z_p);
			}
		}
	}
	
	printf("%lu", res);
	// printf("%I64u", res);
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:33: error: 'qsort' was not declared in this scope
   73 |                                 qsort(css, n, sizeof(Cake), comp_max);
      |                                 ^~~~~
Language: C++

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) ((a < b) ? a : b)
#define abs(a) ((a < 0) ? -(a) : a)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

typedef struct {
	s64 x;
	s64 y;
	s64 z;
	int num;
} Cake;

static inline int ri() {
	int a;
	scanf("%d", &a);
	return a;
}

int comp_max(const void* a, const void* b) {
	const Cake* aa = (const Cake*) a;
	const Cake* bb = (const Cake*) b;
	
	s64 aaa = aa->x + aa->y + aa->z;
	s64 bbb = bb->x + bb->y + bb->z;
	
	return (aaa - bbb < 0) ? 1 : (aaa - bbb == 0) ? 0 : -1;
}

int main() {
	int n = ri();
	int m = ri();
	
	Cake cs[n];
	for (int i = 0; i < n; i++) {
		cs[i].num = i;
		
		scanf("%lld", &cs[i].x);
		scanf("%lld", &cs[i].y);
		scanf("%lld", &cs[i].z);
		/*
		scanf("%I64d", &cs[i].x);
		scanf("%I64d", &cs[i].y);
		scanf("%I64d", &cs[i].z);*/
	}
	
	u64 res = 0;
	// i : x
	// j : y
	// k : z
	// 0 : -, 1 : +
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 2; j++) {
			for (int k = 0; k < 2; k++) {
				Cake css[n];
				for (int l = 0; l < n; l++) {
					css[l].x = cs[l].x * (i ? -1 : 1);
					css[l].y = cs[l].y * (j ? -1 : 1);
					css[l].z = cs[l].z * (k ? -1 : 1);
					css[l].num = cs[l].num;
				}
				qsort(css, n, sizeof(Cake), comp_max);
				s64 x_p = 0;
				s64 y_p = 0;
				s64 z_p = 0;
				for (int l = 0; l < m; l++) {
					x_p += css[l].x;
					y_p += css[l].y;
					z_p += css[l].z;
				}
				if (x_p < 0 || y_p < 0 || z_p < 0) continue;
				else res = (u64)max((s64)res, x_p+y_p+z_p);
			}
		}
	}
	
	printf("%llu", res);
	// printf("%I64u", res);
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:33: error: 'qsort' was not declared in this scope
   73 |                                 qsort(css, n, sizeof(Cake), comp_max);
      |                                 ^~~~~
Language: C++

#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;
#define rep(i,n) for(long long i=0;i<n;i++)
#define Rep(i,n0,n) for(long long i=n0;i<n;i++)
#define Com(i,j,n) for(long long i=0;i<n-1;i++)for(long long j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;

long long max(long long a,long long b){
	return (a>b)? a:b;
}

long long main (){
	long long NNN,MMM;
	cin >> NNN >> MMM;
	long long x[NNN],y[NNN],z[NNN];
	rep(i,NNN){
		cin >> x[i] >> y[i] >>z[i];
	}
	//+++
	long long maxx=0;


	long long sumppp=0;
	vector <long long> tempppp;
	long long ppp=0;
	rep(i,NNN){
		ppp = x[i] + y[i] + z[i];
		tempppp.push_back(ppp);
		ppp=0;
	}
	sort(tempppp.rbegin(),tempppp.rend());
	rep(i,MMM){
		sumppp += tempppp[i];
	}
	maxx= max(maxx,sumppp);



	long long sumppm=0;
	vector <long long> tempppm;
	long long ppm=0;
	rep(i,NNN){
		ppm = x[i] + y[i] - z[i];
		tempppm.push_back(ppm);
		ppm=0;
	}
	sort(tempppm.rbegin(),tempppm.rend());
	rep(i,MMM){
		sumppm += tempppm[i];
	}
	maxx= max(maxx,sumppm);



	long long sumpmp=0;
	vector <long long> temppmp;
	long long pmp=0;
	rep(i,NNN){
		pmp = x[i] - y[i] + z[i];
		temppmp.push_back(pmp);
		pmp=0;
	}
	sort(temppmp.rbegin(),temppmp.rend());
	rep(i,MMM){
		sumpmp += temppmp[i];
	}	
	maxx= max(maxx,sumpmp);



	long long sumpmm=0;
	vector <long long> temppmm;
	long long pmm=0;
	rep(i,NNN){
		pmm = x[i] - y[i] - z[i];
		temppmm.push_back(pmm);
		pmm=0;
	}
	sort(temppmm.rbegin(),temppmm.rend());
	rep(i,MMM){
		sumpmm += temppmm[i];
	}	
	maxx= max(maxx,sumpmm);



	long long summpp=0;
	vector <long long> tempmpp;
	long long mpp=0;
	rep(i,NNN){
		mpp =  -x[i] + y[i] + z[i];
		tempmpp.push_back(mpp);
		mpp=0;
	}
	sort(tempmpp.rbegin(),tempmpp.rend());
	rep(i,MMM){
		summpp += tempmpp[i];
	}	
	maxx= max(maxx,summpp);



	long long summpm=0;
	vector <long long> tempmpm;
	long long mpm=0;
	rep(i,NNN){
		mpm =  -x[i] + y[i] - z[i];
		tempmpm.push_back(mpm);
		mpm=0;
	}
	sort(tempmpm.rbegin(),tempmpm.rend());
	rep(i,MMM){
		summpm += tempmpm[i];
	}	
	maxx= max(maxx,summpm);



	long long summmp=0;
	vector <long long> tempmmp;
	long long mmp=0;
	rep(i,NNN){
		mmp =  -x[i] - y[i] + z[i];
		tempmmp.push_back(mmp);
		mmp=0;
	}
	sort(tempmmp.rbegin(),tempmmp.rend());
	rep(i,MMM){
		summmp += tempmmp[i];
	}	
	maxx= max(maxx,summmp);



	long long summmm=0;
	vector <long long> tempmmm;
	long long mmm=0;
	rep(i,NNN){
		mmm =  -x[i] - y[i] - z[i];
		tempmmm.push_back(mmm);
		mmm=0;
	}
	sort(tempmmm.rbegin(),tempmmm.rend());
	rep(i,MMM){
		summmm += tempmmm[i];
	}	
	maxx= max(maxx,summmm);

	cout << maxx << endl;



	return 0;
}


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

#include<stdio.h>
#include<stdlib.h>
int a, k=0;
int x[1000],y[1000],z[1000];
int main(){
scanf("%d",&a);

for(int i=0;i<a;i++) scanf("%d %d %d",&x[i],&y[i],&z[i];

for(int i=0;i<a;i++){
for(int j=a-1;j>i;j--){
if(k<abs(x[j]+x[i]))+abs(y[j]+y[i])+abs(z[j]+z[i]){
k=abs(x[j]+x[i])+abs(y[j]+y[i])+abs(z[j]+z[i]);
}}}
printf("%d",&k);
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:56: error: expected ')' before ';' token
    8 | for(int i=0;i<a;i++) scanf("%d %d %d",&x[i],&y[i],&z[i];
      |                           ~                            ^
      |                                                        )
a.cc:12:51: error: expected ';' before '{' token
   12 | if(k<abs(x[j]+x[i]))+abs(y[j]+y[i])+abs(z[j]+z[i]){
      |                                                   ^
      |                                                   ;
Language: C++

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

long long GetMax(size_t M, vector<long long> x, vector<long long> y, vector<long long> z){
    auto N = x.size();
    long long maxN = 0;
    vector<array<int, 3>> signList;
    signList.push_back(array<int,3>{+1, +1, +1});
    signList.push_back(array<int,3>{+1, +1, -1});
    signList.push_back(array<int,3>{+1, -1, +1});
    signList.push_back(array<int,3>{+1, -1, -1});
    signList.push_back(array<int,3>{-1, +1, +1});
    signList.push_back(array<int,3>{-1, +1, -1});
    signList.push_back(array<int,3>{-1, -1, +1});
    signList.push_back(array<int,3>{-1, -1, -1});
    for(auto sign : signList){
        int signX = sign[0];
        int signY = sign[1];
        int signZ = sign[2];
        vector<long long> values;
        for(size_t i=0; i<N; i++){
            auto v = x.at(i) * signX + y.at(i) * signY + z.at(i) * signZ;
            values.push_back(v);
        }
        sort(values.begin(), values.end(), greater<>());
        long long maxNCand = 0;
        for(size_t i=0;i<M;i++) maxNCand+=values[i];
        if(maxNCand > maxN) maxN = maxNCand;
    }

    return maxN;
}

int main()
{
    size_t N, M;
    cin >> N >> M;
    long long xi, yi, zi;
    vector<long long> x,y,z;
    for(size_t i=0;i<N;i++){
        cin >> xi >> yi >> zi;
        x.push_back(xi);
        y.push_back(yi);
        z.push_back(zi);
    }
    auto v = GetMax(M, x, y, z);
    cout << v << endl;
    return 0;
}

Compiler output:
a.cc: In function 'long long int GetMax(size_t, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>)':
a.cc:27:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   27 |         sort(values.begin(), values.end(), greater<>());
      |         ^~~~
      |         short
Language: C++

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
using namespace std;
int main(){

int n,m;
long int x[1000];
long int y[1000];
long int z[1000];
long int a[2][2][2][1000]=0;
long int data[1000]=0;
long long int sum=0;
long long int max=-900000000000000;
cin >> n >> m;

for(int i=0;i<n;i++){
	cin >> x[i] >> y[i] >> z[i];
	for(int j=0;j<2;j++){
		for(int k=0;k<2;k++){
			for(int l=0;l<2;l++){
				a[j][k][l][i]=(1 - 2*j) * x[i] +(1 - 2*k) * y[i] + (1 - 2*l) * z[i];
			}
		}
	}
}

	for(int j=0;j<2;j++){
		for(int k=0;k<2;k++){
			for(int l=0;l<2;l++){
			
			//section 
			
				for(int i=0;i<n;i++){
					for(int f=0;f<m;f++){
						if(a[j][k][l][i]>data[f]){
							data[f]=a[j][k][l][i];
							break;
						}
					}
				}
				
			//sum
			
				for(int i=0;i<m;i++){
					sum = sum+ data[i];
				}
				if(max<sum){
					max = sum;
				}
				
			//reset
			
				for(i=0;i<m;i++){
				data[i]=0;
				}
				sum = 0;
			
			}
		}
	}
	
cout << max;
return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:27: error: array must be initialized with a brace-enclosed initializer
   24 | long int a[2][2][2][1000]=0;
      |                           ^
a.cc:25:21: error: array must be initialized with a brace-enclosed initializer
   25 | long int data[1000]=0;
      |                     ^
a.cc:67:37: error: 'i' was not declared in this scope
   67 |                                 for(i=0;i<m;i++){
      |                                     ^
Language: C++

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

//タイマー
class Timer {
	chrono::high_resolution_clock::time_point start, end;
	double limit;

public:
	Timer() {
		start = chrono::high_resolution_clock::now();
	}
	Timer(double l) {
		start = chrono::high_resolution_clock::now();
		limit = l;
	}

	double getTime() {
		end = chrono::high_resolution_clock::now();
		return chrono::duration<double>(end - start).count();
	}

	bool Over() {
		if (getTime() > limit) {
			return true;
		}
		return false;
	}

	void setLimit(double l) {
		limit = l;
	}
	void setStart() { start = chrono::high_resolution_clock::now(); }
	double getLimit() { return limit; }
};

//疑似乱数
class Xor128 {
	unsigned static int x, y, z, w;
public:
	Xor128() {
		x = 31103110, y = 123456789, z = 521288629, w = 88675123;
	}

	unsigned int rand()
	{
		unsigned int t;
		t = (x ^ (x << 11)); x = y; y = z; z = w;
		return(w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
	}
};
unsigned int Xor128::x, Xor128::y, Xor128::z, Xor128::w;

struct cake {
	long long x, y, z;
};
Xor128 xor128;

long long sums[3];
int main() {
	int N, M; cin >> N >> M;
	vector<cake>cakes, ans;
	for (int i = 0; i < N; i++) {
		long long x, y, z; cin >> x >> y >> z;
		cakes.push_back(cake({x, y, z}));
	}

	Timer tmr;
	tmr.setLimit(1.9);
	int loop = 0;
	double startTemp = 10000;
	double endTemp = 10;
	double diffTemp = (endTemp - startTemp) / 1.9;
	double currentTime = tmr.getTime();
	long long  score, best_score;
	best_score = score = 0;


	for (int i = 0; i < M; i++) {
		sums[0] += cakes[0].x;
		sums[1] += cakes[0].y;
		sums[2] += cakes[0].z;

		ans.push_back(cakes[0]);
		swap(cakes.front(), cakes.back());
		cakes.pop_back();
	}
	for (int i = 0; i < 3; i++)score += abs(sums[i]);
	best_score = score;

	if (cakes.size() == 0 || M == 0) {
		cout << best_score << endl;
		return 0;
	}

	while (1) {
		loop++;
		if (loop % 1000 == 0) {
			currentTime = tmr.getTime();

			if (currentTime > 1.9)break;
		}

		int r = xor128.rand() % M;
		int r2 = xor128.rand() % cakes.size();

		long long change = 0;
		change = abs(sums[0] + cakes[r2].x - ans[r].x) + abs(sums[1] + cakes[r2].y - ans[r].y) + abs(sums[2] + cakes[r2].z - ans[r].z) - score;

		bool accept = false;
		if (change >= 0)accept = true;
		else {
			double temp = startTemp + currentTime * diffTemp;
			double prob = exp(change / temp);
			accept = UINT32_MAX * prob > xor128.rand();
		}

		if (accept) {
			score += change;
			sums[0] += cakes[r2].x - ans[r].x;
			sums[1] += cakes[r2].y - ans[r].y;
			sums[2] += cakes[r2].z - ans[r].z;

			cakes.push_back(ans[r]);
			ans[r] = cakes[r2];
			swap(cakes[r2], cakes.back());
			cakes.pop_back();

			if (best_score < score) {
				best_score = score; 
			}
		}
	}

	cout << best_score << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:118:39: error: 'exp' was not declared in this scope
  118 |                         double prob = exp(change / temp);
      |                                       ^~~
Language: Java

import java.util.*;
import static java.lang.System.out;

public class Main{
   public static Scanner sc = new Scanner(System.in);
   public static void main(String args[]){
    int N = sc.nextInt();
    int M = sc.nextInt();
    long array[] = new int[N];
    for (int i = 0; i < A; i++) {
      int sum = 0;
      for (int j = 0; j < 3; j++) {
        sum += sc.nextInt();
      }
      array[i] = sum;
    }
    Arrays.sort(array);

    long result = 0;
    for (int i = N; i > M; i--) {
      if (array[i] > 0){
        ressult += array[i]; 
      }
    }
    System.out.println(result);
   }
}

Compiler output:
Main.java:9: error: incompatible types: int[] cannot be converted to long[]
    long array[] = new int[N];
                   ^
Main.java:10: error: cannot find symbol
    for (int i = 0; i < A; i++) {
                        ^
  symbol:   variable A
  location: class Main
Main.java:22: error: cannot find symbol
        ressult += array[i]; 
        ^
  symbol:   variable ressult
  location: class Main
3 errors