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];
	}
	///+++
	int 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 - 1;i > m;i--)ans += res[i];
	///++-
	int 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 - 1;i > m;i--)ress += res[i];
	ans = max(ans, ress);
	///+-+
	int 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 - 1;i > m;i--)ress += res[i];
	ans = max(ans, ress);
	///+--
	int 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 - 1;i > m;i--)ress += res[i];
	ans = max(ans, ress);
	///-++
	int 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 - 1;i > m;i--)ress += res[i];
	ans = max(ans, ress);
	///-+-
	int 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 - 1;i > m;i--)ress += res[i];
	ans = max(ans, ress);
	///--+
	int 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 - 1;i > m;i--)ress += res[i];
	ans = max(ans, ress);
	///---
	int 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 - 1;i > m;i--)ress += res[i];
	ans = max(ans, ress);

	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: redeclaration of 'int ress'
   19 |         int ress = 0;
      |             ^~~~
a.cc:14:30: note: 'int ress' previously declared here
   14 |         int ans = 0, res[n], ress=0;
      |                              ^~~~
a.cc:25:13: error: redeclaration of 'int ress'
   25 |         int ress = 0;
      |             ^~~~
a.cc:14:30: note: 'int ress' previously declared here
   14 |         int ans = 0, res[n], ress=0;
      |                              ^~~~
a.cc:31:13: error: redeclaration of 'int ress'
   31 |         int ress = 0;
      |             ^~~~
a.cc:14:30: note: 'int ress' previously declared here
   14 |         int ans = 0, res[n], ress=0;
      |                              ^~~~
a.cc:37:13: error: redeclaration of 'int ress'
   37 |         int ress = 0;
      |             ^~~~
a.cc:14:30: note: 'int ress' previously declared here
   14 |         int ans = 0, res[n], ress=0;
      |                              ^~~~
a.cc:43:13: error: redeclaration of 'int ress'
   43 |         int ress = 0;
      |             ^~~~
a.cc:14:30: note: 'int ress' previously declared here
   14 |         int ans = 0, res[n], ress=0;
      |                              ^~~~
a.cc:49:13: error: redeclaration of 'int ress'
   49 |         int ress = 0;
      |             ^~~~
a.cc:14:30: note: 'int ress' previously declared here
   14 |         int ans = 0, res[n], ress=0;
      |                              ^~~~
a.cc:55:13: error: redeclaration of 'int ress'
   55 |         int ress = 0;
      |             ^~~~
a.cc:14:30: note: 'int ress' previously declared here
   14 |         int ans = 0, res[n], ress=0;
      |                              ^~~~