Language: C

#include <stdio.h>
#include <limits.h>

typedef long long ll;

struct t {
	ll a = 0;
	ll b = 0;
	ll c = 0;
};

ll abs(ll a) {
	return a > 0 ? a : -a;
}

ll sum(struct t a) {
	return a.a + a.b + a.c;
}

struct t max(struct t a, struct t b) {
	ll x = sum(a);
	ll y = sum(b);

	return x > y ? a : b;
}

struct t sum(struct t a, struct t b) {
	t result;

	result.a = a.a + b.a;
	result.b = a.b + b.b;
	result.c = a.c + b.c;

	return result;
}

struct t f[1000][1000], arr[1010];

void clear(struct t f[][1000]) {
	int i, j;

	for (i = 0; i < 1000; i++) {
		for (j = 0; j < 1000; j++) {
			f[i][j] = {0,0,0};
		}
	}
}
int main() {
	int n, m;
	int i, j;

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

	for (i = 1; i <= n; i++) {
		scanf("%lld%lld%lld", &arr[i].a, &arr[i].b, &arr[i].c);
	}

	//t d = {0,0,0};
	//for (i = 0; i <= m; i++) {
	//	f[0][i] = d;
	//}

	int a, b, c;
	ll result = 0;

	for (a = -1; a < 2; a++)
		for (b = -1; b < 2; b++)
			for (c = -1; c < 2; c++) {
				
				if (a&&b&&c) {
					clear(f);
					for (i = 1; i <= n; i++) {
						for (j = 1; j <= i; j++) {
							if (j > m) break;
							struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
							struct t d = sum(f[i - 1][j - 1], k);
							f[i][j] = max(f[i - 1][j], d);
						}
					}

					result = sum(f[n][m]) > result ? sum(f[n][m]) : result;
				}
			}

	printf("%lld", result);

	getchar(); getchar();
	return 0;
}

Compiler output:
main.c:7:14: error: expected ':', ',', ';', '}' or '__attribute__' before '=' token
    7 |         ll a = 0;
      |              ^
main.c:12:4: warning: conflicting types for built-in function 'abs'; expected 'int(int)' [-Wbuiltin-declaration-mismatch]
   12 | ll abs(ll a) {
      |    ^~~
main.c:3:1: note: 'abs' is declared in header '<stdlib.h>'
    2 | #include <limits.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c: In function 'sum':
main.c:17:17: error: 'struct t' has no member named 'a'
   17 |         return a.a + a.b + a.c;
      |                 ^
main.c:17:23: error: 'struct t' has no member named 'b'
   17 |         return a.a + a.b + a.c;
      |                       ^
main.c:17:29: error: 'struct t' has no member named 'c'
   17 |         return a.a + a.b + a.c;
      |                             ^
main.c: At top level:
main.c:27:10: error: conflicting types for 'sum'; have 'struct t(struct t,  struct t)'
   27 | struct t sum(struct t a, struct t b) {
      |          ^~~
main.c:16:4: note: previous definition of 'sum' with type 'll(struct t)' {aka 'long long int(struct t)'}
   16 | ll sum(struct t a) {
      |    ^~~
main.c: In function 'sum':
main.c:28:9: error: unknown type name 't'; use 'struct' keyword to refer to the type
   28 |         t result;
      |         ^
      |         struct 
main.c:30:15: error: request for member 'a' in something not a structure or union
   30 |         result.a = a.a + b.a;
      |               ^
main.c:30:21: error: 'struct t' has no member named 'a'
   30 |         result.a = a.a + b.a;
      |                     ^
main.c:30:27: error: 'struct t' has no member named 'a'
   30 |         result.a = a.a + b.a;
      |                           ^
main.c:31:15: error: request for member 'b' in something not a structure or union
   31 |         result.b = a.b + b.b;
      |               ^
main.c:31:21: error: 'struct t' has no member named 'b'
   31 |         result.b = a.b + b.b;
      |                     ^
main.c:31:27: error: 'struct t' has no member named 'b'
   31 |         result.b = a.b + b.b;
      |                           ^
main.c:32:15: error: request for member 'c' in something not a structure or union
   32 |         result.c = a.c + b.c;
      |               ^
main.c:32:21: error: 'struct t' has no member named 'c'
   32 |         result.c = a.c + b.c;
      |                     ^
main.c:32:27: error: 'struct t' has no member named 'c'
   32 |         result.c = a.c + b.c;
      |                           ^
main.c:34:16: error: incompatible types when returning type 'int' but 'struct t' was expected
   34 |         return result;
      |                ^~~~~~
main.c: In function 'clear':
main.c:44:35: error: expected expression before '{' token
   44 |                         f[i][j] = {0,0,0};
      |                                   ^
main.c: In function 'main':
main.c:55:46: error: 'struct t' has no member named 'a'
   55 |                 scanf("%lld%lld%lld", &arr[i].a, &arr[i].b, &arr[i].c);
      |                                              ^
main.c:55:57: error: 'struct t' has no member named 'b'
   55 |                 scanf("%lld%lld%lld", &arr[i].a, &arr[i].b, &arr[i].c);
      |                                                         ^
main.c:55:68: error: 'struct t' has no member named 'c'
   55 |                 scanf("%lld%lld%lld", &arr[i].a, &arr[i].b, &arr[i].c);
      |                                                                    ^
main.c:75:78: error: 'struct t' has no member named 'a'
   75 |                                                         struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                              ^
main.c:75:72: warning: excess elements in struct initializer
   75 |                                                         struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                        ^~~
main.c:75:72: note: (near initialization for 'k')
main.c:75:89: error: 'struct t' has no member named 'b'
   75 |                                                         struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                                         ^
main.c:75:83: warning: excess elements in struct initializer
   75 |                                                         struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                                   ^~~
main.c:75:83: note: (near initialization for 'k')
main.c:75:100: error: 'struct t' has no member named 'c'
   75 |                                                         struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                                                    ^
main.c:75:94: warning: excess elements in struct initializer
   75 |                                                         struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                                              ^~~
main.c:75:94: note: (near initialization for 'k')
main.c:81:50: error: too few arguments to function 'sum'
   81 |                                         result = sum(f[n][m]) > result ? sum(f[n][m]) : result;
      |                                                  ^~~
main.c:27:10: note: declared here
   27 | struct t sum(struct t a, struct t b) {
      |          ^~~
main.c:81:74: error: too few arguments to function 'sum'
   81 |                                         result = sum(f[n][m]) > result ? sum(f[n][m]) : result;
      |                                                                          ^~~
main.c:27:10: note: declared here
   27 | struct t sum(struct t a, struct t b) {
      |          ^~~