Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

//入力
ll a[100010][3];

//DPテーブル
ll dp[100010][3];

int main() {
    int N;
    cin >> N;
    for(int i=0; i<N; ++i) for(int j=0; j<3; ++j) cin >> a[i][j];


    for(int i=0; i<N; i++) {
        for(int j=0; j<3; j++) { //i日目の遊びの種類
            for(int k=0; k<3; k++) { //i+1日目の遊びの種類
                if(j == k) continue;
                // iからi+1日目への遷移を考える。
                chmax(dp[i+1][k], dp[i][j] + a[i][k]);
            }
        }
    }

    //N日目にどの遊びをするとmaxとなるか
    ll res = 0;
    for(int j=0; j<3; ++j) chmax(res, dp[N][j]);
    cout << res << endl;
}#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

//入力
ll a[100010][3];

//DPテーブル
ll dp[100010][3];

int main() {
    int N;
    cin >> N;
    for(int i=0; i<N; ++i) for(int j=0; j<3; ++j) cin >> a[i][j];


    for(int i=0; i<N; i++) {
        for(int j=0; j<3; j++) { //i日目の遊びの種類
            for(int k=0; k<3; k++) { //i+1日目の遊びの種類
                if(j == k) continue;
                // iからi+1日目への遷移を考える。
                chmax(dp[i+1][k], dp[i][j] + a[i][k]);
            }
        }
    }

    //N日目にどの遊びをするとmaxとなるか
    ll res = 0;
    for(int j=0; j<3; ++j) chmax(res, dp[N][j]);
    cout << res << endl;
}

Compiler output:
a.cc:34:2: error: stray '#' in program
   34 | }#include <bits/stdc++.h>
      |  ^
a.cc:34:3: error: 'include' does not name a type
   34 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:37:31: error: redefinition of 'template<class T> bool chmax(T&, T)'
   37 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:4:31: note: 'template<class T> bool chmax(T&, T)' previously declared here
    4 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:38:31: error: redefinition of 'template<class T> bool chmin(T&, T)'
   38 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:5:31: note: 'template<class T> bool chmin(T&, T)' previously declared here
    5 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:39:17: error: redefinition of 'const long long int INF'
   39 | const long long INF = 1LL << 60;
      |                 ^~~
a.cc:6:17: note: 'const long long int INF' previously defined here
    6 | const long long INF = 1LL << 60;
      |                 ^~~
a.cc:42:4: error: redefinition of 'll a [100010][3]'
   42 | ll a[100010][3];
      |    ^
a.cc:9:4: note: 'll a [100010][3]' previously declared here
    9 | ll a[100010][3];
      |    ^
a.cc:45:4: error: redefinition of 'll dp [100010][3]'
   45 | ll dp[100010][3];
      |    ^~
a.cc:12:4: note: 'll dp [100010][3]' previously declared here
   12 | ll dp[100010][3];
      |    ^~
a.cc:47:5: error: redefinition of 'int main()'
   47 | int main() {
      |     ^~~~
a.cc:14:5: note: 'int main()' previously defined here
   14 | int main() {
      |     ^~~~