Language: C

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

typedef long long ll;

typedef struct t {
	ll a = 0, b = 0, 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, b = 0, c = 0;
      |              ^
main.c:8:1: warning: useless storage class specifier in empty declaration
    8 | };
      | ^
main.c:10:4: warning: conflicting types for built-in function 'abs'; expected 'int(int)' [-Wbuiltin-declaration-mismatch]
   10 | 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:15:17: error: 'struct t' has no member named 'a'
   15 |         return a.a + a.b + a.c;
      |                 ^
main.c:15:23: error: 'struct t' has no member named 'b'
   15 |         return a.a + a.b + a.c;
      |                       ^
main.c:15:29: error: 'struct t' has no member named 'c'
   15 |         return a.a + a.b + a.c;
      |                             ^
main.c: At top level:
main.c:25:10: error: conflicting types for 'sum'; have 'struct t(struct t,  struct t)'
   25 | struct t sum(struct t a, struct t b) {
      |          ^~~
main.c:14:4: note: previous definition of 'sum' with type 'll(struct t)' {aka 'long long int(struct t)'}
   14 | ll sum(struct t a) {
      |    ^~~
main.c: In function 'sum':
main.c:26:9: error: unknown type name 't'; use 'struct' keyword to refer to the type
   26 |         t result;
      |         ^
      |         struct 
main.c:28:15: error: request for member 'a' in something not a structure or union
   28 |         result.a = a.a + b.a;
      |               ^
main.c:28:21: error: 'struct t' has no member named 'a'
   28 |         result.a = a.a + b.a;
      |                     ^
main.c:28:27: error: 'struct t' has no member named 'a'
   28 |         result.a = a.a + b.a;
      |                           ^
main.c:29:15: error: request for member 'b' in something not a structure or union
   29 |         result.b = a.b + b.b;
      |               ^
main.c:29:21: error: 'struct t' has no member named 'b'
   29 |         result.b = a.b + b.b;
      |                     ^
main.c:29:27: error: 'struct t' has no member named 'b'
   29 |         result.b = a.b + b.b;
      |                           ^
main.c:30:15: error: request for member 'c' in something not a structure or union
   30 |         result.c = a.c + b.c;
      |               ^
main.c:30:21: error: 'struct t' has no member named 'c'
   30 |         result.c = a.c + b.c;
      |                     ^
main.c:30:27: error: 'struct t' has no member named 'c'
   30 |         result.c = a.c + b.c;
      |                           ^
main.c:32:16: error: incompatible types when returning type 'int' but 'struct t' was expected
   32 |         return result;
      |                ^~~~~~
main.c: In function 'clear':
main.c:42:35: error: expected expression before '{' token
   42 |                         f[i][j] = {0,0,0};
      |                                   ^
main.c: In function 'main':
main.c:53:46: error: 'struct t' has no member named 'a'
   53 |                 scanf("%lld%lld%lld", &arr[i].a, &arr[i].b, &arr[i].c);
      |                                              ^
main.c:53:57: error: 'struct t' has no member named 'b'
   53 |                 scanf("%lld%lld%lld", &arr[i].a, &arr[i].b, &arr[i].c);
      |                                                         ^
main.c:53:68: error: 'struct t' has no member named 'c'
   53 |                 scanf("%lld%lld%lld", &arr[i].a, &arr[i].b, &arr[i].c);
      |                                                                    ^
main.c:73:78: error: 'struct t' has no member named 'a'
   73 |                                                         struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                              ^
main.c:73:72: warning: excess elements in struct initializer
   73 |                                                         struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                        ^~~
main.c:73:72: note: (near initialization for 'k')
main.c:73:89: error: 'struct t' has no member named 'b'
   73 |                                                         struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                                         ^
main.c:73:83: warning: excess elements in struct initializer
   73 |                                                         struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                                   ^~~
main.c:73:83: note: (near initialization for 'k')
main.c:73:100: error: 'struct t' has no member named 'c'
   73 |                                                         struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                                                    ^
main.c:73:94: warning: excess elements in struct initializer
   73 |                                                         struct t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                                              ^~~
main.c:73:94: note: (near initialization for 'k')
main.c:79:50: error: too few arguments to function 'sum'
   79 |                                         result = sum(f[n][m]) > result ? sum(f[n][m]) : result;
      |                                                  ^~~
main.c:25:10: note: declared here
   25 | struct t sum(struct t a, struct t b) {
      |          ^~~
main.c:79:74: error: too few arguments to function 'sum'
   79 |                                         result = sum(f[n][m]) > result ? sum(f[n][m]) : result;
      |                                                                          ^~~
main.c:25:10: note: declared here
   25 | struct t sum(struct t a, struct t b) {
      |          ^~~