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(t a) {
	return a.a + a.b + a.c;
}

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

	return x > y ? a : b;
}

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

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

	return result;
}

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

void clear(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;
							t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
							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:14:8: error: unknown type name 't'
   14 | ll sum(t a) {
      |        ^
main.c:18:1: error: unknown type name 't'; use 'struct' keyword to refer to the type
   18 | t max(t a, t b) {
      | ^
      | struct 
main.c:18:7: error: unknown type name 't'
   18 | t max(t a, t b) {
      |       ^
main.c:18:12: error: unknown type name 't'
   18 | t max(t a, t b) {
      |            ^
main.c:25:1: error: unknown type name 't'; use 'struct' keyword to refer to the type
   25 | t sum(t a, t b) {
      | ^
      | struct 
main.c:25:7: error: unknown type name 't'
   25 | t sum(t a, t b) {
      |       ^
main.c:25:12: error: unknown type name 't'
   25 | t sum(t a, t b) {
      |            ^
main.c:35:1: error: unknown type name 't'; use 'struct' keyword to refer to the type
   35 | t f[1000][1000], arr[1010];
      | ^
      | struct 
main.c:37:12: error: unknown type name 't'
   37 | void clear(t f[][1000]) {
      |            ^
main.c: In function 'main':
main.c:53:46: error: request for member 'a' in something not a structure or union
   53 |                 scanf("%lld%lld%lld", &arr[i].a, &arr[i].b, &arr[i].c);
      |                                              ^
main.c:53:57: error: request for member 'b' in something not a structure or union
   53 |                 scanf("%lld%lld%lld", &arr[i].a, &arr[i].b, &arr[i].c);
      |                                                         ^
main.c:53:68: error: request for member 'c' in something not a structure or union
   53 |                 scanf("%lld%lld%lld", &arr[i].a, &arr[i].b, &arr[i].c);
      |                                                                    ^
main.c:69:41: error: implicit declaration of function 'clear'; did you mean 'clearerr'? [-Wimplicit-function-declaration]
   69 |                                         clear(f);
      |                                         ^~~~~
      |                                         clearerr
main.c:73:57: error: unknown type name 't'; use 'struct' keyword to refer to the type
   73 |                                                         t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                         ^
      |                                                         struct 
main.c:73:71: error: request for member 'a' in something not a structure or union
   73 |                                                         t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                       ^
main.c:73:82: error: request for member 'b' in something not a structure or union
   73 |                                                         t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                                  ^
main.c:73:76: warning: excess elements in scalar initializer
   73 |                                                         t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                            ^~~
main.c:73:76: note: (near initialization for 'k')
main.c:73:93: error: request for member 'c' in something not a structure or union
   73 |                                                         t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                                             ^
main.c:73:87: warning: excess elements in scalar initializer
   73 |                                                         t k = { arr[i].a*a,arr[i].b*b,arr[i].c*c };
      |                                                                                       ^~~
main.c:73:87: note: (near initialization for 'k')
main.c:74:57: error: unknown type name 't'; use 'struct' keyword to refer to the type
   74 |                                                         t d = sum(f[i - 1][j - 1], k);
      |                                                         ^
      |                                                         struct 
main.c:74:63: error: implicit declaration of function 'sum' [-Wimplicit-function-declaration]
   74 |                                                         t d = sum(f[i - 1][j - 1], k);
      |                                                               ^~~
main.c:75:67: error: implicit declaration of function 'max' [-Wimplicit-function-declaration]
   75 |                                                         f[i][j] = max(f[i - 1][j], d);
      |                                                                   ^~~