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

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


public class ABC100_4 {

    public static Scanner scanner = new Scanner(System.in);
	public static void main(String[] args) {

		int n = scanner.nextInt();
		int m = scanner.nextInt();
		long[][] totalValue = new long[8][n];
		for(int i=0; i<n; i++) {
			long x = scanner.nextLong();
			long y = scanner.nextLong();
			long z = scanner.nextLong();
			for(int j=0; j<8; j++) {
//				System.out.println((4&j) + "," + (2&j)+ "," + (1&j));
				if((4 & j) == 4)
					totalValue[j][i] += -x;
				else
					totalValue[j][i] += x;
				if((2 & j) == 2)
					totalValue[j][i] += -y;
				else
					totalValue[j][i] += y;
				if((1 & j) == 1)
					totalValue[j][i] += -z;
				else
					totalValue[j][i] += z;
			}
		}
		long max = Long.MIN_VALUE; 
		for(int i=0; i<8; i++) {
//			System.out.println(Arrays.toString(totalValue[i]));
			Arrays.sort(totalValue[i]);
//			System.out.println(Arrays.toString(totalValue[i]));
			long sum = 0l;
			for(int j=n-m; j<n; j++) {
				sum += totalValue[i][j];
			}
//			System.out.println(sum);
			if(sum > max)
				max = sum;
		}
		System.out.println(max);
	}
}


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

#include <stdio.h>

int main(void) {
	int N, i, M, j, k = 0;
	scanf("%d %d", &N, &M);
	long long x[N], y[N], z[N], total[8][N], ans = −10000000000;

	for(i = 0; i < N; i++){
		scanf("%lld %lld %lld", &x[i], &y[i], &z[i]);
		total[0][i] =   x[i] + y[i] + z[i];
		total[1][i] = - x[i] + y[i] + z[i];
		total[2][i] =   x[i] - y[i] + z[i];
		total[3][i] =   x[i] + y[i] - z[i];
		total[4][i] = - x[i] - y[i] + z[i];
		total[5][i] = - x[i] + y[i] - z[i];
		total[6][i] =   x[i] - y[i] - z[i];
		total[7][i] = - x[i] - y[i] - z[i];
	} 

	// 動的計画法
	long long dp[N + 1][M + 1]; //dp[i][j] := i番目のケーキの中から個数がjこを超えないように選んだ時の和の最大値
	// 初期化
	for(i = 0; i <= N; i++){
		dp[i][0] = 0;
	}
	for(j = 0; j <= M; j++){
		dp[0][j] = 0;
	}
	
	for(k = 0; k < 8; k++){
	
		for(i = 0; i <= N; i++){
			for(j = 1; j <= M; j++){
				if(dp[i][j] > dp[i][j - 1] + total[k][i]){
					dp[i + 1][j] = dp[i][j];
				}else{
					dp[i + 1][j] = dp[i][j - 1] + total[k][i];
				}
			}
		}
		if(dp[N][M] > ans) ans = dp[N][M];
		
	}
	

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

Compiler output:
main.c: In function 'main':
main.c:6:56: error: stray '\342' in program
    6 |         long long x[N], y[N], z[N], total[8][N], ans = <U+2212>10000000000;
      |                                                        ^~~~~~~~
Language: C

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

int main(){
    
long N,M,x[1000],y[1000],z[1000],sum[1000],ans=0;
    
    scanf("%d %d",&N,&M);
    for(int i=0;i<N;i++)
    {
        scanf("%d %d %d",&x[i],&y[i],&z[i]);
        sum[i] = abs(x[i]) + abs(y[i]) + abs(z[i]);
    }
    for(int i = 0;i<N;i++)
    {
        for(int j = N-1;j>=0;j--)
        {
            if(sum[j]<sum[j-1])
            {
                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("%ld\n",ans);
}        

Compiler output:
main.c: In function 'main':
main.c:30:10: error: stray '\342' in program
   30 |         N<U+2014>;
      |          ^~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<string> 
#include<map>
#include<set>
#include<vector>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include<queue>
#include<utility>
#include<cstdio>
#include<cstring>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qui queue<int>
#define vit vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
int x[1001],y[1001],z[1001],xx=0,yy=0;
int main()
{int n,m;cin>>n>>m;
fo(i,0,n){	
	cin>>x[i]>>y[i]>>z[i];
	a[i]=x[i]+y[i]+z[i];
}
sort(a,a+1001);
fo(i,0,m)xx+=a[i];
for(int i=n;i>=n-m;i--)yy+=a[i];
cout<<max(abs(xx),abs(yy));
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'a' was not declared in this scope
   27 |         a[i]=x[i]+y[i]+z[i];
      |         ^
a.cc:29:6: error: 'a' was not declared in this scope
   29 | sort(a,a+1001);
      |      ^
Language: C++

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

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n,m;
	cin >> n >> m;
	ll a[1010][3] = {0};
	for(int i = 1; i <= n; i++){
		for(int j = 0; j < 3; j++){
			cin >> a[i][j];
		}
	}
	ll ans = -(1ll<<60)
	for(int i = 0; i < 8; i++){
		vector<ll> vec;
		for(int j = 0; j < n; j++){
			ll s = 0;
			for(int k = 0; k < 3; k++){
				if(((i+1)/(1<<k)) % 2 == 0) s += a[j][k];
				else s -= a[j][k];
			}
			vec.push_back(s);
		}
		sort(all(vec));
		reverse(all(vec));
		ll sum = 0;
		for(int j = 0; j < m; j++){
			sum += vec[j];
		}
		ans = max(sum,ans);
	}

	cout << ans << endl;



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: expected ',' or ';' before 'for'
   32 |         for(int i = 0; i < 8; i++){
      |         ^~~
a.cc:32:24: error: 'i' was not declared in this scope
   32 |         for(int i = 0; i < 8; i++){
      |                        ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int n, m; cin >> n >> m;
  using Taplis = tuple<int64_t, int64_t, int64_t>;
  vector<> data;
  rep(i, n) {
    int64_t x, y, z; cin >> x >> y >> z;
    data.emplace_back(x, y, z);
  }

  int64_t max_sum = 0;  

  for (int xf = -1; xf < 2; xf += 2)
  for (int yf = -1; yf < 2; yf += 2)
  for (int zf = -1; zf < 2; zf += 2) {
    auto const xyzsummer = [&](Taplis const& t) {
      return get<0>(t) * xf + get<1>(t) * yf + get<2>(t) * zf;
    };
    sort(data.begin(), data.end(), [&](auto const& lhs, auto const& rhs) {
      return xyzsummer(lhs) > xyzsummer(rhs);
    });
    int64_t sum = 0;
    rep(i, m) {
      sum += xyzsummer(data[i]);
    }
    maximize(max_sum, sum);
  }
  cout << max_sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:10: error: wrong number of template arguments (0, should be at least 1)
   21 |   vector<> data;
      |          ^
In file included from /usr/include/c++/14/vector:66,
                 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/stl_vector.h:428:11: note: provided for 'template<class _Tp, class _Alloc> class std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:24:10: error: request for member 'emplace_back' in 'data', which is of non-class type 'int'
   24 |     data.emplace_back(x, y, z);
      |          ^~~~~~~~~~~~
a.cc:35:15: error: request for member 'begin' in 'data', which is of non-class type 'int'
   35 |     sort(data.begin(), data.end(), [&](auto const& lhs, auto const& rhs) {
      |               ^~~~~
a.cc:35:29: error: request for member 'end' in 'data', which is of non-class type 'int'
   35 |     sort(data.begin(), data.end(), [&](auto const& lhs, auto const& rhs) {
      |                             ^~~
a.cc:40:28: error: invalid types 'int[int]' for array subscript
   40 |       sum += xyzsummer(data[i]);
      |                            ^
Language: C++

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

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

long long max(long long a,long long b){
	return (a>b)? a:b;
}
int j_k_bit_1or0(int j,int k){

}

int main (){
	long long NNN,MMM,maxx=0,p=0,sum=0;
	cin >> NNN >> MMM;
	long long a[3][NNN];
	rep(i,NNN){rep(j,3){scanf("%lld",&a[j][i]);}}
	vector <long long> temp[8];
	rep(i,8){
		rep(j,NNN){
			rep(k,3)(i & (1 << k))? p += a[k][j]:p -= a[k][j];
			temp[i].push_back(p);
			p=0;
		}
		sort(temp[i].rbegin(),temp[i].rend());
		sum=0;
		rep(k,MMM)sum += temp[i][k];
		maxx = max(sum,maxx);
	}
	printf("%lld",maxx)

	return 0;
}


Compiler output:
a.cc: In function 'int j_k_bit_1or0(int, int)':
a.cc:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
   15 | }
      | ^
a.cc: In function 'int main()':
a.cc:34:28: error: expected ';' before 'return'
   34 |         printf("%lld",maxx)
      |                            ^
      |                            ;
   35 | 
   36 |         return 0;
      |         ~~~~~~
Language: C++

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

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int  i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;

long long max(long long a,long long b){
	return (a>b)? a:b;
}
int j_k_bit_1or0(int j,int k){
	if(k==0)return (j%2==0)? 0:1;
	if(k==1)return (((j-j%2)/2)%2==0)? 0:1;
	return ((((j-j%2)/2)-(j-j%2)/2)%2)/2)%2==0)? 0:1;
}

int main (){
	long long NNN,MMM,maxx=0,p=0,sum=0;
	cin >> NNN >> MMM;
	long long a[3][NNN];
	rep(i,NNN){
		rep(j,3){
			cin >> a[j][i];
		}
	}
	vector <long long> temp[8];
	rep(i,NNN){
		rep(j,8){
			rep(k,3){
				if(j_k_bit_1or0(j,k)==0)p += a[k][j]
				else p -= a[k][j]
			}
			temp[j].push_back(p);
			sort(temp[j].rbegin(),temp[j].rend());
		}
		sum =0;
		rep(j,MMM){
			sum += temp[j];
		}
		maxx = max(sum,maxx);
	}
	cout << maxx << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int j_k_bit_1or0(int, int)':
a.cc:24:45: error: expected ';' before ')' token
   24 |         return ((((j-j%2)/2)-(j-j%2)/2)%2)/2)%2==0)? 0:1;
      |                                             ^
      |                                             ;
a.cc:24:45: error: expected primary-expression before ')' token
a.cc: In function 'int main()':
a.cc:40:69: error: expected ';' before 'else'
   40 |                                 if(j_k_bit_1or0(j,k)==0)p += a[k][j]
      |                                                                     ^
      |                                                                     ;
   41 |                                 else p -= a[k][j]
      |                                 ~~~~                                 
a.cc:48:29: error: no match for 'operator+=' (operand types are 'long long int' and 'std::vector<long long int>')
   48 |                         sum += temp[j];
      |                         ~~~~^~~~~~~~~~
Language: C++

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

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int  i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;

long long max(long long a,long long b){
	return (a>b)? a:b;
}
int j_k_bit_1or0(int j,int k){
	if(k==0)return (j%2==0)? 0:1;
	if(k==1)return (((j-j%2)/2)%2==0)? 0:1?
	return ((((j-j%2)/2)-(j-j%2)/2)%2)/2)%2==0)? 0:1?
}

int main (){
	long long NNN,MMM,maxx=0,p=0;
	cin >> NNN >> MMM;
	long long a[3][NNN];
	rep(i,NNN){
		rep(j,3){
			cin >> a[j][i];
		}
	}
	vector <long long> temp[8];
	rep(i,NNN){
		rep(j,8){
			rep(k,3){
				if(j_k_bit_1or0(j,k)==0)p += a[k][j]
				else p -= a[k][j]
			}
			temp[j].push_back(p);
		}
		sort(temp[j].rbegin(),temp[j].rend());
		sum =0;
		rep(j,MMM){
			sum += temp[j];
		}
		maxx = max(sum,maxx);
	}
	cout << maxx << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int j_k_bit_1or0(int, int)':
a.cc:24:9: error: expected primary-expression before 'return'
   24 |         return ((((j-j%2)/2)-(j-j%2)/2)%2)/2)%2==0)? 0:1?
      |         ^~~~~~
a.cc:23:48: error: expected ':' before 'return'
   23 |         if(k==1)return (((j-j%2)/2)%2==0)? 0:1?
      |                                                ^
      |                                                :
   24 |         return ((((j-j%2)/2)-(j-j%2)/2)%2)/2)%2==0)? 0:1?
      |         ~~~~~~                                  
a.cc:24:9: error: expected primary-expression before 'return'
   24 |         return ((((j-j%2)/2)-(j-j%2)/2)%2)/2)%2==0)? 0:1?
      |         ^~~~~~
a.cc:23:48: error: expected ';' before 'return'
   23 |         if(k==1)return (((j-j%2)/2)%2==0)? 0:1?
      |                                                ^
      |                                                ;
   24 |         return ((((j-j%2)/2)-(j-j%2)/2)%2)/2)%2==0)? 0:1?
      |         ~~~~~~                                  
a.cc:24:45: error: expected ';' before ')' token
   24 |         return ((((j-j%2)/2)-(j-j%2)/2)%2)/2)%2==0)? 0:1?
      |                                             ^
      |                                             ;
a.cc:24:45: error: expected primary-expression before ')' token
a.cc: In function 'int main()':
a.cc:40:69: error: expected ';' before 'else'
   40 |                                 if(j_k_bit_1or0(j,k)==0)p += a[k][j]
      |                                                                     ^
      |                                                                     ;
   41 |                                 else p -= a[k][j]
      |                                 ~~~~                                 
a.cc:45:27: error: 'j' was not declared in this scope
   45 |                 sort(temp[j].rbegin(),temp[j].rend());
      |                           ^
a.cc:46:17: error: 'sum' was not declared in this scope
   46 |                 sum =0;
      |                 ^~~
Language: C

#include<stdio.h>
int main()
{
    int N,M,i,j,k,l,m,b,c = 0,x,y,z;

    int a[10000];

    scanf("%d %d",&N,&M);
    for(i = 0;i < N;i++){
    	scanf("%d %d %d",&x,&y,&z);
        a[i] = x + y + z;]
        if(a[i] < 0)
            a[i] = -a[i];
    }
    for(k = 0;k < N;k++){
        for(l = k;l < N;l++){
            if(a[l] > a[k]){
                b = a[l];
                a[l] = a[k];
                a[k] = b;
            }
        }
    }
    for(m = 0;m < M;m++){
        c = c + a[m];
    }

    printf("%d",c);

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:26: error: expected statement before ']' token
   11 |         a[i] = x + y + z;]
      |                          ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(){
  ll N,M;
  cin >> N >> M;
  ll x[N],y[N],z[N];
  ll ans=0,ans2=0;
  int d[N];
  a[8]={1,1,1,-1,-1,-1,1,-1};
  b[8]={1,1,-1,1,-1,1,-1,-1};
  c[8]={1,-1,1,1,1,-1,-1,-1};  
  for(int i=1;i<=N;i++){
    cin >> x[i] >> y[i] >>z[i];
  }
  for(int i=0;i<=8;i++){
    for(int j=0;j<N;i++){
      d[i]=a[i]*x[j]+b[i]*y[j]+c[i]*z[j];
      ans+=d[i];
    }
    ans2=max(ans2,ans);
  }

  cout << ans2 << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:3: error: 'a' was not declared in this scope
   23 |   a[8]={1,1,1,-1,-1,-1,1,-1};
      |   ^
a.cc:24:3: error: 'b' was not declared in this scope
   24 |   b[8]={1,1,-1,1,-1,1,-1,-1};
      |   ^
a.cc:25:3: error: 'c' was not declared in this scope
   25 |   c[8]={1,-1,1,1,1,-1,-1,-1};
      |   ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,n,s) for(int i=(int)(s);i<(int)(n);++i)
#define RREP(i,n,s) for(int i=(int)(s);i>=(int)(n);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()


int main() {
    int n, m; cin >> n >> m;
    ll x[n], y[n], z[n];
    REP(i, n) {
        cin >> x[i] >> y[i] >> z[i];
    }

    ll dp[n+1][m+1][8];
    fill(dp[0][0], dp[n+1][0], -(ll)LLONG_MAX/2);
    REP(i, n+1) fill(dp[i][0], dp[i][1], 0);

    REP(i, n) {
        REP(j, m) {
            if (j > i) break;
            dp[i+1][j+1][0] = max(dp[i][j+1][0], dp[i][j][0] + x[i] + y[i] + z[i]);
            dp[i+1][j+1][1] = max(dp[i][j+1][1], dp[i][j][1] + x[i] + y[i] - z[i]);
            dp[i+1][j+1][2] = max(dp[i][j+1][2], dp[i][j][2] + x[i] - y[i] + z[i]);
            dp[i+1][j+1][3] = max(dp[i][j+1][3], dp[i][j][3] + x[i] - y[i] - z[i]);
            dp[i+1][j+1][4] = max(dp[i][j+1][4], dp[i][j][4] - x[i] + y[i] + z[i]);
            dp[i+1][j+1][5] = max(dp[i][j+1][5], dp[i][j][5] - x[i] + y[i] - z[i]);
            dp[i+1][j+1][6] = max(dp[i][j+1][6], dp[i][j][6] - x[i] - y[i] + z[i]);
            dp[i+1][j+1][7] = max(dp[i][j+1][7], dp[i][j][7] - x[i] - y[i] - z[i]);
        }
    }

    ll max = -1;
    REP(i, 8) {
        if (dp[n][m][i] > max) {
            max = dp[n][m][i];
        }
    }

    cout << max << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:37: error: 'LLONG_MAX' was not declared in this scope
   29 |     fill(dp[0][0], dp[n+1][0], -(ll)LLONG_MAX/2);
      |                                     ^~~~~~~~~
a.cc:9:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include <iomanip>
  +++ |+#include <climits>
    9 |
Language: C++

#include<iostream>
#include<array>
#include<vector>
#include<algorithm>
bool comp0(const std::array<long long, 3>&arg1, const std::array<long long, 3>&arg2) { return +arg1[0] + arg1[1] + arg1[2] > +arg2[0] + arg2[1] + arg2[2]; }
bool comp1(const std::array<long long, 3>&arg1, const std::array<long long, 3>&arg2) { return +arg1[0] + arg1[1] - arg1[2] > +arg2[0] + arg2[1] - arg2[2]; }
bool comp2(const std::array<long long, 3>&arg1, const std::array<long long, 3>&arg2) { return +arg1[0] - arg1[1] + arg1[2] > +arg2[0] - arg2[1] + arg2[2]; }
bool comp3(const std::array<long long, 3>&arg1, const std::array<long long, 3>&arg2) { return +arg1[0] - arg1[1] - arg1[2] > +arg2[0] - arg2[1] - arg2[2]; }
bool comp4(const std::array<long long, 3>&arg1, const std::array<long long, 3>&arg2) { return -arg1[0] + arg1[1] + arg1[2] > -arg2[0] + arg2[1] + arg2[2]; }
bool comp5(const std::array<long long, 3>&arg1, const std::array<long long, 3>&arg2) { return -arg1[0] + arg1[1] - arg1[2] > -arg2[0] + arg2[1] - arg2[2]; }
bool comp6(const std::array<long long, 3>&arg1, const std::array<long long, 3>&arg2) { return -arg1[0] - arg1[1] + arg1[2] > -arg2[0] - arg2[1] + arg2[2]; }
bool comp7(const std::array<long long, 3>&arg1, const std::array<long long, 3>&arg2) { return -arg1[0] - arg1[1] - arg1[2] > -arg2[0] - arg2[1] - arg2[2]; }
int main()
{
	int n, m;
	std::cin >> n >> m;
	std::vector<std::array<long long, 3>>xyz(n);
	for (int i = 0; i < n; i++)
	{
		std::cin >> xyz[i][0] >> xyz[i][1] >> xyz[i][2];
	}
	long long ans = 0;
	for (auto c : { comp0, comp1, comp2, comp3, comp4, comp5, comp6, comp7 };)
	{
		std::sort(xyz.begin(), xyz.end(), c);
		long long sum[3] = { 0,0,0 };
		for (int i = 0; i < m; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				sum[j] += xyz[i][j];
			}
		}
		long long ans_tmp = abs(sum[0]) + abs(sum[1]) + abs(sum[2]);
		if (ans < ans_tmp)
		{
			ans = ans_tmp;
		}
	}
	std::cout << ans << std::endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:81: error: expected ')' before ';' token
   23 |         for (auto c : { comp0, comp1, comp2, comp3, comp4, comp5, comp6, comp7 };)
      |             ~                                                                   ^
      |                                                                                 )
a.cc:23:82: error: expected primary-expression before ')' token
   23 |         for (auto c : { comp0, comp1, comp2, comp3, comp4, comp5, comp6, comp7 };)
      |                                                                                  ^
Language: C++

#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) begin(x), end(x)

int main(){
    ll n,m;cin>>n>>m;
    vector<ll> vx(n),vy(n),vz(n),vans(n);
    ll ans=0,temp1=0,temp2=0;
    rep(i,n){
      cin>>vx[i]>>vy[i]>>vz[i];
    }

    int J[][3]={{1,1,1},{-1,1,1},{1,-1,1},{1,1,-1}};

    rep(j,4){
      rep(i,n){
        vans[i]=0;
        vans[i]=J[j][0]*vx[i]+J[j][1]*vy[i]+J[j][2]*vz[i];
      }
      sort(all(vans));
      temp1=0,temp2=0;
      rep(i,m){
        temp1+=vans[i];
        temp2+=vans[n-i-1];
      }
      ans=max(max(abs(temp1),abs(temp2)),ans);
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: 'cin' was not declared in this scope
    9 |     ll n,m;cin>>n>>m;
      |            ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:31:5: error: 'cout' was not declared in this scope
   31 |     cout<<ans<<endl;
      |     ^~~~
a.cc:31:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:16: error: 'endl' was not declared in this scope
   31 |     cout<<ans<<endl;
      |                ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

    #include <bits/stdc++.h>
    using namespace std;
     
    int N,M;
    long x[2000],y[2000],z[2000], w[2000];
     
    int main(){  
      //freopen("ABC049C_in.txt", "r", stdin);
     
      scanf("%d %d\n",&N,&M);
      for(int i=1;i<=N;i++){
        scanf("%ld %ld %ld\n",&x[i], &y[i], &z[i]);
      }
      
      long ans=0;

      for(int bit=0; bit<(1<<3); bit++){
        long a=(bit&(1<<0)) ? 1 : -1;
        long b=(bit&(1<<1)) ? 1 : -1;
        long c=(bit&(1<<2)) ? 1 : -1;
        for(int int=1;i<=N;i++){
            w[i]=a*x[i]+b*y[i]+c*z[i];
        }
        partial_sort(w+1, w+N+1, w+2000);
        long cur=0;

        for(int i=1;i<=M;i++){
            cur+=w[i];  
        }      
        if(cur>ans){ans=cur;}  
      }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:21:20: error: expected unqualified-id before '=' token
   21 |         for(int int=1;i<=N;i++){
      |                    ^
a.cc:21:20: error: expected ';' before '=' token
   21 |         for(int int=1;i<=N;i++){
      |                    ^
      |                    ;
a.cc:21:20: error: expected primary-expression before '=' token
a.cc:21:23: error: 'i' was not declared in this scope
   21 |         for(int int=1;i<=N;i++){
      |                       ^
a.cc:21:27: error: expected ')' before ';' token
   21 |         for(int int=1;i<=N;i++){
      |            ~              ^
      |                           )
a.cc:21:28: error: 'i' was not declared in this scope
   21 |         for(int int=1;i<=N;i++){
      |                            ^
Language: C++

#pragma warning (disable:4996)
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<limits>
using namespace std;
int main()
{
	int n, m;
	cin >> n >> m;
	long long x[1005][3];
	for (int i = 0; i < n; i++)
	{
		cin >> x[i][0] >> x[i][1] >> x[i][2];
	}
	long long out=INT_MIN;
	long long v[1005];
	long long z;
	int a[3];

	a[0] = -1;
	a[1] = -1;
	a[2] = -1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = -1;
	a[1] = -1;
	a[2] = 1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = -1;
	a[1] = 1;
	a[2] = -1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = -1;
	a[1] = 1;
	a[2] = 1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = 1;
	a[1] = -1;
	a[2] = -1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = 1;
	a[1] = -1;
	a[2] = 1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = 1;
	a[1] = 1;
	a[2] = -1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = 1;
	a[1] = 1;
	a[2] = 1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;

	cout << out << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:23: error: 'INT_MIN' was not declared in this scope
   16 |         long long out=INT_MIN;
      |                       ^~~~~~~
a.cc:6:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include<limits>
  +++ |+#include <climits>
    6 | using namespace std;
Language: C++

#include <iostream>
#include <vector>

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

using namespace std;

typedef vector<long long int> V;

vector<vector<long long int> > xyz;
int n, m, x2, y2, z2;

bool comp(const V &a, const V &b){
	return (a[0]*x2+a[1]*y2+a[2]*z2 > b[0]*x2+b[1]*y2+b[2]*z2);
}

int main(){
	const int diff[10] = {1, -1, 1, -1, -1, -1, 1, 1, 1, -1};
	long long int input, ans, finalans, po;

	cin >> n >> m;
	xyz = vector<vector<long long int> > (n);
	ans = 0;
	finalans = 0;

	REP(i,n){
		REP(l,3){
			cin >> input;
			xyz[i].push_back(input);
		}
	}

	REP(i,8){
		ans = 0;
		x2 = diff[i];
		y2 = diff[i+1];
		z2 = diff[i+2];
		sort(xyz.begin(), xyz.end(), comp);
		REP(l,3){
			po = 0;
			REP(k,m){
				po += xyz[k][l];
			}
			ans += abs(po);
		}
		if (ans>finalans) finalans = ans;
	}

	cout << finalans << endl;

	return 0;
}


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

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
long long N, M, a[100009][3], maxn = -(1LL << 60);
int p[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},
};
 
int main() {
	cin >> N >> M;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j < 3; j++) cin >> a[i][j];
	}
	 // 8 pattern
	for (int i = 0; i < 8; i++) {
		// Nに対して
		vector<long long>vec;
		for (int j = 1; j <= N; j++) {
			long long S = 0;
			// x, y, zに対して
			for (int k = 0; k < 3; k++) S += p[j][k]a[j][k];
			vec.push_back(S);
		}
		
		// NをソートしてMタス
		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: In function 'int main()':
a.cc:30:65: error: expected ';' before 'a'
   30 |                         for (int k = 0; k < 3; k++) S += p[j][k]a[j][k];
      |                                                                 ^
      |                                                                 ;
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
long long N, M, a[100009][3], maxn = -(1LL << 60);
int p[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},
}
 
int main() {
	cin >> N >> M;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j < 3; j++) cin >> a[i][j];
	}
	 // 8 pattern
	for (int i = 0; i < 8; i++) {
		// Nに対して
		vector<long long>vec;
		for (int j = 1; j <= N; j++) {
			long long S = 0;
			// x, y, zに対して
			for (int k = 0; k < 3; k++) S += p[j][k]a[j][k];
			vec.push_back(S);
		}
		
		// NをソートしてMタス
		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:18:1: error: expected ',' or ';' before 'int'
   18 | int main() {
      | ^~~
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;

typedef long long ll;
const ll INF = 1000000000000;
ll n, m, x[1000], y[1000], z[1000];

ll dp[1001][1001];

ll check() {
  for (ll i = 0; i <= n; i++)
    for (ll j = 0; j <= m; j++) dp[i][j] = -1;
  ll ans = 0;
  dp[0][0] = 0;
  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < m; j++) {
      dp[i+1][j+1] = dp[i][j+1];
      if (dp[i][j] > -1) dp[i][j] + x[i] + y[i] + z[i]);
    }
  }
  for (ll i = 0; i <= n; i++)
    ans = max(ans, dp[i][m]);
  return ans;
}

void change(ll* p) {
  for (ll i = 0; i < n; i++) p[i] = -p[i];
}

int main() {
  scanf("%lld%lld", &n, &m);
  for (ll i = 0; i < n; i++) scanf("%lld%lld%lld", &x[i], &y[i], &z[i]);
  ll ans = 0;
  ans = max(ans, check()); // +++
  change(x);
  ans = max(ans, check()); // -++
  change(y);
  ans = max(ans, check()); // --+
  change(z);
  ans = max(ans, check()); // ---
  change(y);
  ans = max(ans, check()); // -+-
  change(x);
  ans = max(ans, check()); // ++-
  change(y);
  ans = max(ans, check()); // +--
  change(z);
  ans = max(ans, check()); // +-+
  printf("%lld\n", ans);
}

Compiler output:
a.cc: In function 'll check()':
a.cc:19:55: error: expected ';' before ')' token
   19 |       if (dp[i][j] > -1) dp[i][j] + x[i] + y[i] + z[i]);
      |                                                       ^
      |                                                       ;
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;

typedef long long ll;
const ll INF = 1000000000000;
ll n, m, x[1000], y[1000], z[1000];

ll dp[1001][1001];

ll check() {
  for (ll i = 0; i <= n; i++)
    for (ll j = 0; j <= m; j++) dp[i][j] = -1;
  ll ans = 0;
  dp[0][0] = 0;
  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < m; j++) {
      dp[i+1][j+1] = dp[i][j+1]
      if (dp[i][j] > -1) dp[i][j] + x[i] + y[i] + z[i]);
    }
  }
  for (ll i = 0; i <= n; i++)
    ans = max(ans, dp[i][m]);
  return ans;
}

void change(ll* p) {
  for (ll i = 0; i < n; i++) p[i] = -p[i];
}

int main() {
  scanf("%lld%lld", &n, &m);
  for (ll i = 0; i < n; i++) scanf("%lld%lld%lld", &x[i], &y[i], &z[i]);
  ll ans = 0;
  ans = max(ans, check()); // +++
  change(x);
  ans = max(ans, check()); // -++
  change(y);
  ans = max(ans, check()); // --+
  change(z);
  ans = max(ans, check()); // ---
  change(y);
  ans = max(ans, check()); // -+-
  change(x);
  ans = max(ans, check()); // ++-
  change(y);
  ans = max(ans, check()); // +--
  change(z);
  ans = max(ans, check()); // +-+
  printf("%lld\n", ans);
}

Compiler output:
a.cc: In function 'll check()':
a.cc:18:32: error: expected ';' before 'if'
   18 |       dp[i+1][j+1] = dp[i][j+1]
      |                                ^
      |                                ;
   19 |       if (dp[i][j] > -1) dp[i][j] + x[i] + y[i] + z[i]);
      |       ~~
Language: C++

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

int N, M;

int main() {
    cin >> N >> M;
    vector<long long> a[3];
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            long long num; cin >> num;
            a[j].push_back(num);
        }
    }
    long long res = 0;
    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[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];
        }
        res = max(res, sum);
    }
    cout << res << endl;
}



























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


#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <functional>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(var,init,end) for(int var=init;var<end;var++)
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)


int main() {
	int N, M;
	cin >> N >> M;
	vector<vector <long long>> xyz(N);
	FOR(i, 0, N) {
		xyz[i] = vector<long long>(3);
		cin >> xyz[i][0] >> xyz[i][1] >> xyz[i][2];
	}

	long long max_value = -INFINITY;
	
	int idx = 1;
	int sign_x = -1,sign_y=-1,sign_z=-1;
	FOR(i,0,8) {
		vector<long long> sum_val(N);
		FOR(m, 0, N) {
			if (m % 2 == 0) {
				sign_z *= -1;
			}
			if (m ==0 || m==1 || m==4||m==5) {
				sign_y = 1;
			}
			else
			{
				sign_y = -1;
			}
			if (m >3 ) {
				sign_x = 1;
			}
			sum_val[m] = xyz[m][0]*sign_x + xyz[m][1]*sign_y + xyz[m][2]* sign_z;
		}
		sort(sum_val.begin(), sum_val.end(), std::greater<long long>());

		long long tmp = 0;
		FOR(m, 0, M) {
			tmp += sum_val[m];
		}
		
		if (tmp > max_value) {
			max_value = tmp;
		}
	}
	
	cout << max_value;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:32: error: 'INFINITY' was not declared in this scope
   22 |         long long max_value = -INFINITY;
      |                                ^~~~~~~~
Language: C++

#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N, M, ans;

int main()
{
	in >> N >> M;
	std::vector<LL>x(N), y(N), z(N);
	rep(i, N) in >> x[i] >> y[i] >> z[i];
	rep(bit, 8)
	{
		std::vector<LL>res(N);
		rep(i, N)
		{
			LL a = x[i] * (bit & 1 ? 1 : -1);
			LL b = y[i] * (bit & 2 ? 1 : -1);
			LL c = z[i] * (bit & 4 ? 1 : -1);
			res[i] = a + b + c;
		}
		std::sort(res.rbegin(), res.rend());
		rep(i, M - 1) res[i + 1] += res[i];
		ans = std::max(ans, abs(res[M - 1]));
	}
	out << ans << std::endl;
	return 0;
}


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

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

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

  vector<vector<int64_t>> x(3, vector<int64_t>(n));
  for (int i = 0; i < n; ++i) {
    cin >> x[0][i] >> x[1][i] >> x[2][i];
  }

  int64_t ans = -1001001001001001ll;
  for (int bit = 0; bit < 8; ++bit) {
    vector<int64_t> v(n);
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < 3; ++j) {
        v[i] += (bit & (1 << j) ? -1 : 1) * x[j][i];
      }
    }

    sort(v.rbegin(), v.rend());
    ans = max(ans, accumulate(v.begin(), v.begin() + m, 0ll));
  }

  cout << ans << endl;
}


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

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

#define MAX 1000

int main(){
  int n,m;

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

  long long ans = 0;

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

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

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

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

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

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


Compiler output:
main.c: In function 'main':
main.c:38:17: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   38 |       tempans = abs(tempx) + abs(tempy) + abs(tempz);
      |                 ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c:38:21: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   38 |       tempans = abs(tempx) + abs(tempy) + abs(tempz);
      |                     ^~~~~
<built-in>: note: built-in 'abs' declared here
main.c:38:34: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   38 |       tempans = abs(tempx) + abs(tempy) + abs(tempz);
      |                                  ^~~~~
<built-in>: note: built-in 'abs' declared here
main.c:38:47: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   38 |       tempans = abs(tempx) + abs(tempy) + abs(tempz);
      |                                               ^~~~~
<built-in>: note: built-in 'abs' declared here
main.c:44:3: error: expected declaration or statement at end of input
   44 |   return 0;
      |   ^~~~~~
Language: C++

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


ll n, m, x[1024], y[1024], z[1024];
int main(){
  cin >> n >> m;
  for(int i=0;i<n;:i++) cin >> x[i] >> y[i] >> z[i];
  ll ans = 0;
  for(int sx=-1;sx<3;sx+=2){
    for(int sy=-1;sy<3;sy+=2){
  	  for(int sz=-1;sz<3;sz+=2){
        vector<ll> v;
        for(int i=0;i<n;i++) v.push_back(sx*x[i]+sy*y[i]+sz*z[i]);
        sort(v.begin(), v.end(), greater<ll>());
        ll sum = 0;
        for(int i=0;i<m;i++) sum += v[i];
        ans = max(ans, sum);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:19: error: expected primary-expression before ':' token
    9 |   for(int i=0;i<n;:i++) cin >> x[i] >> y[i] >> z[i];
      |                   ^
a.cc:9:19: error: expected ')' before ':' token
    9 |   for(int i=0;i<n;:i++) cin >> x[i] >> y[i] >> z[i];
      |      ~            ^
      |                   )
a.cc:9:19: error: expected primary-expression before ':' token
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:28: error: expected primary-expression before 'long'
   12 |                 score[i] = long long(fabs(x) + fabs(y) + fabs(z));
      |                            ^~~~
Language: C++

#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

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 c1[] = { 1, 1, 1, 1, -1, -1, -1, -1 };
    ll c2[] = { 1, 1, -1, -1, 1, 1, -1, -1 };
    ll c3[] = { 1, -1, 1, -1, 1, -1, 1, -1 };

    ll ans = 0;

    for (int k = 0; k < 8; k++) {
        vector<ll> score(N);
        for (int i = 0; i < N; i++) {
            score[i] = c1[k] * x[i] + c2[k] * y[i] + c3[k] * z[i];
        }
        sort(score.begin(), score.end(), greater<ll>());

        ans = max(ans, accumulate(score.begin(), score.begin() + M, 0LL));
    }

    cout << ans << endl;
}


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

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

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

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