Language: C++

#include<bits/stdc++.h>
using namespace std;
#define con continue
#define bk break
#define LL long long
#define db double
#define pt cout<<'\n';
#define ms(a, b) memset((a), (b), sizeof(a))
#define mp make_pair
#define endl '\n'
LL inf=2147483647;const long long ll =9223372036854775807,ninf=1000000000;const double eps = 1e-6; const long long nll =1000000000000000000;
#define sz size()
#define len(X) strlen(X)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ULL unsigned long long
#define de cout<<"test"<<endl;
#define st system("pause");
#define F first
#define S second
int main()
{

int a,b;
while(cin>>a>>b){
    int A[1005]={},B[1005]={},C[1005]={};
    for(int i=0;i<a;i++){
        cin>>A[i]>>B[i]>>C[i];
    }
    int ans=0;
    for(int i=0;i<(1<<3);i++){
        int num[1005]={};
        for(int j=0;j<a;j++){
            int sum=0;
            if(i&1){
                sum+=A[i];
            }
            else{
                sum+=(-1*A[i]);
            }
            
            if(i&2){
                sum+=B[i];
            }
            else{
                sum+=(-1*B[i]);
            }
            if(i&4){
                sum+=C[i];
            }
            else{
              sum+=(-1*C[i]);
            }
            num[i]=sum;
        }
        sort(num,num+a);
        reverse(num,num+a);
        LL tmp=0;
        for(int j=0;j<b;j++)
            tmp+=num[j];
        
        ans=max(ans,tmp);
    }
    cout<<ans<<endl;
}
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:16: error: no matching function for call to 'max(int&, long long int&)'
   61 |         ans=max(ans,tmp);
      |             ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:61:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   61 |         ans=max(ans,tmp);
      |             ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:61:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   61 |         ans=max(ans,tmp);
      |             ~~~^~~~~~~~~