Language: C++

int maxHappiness(vector<vector<int>> &happiness, int days, int activity){
    if(days == 0){
        return happiness[activity];
}
    int pastMaxHappiness = INT_MIN;
    for(int i=0;i <3; i++){
        if(i != activity){
            int pastMaxHappiness = max(maxHappiness, days -1, i);
        }
    }
    return happiness[activity] + pastMaxHappiness;
}
int main(){
    int n;
    cin>>n;
    vector<vector<int>> happiness;
    for(int i=0; i<n; i++){
        for(int j=0; j<3; j++){
            cin>>happiness[i][j];
}
    }
    
    int ans = INT_MIN;
    for(int i=0; i<3; i++){
        ans = max(ans, maxHappiness(happiness, n-1, i));
}
return ans;
}


Compiler output:
a.cc:1:18: error: 'vector' was not declared in this scope
    1 | int maxHappiness(vector<vector<int>> &happiness, int days, int activity){
      |                  ^~~~~~
a.cc:1:25: error: 'vector' was not declared in this scope
    1 | int maxHappiness(vector<vector<int>> &happiness, int days, int activity){
      |                         ^~~~~~
a.cc:1:32: error: expected primary-expression before 'int'
    1 | int maxHappiness(vector<vector<int>> &happiness, int days, int activity){
      |                                ^~~
a.cc:1:50: error: expected primary-expression before 'int'
    1 | int maxHappiness(vector<vector<int>> &happiness, int days, int activity){
      |                                                  ^~~
a.cc:1:60: error: expected primary-expression before 'int'
    1 | int maxHappiness(vector<vector<int>> &happiness, int days, int activity){
      |                                                            ^~~
a.cc:1:72: error: expression list treated as compound expression in initializer [-fpermissive]
    1 | int maxHappiness(vector<vector<int>> &happiness, int days, int activity){
      |                                                                        ^
a.cc: In function 'int main()':
a.cc:15:5: error: 'cin' was not declared in this scope
   15 |     cin>>n;
      |     ^~~
a.cc:16:5: error: 'vector' was not declared in this scope
   16 |     vector<vector<int>> happiness;
      |     ^~~~~~
a.cc:16:19: error: expected primary-expression before 'int'
   16 |     vector<vector<int>> happiness;
      |                   ^~~
a.cc:19:18: error: 'happiness' was not declared in this scope; did you mean 'maxHappiness'?
   19 |             cin>>happiness[i][j];
      |                  ^~~~~~~~~
      |                  maxHappiness
a.cc:23:15: error: 'INT_MIN' was not declared in this scope
   23 |     int ans = INT_MIN;
      |               ^~~~~~~
a.cc:1:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
  +++ |+#include <climits>
    1 | int maxHappiness(vector<vector<int>> &happiness, int days, int activity){
a.cc:25:37: error: 'happiness' was not declared in this scope; did you mean 'maxHappiness'?
   25 |         ans = max(ans, maxHappiness(happiness, n-1, i));
      |                                     ^~~~~~~~~
      |                                     maxHappiness
a.cc:25:36: error: 'maxHappiness' cannot be used as a function
   25 |         ans = max(ans, maxHappiness(happiness, n-1, i));
      |                        ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
a.cc:25:15: error: 'max' was not declared in this scope
   25 |         ans = max(ans, maxHappiness(happiness, n-1, i));
      |               ^~~