#include <iostream>                                                                                                                                                                                                
                                                                                                                                                                                                                   
using namespace std;                                                                                                                                                                                               
                                                                                                                                                                                                                   
int main(){                                                                                                                                                                                                        
                                                                                                                                                                                                                   
  int a,b,c,d;                                                                                                                                                                                                     
                                                                                                                                                                                                                   
  cin >> a >> b >> c >> d;                                                                                                                                                                                         
                                                                                                                                                                                                                   
  if(-d <= a - c && a - c <= d){                                                                                                                                                                                   
    cout << "Yes" << "\n";                                                                                                                                                                                         
    return 0;                                                                                                                                                                                                      
  }                                                                                                                                                                                                                
                                                                                                                                                                                                                   
  if((-d <= a - b && a - b <= d) && (-d <= b - c && b - c <= d)){                                                                                                                                                  
    cout << "Yes" << "\n";                                                                                                                                                                                         
    return 0;                                                                                                                                                                                                      
  }                                                                                                                                                                                                                
                                                                                                                                                                                                                   
  cout << "No" << "\n";                                                                                                                                                                                            
                                                                                                                                                                                                                   
  return 0;                                                                                                                                                                                                        
}                                                                                                                                                                                                                  
       

Measured memory_bytes: 256