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

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

typedef long long ll;
ll p[2] = {1, -1};
const ll INF = 1LL << 60;

int main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> x(N), y(N), z(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i] >> z[i];
    }

    ll ans = 0;
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                vector<vector<ll>> dp(1010, vector<ll>(1010, -INF));
                dp[0][0] = 0;
                for (int n = 0; n < N; n++) {
                    ll X = x[n] * p[i], Y = y[n] * p[j], Z = z[n] * p[k];
                    ll sum = X + Y + Z;
                    for (int m = 0; m <= M; m++) {
                        if (dp[n][m] == -INF) continue;
                        dp[n + 1][m + 1] =
                            max(dp[n + 1][m + 1], dp[n][m] + sum);
                        dp[n + 1][m] = max(dp[n + 1][m], dp[n][m]);
                    }
                }
                chmax(ans, dp[N][M]);
            }
        }
    }

    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:17: error: 'chmax' was not declared in this scope
   32 |                 chmax(ans, dp[N][M]);
      |                 ^~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()
#define INF (ll)((1LL)<<60))

using namespace std;

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

int a[100005][3];

int main()
{
	ll maxn = -INF;

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N, M; cin >> N >> M;
	for (int i = 1; i <= N; ++i){
		for (int j = 0; j < 3; ++j){
			cin >> a[i][j];
		} // end for
	} // end for
	
	rep (i, 8){
		vector<ll> vec; vec.clear();
		for (int j = 1; j <= N; ++j){
			ll S = 0LL;
			rep (k, 3){
				if ((i / (1<<k)) % 2 == 0)
					S += a[j][k];
				else
					S -= a[j][k];
			} // end if
			vec.push_back(S);
		} // end for
		sort(ALL(vec));
		reverse(ALL(vec));
		ll ans = 0LL;
		rep (j, M){
			ans += vec[j];
		} // end rep
		maxn = max(maxn, ans);
	} // end rep
	cout << maxn << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:28: error: expected ',' or ';' before ')' token
    4 | #define INF (ll)((1LL)<<60))
      |                            ^
a.cc:15:20: note: in expansion of macro 'INF'
   15 |         ll maxn = -INF;
      |                    ^~~
Language: C

N,M = map(int,raw_input().split())

array = [map(int,raw_input().split()) for i in range(N)]

v = [[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]

ans = 0

for i in range(8):
    tmp = []
    for j in range(N):
        tmp.append(array[j][0]*v[i][0]+array[j][1]*v[i][1]+array[j][2]*v[i][2])
    tmp.sort()
    ans = max(ans,sum(tmp[N-M:]))

print ans

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | N,M = map(int,raw_input().split())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'M' [-Wimplicit-int]
    1 | N,M = map(int,raw_input().split())
      |   ^
main.c:1:7: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | N,M = map(int,raw_input().split())
      |       ^~~
main.c:1:11: error: expected expression before 'int'
    1 | N,M = map(int,raw_input().split())
      |           ^~~
main.c:3:1: error: expected ',' or ';' before 'array'
    3 | array = [map(int,raw_input().split()) for i in range(N)]
      | ^~~~~
Language: C++

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

long long ocbit(int x,int y,int z,int i){
  int X,Y,Z;
  X=i%2;i/=2;
  Y=i%2;i/=2;
  Z=i%2;
  return x*(2*X-1)+y*(2*Y-1)+z*(2*Z-1);
}

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> wa(N);
  vector<int> hikaku(8,0);
  int x,y,z;
  for(int j=0;j<8;j++){
    for(int i=0;i<N;i++){
      cin >> x,y,z;
      wa.at(i)=(x,y,z,j);
    }
    sort(wa.begin(),wa.end());
    reverse(wa.begin(),wa.end());
    for(int i=0;i<M;i++)
      hikaku.at(j)+=hikaku].at(i);
  }
  sort(hikaku.begin(),hikaku.end());
  cout << hikaku.at(7);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:19: error: no match for 'operator+=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<int>')
   26 |       hikaku.at(j)+=hikaku].at(i);
      |       ~~~~~~~~~~~~^~~~~~~~
Language: C++

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

long long ocbit(int x,int y,int z,int i){
  int X,Y,Z;
  X=i%2;i/=2;
  Y=i%2;i/=2;
  Z=i%2;
  return x*(2*X-1)+y*(2*Y-1)+z*(2*Z-1);
}

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> wa(N);
  vector<int> hikaku(8,0);
  int x,y,z;
  for(int j=0;j<8;j++){
    for(int i=0;i<N;i++){
      cin >> x,y,z;
      wa.at(i)=(x,y,z,j);
    }
    sort(wa.begin(),wa.end());
    for(int i=0;i<M;i++)
      hikaku.at(j)+=reverse.at(N-1-i);
  }
  sort(hikaku.begin(),hikaku.end());
  cout << hikaku.at(7);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:29: error: overloaded function with no contextual type information
   25 |       hikaku.at(j)+=reverse.at(N-1-i);
      |                             ^~
Language: C++

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

long long ocbit(int x,int y,int z,int i){
  int X,Y,Z;
  X=i%2;i/=2;
  Y=i%2;i/=2;
  Z=i%2;
  return x*(2*X-1)+y*(2*Y-1)+z*(2*Z-1);
}

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> wa(N);
  vector<int> hikaku(8,0);
  int x,y,z;
  for(int j=0;j<8;j++){
    for(int i=0;i<N){
      cin >> x,y,z;
      wa.at(i)=(x,y,z,j);
    }
    sort(wa.begin(),wa.end());
    reverse(wa.begin(),wa.end());
    for(int i=0;i<M;i++)
      hikaku.at(j)+=reverse.at(i);
  }
  sort(hikaku.begin(),hikaku.end());
  cout << hikaku.at(7);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:20: error: expected ';' before ')' token
   19 |     for(int i=0;i<N){
      |                    ^
      |                    ;
a.cc:26:29: error: overloaded function with no contextual type information
   26 |       hikaku.at(j)+=reverse.at(i);
      |                             ^~
Language: C++

#include <bits/stdc++>
using namespace std;
int s[] = {-1,1};
int main(){
  int n,m; cin >> n >> m;;
  vector<long long int> a(n),b(n),c(n);
  for(int i=0;i<n;i++) cin >> a[i] >> b[i] >> c[i];
  long long int ans = -1000000000;
  for(int i=0;i<2;i++)
    for(int j=0;j<2;j++)
      for(int k=0;k<2;k++){
   		vector<int> v(n);   	
      	for(int l=0;l<n;l++) v[i] = s[i]*a[l] + s[j]*b[l] + s[k]*c[l];
        sort(v.begin(),v.end());
        long long int sum = 0;
        for(int l=0;l<m;i++) sum += v[n-i-1];
        ans = max(ans,sum);
   }
  cout << ans << endl;
  return 0;
}

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

#include <iostream>
#include <cmath>
typedef long long ll;

using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  ll x[N], y[N], z[N];
  for (int i = 0; i < N; i++) { cin >> x[i]; cin >> y[i]; cin >> z[i]; }

  ll ans = 0;
  ll sum_cake[N];
  for (int i = 0; i < N; i++) sum_cake[i] = x[i] + y[i] + z[i];
  sort(sum_cake, sum_cake + N, greater<ll>());
  ll sum_val = 0;
  for (int i = 0; i < M; i++) sum_val += sum_cake[i];
  ans = max(ans, sum_val);

  for (int i = 0; i < N; i++) sum_cake[i] = x[i] + y[i] - z[i];
  sort(sum_cake, sum_cake + N, greater<ll>());
  sum_val = 0;
  for (int i = 0; i < M; i++) sum_val += sum_cake[i];
  ans = max(ans, sum_val);

  for (int i = 0; i < N; i++) sum_cake[i] = x[i] - y[i] + z[i];
  sort(sum_cake, sum_cake + N, greater<ll>());
  sum_val = 0;
  for (int i = 0; i < M; i++) sum_val += sum_cake[i];
  ans = max(ans, sum_val);

  for (int i = 0; i < N; i++) sum_cake[i] = x[i] - y[i] - z[i];
  sort(sum_cake, sum_cake + N, greater<ll>());
  sum_val = 0;
  for (int i = 0; i < M; i++) sum_val += sum_cake[i];
  ans = max(ans, sum_val);

  for (int i = 0; i < N; i++) sum_cake[i] = -x[i] + y[i] + z[i];
  sort(sum_cake, sum_cake + N, greater<ll>());
  sum_val = 0;
  for (int i = 0; i < M; i++) sum_val += sum_cake[i];
  ans = max(ans, sum_val);

  for (int i = 0; i < N; i++) sum_cake[i] = -x[i] + y[i] - z[i];
  sort(sum_cake, sum_cake + N, greater<ll>());
  sum_val = 0;
  for (int i = 0; i < M; i++) sum_val += sum_cake[i];
  ans = max(ans, sum_val);

  for (int i = 0; i < N; i++) sum_cake[i] = -x[i] - y[i] + z[i];
  sort(sum_cake, sum_cake + N, greater<ll>());
  sum_val = 0;
  for (int i = 0; i < M; i++) sum_val += sum_cake[i];
  ans = max(ans, sum_val);

  for (int i = 0; i < N; i++) sum_cake[i] = -x[i] - y[i] - z[i];
  sort(sum_cake, sum_cake + N, greater<ll>());
  sum_val = 0;
  for (int i = 0; i < M; i++) sum_val += sum_cake[i];
  ans = max(ans, sum_val);
  
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   16 |   sort(sum_cake, sum_cake + N, greater<ll>());
      |   ^~~~
      |   sqrt
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n,m,a,b,c,e=-10000000000000000;
  cin>>n>>m;
  vector<vector<ll>> v(8,vector<ll>(n));
  int d[8][3]={{1,1,1},{1,1,-1},{1,-1,1},{-1,1,1},{1,-1,-1},{-1,1,-1},{-1,-1,1},{-1,-1,-1}};
  for(int i=0;i<n;i++){
    cin>>a>>b>>c;
    for(int j=0;j<8;j++){
      v[j][i]=a*d[0]+b*d[1]+c*d[2];
    }
  }
  for(int i=0;i<8;i++){
    sort(v[i].begin(),v[i].end(),greater());
    ll f=0;
    for(int j=0;j<m;j++){
      f+=v[i][j];
    }
    e=max(e,f);
  }
  cout<<e;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: invalid operands of types 'long long int' and 'int [3]' to binary 'operator*'
   12 |       v[j][i]=a*d[0]+b*d[1]+c*d[2];
      |               ~^~~~~
      |               |    |
      |               |    int [3]
      |               long long int
a.cc:12:23: error: invalid operands of types 'long long int' and 'int [3]' to binary 'operator*'
   12 |       v[j][i]=a*d[0]+b*d[1]+c*d[2];
      |                      ~^~~~~
      |                      |    |
      |                      |    int [3]
      |                      long long int
a.cc:12:30: error: invalid operands of types 'long long int' and 'int [3]' to binary 'operator*'
   12 |       v[j][i]=a*d[0]+b*d[1]+c*d[2];
      |                             ~^~~~~
      |                             |    |
      |                             |    int [3]
      |                             long long int
Language: C++

#include <iostream>
#include <cmath>
#include <stack>
#include <string>
using namespace std;
using ll=long long;

const ll nmax=1000;
ll x[nmax+1],y[nmax+1],z[nmax+1];


int main(){
    ll N,M;
    cin>>N>>M;
    for(int i=0;i<N;i++)cin>>x[i]>>y[i]>>z[i];
    ll sl[N];
    ll ans=0;
    for(int i=0;i<=1;i++){
        for(int j=0;j<=1;j++){
            for(int k=0;k<=1;k++){
                for(int l=0;l<N;l++)sl[l]=pow(-1,i)*x[l]+pow(-1,j)*y[l]+pow(-1,k)*z[l];
                sort(sl,sl+N,greater<ll>());
                ll ct=0;
                for(int i=0;i<M;i++)ct+=sl[i];
                ans=max(ans,ct);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:17: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   22 |                 sort(sl,sl+N,greater<ll>());
      |                 ^~~~
      |                 sqrt
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <cstring>
#include <cmath>
#include <math.h>

using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;


#define v_exists(elem, v) find(v.begin(),v.end(),elem)!=v.end()
#define s_exists(elem, s) s.find(elem)!=s.end()
#define tasu(x, y) (x+y)%MOD
#define kake(x, y) x*y%MOD

long gcd(long a, long b) {
    return b == 0 ? a : gcd(b, a % b);
}

long lcm( long m, long n ){
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;

	return ((m / gcd(m, n)) * n);
}

int main(){
	int N,M;
	cin >> N >> M;


	long long xyz [3][1010];

	for (int i = 0; i < N; ++i){
		for (int j = 0; j < 3; ++j){
			cin >> xyz[j][i];
		}
	}

	long long res = 0;
	for (int bit = 0; bit < (1<<3); ++bit){

		vector<long long> v;

		for(int i=0; i<N; ++i){

			long long temp = 0;

			for (int j = 0; j < 3; ++j){
				if(bit & (1 << j)){
					temp += xyz[j][i];
				} else {
					temp -= xyz[j][i];
				}
			}
			v.push_back(temp);
		}

		sort(v.begin(), v.end(), greater<long long>());

		long long sum = 0;
		for (int i = 0; i < M; ++i){
			sum += v[i];
		}

		res = max(res, sum);
	}

	cout << res << endl;

	return 0;
}

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

signed main() {
    
    int N, M;
    cin >> N >> M;
    
    vector<vector<int>> list;
    list.resize(N);
    
    int x, y, z;

    for(int i = 0; i < N; ++i){
        list[i].resize(3);
        cin >> x >> y >> z;
        list[i] = {x, y, z};
    }
    
    int ans = 0;
    int num = 0;
    vector<int> temp;
    
    for(int c = 0; c < 8; ++c){
        num = 0;
        for(int i = 0; i < N; ++i){
            temp.push_back(
                           ((c & 1) * 2 - 1) * list[i][0] + (((c >> 1) & 1) * 2 - 1) * list[i][1] + (((c >> 2) & 1) * 2 - 1) * list[i][2]);
        }
        sort(temp.begin(), temp.end());
        
        for(int i = N - 1; i >= N - M; --i){
            num += temp[i];
        }
        
        if(num > ans){
            ans = num;
        }
        
        temp.clear();
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> N >> M;
      |     ^~~
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     vector<vector<int>> list;
      |     ^~~~~~
a.cc:6:19: error: expected primary-expression before 'int'
    6 |     vector<vector<int>> list;
      |                   ^~~
a.cc:7:5: error: 'list' was not declared in this scope
    7 |     list.resize(N);
      |     ^~~~
a.cc:19:12: error: expected primary-expression before 'int'
   19 |     vector<int> temp;
      |            ^~~
a.cc:24:13: error: 'temp' was not declared in this scope
   24 |             temp.push_back(
      |             ^~~~
a.cc:27:14: error: 'temp' was not declared in this scope
   27 |         sort(temp.begin(), temp.end());
      |              ^~~~
a.cc:27:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   27 |         sort(temp.begin(), temp.end());
      |         ^~~~
      |         short
a.cc:39:5: error: 'cout' was not declared in this scope
   39 |     cout << ans << endl;
      |     ^~~~
a.cc:39:20: error: 'endl' was not declared in this scope
   39 |     cout << ans << endl;
      |                    ^~~~
Language: C++

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

#define int long long

signed main() {
    int N, M;
    cin >> N >> M;
    
    vector<vector<int>> list;
    list.resize(N);
    
    int x, y, z;

    for(int i = 0; i < N; ++i){
        list[i].resize(3);
        cin >> x >> y >> z;
        list[i] = {x, y, z};
    }
    
    int ans = 0;
    
    vector<int> temp;
    
    for(int i = 0; i < N; ++i){
        temp.push_back(list[i][0] + list[i][1] + list[i][2]);
    }
    
    sort(temp.begin(), temp.end());
    
    int num = 0;
    for(int i = N - 1; i >= N - M; --i){
        num += temp[i];
    }
    
    ans = num;
    
    temp.clear();
    
    
    for(int i = 0; i < N; ++i){
        temp.push_back(list[i][0] + list[i][1] - list[i][2]);
    }
    
    sort(temp.begin(), temp.end());
    
    num = 0;
    for(int i = N - 1; i >= N - M; --i){
        num += temp[i];
    }
    
    if(num > ans){ans = num;}
    
    temp.clear();
    
    for(int i = 0; i < N; ++i){
        temp.push_back(list[i][0] - list[i][1] + list[i][2]);
    }
    
    sort(temp.begin(), temp.end());
    
    num = 0;
    for(int i = N - 1; i >= N - M; --i){
        num += temp[i];
    }
    
    if(num > ans){ans = num;}
    
    temp.clear();
    
    for(int i = 0; i < N; ++i){
        temp.push_back( - list[i][0] + list[i][1] + list[i][2]);
    }
    
    sort(temp.begin(), temp.end());
    
    num = 0;
    for(int i = N - 1; i >= N - M; --i){
        num += temp[i];
    }
    
    if(num > ans){ans = num;}
    
    temp.clear();
    
    for(int i = 0; i < N; ++i){
        temp.push_back(list[i][0] - list[i][1] - list[i][2]);
    }
    
    sort(temp.begin(), temp.end());
    
    num = 0;
    for(int i = N - 1; i >= N - M; --i){
        num += temp[i];
    }
    
    if(num > ans){ans = num;}
    
    temp.clear();
    
    for(int i = 0; i < N; ++i){
        temp.push_back(-list[i][0] + list[i][1] - list[i][2]);
    }
    
    sort(temp.begin(), temp.end());
    
    num = 0;
    for(int i = N - 1; i >= N - M; --i){
        num += temp[i];
    }
    
    if(num > ans){ans = num;}
    
    temp.clear();
    
    for(int i = 0; i < N; ++i){
        temp.push_back(-list[i][0] - list[i][1] + list[i][2]);
    }
    
    sort(temp.begin(), temp.end());
    
    num = 0;
    for(int i = N - 1; i >= N - M; --i){
        num += temp[i];
    }
    
    if(num > ans){ans = num;}
    
    temp.clear();
    
    for(int i = 0; i < N; ++i){
        temp.push_back(-list[i][0] - list[i][1] - list[i][2]);
    }
    
    sort(temp.begin(), temp.end());
    
    num = 0;
    for(int i = N - 1; i >= N - M; --i){
        num += temp[i];
    }
    
    if(num > ans){ans = num;}
    
    temp.clear();
    
    cout << ans << endl;
    
    return 0;
}

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

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){

  int n,m;
  cin>>n>>m;
  vector<llong> v1,v2,v3,v4,v5,v6,v7,v8;
  REP(i,n){
    llong x,y,z;
    cin>>x>>y>>z;
    v1.pb(x+y+z);
    v2.pb(x+y-z);
    v3.pb(x-y+z);
    v4.pb(x-y-z);
    v5.pb(-x+y+z);
    v6.pb(-x+y-z);
    v7.pb(-x-y+z);
    v8.pb(-x-y-z);
  }

  VSORT(v1);
  VSORT(v2);
  VSORT(v3);
  VSORT(v4);
  VSORT(v5);
  VSORT(v6);
  VSORT(v7);
  VSORT(v8);

  llong sum[8];
  REP(i,8){
    sum[i] = 0;
  }
  llona ans = 0;
  for(int i=n-1;i>n-1-m;i--){
    sum[0] += v1[i];
    sum[1] += v2[i];
    sum[2] += v3[i];
    sum[3] += v4[i];
    sum[4] += v5[i];
    sum[5] += v6[i];
    sum[6] += v7[i];
    sum[7] += v8[i];
  }
  REP(i,8){
    ans = max(sum[i],ans);
  }

  cout<<ans<<endl;


  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:3: error: 'llona' was not declared in this scope; did you mean 'llong'?
   51 |   llona ans = 0;
      |   ^~~~~
      |   llong
a.cc:63:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   63 |     ans = max(sum[i],ans);
      |     ^~~
      |     abs
a.cc:66:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   66 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

#define _USE_MATH_DEFINES 

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>

using namespace std;

typedef long long ll;

#define REP(var,n) for(int var=0;var<(n);var++)
#define ALL(c) (c).begin(),(c).end()

ll solve(int N, int M, vector<ll>&  x, vector<ll>& y, vector<ll>& z){
    ll best =0;
    for(int pm1=-1;pm1<=1;pm1+=2)
        for(int pm2=-1;pm2<=1;pm2+=2)
            for(int pm3=-1;pm3<=1;pm3+=2){
                vector<ll> s(N);
                REP(i,N){
                    s[i] = x[i]*pm1 + y[i]*pm2 + z[i]*pm3;
                }
                sort(ALL(s)); reverse(ALL(s));
                ll score = 0;
                REP(i,M) score += s[i];
                best = max(best, score);
            }
    return best;
}

int main()
{
    int N,M; cin >> N >> M;
    vector<ll> x(N), y(N), z(N);

    REP(i,N){
        cin >> x[i] >> y[i] >> z[i];
    }
    cout << solve(N,M,x,y,z) << endl;

    return 0;
}

Compiler output:
a.cc: In function 'll solve(int, int, std::vector<long long int>&, std::vector<long long int>&, std::vector<long long int>&)':
a.cc:25:17: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   25 |                 sort(ALL(s)); reverse(ALL(s));
      |                 ^~~~
      |                 sqrt
a.cc:25:31: error: 'reverse' was not declared in this scope
   25 |                 sort(ALL(s)); reverse(ALL(s));
      |                               ^~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using Int = long long;
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[i] >> Y[i] >> Z[i];
    Int result = 0;
    for (int i = 0; i < 8; i++) {
        vector<Int> P(N);
        for (int j = 0; j < N; j++) {
            P[j] = (i&1 ? 1 : -1) * X[j] + (i&2 ? 1 : -1) * Y[j] + (i&4 ? 1 : -1) * Z[j];
        }
        sort(P.rbegin(), P.rend());
        result = max(result, accumulate(P.begin(), P.begin()+M, 0LL));
    }
    cout << result << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:30: error: 'accumulate' was not declared in this scope
   19 |         result = max(result, accumulate(P.begin(), P.begin()+M, 0LL));
      |                              ^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n,m,a,b,c;
    ll x[1000],y[1000],z[1000],memo[1000];
    cin>>n>>m;
    a=1,b=1,c=1;
    for(int i=0;i<n;i++)memo[i]=(x[i]*a)+(y[i]*b)+(z[i]*c);
    sort(memo,memo+n);
    cnt=0;
    for(int i=n-1;i>=n-m;i--)cnt+=memo[i];
    ans=max(ans,cnt);
    a=1,b=1,c=-1;
    for(int i=0;i<n;i++)memo[i]=(x[i]*a)+(y[i]*b)+(z[i]*c);
    sort(memo,memo+n);
    cnt=0;
    for(int i=n-1;i>=n-m;i--)cnt+=memo[i];
    ans=max(ans,cnt);
    a=1,b=-1,c=1;
    for(int i=0;i<n;i++)memo[i]=(x[i]*a)+(y[i]*b)+(z[i]*c);
    sort(memo,memo+n);
    cnt=0;
    for(int i=n-1;i>=n-m;i--)cnt+=memo[i];
    ans=max(ans,cnt);
    a=1,b=-1,c=-1;
    for(int i=0;i<n;i++)memo[i]=(x[i]*a)+(y[i]*b)+(z[i]*c);
    sort(memo,memo+n);
    cnt=0;
    for(int i=n-1;i>=n-m;i--)cnt+=memo[i];
    ans=max(ans,cnt);
    a=-1,b=1,c=1;
    for(int i=0;i<n;i++)memo[i]=(x[i]*a)+(y[i]*b)+(z[i]*c);
    sort(memo,memo+n);
    cnt=0;
    for(int i=n-1;i>=n-m;i--)cnt+=memo[i];
    ans=max(ans,cnt);
    a=-1,b=1,c=-1;
    for(int i=0;i<n;i++)memo[i]=(x[i]*a)+(y[i]*b)+(z[i]*c);
    sort(memo,memo+n);
    cnt=0;
    for(int i=n-1;i>=n-m;i--)cnt+=memo[i];
    ans=max(ans,cnt);
    a=-1,b=-1,c=1;
    for(int i=0;i<n;i++)memo[i]=(x[i]*a)+(y[i]*b)+(z[i]*c);
    sort(memo,memo+n);
    cnt=0;
    for(int i=n-1;i>=n-m;i--)cnt+=memo[i];
    ans=max(ans,cnt);for(int i=0;i<n;i++)memo[i]=(x[i]*a)+(y[i]*b)+(z[i]*c);
    sort(memo,memo+n);
    cnt=0;
    for(int i=n-1;i>=n-m;i--)cnt+=memo[i];
    ans=max(ans,cnt);
    a=-1,b=-1,c=-1;
    for(int i=0;i<n;i++)memo[i]=(x[i]*a)+(y[i]*b)+(z[i]*c);
    sort(memo,memo+n);
    cnt=0;
    for(int i=n-1;i>=n-m;i--)cnt+=memo[i];
    ans=max(ans,cnt);
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
   11 |     cnt=0;
      |     ^~~
      |     int
a.cc:13:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |     ans=max(ans,cnt);
      |     ^~~
      |     abs
Language: C++

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


int main(){
    int n,m;
    cin>>n>>m;
    ll ans=0;
    
    vector<ll>a(n),b(n),c(n);
    rep(i,n)cin>>a[i]>>b[i]>>c[i];
    for(int bit=0;bit<(1<<4);bit++){
        ll sum=0;
        rep(i,n){
        ll t=0;
        if(bit|1)t+=a[i];
        else t-=a[i];
        if(bit>>1|1)t+=b[i]
        else t-=b[i];
        if(bit>>2|1)t+=c[i];
        else t-=c[i];
        if(t>0)sum+=t;
        }
    ans=max(ans,sum);
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:28: error: expected ';' before 'else'
   21 |         if(bit>>1|1)t+=b[i]
      |                            ^
      |                            ;
   22 |         else t-=b[i];
      |         ~~~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main() {
    long long n, m, a[1000][3];
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 3; ++j) {
            cin >> a[i][j];
        }
    }
    long long max = -(1LL << 60);
    for (int i = 0; i < 8; ++i) {
        vector<long long> vec;
        for (int j = 0; j < n; ++j) {
            long long S = 0;
            for (int k = 0; k < 3; ++k) {
                if (i & 1 << k) {
                    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 _max = 0;
        for (int j = 0; j < m; ++j) {
            _max += vec[j];
        }
        if (_max > max) {
            max = _max;
        }
    }
    cout << max << endl;
    return 0;
}


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

#include<iostream>
#include<vector>
using namespace std;
int main() {
    long long n, m, a[1000][3];
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 3; ++j) {
            cin >> a[i][j];
        }
    }
    long long max = LLONG_MIN;
    for (int i = 0; i < 8; ++i) {
        vector<long long> vec;
        for (int j = 0; j < n; ++j) {
            long long S = 0;
            for (int k = 0; k < 3; ++k) {
                if (i & 1 << k) {
                    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 _max = 0;
        for (int j = 0; j < m; ++j) {
            _max += vec[j];
        }
        if (_max > max) {
            max = _max;
        }
    }
    cout << max << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: 'LLONG_MIN' was not declared in this scope
   12 |     long long max = LLONG_MIN;
      |                     ^~~~~~~~~
a.cc:3:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include<vector>
  +++ |+#include <climits>
    3 | using namespace std;
a.cc:26:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   26 |         sort(vec.begin(), vec.end());
      |         ^~~~
      |         short
a.cc:27:9: error: 'reverse' was not declared in this scope
   27 |         reverse(vec.begin(), vec.end());
      |         ^~~~~~~
Language: C++

10 5
10 -80 21
23 8 38
-94 28 11
-26 -2 18
-69 72 79
-26 -86 -54
-72 -50 59
21 65 -32
40 -94 87
-62 18 82

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 10 5
      | ^~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
typedef int Int;
#define int long long
#define loop(i,n) for(int i =0; i < (n); i ++)
using namespace std;
Int main(){
	int n,m;
	cin>>n>>m;
	int num[n][3],maxv=-1;
	loop(i,n)loop(j,3)cin>>num[i][j];
	loop(bit,8){
		vector<int> v(n);
		loop(i,n)loop(j,3)v[i]+=(bit & (1<<j) ? -1 : 1) * num[i][j];
		sort(v.rbegin(),v.rend());
		maxv=max(maxv,accumulate(v.begin(),v.begin()+m,0LL));
	}
	cout<<maxv;
	return 0;
}

Compiler output:
a.cc: In function 'Int main()':
a.cc:17:31: error: 'accumulate' was not declared in this scope
   17 |                 maxv=max(maxv,accumulate(v.begin(),v.begin()+m,0LL));
      |                               ^~~~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
typedef int Int;
#define int long long
#define loop(i,n) for(int i =0; i < (n); i ++)
using namespace std;
Int main(){
	int n,m;
	cin>>n>>m;
	int num[n][3],maxv=-1;
	loop(i,n)loop(j,3)cin>>num[i][j];
	loop(bit,8){
		vector<int> v(n);
		loop(i,n)loop(j,3)v[i]+=(bit & (1<<j) ? -1 : 1) * num[i][j];
		sort(v.rbegin(),v.rend());
		maxv=max(maxv,accumulate(v.begin(),v.begin()+m,0LL));
	}
	cout<<maxv;
	return 0;
}

Compiler output:
a.cc: In function 'Int main()':
a.cc:13:17: error: 'vector' was not declared in this scope
   13 |                 vector<int> v(n);
      |                 ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<algorithm>
  +++ |+#include <vector>
    3 | typedef int Int;
a.cc:4:13: error: expected primary-expression before 'long'
    4 | #define int long long
      |             ^~~~
a.cc:13:24: note: in expansion of macro 'int'
   13 |                 vector<int> v(n);
      |                        ^~~
a.cc:14:35: error: 'v' was not declared in this scope
   14 |                 loop(i,n)loop(j,3)v[i]+=(bit & (1<<j) ? -1 : 1) * num[i][j];
      |                                   ^
a.cc:15:22: error: 'v' was not declared in this scope
   15 |                 sort(v.rbegin(),v.rend());
      |                      ^
a.cc:16:31: error: 'accumulate' was not declared in this scope
   16 |                 maxv=max(maxv,accumulate(v.begin(),v.begin()+m,0LL));
      |                               ^~~~~~~~~~
Language: C++

#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
using namespace std;
//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] = {};
long long xx[1001] = {}, yy[1001] = {}, zz[1001] = {};

void BubSort()


Compiler output:
a.cc:17:15: error: expected initializer at end of input
   17 | void BubSort()
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <bitset>
#include <algorithm>

using namespace std;

int main(){
        int N = 0;
        int M = 0;
        long long ans = 0;
        cin >> N >> M;

        vector<map<char, long long>> cake;
        while(N--){
                long long x, y, z;
                cin >> x >> y >> z;
                map<char, long long> mp ;
                mp.insert(make_pair('x', x));
                mp.insert(make_pair('y', y));
                mp.insert(make_pair('z', z));
                cake.push_back(mp);
        }

        for(int i = 1; i < pow(2, cake.size()); i++){
                bitset<1000> b(i);
                string k = b.to_string();
                if(count(k.begin(), k.end(), '1') == M){
                        long long totx = 0, toty = 0, totz = 0;
                        for(int j = 0; j < k.length(); j++){
                                if(k[999-j] == '1'){
                                        totx += ((map<char, long long>)cake[j]).at('x');
                                        toty += ((map<char, long long>)cake[j]).at('y');
                                        totz += ((map<char, long long>)cake[j]).at('z');
                                }
                        }
                        ans = max(ans, abs(totx) + abs(toty) + abs(totz));
                }
        }
        cout << ans << endl;

        return 0;


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

#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#include <bitset>
#include <complex>
#include <cassert>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define GI(i) (scanf("%d",&i))
#define GLL(i) (scanf("%lld",&i))
#define GD(i)  (scanf("%lf",&i))
#define PB          push_back
#define MP          make_pair
#define MT          make_tuple
#define GET0(x)     (get<0>(x))
#define GET1(x)     (get<1>(x))
#define GET2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       (1LL<<60)
#define LLMIN       -(1LL<<60)
#define IMAX        (1<<30)
#define IMIN        -(1<<30)
typedef long long LL;
using namespace std;
 
LL N,M;
LL X[1000],Y[1000],Z[1000];
LL DP[1000+1][1000+1]={0};
 
int main(void){
    GLL(N);GLL(M);
    REP(i,N){
        GLL(X[i]);GLL(Y[i]);GLL(Z[i]);
    }
    LL ans = LLMIN;
    for(LL xflag=-1;xflag<2;xflag+=2)
        for(LL yflag=-1;yflag<2;yflag+=2)
            for(LL zflag=-1;zflag<2;zflag+=2){
               for(LL i=0;i<N;i++) for(LL j=0;j<=M;j++) DP[i][j] = 0;
               DP[0][1] = X[0]*xflag + Y[0]*yflag + Z[0]*zflag;
                for(LL i=0;i<N;i++){
                    LL v = X[i]*xflag + Y[i]*yflag + Z[i]*zflag;
                    DP[i][j] = max(DP[i-1][j-1] + v, DP[i-1][j]);
                    }
                }
  ans = max(ans, DP[N-1][M]);
            }
    printf("%lld\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:27: error: 'j' was not declared in this scope
   57 |                     DP[i][j] = max(DP[i-1][j-1] + v, DP[i-1][j]);
      |                           ^
a.cc: At global scope:
a.cc:62:11: error: expected constructor, destructor, or type conversion before '(' token
   62 |     printf("%lld\n",ans);
      |           ^
a.cc:63:5: error: expected unqualified-id before 'return'
   63 |     return 0;
      |     ^~~~~~
a.cc:64:1: error: expected declaration before '}' token
   64 | }
      | ^
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;

int main() {
    int N, M;
    cin >> N >> M;
    ll x[N], y[N], z[N];
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i] >> z[i];
    }
    for (int i = 0; i < 8; i++) {
        int mark[3];
        for (int j = 0; j < 3; i++) {
            if ((i >> j) % 2 == 1) {
                mark[j] = 1;
            } else {
                mark[j] = -1;
            }
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   50 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;

int main() {
    int N, M;
    cin >> N >> M;
    ll x[N], y[N], z[N];
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i] >> z[i];
    for (int i = 0; i < 8; i++) {
        int mark[3];
        for (int j = 0; j < 3; i++) {
            if ((i >> j) % 2 == 1) {
                mark[j] = 1;
            } else {
                mark[j] = -1;
            }
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   49 |     cout << ans << endl;
      |             ^~~
      |             abs
a.cc:50:2: error: expected '}' at end of input
   50 | }
      |  ^
a.cc:33:12: note: to match this '{'
   33 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  long long int a[n] ;
  long long sum;
  for(int i=0;i<n;i++){
    int x,y,z;
    a[i] = 0;
    cin >> x >> y >>z;
    a[i] = x + y + z;
  }

  for(int i=0;i<n;i++)
    for(int j=0;j<n-1;j++){
      if(a[i]<a[i+1])swap(a[i],a[i+1]);
    }
  sum = 0;
  for(int i=0;i<m;i++){
    sum += a[i];
  }
  cout << sum << endl;

}
 int n,m;
  cin >> n >> m;
  long long int a[n] ;
  long long sum;
  for(int i=0;i<n;i++){
    int x,y,z;
    a[i] = 0;
    cin >> x >> y >> z;
    a[i] = x + y + z;
  }

  for(int i=0;i<n;i++)
    for(int j=0;j<n-1;j++){
      if(a[i]<a[i+1]) swap(a[i],a[i+1]);
    }
  sum = 0;
  for(int i=0;i<m;i++){
    sum += a[i];
  }
  cout << sum << endl;

}


Compiler output:
a.cc:27:3: error: 'cin' does not name a type
   27 |   cin >> n >> m;
      |   ^~~
a.cc:28:19: error: size of array 'a' is not an integral constant-expression
   28 |   long long int a[n] ;
      |                   ^
a.cc:30:3: error: expected unqualified-id before 'for'
   30 |   for(int i=0;i<n;i++){
      |   ^~~
a.cc:30:15: error: 'i' does not name a type
   30 |   for(int i=0;i<n;i++){
      |               ^
a.cc:30:19: error: 'i' does not name a type
   30 |   for(int i=0;i<n;i++){
      |                   ^
a.cc:37:3: error: expected unqualified-id before 'for'
   37 |   for(int i=0;i<n;i++)
      |   ^~~
a.cc:37:15: error: 'i' does not name a type
   37 |   for(int i=0;i<n;i++)
      |               ^
a.cc:37:19: error: 'i' does not name a type
   37 |   for(int i=0;i<n;i++)
      |                   ^
a.cc:38:17: error: 'j' does not name a type
   38 |     for(int j=0;j<n-1;j++){
      |                 ^
a.cc:38:23: error: 'j' does not name a type
   38 |     for(int j=0;j<n-1;j++){
      |                       ^
a.cc:41:3: error: 'sum' does not name a type
   41 |   sum = 0;
      |   ^~~
a.cc:42:3: error: expected unqualified-id before 'for'
   42 |   for(int i=0;i<m;i++){
      |   ^~~
a.cc:42:15: error: 'i' does not name a type
   42 |   for(int i=0;i<m;i++){
      |               ^
a.cc:42:19: error: 'i' does not name a type
   42 |   for(int i=0;i<m;i++){
      |                   ^
a.cc:45:3: error: 'cout' does not name a type
   45 |   cout << sum << endl;
      |   ^~~~
a.cc:47:1: error: expected declaration before '}' token
   47 | }
      | ^
Language: C++

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

int main(){
	ios::sync_with_stdio(0);
	long long n,m,ans=0,summ=0;
	cin>>n>>m;
	vector<long long> a1,a2,b1,b2,c1,c2,sum;
	for(long long i=0;i<n;i++){
		long long a,b,c;
		cin>>a>>b>>c;
		a1.push_back(a);
		b1.push_back(b);
		c1.push_back(c);
		a2.push_back(-a);
		b2.push_back(-b);
		c2.push_back(-c);
		sum.push_back(0);
	}
	for(int i=0;i<2;i++){
		vector<long long> a;
		if(i)a=a2;
		else a=a1;
		for(int j=0;j<2;j++){
			vector<long long> b;
			if(j) b=b2;
			else b=b1;
			for(int k=0;k<2;k++){
				vector<long long>c;
				if(k)c=c2;
				else c=c1;
				for(int l=0;l<n;++l){
					sum[l]=a[l]+b[l]+c[l];
				}
				sort(sum.begin(),sum.end());
				summ=0;
				for(int i=0;i<m;i++)summ+=sum[n-1-i];
				ans=max(ans,summ);
			}
		}
	}
	cout<<ans<<"\n";
	return 0;
}

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

import itertools

n, m = map(int, input().split())
pice = []
for _ in range(n):
    x, y, z = map(int, input().split())
    pice.append((x, y, z))
ans = 0
for i, j, k in itertools.product((-1, 1), repeat=3):
    a = [x * i + y * j + z * k for (x, y, z) in pice]
    a.sort()
    ans = max(ans, abs(sum(a[0:m])))
print(ans)


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

#include <iostream>
using namespace std;

int main() {
    long long N, M, ans = 0;
    cin >> N >> M;
    long long x[N], y[N], z[N];
    for (long long i = 0; i < N; ++i) cin >> x[i] >> y[i] >> z[i];

    for (long double i = 0; i < 1 << N; ++i) {
        long long s = i, t = 0;
        while (s) {
            if (s & 1) ++t;
            s = s >> 1;
        }
        if (t == M) {
            long long X = 0, Y = 0, Z = 0;
            for (long long j = 0; j < N; ++j) {
                if (i & 1 << j) {
                    X += x[j];
                    Y += y[j];
                    Z += z[j];
                }
            }
            if (X < 0) X *= -1;
            if (Y < 0) Y *= -1;
            if (Z < 0) Z *= -1;
            if (ans < X + Y + Z) ans = X + Y + Z;
        }
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:19:23: error: invalid operands of types 'long double' and 'int' to binary 'operator&'
   19 |                 if (i & 1 << j) {
      |                     ~ ^ ~~~~~~
      |                     |     |
      |                     |     int
      |                     long double
Language: C++

#include<stdio.h>
int n, m;
long long int a[1000], b[1000], c[1000], d, max=0;
void f(int n1, int m1, long long int a1, long long int b1, long long int c1)
{
  if(m1==m)
  {
    d=abs(a1)+abs(b1)+abs(c1);
    if(d>max) max=d;
    return;
  }
  if(n1==n) return;
  f(n1+1, m1, a1, b1, c1);
  f(n1+1, m1+1, a1+a[n1], b1+b[n1], c1+c[n1]);
}
int main()
{
  int i;
  scanf("%d %d", &n, &m);
  for(i=0; i<n; i++) scanf("%lld %lld %lld", a+i, b+i, c+i);
  f(0, 0, 0, 0, 0);
  printf("%lld", max);
  return 0;
}


Compiler output:
a.cc: In function 'void f(int, int, long long int, long long int, long long int)':
a.cc:8:7: error: 'abs' was not declared in this scope
    8 |     d=abs(a1)+abs(b1)+abs(c1);
      |       ^~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
using ll = long long;

int main() {
	ll n, m;
	cin >> n >> m;
	ll x[n], y[n], z[n];
	for (int i = 0;i < n;i++) {
		cin >> x[i] >> y[i] >> z[i];
	}
	///+++
	ll ans = 0, res[n], ress=0;
	for (int i = 0;i < n;i++)res[i] = x[i] + y[i] + z[i];
	sort(res, res + n);
	for (int i = n;i >= m;i--)ans += res[i-1];
	///++-
	ress = 0;
	for (int i = 0;i < n;i++)res[i] = x[i] + y[i] - z[i];
	sort(res, res + n);
	for (int i = n;i >= m;i--)ress += res[i-1];
	ans = max(ans, ress);
	///+-+
	ress = 0;
	for (int i = 0;i < n;i++)res[i] = x[i] - y[i] + z[i];
	sort(res, res + n);
	for (int i = n;i >= m;i--)ress += res[i-1];
	ans = max(ans, ress);
	///+--
	ress = 0;
	for (int i = 0;i < n;i++)res[i] = x[i] - y[i] - z[i];
	sort(res, res + n);
	for (int i = n;i >= m;i--)ress += res[i-1];
	ans = max(ans, ress);
	///-++
	ress = 0;
	for (int i = 0;i < n;i++)res[i] = -x[i] + y[i] + z[i];
	sort(res, res + n);
	for (int i = n;i >= m;i--)ress += res[i-1];
	ans = max(ans, ress);
	///-+-
	ress = 0;
	for (int i = 0;i < n;i++)res[i] = -x[i] + y[i] - z[i];
	sort(res, res + n);
	for (int i = n;i => m;i--)ress += res[i-1];
	ans = max(ans, ress);
	///--+
	ress = 0;
	for (int i = 0;i < n;i++)res[i] = -x[i] - y[i] + z[i];
	sort(res, res + n);
	for (int i = n;i >= m;i--)ress += res[i-1];
	ans = max(ans, ress);
	///---
	ress = 0;
	for (int i = 0;i < n;i++)res[i] = -x[i] - y[i] - z[i];
	sort(res, res + n);
	for (int i = n;i >= m;i--)ress += res[i-1];
	ans = max(ans, ress);

	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:27: error: expected primary-expression before '>' token
   46 |         for (int i = n;i => m;i--)ress += res[i-1];
      |                           ^
Language: C

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

int main(){
    
long long int N,M,x[1000],y[1000],z[1000],sum[1000],ans=0;
    
    scanf("%lld %lld",&N,&M);
    for(int i=0;i<N;i++)
    {
        scanf("%lld %lld %lld",&x[i],&y[i],&z[i]);
        sum[i] = x[i]+ y[i] + z[i];
        sum[i] = abs(sun[i]);
    }
    for(int i = 0;i<N;i++)
    {
        for(int j = N-1;j>0;j--)
        {
            if(sum[j]<sum[j-1])
            {
                long int b = sum[j];
                sum[j] = sum[j-1];
                sum[j-1] = b;
            }
        }
    }
    for(int i = 0;i<M;i++)
    {  
        ans += sum[N-1];
        N--;
    }
    
    printf("%lld\n",ans);
    return 0;
}        

Compiler output:
main.c: In function 'main':
main.c:14:22: error: 'sun' undeclared (first use in this function); did you mean 'sum'?
   14 |         sum[i] = abs(sun[i]);
      |                      ^~~
      |                      sum
main.c:14:22: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.*;

public class Main {
    @lombok.ToString
    private class Cake {
        long x, y, z;

        public Cake(long x, long y, long z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }
    }

    public void main(Scanner sc) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        Cake cake[] = new Cake[n];
        for (int i = 0; i < n; i++) {
            cake[i] = new Cake(sc.nextLong(), sc.nextLong(), sc.nextLong());
        }

        long ans = 0;
        long sums[] = new long[n];
        for (int i = 0; i < 8; i++) {
            int a = (i % 2) * 2 - 1;
            int b = ((i >> 1) % 2) * 2 - 1;
            int c = ((i >> 2) % 2) * 2 - 1;
            for (int j = 0; j < n; j++) {
                sums[j] = cake[j].x * a + cake[j].y * b + cake[j].z * c;
            }

            Arrays.sort(sums);
            long sum = 0;
            for (int j = 0; j < m; j++) {
                sum += sums[n - j - 1];
            }
            ans = Math.max(ans, sum);
        }

        System.out.println(ans);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Compiler output:
Main.java:4: error: package lombok does not exist
    @lombok.ToString
           ^
1 error