Language: C++

#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include <vector>
#include <cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  
  ll n; ci(n);
  vpll dp(n+100);
  FOR(i,1,n){
   dp[i].fi=INF;
  }
  FOR(i,1,n){
   ll a,b,c;
      ci(a>>b>>c);
    if (max({a,b,c}}==a) dp[i].se=1;
    else if(max({a,b,c})==b) dp[i].se=2;
    else dp[i].se=3;
    if(dp[i].se!=dp[i].se){
    dp[i].fi=max({a,b,c})+dp[i-1].fi;
    }
    else{
      dp[i].fi=(a+b+c)-max({a,b,c})-min({a,b,c})+dp[i-1].fi;
    }
        }
        co(dp[n])
        }

Compiler output:
a.cc: In function 'int main()':
a.cc:108:20: error: expected ')' before '}' token
  108 |     if (max({a,b,c}}==a) dp[i].se=1;
      |            ~       ^
      |                    )
a.cc:108:20: error: expected ')' before '}' token
  108 |     if (max({a,b,c}}==a) dp[i].se=1;
      |        ~           ^
      |                    )
a.cc:108:20: error: expected primary-expression before '}' token
a.cc:108:21: error: expected primary-expression before '==' token
  108 |     if (max({a,b,c}}==a) dp[i].se=1;
      |                     ^~
a.cc:108:23: error: 'a' was not declared in this scope
  108 |     if (max({a,b,c}}==a) dp[i].se=1;
      |                       ^
a.cc:109:5: error: 'else' without a previous 'if'
  109 |     else if(max({a,b,c})==b) dp[i].se=2;
      |     ^~~~
a.cc:109:20: error: 'b' was not declared in this scope
  109 |     else if(max({a,b,c})==b) dp[i].se=2;
      |                    ^
a.cc:109:22: error: 'c' was not declared in this scope
  109 |     else if(max({a,b,c})==b) dp[i].se=2;
      |                      ^
a.cc:109:16: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
  109 |     else if(max({a,b,c})==b) dp[i].se=2;
      |             ~~~^~~~~~~~~
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:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
/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:   candidate expects 2 arguments, 1 provided
a.cc:109:33: error: 'i' was not declared in this scope
  109 |     else if(max({a,b,c})==b) dp[i].se=2;
      |                                 ^
a.cc:110:13: error: 'i' was not declared in this scope
  110 |     else dp[i].se=3;
      |             ^
a.cc:111:11: error: 'i' was not declared in this scope
  111 |     if(dp[i].se!=dp[i].se){
      |           ^
a.cc:112:21: error: 'b' was not declared in this scope
  112 |     dp[i].fi=max({a,b,c})+dp[i-1].fi;
      |                     ^
a.cc:112:23: error: 'c' was not declared in this scope
  112 |     dp[i].fi=max({a,b,c})+dp[i-1].fi;
      |                       ^
a.cc:112:17: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
  112 |     dp[i].fi=max({a,b,c})+dp[i-1].fi;
      |              ~~~^~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided
/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, 1 provided
/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:   template argument deduction/substitution failed:
/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:   candidate expects 2 arguments, 1 provided
a.cc:115:19: error: 'b' was not declared in this scope
  115 |       dp[i].fi=(a+b+c)-max({a,b,c})-min({a,b,c})+dp[i-1].fi;
      |                   ^
a.cc:115:21: error: 'c' was not declared in this scope
  115 |       dp[i].fi=(a+b+c)-max({a,b,c})-min({a,b,c})+dp[i-1].fi;
      |                     ^
a.cc:115:27: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
  115 |       dp[i].fi=(a+b+c)-max({a,b,c})-min({a,b,c})+dp[i-1].fi;
      |                        ~~~^~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided
/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, 1 provided
/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:   template argument deduction/substitution failed:
/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:   candidate expects 2 arguments, 1 provided
a.cc:115:40: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
  115 |       dp[i].fi=(a+b+c)-max({a,b,c})-min({a,b,c})+dp[i-1].fi;
      |                                     ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
a.cc: At global scope:
a.cc:55:15: error: 'cout' does not name a type; did you mean 'co'?
   55 | #define co(a) cout<<a<<endl;
      |               ^~~~
a.cc:118:9: note: in expansion of macro 'co'
  118 |         co(dp[n])
      |         ^~
a.cc:119:9: error: expected declaration before '}' token
  119 |         }
      |         ^