Easy and clean C++ code
Code

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