Here is my code. I tried to convert nums[i] and nums[j] to long but it still failed. I know it's a bad o(n^2), but I really want to solve the overflow problem. Thanks a lot.

```
bool containsNearbyAlmostDuplicate(int* nums, int numsSize, int k, int t) {
int i,j;
if(numsSize==0 ||k==0)
return false;
if(numsSize>k)
{
for(i=k;i<numsSize;i++)
{
for(j=i-k;j<i;j++)
{
if(abs(nums[i]-nums[j])<=t)
return true;
}
}
return false;
}
else
{
for(i=1;i<numsSize;i++)
{
for(j=0;j<i;j++)
{
if(abs(nums[i]-nums[j])<=t)
return true;
}
}
return false;
}
}
```