4 Line C++ Concise
Simply implement the conditions given in the question.
- Simply implement the conditions given in the question.

```cpp []
class Solution {
    public:
        int sumOfGoodNumbers(vector<int>& nums, int k ,int sum = 0) {
            for (int i = 0 ; i < nums.size() ; i++) {
                bool IsaGoodNumber = true;
                if (i-k >= 0 && nums[i] <= nums[i-k]) IsaGoodNumber = false;
                if (i+k < nums.size() && nums[i] <= nums[i+k]) IsaGoodNumber = false;
                if (IsaGoodNumber) sum += nums[i];
            }
            return sum;
        }
    };
```
['C++']