Language: C++

#include <cstdio>
#define ll long long 
#include <iostream>
using namespace std;
const int MAXN = 1010;

struct item{
	ll a;
	ll b;
	ll c;
};
ll abs(ll t){
	if(t < 0) return -t;
	else return t;
}
ll eval(item t){
	return abs(t.a) + abs(t.b) + abs(t.c);
}
item val_add(item x,item y){
	item t;
	t.a = x.a + y.a;
	t.b = x.b + y.b;
	t.c = x.c + y.c;
	return t;
}
item max(item x,item y){
	ll val = eval(x);
	ll val2 = eval(y);
	if(val > val2) return x;
	else return y;
}
item W[MAXN];
item dp[MAXN][MAXN];

int main(){
	int n;
	int m;
	cin >> n >> m;
	for(int i = 1;i <= n;i++){
		ll x,y,z;
		cin >> x >> y >> z;
		W[i].a = x;
		W[i].b = y;
		W[i].c = z;
	}
	for(int i = 1;i <= n;i++){
		dp[i][1] = W[i];
	}
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= i;j++){
			dp[i][j] = max(val_add(dp[i - 1][j - 1],W[i]),dp[i - 1][j]);
		}					
	}
/*	for(int i = 1;i <= n + 1;i++){
		for(int j = 1;j <= m + 1;j++){
			cout << "dp[" << i << "]" << "[" << j << "]:" << eval(dp[i][j]) << "  "; 
		}
		cout << endl;
	}*/
	ll t = eval(dp[n][m]);			
	cout << t;		
	return 0;			
} 

Compiler output:
a.cc: In function 'long long int eval(item)':
a.cc:17:19: error: call of overloaded 'abs(long long int&)' is ambiguous
   17 |         return abs(t.a) + abs(t.b) + abs(t.c);
      |                ~~~^~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:3:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:12:4: note: candidate: 'long long int abs(long long int)'
   12 | ll abs(ll t){
      |    ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
a.cc:17:30: error: call of overloaded 'abs(long long int&)' is ambiguous
   17 |         return abs(t.a) + abs(t.b) + abs(t.c);
      |                           ~~~^~~~~
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:12:4: note: candidate: 'long long int abs(long long int)'
   12 | ll abs(ll t){
      |    ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
a.cc:17:41: error: call of overloaded 'abs(long long int&)' is ambiguous
   17 |         return abs(t.a) + abs(t.b) + abs(t.c);
      |                                      ~~~^~~~~
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:12:4: note: candidate: 'long long int abs(long long int)'
   12 | ll abs(ll t){
      |    ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~