My code:

class Solution {

public:

bool containsNearbyAlmostDuplicate(vector<int>& nums, int k, int t) {

int num = nums.size();

int n = 0, m =0;

long long key;

for(; n < num; n++)

{

m = n;

for(; m < num-1; m++)

{

key = nums[n] - nums[m+1];

if(key > 2147483647 || key <= -2147483648)

return false;

if(abs(nums[n] - nums[m+1]) <= t)

if(abs(n-m-1) <= k)

return true;

```
}
}
return false;
}
```

};