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

#include <bits/stdc++.h>

#define rep(i, n) for (ll i=0;i<(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;
//using ll=long long;
typedef long long ll;
typedef pair<ll, ll> pi;



int main(){
  ll n,m;
  cin>>n>>m;

  ll x[n];
  ll y[n];
  ll z[n];

  rep(i,n){
    cin >>x[i]>>y[i]>>z[i];
  }

  ll dp[n+1][m+1][2][2][2];


  ll geta = -1000000010;
  
   rep(i, n+1){
    rep(j, m+1){
      rep(xi,2){
	rep(yi,2){
	  rep(zi,2){
	    if(j==0) dp[i][j][xi][yi][zi] = 0;
	    else dp[i][j][xi][yi][zi] = geta
	  }}}}}
  
  ll xxi,yyi,zzi;
  ll xx,yy,zz;
  
  rep(j, m){
    rep(i, n){
      rep(xi,2){
	rep(yi,2){
	  rep(zi,2){
	    if (xi==0) xxi = -1; else xxi=1;
	    if (yi==0) yyi = -1; else yyi=1;
	    if (zi==0) zzi = -1; else zzi=1;
	    chmax(dp[i+1][j][xi][yi][zi] ,dp[i][j][xi][yi][zi]);
	    // cout << dp[i+1][j][xi][yi][zi] <<endl;
	    xx = x[i]*xxi;
	    yy = y[i]*yyi;
	    zz = z[i]*zzi;
	    //cout << dp[i+1][j+1][xi][yi][zi] << " " <<dp[i][j][xi][yi][zi]<<xx<<yy<<zz<<endl;
	    dp[i+1][j+1][xi][yi][zi] = max(dp[i+1][j+1][xi][yi][zi], dp[i][j][xi][yi][zi]+xx+yy+zz);
	    //cout << dp[i+1][j+1][xi][yi][zi] << " "<<i<<j<<endl;

	  }
	}
      }
    }
  }

  ll ans = 0;

  rep(xi,2){
    rep(yi,2){
      rep(zi,2){
	if(dp[n][m][xi][yi][zi]<0) dp[n][m][xi][yi][zi]+=geta;
	chmax(ans, dp[n][m][xi][yi][zi]);
	  // cout << ans << endl;
	// cout << dp[n][m][xi][yi][zi] <<endl;

      }
    }
  }
  
  cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:45: error: expected ';' before '}' token
   37 |             else dp[i][j][xi][yi][zi] = geta
      |                                             ^
      |                                             ;
   38 |           }}}}}
      |           ~
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,m;
  cin>>n>>m;
  vvll x(n,vll(3));
  rep(i,n){
    cin>>x[i][0]>>x[i][1]>>x[i][2];
  }
  ll ans=0;
  for(int bit=0;bit<(1<<3);bit++){
    vll p(0);
    rep(i,n){
      cu=0;
      for(int j=0;j<3;j++){
        if(bit&(1<<j)){
          cu+=x[i][j];
        }
        else cu-=x[i][j];
      }
      p.pb(cu);
    }
    sort(rall(p));
    ll k=0;
    rep(i,m){
      k+=p[i];
    }
    ans=max(ans,k);
  }
  COUT(ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:7: error: 'cu' was not declared in this scope; did you mean 'pu'?
   53 |       cu=0;
      |       ^~
      |       pu
Language: C++

#include <cstdio>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;

ll N, M;
ll x[1010], y[1010], z[1010];

int main()
{
  scanf( "%lld%lld", &N, &M );

  rep( i, N )
    scanf( "%lld%lld%lld", x+i, y+i, z+i );

  ll ans = 0;

  rep( S, 1<<3 )
  {
    ll s1 = S&1 ? 1 : -1, s2 = S>>1&1 ? 1 : -1, s3 = S>>2&1 ? 1 : -1;

    std::vector<ll> vs;

    rep( i, N )
      vs.emplace_back( s1*x[i]+s2*y[i]+s3*z[i] );

    std::sort( all(vs) );

    ll sum = 0;
    for( int i = N-1; i >= N-M; --i )
      sum += vs[i];

    chmax( ans, sum );
  }

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

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:10: error: 'sort' is not a member of 'std'
   33 |     std::sort( all(vs) );
      |          ^~~~
Language: Java

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

public class ABC100D {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		long[][] in = new long[n][3];
		for (int i = 0; i < n; i++) {
			in[i][0] = sc.nextLong();
			in[i][1] = sc.nextLong();
			in[i][2] = sc.nextLong();
		}
		long[] a = new long[n];
		long max = 0, sum = 0;
		for(int e: new int[] {-1,1}) {
			for(int f: new int[] {-1,1}) {
				for(int g: new int[] {-1,1}) {
					for (int j = 0; j < n; j++) a[j] = e*in[j][0]+f*in[j][1]+g*in[j][2];
					Arrays.parallelSort(a);
					for (int j = 0; j < m; j++) sum += a[n-j-1];
					max = Math.max(max,sum);
					sum = 0;
				}
			}
		}
		System.out.println(max);
		sc.close();
	}
}

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

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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> x(N),y(N),z(N);
  for(int i=0;i<N;i++){
    cin>>x.at(i)>>y.at(i)>>z.at(i);
  }
  
  long long dp[M+1][2][2][2];
  for(int i=0;i<M+1;i++){
    for(int j=0;j<2;j++){
      for(int k=0;k<2;k++){
        for(int l=0;l<2;l++){
          dp[i][j][k][l]=-10000000000000;
        }
      }
    }
  }
  
  for(int i=0;i<2;i++){
    for(int j=0;j<2;j++){
      for(int k=0;k<2;k++){
        dp[0][i][j][k]=0;
      }
    }
  }
  
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      dp[j+1][0][0][0]=max(dp[j+1][0][0][0],dp[j][0][0][0]+x.at(i)+y.at(i)+z.at(i));
      dp[j+1][1][0][0]=max(dp[j+1][1][0][0],dp[j][1][0][0]-x.at(i)+y.at(i)+z.at(i));
      dp[j+1][0][1][0]=max(dp[j+1][0][1][0],dp[j][0][1][0]+x.at(i)-y.at(i)+z.at(i));
      dp[j+1][0][0][1]=max(dp[j+1][0][0][1],dp[j][0][0][1]+x.at(i)+y.at(i)-z.at(i));
      dp[j+1][1][1][0]=max(dp[j+1][1][1][0],dp[j][1][1][0]-x.at(i)-y.at(i)+z.at(i));
      dp[j+1][1][0][1]=max(dp[j+1][1][0][1],dp[j][1][0][1]-x.at(i)+y.at(i)-z.at(i));
      dp[j+1][0][1][1]=max(dp[j+1][0][1][1],dp[j][0][1][1]+x.at(i)-y.at(i)-z.at(i));
      dp[j+1][1][1][1]=max(dp[j+1][1][1][1],dp[j][1][1][1]-x.at(i)-y.at(i)-z.at(i));
    }
    long long ans=0;
    for(int i=0;i<2;i++){
      for(int j=0;j<2;j++){
        for(int k=0;k<2;k++){
          ans=max(dp[M][i][j][k],ans);
        }
      }
    }
    
    cout<<ans<<endl;
  }
  

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

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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> x(N),y(N),z(N);
  for(int i=0;i<N;i++){
    cin>>x.at(i)>>y.at(i)>>z.at(i);
  }
  
  long long dp[M+1][2][2][2];
  for(int i=0;i<M+1;i++){
    for(int j=0;j<2;j++){
      for(int k=0;k<2;k++){
        for(int l=0;l<2;l++){
          dp[i][j][k][l]=-10000000000000;
        }
      }
    }
  }
  
  for(int i=0;i<2;i++){
    for(int j=0;j<2;j++){
      for(int k=0;k<2;k++){
        dp[0][i][j][k]=0;
      }
    }
  }
  
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      dp[j+1][0][0][0]=max(dp[j+1][0][0][0],dp[j][0][0][0]+x.at(i)+y.at(i)+z.at(i));
      dp[j+1][1][0][0]=max(dp[j+1][1][0][0],dp[j][1][0][0]-x.at(i)+y.at(i)+z.at(i));
      dp[j+1][0][1][0]=max(dp[j+1][0][1][0],dp[j][0][1][0]+x.at(i)-y.at(i)+z.at(i));
      dp[j+1][0][0][1]=max(dp[j+1][0][0][1],dp[j][0][0][1]+x.at(i)+y.at(i)-z.at(i));
      dp[j+1][1][1][0]=max(dp[j+1][1][1][0],dp[j][1][1][0]-x.at(i)-y.at(i)+z.at(i));
      dp[j+1][1][0][1]=max(dp[j+1][1][0][1],dp[j][1][0][1]-x.at(i)+y.at(i)-z.at(i));
      dp[j+1][0][1][1]=max(dp[j+1][0][1][1],dp[j][0][1][1]+x.at(i)-y.at(i)-z.at(i));
      dp[j+1][1][1][1]=max(dp[j+1][1][1][1],dp[j][1][1][1]-x.at(i)-y.at(i)-z.at(i));
    }
    ans=0;
    for(int i=0;i<2;i++){
      for(int j=0;j<2;j++){
        for(int k=0;k<2;k++){
          ans=max(dp[M][i][j][k],ans);
        }
      }
    }
    
    cout<<ans<<endl;
  }
  

Compiler output:
a.cc: In function 'int main()':
a.cc:42:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   42 |     ans=0;
      |     ^~~
      |     abs
a.cc:52:4: error: expected '}' at end of input
   52 |   }
      |    ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    long int x[n], y[n], z[n];
    for(int i = 0; i < n; i++){
        scanf("%ld %ld %ld", &x[i], &y[i], &z[i]);
    }
    long int max = 0;
    for(int i = -1; i < 2; i += 2){
        for(int j = -1; j < 2; j += 2){
            for(int k = -1; k < 2; k += 2){
                long int a[n];
                for(int l = 0; l < n; l++){
                    a[l] = x[l] * i + y[l] * j + z[l] * k;
                    // printf("%d ", a[l]);
                }
                // puts("");

                sort(a, a + n, greater<int>());
                long int c = 0;
                for(int l = 0; l < m; l++){
                    c += a[l];
                    // printf("%d ", a[l]);
                }
                // puts("");
                if (c >= max) max = c;
            }
        }
    }
    printf("%ld\n", max);
}

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

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

int N, M;

int main() {
    cin >> N >> M;
  
    long long int a[3]={0};
  
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            long long num; cin >> num;
            a[j].push_back(num);
        }
    }
  
  //bit処理
  
  
    long long int  ant = 0;
  
    for (int k = 0; k < (1<<3); k++) {
        vector<long long> b;
      
        for (int i = 0; i < N; i++) {
          
            long long int  tmp = 0;
            for (int j = 0; j < 3; j++) {
              
                if (k & (1<<j)) tmp += a[j][i];
                else tmp -= a[j][i];
            }
            b.push_back(tmp);
        }
        sort(b.begin(), b.end(), greater<long long>());
        long long sum = 0;
        for (int i = 0; i < M; ++i) {
            sum += b[i];
        }
        ant = max(ant , sum);
    }
    cout << ant << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: request for member 'push_back' in 'a[j]', which is of non-class type 'long long int'
   16 |             a[j].push_back(num);
      |                  ^~~~~~~~~
a.cc:33:44: error: invalid types 'long long int[int]' for array subscript
   33 |                 if (k & (1<<j)) tmp += a[j][i];
      |                                            ^
a.cc:34:33: error: invalid types 'long long int[int]' for array subscript
   34 |                 else tmp -= a[j][i];
      |                                 ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
using namespace std;
typedef long long ll;

int main() {
    int n, m; cin >> n >> m;
    vector<ll> a[3];
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            ll b; cin >> b;
            a[j].push_back(b);
        }
    }
    
    ll ans = 0;
    for (int bit = 0; bit < (1<<n); bit++) {
        vector<ll> b;
        for (int i = 0; i < n; i++)
        {
            ll c = 0;
            for (int j = 0; j < 3; j++)
            {
                if (bit & (1<<j)) c += a[j][i];
                else c -= a[j][i];
            }
            b.push_back(c);
        }
        sort(b.begin(), b.end(), gereater<ll>());
        ll tmp = 0;
        for (int i = 0; i < m; i++)
        {
            tmp += b[i];
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:34: error: 'gereater' was not declared in this scope; did you mean 'isgreater'?
   36 |         sort(b.begin(), b.end(), gereater<ll>());
      |                                  ^~~~~~~~
      |                                  isgreater
a.cc:36:45: error: expected primary-expression before '>' token
   36 |         sort(b.begin(), b.end(), gereater<ll>());
      |                                             ^
a.cc:36:47: error: expected primary-expression before ')' token
   36 |         sort(b.begin(), b.end(), gereater<ll>());
      |                                               ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

ll order(vector<ll> v, int k){
	int n,i,l,r,p=0,q=0;
	ll pivot;
	n = v.l_ength();
	u.reserve(n);
	if(n<5){
		sort(v.begin(),v.end());
		return v[k];
	}
	vector<ll> u;
	for(i=0; i<n; i+=5){
		l = i; r = min(i+5,n);
		sort(&v[l],&v[r]);
		u.push_back(v[(l+r)/2]);
	}
	pivot = order(u,n/10);
	u.clear();
	for(i=0; i<n; ++i){
		if(v[i]<pivot){
			++p;
		}else if(v[i]==pivot){
			++q;
		}
	}
	if(k<p){
		for(i=0; i<n; ++i){
			if(v[i]<pivot){
				u.push_back(v[i]);
			}
		}
		return order(u,k);
	}else if(k>=p+q){
		for(i=0; i<n; ++i){
			if(v[i]>pivot){
				u.push_back(v[i]);
			}
		}
		return order(u,k-p-q);
	}else{
		return pivot;
	}
}

ll a[1111][3];

int main(void){
	int n,m,i,j,k,cnt=0;
	ll pivot,tmp,ans=-INFLL;
	cin >> n >> m;
	vector<ll> v(n);
	if(!m){
		cout << 0ll << endl;
		return 0;
	}
	for(i=0; i<n; ++i){
		for(k=0; k<3; ++k){
			cin >> a[i][k];
		}
	}
	for(j=0; j<8; ++j){
		tmp = 0ll; cnt = 0;
		fill(v.begin(),v.end(),0ll);
		for(i=0; i<n; ++i){
			for(k=0; k<3; ++k){
				if(j&(1<<k)){
					v[i] += a[i][k];
				}else{
					v[i] -= a[i][k];
				}
			}
		}
		pivot = order(v,n-m);
		for(i=0; i<n; ++i){
			if(v[i]>pivot){
				++cnt;
				tmp += v[i];
			}
		}
		tmp += pivot*(m-cnt);
		ans = max(ans,tmp);
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'll order(std::vector<long long int>, int)':
a.cc:26:9: error: 'u' was not declared in this scope
   26 |         u.reserve(n);
      |         ^
Language: C++

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

struct mydata{
    long long x, y, z;
};

int main() {
    lomg long n, m;
    cin >> n >> m;
    vector<mydata> a(n);
    for(int i = 0; i <n ; i++){
        cin >> a[i].x >> a[i].y >> a[i].z;
    }
    long long ans = -(1LL << 60);
    for(int i = 0; i<8 ; i++){
        vector<long long> vec;
        for(int j = 0; j<n ;j++){
            long long sum = 0;
			for (int k = 0; k < 3; k++) {
			    long long temp;
		        if(k == 0)
		            temp = a[j].x;
		        else if(k == 1)
		            temp = a[j].y;
		        else
		            temp = a[j].z;
			    if ((i / (1 << k)) % 2 == 0){ 
			        sum += temp; 
			    }
			    else{
			        sum -= temp;
			    }
			}
			vec.push_back(sum);
        }
        
        sort(vec.begin(), vec.end(), greater<int>() );
        long long res = 0;
        for(int i = 0 ; i<m ; i++)
            res += vec[i];
        ans = max(ans, res);
    }
    
    cout<<ans<<endl;
    return 0;
    
}






Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'lomg' was not declared in this scope; did you mean 'long'?
    9 |     lomg long n, m;
      |     ^~~~
      |     long
a.cc:10:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   10 |     cin >> n >> m;
      |            ^
      |            yn
a.cc:10:17: error: 'm' was not declared in this scope; did you mean 'tm'?
   10 |     cin >> n >> m;
      |                 ^
      |                 tm
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int n,m;  cin >> n >> m;
  vll sum(n),x(n),y(n),z(n);
  rep0(i,n){
    cin >> x[i] >> y[i] >> z[i];
    sum[i] = x[i]+y[i]+z[i];
  }
  sort(all(sum));
  ll sum_ue = 0, sum_shita = 0;
  rep0(i,n){
    sum_ue += sum[i];
    sum_shita += sum[n-1-i]
  }
  cout << max(abs(sum_ue),abs(sum_shita));
}


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

N, M = map(int, input().split())
xyz = [[int(i) for i in input().split()] for _ in range(N)]

ret = -float('inf')
for i in [-1, 1] :
    for j in [-1, 1] :
        for k in [-1, 1] :
            ret = max(ret, sum(sorted([x * i + y * j + z * k for x, y, z in xyz])[N-M:]))
            
print(ret)

Compiler output:
a.cc:4:14: warning: multi-character character constant [-Wmultichar]
    4 | ret = -float('inf')
      |              ^~~~~
a.cc:1:1: error: 'N' does not name a type
    1 | N, M = map(int, input().split())
      | ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1e9+7, MAX = 1e9, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
long long sum = 0;

typedef pair<int, int> Pa;
typedef long long ll;

int main() {
    cin >> N >> M;
    ll x[1000],y[1000],z[1000];
    rep(i, N){
        cin >> x[i] >> y[i] >> z[i];
    }
    ll max_value = 0;

    ll max_value = INF;
    rep(i, 8){
        vector<ll> vec;
        rep(j, N){
            ll sum = 0;
            if(i%2 == 0){
                sum += x[j];
            }else{
                sum -= x[j];
            }
            if((i/2)%2 == 0){
                sum += y[j];
            }else{
                sum -= y[j];
            }
            if((i/4)%2 == 0){
                sum += z[j];
            }else{
                sum -= z[j];
            }
            vec.push_back(sum);
        }
        sort(vec.begin(), vec.end(), greater<int>());
        ll sum = 0;
        rep(k, M) sum += vec[k]; 
        max_value = max(max_value, sum);
    }
    cout << max_value;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:8: error: redeclaration of 'll max_value'
   21 |     ll max_value = INF;
      |        ^~~~~~~~~
a.cc:19:8: note: 'll max_value' previously declared here
   19 |     ll max_value = 0;
      |        ^~~~~~~~~
Language: C++

//
//  main.cpp
//  ABC
//
//  Created by Amarsanaa Davaasuren on 2019/08/31.
//  Copyright © 2019 Amarsanaa Davaasuren. All rights reserved.
//

#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#define rep(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)

using namespace std;
using ll = long long;


int main(){
    int N, M; cin >> N >> M;
    vector <ll> xyz(N);
    vector <ll> _xyz(N);
    vector <ll> x_yz(N);
    vector <ll> xy_z(N);
    vector <ll> _x_yz(N);
    vector <ll> x_y_z(N);
    vector <ll> _xy_z(N);
    vector <ll> _x_y_z(N);
    
    rep(i,0,N){

        ll x,y,z;
        cin >> x >> y >>z;
        xyz[i] = -1*((x) + (y )+ (z));
        _xyz[i] = -1*((- x) + (y )+ (z));
        x_yz[i] = -1*((x) - (y )+ (z));
        xy_z[i] = -1*((x) + (y )- (z));
        _x_yz[i] =-1*(( - x) - (y )+ (z));
        x_y_z[i] = -1*((x) - (y )- (z));
        _xy_z[i] = -1*((-x) + (y) - (z));
        _x_y_z[i] = -1*((-x) + (-y) + (-z));
        
    }
    sort(xyz.begin(),xyz.end());
    sort(_xyz.begin(),_xyz.end());
    sort(x_yz.begin(),x_yz.end());
    sort(xy_z.begin(),xy_z.end());
    sort(_x_yz.begin(),_x_yz.end());
    sort(x_y_z.begin(),x_y_z.end());
    sort(_xy_z.begin(),_xy_z.end());
    sort(_x_y_z.begin(),_x_y_z.end());
    vector<ll> ans(8);
    rep(i,0,M){
        ans[0] += xyz[i];
    }
    rep(i,0,M){
        ans[1] += _xyz[i];
    }
    rep(i,0,M){
        ans[2] += x_yz[i];
    }
    rep(i,0,M){
        ans[3] += xy_z[i];
    }
    rep(i,0,M){
        ans[4] += _x_yz[i];
    }
    rep(i,0,M){
        ans[5] += x_y_z[i];
    }
    rep(i,0,M){
        ans[6] += _xy_z[i];
    }
    rep(i,0,M){
        ans[7] += _x_y_z[i];
    }
    sort(ans.begin(),ans.end());
    cout << -1*ans[0];
    return 0;
}


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


//  main.cpp
//  ABC
//
//  Created by Amarsanaa Davaasuren on 2019/08/31.
//  Copyright © 2019 Amarsanaa Davaasuren. All rights reserved.
//

#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#define rep(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)

using namespace std;
using ll = long long;



    
long long N, M, a[100009][3], maxn = -(1LL << 60);




int main(){
    int N, M; cin >> N >> M;
    vector <ll> xyz(N);
    vector <ll> _xyz(N);
    vector <ll> x_yz(N);
    vector <ll> xy_z(N);
    vector <ll> _x_yz(N);
    vector <ll> x_y_z(N);
    vector <ll> _xy_z(N);
    vector <ll> _x_y_z(N);
    
    rep(i,0,N){

        ll x,y,z;
        cin >> x >> y >>z;
        xyz[i] = -1*((x) + (y )+ (z));
        _xyz[i] = -1*((- x) + (y )+ (z));
        x_yz[i] = -1*((x) - (y )+ (z));
        xy_z[i] = -1*((x) + (y )- (z));
        _x_yz[i] =-1*(( - x) - (y )+ (z));
        x_y_z[i] = -1*((x) - (y )- (z));
        _xy_z[i] = -1*((-x) + (y) - (z));
        _x_y_z[i] = -1*((-x) + (-y) + (-z));
        
    }
    sort(xyz.begin(),xyz.end());
    sort(_xyz.begin(),_xyz.end());
    sort(x_yz.begin(),x_yz.end());
    sort(xy_z.begin(),xy_z.end());
    sort(_x_yz.begin(),_x_yz.end());
    sort(x_y_z.begin(),x_y_z.end());
    sort(_xy_z.begin(),_xy_z.end());
    sort(_x_y_z.begin(),_x_y_z.end());
    vector<ll> ans(8);
    rep(i,0,M){
        ans[0] += xyz[i];
    }
    rep(i,0,M){
        ans[1] += _xyz[i];
    }
    rep(i,0,M){
        ans[2] += x_yz[i];
    }
    rep(i,0,M){
        ans[3] += xy_z[i];
    }
    rep(i,0,M){
        ans[4] += _x_yz[i];
    }
    rep(i,0,M){
        ans[5] += x_y_z[i];
    }
    rep(i,0,M){
        ans[6] += _xy_z[i];
    }
    rep(i,0,M){
        ans[7] += _x_y_z[i];
    }
    sort(ans.begin(),ans.end());
    cout << -1*ans[0];
    return 0;
}

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

import java.util.Scanner;

import com.sun.tools.classfile.StackMapTable_attribute.verification_type_info;

import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Comparator;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        Long[][] a = new Long[N][3];
        for(int i =0;i<N;i++){
            a[i][0] = sc.nextLong();
            a[i][1] = sc.nextLong();
            a[i][2] = sc.nextLong();
        }
        PriorityQueue<Long> pq = new PriorityQueue<>(Comparator.reverseOrder());
        pq.add(Search(M,N,a,1L,1l,1l));
        pq.add(Search(M,N,a,1l,1l,-1l));
        pq.add(Search(M,N,a,1l,-1l,1l));
        pq.add(Search(M,N,a,1l,-1l,-1l));
        pq.add(Search(M,N,a,-1l,1l,1l));
        pq.add(Search(M,N,a,-1l,1l,-1l));
        pq.add(Search(M,N,a,-1l,-1l,1l));
        pq.add(Search(M,N,a,-1l,-1l,-1l));
        System.out.print(pq.poll());
        sc.close();
    }
    public static Long Search(int M,int N,Long[][] L,Long x,Long y,Long z){
        PriorityQueue<Long> pq2 = new PriorityQueue<>(Comparator.reverseOrder());
        Long ans = 0l;
        for(int i = 0; i<N;i++){
            pq2.add(L[i][0]*x+L[i][1]*y+L[i][2]*z);
        }
        for(int i = 0; i<M;i++){
            ans += pq2.poll();
        }
        return ans;
    }
}

Compiler output:
Main.java:3: error: package com.sun.tools.classfile is not visible
import com.sun.tools.classfile.StackMapTable_attribute.verification_type_info;
                    ^
  (package com.sun.tools.classfile is declared in module jdk.jdeps, which is not in the module graph)
1 error
Language: C++

#include<iostream>
#include<cmath>

typedef struct {
  long long int x;
  long long int y;
  long long int z;
} cake;

long long int dp(cake* cakes,
        int i,
        int n_items,
        int is_x_neg,
        int is_y_neg,
        int is_z_neg) {
  if (i == 0) return 0;
  if (n_items == 0) return 0;

  long long int val_a = dp(cakes, i-1, n_items, is_x_neg, is_y_neg, is_z_neg);
  long long int val_b = dp(cakes, i-1, n_items-1, is_x_neg, is_y_neg, is_z_neg)
             + cakes[i].x * (is_x_neg ? -1 : 1)
             + cakes[i].y * (is_y_neg ? -1 : 1)
             + cakes[i].z * (is_z_neg ? -1 : 1);
  
  long long int val = val_a > val_b ? val_a : val_b;
  return val;
}

int main() {
  int N, M;
  std::cin >> N >> M;
  
  cake cakes[N];
  for (int i=0; i<N; i++)
    std::cin >> cakes[i].x >> cakes[i].y >> cakes[i].z;
   
  long long int ans = 0;
  for (int i=0; i<2; i++)
    for (int j=0; j<2; j++)
      for (int k=0; k<2; k++) {
        long long int val = dp(cakes, N-1, M, i, j, k);
        std::cerr << val << std::endl;
        if (ans < val) ans = val;
      }
  
  std::cout << ans << std::endl;
  return 0;


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

N, M = map(int, input().split())
A = []
for i in range(0, N):
	A.append(list(map(int, input().split())))
max = 0
for i in range(0, 8):
	lst = []
	m = i
	for j in range(0, 3):
		lst.append(-1+2*(m%2))
		m //= 2
	A.sort(key = lambda v: v[0]*lst[0]+v[1]*lst[1]+v[2]*lst[2], reverse = True)
	sums = [0, 0, 0]
	for j in range(0, M):
		sums[0] += A[j][0]
		sums[1] += A[j][1]
		sums[2] += A[j][2]
	sum = abs(sums[0])+abs(sums[1])+abs(sums[2])
	if max < sum:
		max = sum
print(max)

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

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

int main() {
  int N,M;
  cin >> N >> M;
  int x[N],y[N],z[N];
  vector<long> sum(N);
  long ans[8];
  for(int i=0;i<N;i++){
    cin >> x[i] >> y[i] >> z[i];
  }
  for(int j=0;j<8;j++){
    for(int i=0;i<N;i++){
      sum[i]=x[i]*(j%2)+y[i]*((j/2)%2)+z[i]*((j/4)%2);
    }
    sort(sum.begin(),sum.end());
    reverse(sum.begin(), sum.end());
    for(int j=0;j<M;j++){
      ans[i]+=sum[j];
    }
  }
  cout << max({ans[0],ans[1],ans[2],ans[3],ans[4],ans[5],ans[6],ans[7]});
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:11: error: 'i' was not declared in this scope
   20 |       ans[i]+=sum[j];
      |           ^
Language: C++

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

int main() {
  int N,M;
  cin >> N >> M;
  int x[N],y[N],z[N];
  vector<long> sum[N];
  long ans[8];
  for(int i=0;i<N;i++){
    cin >> x[i] >> y[i] >> z[i];
  }
  for(int j=0;j<8;j++){
    for(int i=0;i<N;i++){
      sum[i]=x[i]*(j%2)+y[i]*((j/2)%2)+z[i]*((j/4)%2);
    }
    sort(sum.begin(),sum.edn());
    for(int j=0;j<M;j++){
      ans[i]+=sum[j];
    }
  }
  cout << max({ans[0],ans[1],ans[2],ans[3],ans[4],ans[5],ans[6],ans[7]});
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:53: error: no match for 'operator=' (operand types are 'std::vector<long int>' and 'int')
   15 |       sum[i]=x[i]*(j%2)+y[i]*((j/2)%2)+z[i]*((j/4)%2);
      |                                                     ^
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long int; _Alloc = std::allocator<long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'int' to 'const std::vector<long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long int; _Alloc = std::allocator<long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'int' to 'std::vector<long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long int; _Alloc = std::allocator<long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:17:14: error: request for member 'begin' in 'sum', which is of non-class type 'std::vector<long int> [N]'
   17 |     sort(sum.begin(),sum.edn());
      |              ^~~~~
a.cc:17:26: error: request for member 'edn' in 'sum', which is of non-class type 'std::vector<long int> [N]'
   17 |     sort(sum.begin(),sum.edn());
      |                          ^~~
a.cc:19:11: error: 'i' was not declared in this scope
   19 |       ans[i]+=sum[j];
      |           ^
Language: C++

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

int main() {
  int N,M;
  cin >> N >> M;
  int x[N],y[N],z[N];
  long sum[8];
  for(int i=0;i<N;i++){
    cin >> x[i] >> y[i] >> z[i];
    for(int j=0;j<8;j++){
      sum[j]+=max(0,x[i]*(j%2)+y[i]*((j/2)%2)+z[i]*((j/4)%2)));
    }
  }
  cout << max({sum[0],sum[1],sum[2],sum[3],sum[4],sum[5],sum[6],sum[7]});      
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:62: error: expected ';' before ')' token
   12 |       sum[j]+=max(0,x[i]*(j%2)+y[i]*((j/2)%2)+z[i]*((j/4)%2)));
      |                                                              ^
      |                                                              ;
Language: C++

#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<utility>
#include<functional>
#include<algorithm>
#include<bitset>
#include<ctime>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
int n,m;
typedef long long ll;
ll a[1005],b[1005],c[1005],dp[1005][1005][15];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>a[i]>>b[i]>>c[i];
	memset(dp,-68,sizeof(dp));
	for(int i=0;i<8;i++)
		dp[0][0][i]=0;
	for(int i=0;i<=n;i++)
		for(int j=0;j<=m;j++)
			for(int q=0;q<8;q++)
			{
				dp[i+1][j][q]=max(dp[i+1][j][q],dp[i][j][q]);
				ll here=dp[i][j][q];
				if(q&1)
					here+=a[i+1];
				else
					here-=a[i+1];
				if(q&2)
					here+=b[i+1];
				else
					here-=b[i+1];
				if(q&4)
					here+=c[i+1];
				else
					here-=c[i+1];
				dp[i+1][j+1][q]=max(dp[i+1][j+!1][q],here);
			}
	ll res=0;
	for(int i=0;i<8;i++)
		res=max(res,dp[n][m][i]);
	cout<<res;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'memset' was not declared in this scope
   28 |         memset(dp,-68,sizeof(dp));
      |         ^~~~~~
a.cc:19:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   18 | #include<cstdlib>
  +++ |+#include <cstring>
   19 | using namespace std;
Language: C++

#include<iostream>
#include<sstream>
#include<fstream>
#include<cstring>/*The header <string> and
<string.h> does not contain the useful
function 'memset' and 'memcpy'.*/
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<utility>
#include<algorithm>
#include<functional>
#include<ctime>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#define int long long
using namespace std;
int N,M,a[1010],b[1010],c[1010],dp[1010][1010][11];
main()
{
	memset(dp,-1e18LL,sizeof(dp));
	cin>>N>>M;
	for(int i=0;i<N;i++)
		cin>>a[i]>>b[i]>>c[i];
	for(int i=0;i<8;i++)
		dp[0][0][i]=0;
	for(int i=0;i<N;i++)
		for(int j=0;j<M;j++)
			for(int q=0;q<8;q++)
			{
				dp[i+1][j][q]=max(dp[i][j][q],dp[i+1][j][q]);
				int cnt=dp[i][j][q];
				if(q&1)
					cnt+=a[i+1];
				else	cnt-=a[i+1];
				if(q&2)
					cnt+=b[i+1];
				else	cnt-=b[i+1];
				if(q&4)
					cnt+=c[i+1];
				else	cnt-=c[i+1];
				dp[i+1][j+1][q]=max(dp[i+1][j+1][q],cnt);
			}
	int res=0;
	for(int i=0;i<8;i++)
		res=max(res,dp[N][M][i]);
	cout<<res<<endl;
	return 0;
}

Compiler output:
a.cc:24:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   24 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:26:20: error: unable to find numeric literal operator 'operator""LL'
   26 |         memset(dp,-1e18LL,sizeof(dp));
      |                    ^~~~~~
Language: C++

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

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

int main() {
    int N, M;
    cin >> N >> M; // N種類,M個 N>= M
    vector<vector<long long>> a(N, vector<long long>(3));
    REP(i, N) { cin >> a[i][0] >> a[i][1] >> a[i][2]; }
    // 2^3の8パターン試す
    for(int bit = 0; bit < (1 << 3); bit++) {
        vector<long long> b;
        for(int i = 0; i < N; i++) {
            long long tmp = 0;
            for(int j = 0; j < 3; j++) {
                if(bit & (1 << j)) {
                    tmp += a[i][j]
                } else {
                    tmp -= a[i][j];
                }
            }
        }
        b.push_back(tmp);
        sort(b.begin(), b.end(), greater<loong long>());
        long long sum = 0;
        REP(i, M) { sum += b[i]; }
        res = max(res, sum);
    }
    cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:35: error: expected ';' before '}' token
   44 |                     tmp += a[i][j]
      |                                   ^
      |                                   ;
   45 |                 } else {
      |                 ~                  
a.cc:50:21: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   50 |         b.push_back(tmp);
      |                     ^~~
      |                     tm
a.cc:51:42: error: 'loong' was not declared in this scope; did you mean 'long'?
   51 |         sort(b.begin(), b.end(), greater<loong long>());
      |                                          ^~~~~
      |                                          long
a.cc:51:52: error: template argument 1 is invalid
   51 |         sort(b.begin(), b.end(), greater<loong long>());
      |                                                    ^
a.cc:54:9: error: 'res' was not declared in this scope
   54 |         res = max(res, sum);
      |         ^~~
a.cc:56:13: error: 'res' was not declared in this scope
   56 |     cout << res << endl;
      |             ^~~
Language: C++

#inlcude<iostream>
#include<vector>
#include<algorithm>
using namespace std;
long long N,M,a[100009][3],maxn=-(1LL<<60);
int main(){
	cin>>N>>M;
	for(int i=1;i<=N;i++){
		for(int j=0;j<3;j++){
			cin>>a[i][j];
		}
	}
	for(int i=0;i<8;i++){
		vector<long long>vec;
		for(int j=1;j<=N;j++){
			long long S=0;
			for(int k=0;k<3;k++){
				if((i/(1<<k))%2==0)
				{
					S+=a[j][k];
				}
				else{
					S-=a[j][k];
				}
			}
			vec.push_back(S);
		}
		sort(vec.begin(),vec.end());reverse(vec.begin(),vec.end());
		long long ans=0;
		for(int j=0;j<M;j++){
			ans+=vec[j];
		}
		maxn=max(maxn,ans);
	}
	cout<<maxn<<endl;
	return 0;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inlcude; did you mean #include?
    1 | #inlcude<iostream>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin>>N>>M;
      |         ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<algorithm>
  +++ |+#include <iostream>
    4 | using namespace std;
a.cc:35:9: error: 'cout' was not declared in this scope
   35 |         cout<<maxn<<endl;
      |         ^~~~
a.cc:35:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:35:21: error: 'endl' was not declared in this scope
   35 |         cout<<maxn<<endl;
      |                     ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include<algorithm>
  +++ |+#include <ostream>
    4 | using namespace std;
Language: C

import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();
        int N, M;
        {int[] a = r.ii(); N = a[0]; M = a[1];}
        long[] x = new long[N],
               y = new long[N],
               z = new long[N];
               
        for(int i = 0; i < N; i++){
            long[] a = r.ll();
            x[i] = a[0];
            y[i] = a[1];
            z[i] = a[2];
        }
        
        long max = 0;
        for(int i = 0; i < 8; i++){
            String sign = String.format("%03d", Integer.parseInt(Integer.toBinaryString(i)));             
            int xs = sign.charAt(0) == '0' ? 1 : -1,
                ys = sign.charAt(1) == '0' ? 1 : -1,
                zs = sign.charAt(2) == '0' ? 1 : -1; 
                
            long[] w = new long[N];
            for(int j = 0; j < N; j++)
                w[j] += x[j]*xs + y[j]*ys + z[j]*zs;
            
            Arrays.sort(w);
            long sum = 0;
            for(int j = 0; j < M; j++)
                sum += w[N-1-j];
            
            if(max < sum)
                max = sum;
        }
        print(max);        
    }

    static void print(Object o){
        System.out.println(o.toString());
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }

        String s() throws IOException{
            return readLine();
        }

        String[] ss() throws IOException{
            return s().split(" ");
        }

        int Int(String s){
            return Integer.parseInt(s);
        }

        int i() throws IOException{
            return Int(s());
        }

        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }

        long Long(String s){
            return Long.parseLong(s);
        }

        long l() throws IOException{
            return Long(s());
        }

        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long(ss[j]);            
            return ll;
        }
    }
}

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.io.*;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.io.*;
      |            ^
main.c:2:1: error: unknown type name 'import'
    2 | import java.util.*;
      | ^~~~~~
main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    2 | import java.util.*;
      |            ^
main.c:3:1: error: unknown type name 'public'
    3 | public class Main{
      | ^~~~~~
main.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
    3 | public class Main{
      |              ^~~~
Language: C++

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

#define MAX 1005
int xyz[3*MAX];
int result[8];
int temp[MAX];
int n,m;



int ev(int opa,int opb,int opc){
	opa=opa*2-1;
	opb=opb*2-1;l
	opc=opc*2-1;

	int s=0;
	for(int i=0;i<n;i++){
		temp[i]= xyz[i*3]*opa+xyz[i*3+1]*opb+xyz[i*3+2]*opc;
	}
	sort(temp,temp+n);
	for(int i=0;i<m;i++){
		s+=temp[n-1-i];
	}
	return s;
}



int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++){
cin>>xyz[i*3]>>xyz[i*3+1]>>xyz[i*3+2];
	}
	int maxn = 0;
	  for(int i = 0;i<8;i++){
	  	maxn=max(ev(i/4%2,i/2%2,i%2),maxn);
	  }
	  cout<<maxn;
    return 0;

}


Compiler output:
a.cc: In function 'int ev(int, int, int)':
a.cc:14:21: error: 'l' was not declared in this scope
   14 |         opb=opb*2-1;l
      |                     ^
Language: C++

#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;

int main() {
    ll n,m;
    cin>>n>>m;
    vector<ll> x(n);
    vector<ll> y(n);
    vector<ll> z(n);
    ll maxcake=0;

    rep(i,n){
        cin>>x[i]>>y[i]>>z[i];
    }

    for(int ii=0;ii<(1<<3);ii++){
        vector<ll> v(3);
       for(int j=0;j<3;j++){
           if((ii>>j)&1){
               v[j]=1ll;
           }else{
            v[j]=-1ll;
           }
       }
        vector<ll> vc;a

       rep(i,n){
           ll t=x[i]*v[0]+y[i]*v[1]+z[i]*v[2];
          vc.push_back(abs(t));
       }

       sort(vc.rbegin(),vc.rend());
     ll yu=0;
       rep(i,m){
           yu+=abs(vc[i]);
       }


        maxcake=max(yu,maxcake);


    }
    cout<<maxcake<<endl;



    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:23: error: 'a' was not declared in this scope
   45 |         vector<ll> vc;a
      |                       ^
a.cc:47:12: error: 'i' was not declared in this scope
   47 |        rep(i,n){
      |            ^
a.cc:16:31: note: in definition of macro 'rep'
   16 | #define rep(i, n) for(int i=0;i<n;i++)
      |                               ^
Language: C++

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

int main(){
  int N, M;cin>>N>>M;
  vll x,y,z;
  for (int i=0;i<N;++i){
    int x_,y_,z_;cin>>x_>>y_>>z_;
    x.push_back(x_);y.push_back(y_);z.push_back(z_);
  }

  vi sign={-1,1};

  ll best_score=0;

  for (int j=0;j<2;++j){
    for (int k=0;k<2;++k){
      for (int l=0;l<2;++l){
        vll v;
        for (int i=0;i<N;++i){
          ll raw=sign[j]*x[i]+sign[k]*y[i]+sign[l]*z[i];
          v.push_back(raw);
        }
        sort(v.begin(), v.end(), greater<ll>());
        ll tmp=0;
        for (int i=0;i<M;++i){
          tmp+=v[i];
        }
        best_score=max(best_score, tmp);
      }
    }
  }

  cout << best_score << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'vi' was not declared in this scope
   14 |   vi sign={-1,1};
      |   ^~
a.cc:23:18: error: 'sign' was not declared in this scope; did you mean 'sin'?
   23 |           ll raw=sign[j]*x[i]+sign[k]*y[i]+sign[l]*z[i];
      |                  ^~~~
      |                  sin
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main(){
  int N, M;cin>>N>>M;
  vll X, Y, Z;
  vi sign={-1,1};

  for (int i=0;i<N;++i){
    ll x,y,z;cin>>x>>y>>z;
    X.push_back(x);
    Y.push_back(y);
    Z.push_back(z);
  }

  ll ans=0;
  ll sx=0;
  ll sy=0;
  ll sz=0;

  for (int s=0;s<2;++s){
    for (int t=0;t<2;++t){
      for (int u=0;u<2;++u){
        vll W;
        for (int i=0;i<N;++i){
          ll w=sign[s]*X[i]+sign[t]*Y[i]+sign[u]*Z[i];
          W.push_back(w);
        }
        sort(W.begin(), W.end(), greater<ll>());
        ll tmp_ans=0;
        for (int i=0;i<M;i++){
          tmp_ans+=w[i];
        }
        if(ans<tmp_ans){ans=tmp_ans;}
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:20: error: 'w' was not declared in this scope
   35 |           tmp_ans+=w[i];
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main(){
  int N, M;cin>>N>>M;
  vll X, Y, Z;
  vi sign={-1,1};

  for (int i=0;i<N;++i){
    ll x,y,z;cin>>x>>y>>z;
    X.push_back(x);
    Y.push_back(y);
    Z.push_back(z);
  }

  ll ans=0;
  ll sx=0;
  ll sy=0;
  ll sz=0;

  for (int s=0;s<2;++s){
    for (int t=0;t<2;++t){
      for (int u=0;u<2;++u){
        vll W;
        for (int i=0;i<N;++i){
          ll w=sign[s]*x[i]+sign[t]*y[i]+sign[u]*z[i];
          W.push_back(w);
        }
        sort(W.begin(), W.end(), greater<ll>());
        ll tmp_ans=0;
        for (int i=0;i<M;i++){
          tmp_ans+=w[i];
        }
        if(ans<tmp_ans){ans=tmp_ans;}
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:24: error: 'x' was not declared in this scope
   29 |           ll w=sign[s]*x[i]+sign[t]*y[i]+sign[u]*z[i];
      |                        ^
a.cc:29:37: error: 'y' was not declared in this scope
   29 |           ll w=sign[s]*x[i]+sign[t]*y[i]+sign[u]*z[i];
      |                                     ^
a.cc:29:50: error: 'z' was not declared in this scope
   29 |           ll w=sign[s]*x[i]+sign[t]*y[i]+sign[u]*z[i];
      |                                                  ^
a.cc:35:20: error: 'w' was not declared in this scope
   35 |           tmp_ans+=w[i];
      |                    ^