Recursive + Memo | C++
Code
# Code
```cpp []
class Solution {
public:
    int maximumAmount(vector<vector<int>>& coins) {
        int dp[501][501][3];
        memset(dp, -1, sizeof(dp));
        function<int(int, int, int)> dfs = [&](int row, int col, int robber){
            if(row == coins.size() - 1 && col == coins[0].size() - 1 && robber <= 2){
                if(robber < 2 && coins[row][col] < 0) return 0;
                return coins[row][col];
            }
            if(robber > 2) return -99999999;
            if(row >= coins.size()) return -99999999;
            if(col >= coins[0].size()) return -99999999;
            if(dp[row][col][robber] != -1) return dp[row][col][robber];

            int total = coins[row][col] + max(dfs(row + 1, col, robber), dfs(row, col + 1, robber));
            int possible = -99999999; // Pruning
            if(coins[row][col] < 0) possible = max(dfs(row + 1, col, robber + 1), dfs(row, col + 1, robber + 1));
            return dp[row][col][robber] = max(total, possible);
        };
        return dfs(0, 0, 0);
    }
};
```
['C++']