Language: C++

#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int inf = 1001001001;
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}

int main() {
    int n;
    cin >> n;
    vector<int> a(n),b(n),c(n);
    rep(i,n) cin >> a[i] >> b[i] >> c[i];
    vector<vector<int>> dp(n,vector<int>(3,0));
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    rep(i,n-1) rep(j,3){
            if(j == 0) {
                chmax(dp[i+1][1],dp[i][j]+b[i+1]);
                chmax(dp[i+1][2],dp[i][j]+c[i+1]);
            } else if(j == 1) {
                chmax(dp[i+1][0],dp[i][j]+a[i+1]);
                chmax(dp[i+1][2],dp[i][j]+c[i+1]);
            } else {
                chmax(dp[i+1][0],dp[i][j]+a[i+1]);
                chmax(dp[i+1][1],dp[i][j]+b[i+1]);
            }
        }
    cout << tmax(dp[n-1][0],dp[n-1][1],dp[n-1][2]) << endl;
}

Compiler output:
a.cc:11:11: error: 'pair' does not name a type
   11 | using P = pair<int,int>;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:18:5: error: 'cin' was not declared in this scope
   18 |     cin >> n;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define rep(i,n) for (int i = 0; i < n; ++i)
a.cc:19:5: error: 'vector' was not declared in this scope
   19 |     vector<int> a(n),b(n),c(n);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #define rep(i,n) for (int i = 0; i < n; ++i)
a.cc:19:12: error: expected primary-expression before 'int'
   19 |     vector<int> a(n),b(n),c(n);
      |            ^~~
a.cc:20:21: error: 'a' was not declared in this scope
   20 |     rep(i,n) cin >> a[i] >> b[i] >> c[i];
      |                     ^
a.cc:20:29: error: 'b' was not declared in this scope
   20 |     rep(i,n) cin >> a[i] >> b[i] >> c[i];
      |                             ^
a.cc:20:37: error: 'c' was not declared in this scope
   20 |     rep(i,n) cin >> a[i] >> b[i] >> c[i];
      |                                     ^
a.cc:21:19: error: expected primary-expression before 'int'
   21 |     vector<vector<int>> dp(n,vector<int>(3,0));
      |                   ^~~
a.cc:22:5: error: 'dp' was not declared in this scope
   22 |     dp[0][0] = a[0];
      |     ^~
a.cc:22:16: error: 'a' was not declared in this scope
   22 |     dp[0][0] = a[0];
      |                ^
a.cc:23:16: error: 'b' was not declared in this scope
   23 |     dp[0][1] = b[0];
      |                ^
a.cc:24:16: error: 'c' was not declared in this scope
   24 |     dp[0][2] = c[0];
      |                ^
a.cc:37:5: error: 'cout' was not declared in this scope
   37 |     cout << tmax(dp[n-1][0],dp[n-1][1],dp[n-1][2]) << endl;
      |     ^~~~
a.cc:37:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:4:27: error: 'max' was not declared in this scope; did you mean 'tmax'?
    4 | #define tmax(a,b,c) max(a,max(b,c))
      |                           ^~~
a.cc:37:13: note: in expansion of macro 'tmax'
   37 |     cout << tmax(dp[n-1][0],dp[n-1][1],dp[n-1][2]) << endl;
      |             ^~~~
a.cc:4:21: error: 'max' was not declared in this scope; did you mean 'tmax'?
    4 | #define tmax(a,b,c) max(a,max(b,c))
      |                     ^~~
a.cc:37:13: note: in expansion of macro 'tmax'
   37 |     cout << tmax(dp[n-1][0],dp[n-1][1],dp[n-1][2]) << endl;
      |             ^~~~
a.cc:37:55: error: 'endl' was not declared in this scope
   37 |     cout << tmax(dp[n-1][0],dp[n-1][1],dp[n-1][2]) << endl;
      |                                                       ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define rep(i,n) for (int i = 0; i < n; ++i)