Language: C++

#include<bits/stdc++.h>
usingnamespace std;


#define endl '\n'
#define mem(a,b) memset(a, b, sizeof(a) )
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);


const in max = 1e5+123;

const int inf = 2000000000;

int dp[mx][4],  h[mx][4],n;


int solve (int i,int f1)
{
           if (i>n) return 0;
           if (dp[i][f1] != -1) return dp[i][f1];

           int ret = 0;
           for (int j=0; j<=3; j++){

            if (j != f1){

             ret=max(ret, h[i][j] + solve (i+1, j));
}

           }
           return dp[i][f1] = ret;





}
    int main (){

             optimise();

             cin>>n;
             for(int i=1; i<=n; i++){
                  cin>>h[i][1] >> h[i][2] >> h[i][3];


}

            memset (dp , -1 , sizeof(dp));
            cout<<solve(1, 0) <<endl;

return 0;

}

Compiler output:
a.cc:2:1: error: 'usingnamespace' does not name a type
    2 | usingnamespace std;
      | ^~~~~~~~~~~~~~
a.cc:10:7: error: 'in' does not name a type; did you mean 'int'?
   10 | const in max = 1e5+123;
      |       ^~
      |       int
a.cc:14:8: error: 'mx' was not declared in this scope
   14 | int dp[mx][4],  h[mx][4],n;
      |        ^~
a.cc:14:19: error: 'mx' was not declared in this scope
   14 | int dp[mx][4],  h[mx][4],n;
      |                   ^~
a.cc: In function 'int solve(int, int)':
a.cc:20:16: error: 'dp' was not declared in this scope; did you mean 'dup'?
   20 |            if (dp[i][f1] != -1) return dp[i][f1];
      |                ^~
      |                dup
a.cc:27:27: error: 'h' was not declared in this scope
   27 |              ret=max(ret, h[i][j] + solve (i+1, j));
      |                           ^
a.cc:27:18: error: 'max' was not declared in this scope; did you mean 'std::max'?
   27 |              ret=max(ret, h[i][j] + solve (i+1, j));
      |                  ^~~
      |                  std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:31:19: error: 'dp' was not declared in this scope; did you mean 'dup'?
   31 |            return dp[i][f1] = ret;
      |                   ^~
      |                   dup
a.cc: In function 'int main()':
a.cc:40:14: error: 'optimise' was not declared in this scope; did you mean 'optimize'?
   40 |              optimise();
      |              ^~~~~~~~
      |              optimize
a.cc:42:14: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   42 |              cin>>n;
      |              ^~~
      |              std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:44:24: error: 'h' was not declared in this scope
   44 |                   cin>>h[i][1] >> h[i][2] >> h[i][3];
      |                        ^
a.cc:49:21: error: 'dp' was not declared in this scope; did you mean 'dup'?
   49 |             memset (dp , -1 , sizeof(dp));
      |                     ^~
      |                     dup
a.cc:50:13: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   50 |             cout<<solve(1, 0) <<endl;
      |             ^~~~
      |             std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~