stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long int

#define sz  200010

using namespace std;





string ss[sz];



int main()

{





    string x="";



    ll h,w,i,j,k,p,a,b;



    cin>>h>>w;



    for(i=1; i<=h; i++)cin>>ss[i];



    for(i=1; i<=w+2; i++)x+="#";



    cout<<x<<endl;

    for(i=1; i<=h; i++)

    {

        cout<<"#"<<ss[i]<<"#"<<endl;

    }

    cout<<x<<endl;







    return 0;

}




// Faster C++ solution for the same problem (measured speedup: 8.12954663688673x):
#include<bits/stdc++.h>

#define bye return 0

#define Yes cout << "Yes" << "\n"

#define No  cout << "No" << "\n"

#define YES cout << "YES" << "\n"

#define NO cout << "NO" << "\n"

using namespace std;

int main(){

	ios::sync_with_stdio(false);

    cin.tie(NULL);

    string s1;

    string s2;

    vector< vector<string> > v;

    int a, b, c, cnt=0, in=0;

    

    cin >> a >> b;



    for(int i=0; i<a; ++i){

    vector<string> raw;

    cin >> s1;

    raw.push_back(s1);

    v.push_back(raw);

      

    }



     for(int i=1; i<= b+2; ++i){

     	cout << "#";

     }

     cout << "\n";



     

     for(int i=0; i<v.size(); ++i){

        for(int j=0; j<1; ++j){

     	cout<< "#" << v[i][j] << "#" << "\n";

     	}

     }







     for(int i=1; i<= b+2; ++i){

     	cout << "#";

     }

     cout << "\n";







   bye;



}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long int

#define sz  200010

using namespace std;





string ss[sz];



int main()

{





    string x="";



    ll h,w,i,j,k,p,a,b;



    cin>>h>>w;



    for(i=1; i<=h; i++)cin>>ss[i];



    for(i=1; i<=w+2; i++)x+="#";



    cout<<x<<endl;

    for(i=1; i<=h; i++)

    {

        cout<<"#"<<ss[i]<<"#"<<endl;

    }

    cout<<x<<endl;







    return 0;

}




// Faster C++ solution for the same problem (measured speedup: 8.268227510575166x):
#include <iostream> 

#include <stdlib.h> 

#include <string.h> 

#include <string> 

#include <sstream>

#include <cstring> 

#include<cmath>

using namespace std;

int main()

{

    int  x , y;

    cin >> x >> y;

    

    for (int i = 0; i < y + 2; i++) {

        cout << "#";

    }

    cout << "\n";

    for (int i = 0; i < x ; i++) {

        string z;

        cin >> z;

        cout << "#" << z << "#\n";

    }

    for (int i = 0; i < y + 2; i++) {

        cout << "#";

    }

	



    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long int

#define sz  200010

using namespace std;





string ss[sz];



int main()

{





    string x="";



    ll h,w,i,j,k,p,a,b;



    cin>>h>>w;



    for(i=1; i<=h; i++)cin>>ss[i];



    for(i=1; i<=w+2; i++)x+="#";



    cout<<x<<endl;

    for(i=1; i<=h; i++)

    {

        cout<<"#"<<ss[i]<<"#"<<endl;

    }

    cout<<x<<endl;







    return 0;

}




// Faster C++ solution for the same problem (measured speedup: 8.07839687984683x):
#include <iostream>

#include<math.h>

#include<string>

#include<iomanip>

#include <numeric>

#include <limits>

using namespace std;

 

int main()

{

int h,w; string s[1000]; cin>>h>>w;

for(int i=0; i<h;i++) cin>>s[i];

for(int i=0;i<w+2;i++) cout<<"#"; cout<<"\n";

for(int i=0;i<h;i++)

{

    cout<<"#"<<s[i]<<"#"<<"\n";

}

for(int i=0;i<w+2;i++) cout<<"#";

return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long int

#define sz  200010

using namespace std;





string ss[sz];



int main()

{





    string x="";



    ll h,w,i,j,k,p,a,b;



    cin>>h>>w;



    for(i=1; i<=h; i++)cin>>ss[i];



    for(i=1; i<=w+2; i++)x+="#";



    cout<<x<<endl;

    for(i=1; i<=h; i++)

    {

        cout<<"#"<<ss[i]<<"#"<<endl;

    }

    cout<<x<<endl;







    return 0;

}




// Faster C++ solution for the same problem (measured speedup: 8.307313419643627x):
#include<bits/stdc++.h>

using namespace std;



int N,K,i;

string a;





int main(){

    cin>>N>>K;

    for(i=1;i<=K+2;i++){

        cout<<"#";

    }

    cout<<endl;

    for(i=1;i<=N;i++){

        cin>>a;

        cout<<"#"<<a<<"#"<<endl;

    }

    for(i=1;i<=K+2;i++){

        cout<<"#";

    }

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main(){

  int h,w;

  vector<string> a(100);

  cin>>h>>w;

  for(int i=0; i<h; i++)

    cin>>a.at(i);

  

  for(int i=0; i<w+2; i++)

    cout<<"#";

  cout<<endl;

  

  for(int i=0; i<h; i++)

    cout<<"#"<<a.at(i)<<"#"<<endl;;

  

  for(int i=0; i<w+2; i++)

    cout<<"#";

  cout<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.26887178778567x):
#include <stdio.h>

int main(void)

{

  int h,w;

  char a[101][101];

  scanf("%d%d",&h,&w);

  for(int i=0; i<h; i++)

    scanf("%s",a[i]);

  

  for(int i=0; i<w+2; i++)

    printf("#");

  puts("");

  

  for(int i=0; i<h; i++)

    printf("#%s#\n",a[i]);

  

  for(int i=0; i<w+2; i++)

    printf("#");

  puts("");

  

  return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

bool can(int a,int b,int d){

    return abs(a-b)<=d;

}



int main()

{

    int a,b,c,d;

    while(~scanf("%d%d%d%d",&a,&b,&c,&d)){

        if(can(a,c,d)|| (can(a,b,d) && can(b,c,d))){

            puts("Yes");

        }else{

            puts("No");

        }



    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.232584934813184x):
#include<stdio.h>

#include<stdlib.h>

#include<math.h>



int main()

{

    int a,b,c,r,s,t,d,x=0,u;

    scanf("%d%d%d%d", &a,&b,&c,&d);

    r=abs(a-b);

    s=abs(b-c);

    u=abs(a-c);

    if(r<=d&&s<=d)

        x=1;

    else if(u<=d)

        x=1;

    if(x==1)

        printf("Yes\n");

    else

        printf("No\n");



    return 0;

}
// Slower C++ solution:
#include<iostream>

#include <stdio.h>

#include<algorithm>

#include<string.h>

#include<cmath>

#include <vector>

using namespace std;

int main()

{

    int a,b,c,d;

    scanf("%d%d%d%d",&a,&b,&c,&d);

    if(abs(a-c)<=d)printf("Yes");

    else if(abs(a-b)<=d&&abs(b-c)<=d)printf("Yes");

    else printf("No");

}






// Faster C++ solution for the same problem (measured speedup: 5.23511424012982x):
#include<stdio.h>

#include<stdlib.h>

#include<math.h>



int main()

{

    int a,b,c,r,s,t,d,x=0,u;

    scanf("%d%d%d%d", &a,&b,&c,&d);

    r=abs(a-b);

    s=abs(b-c);

    u=abs(a-c);

    if(r<=d&&s<=d)

        x=1;

    else if(u<=d)

        x=1;

    if(x==1)

        printf("Yes\n");

    else

        printf("No\n");



    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

void display()

{

    int a, b, c, d;

    cin>>a>>b>>c>>d;

    puts(abs(a-c) <= d || abs(a-b) <= d && abs(b-c) <=d ? "Yes": "No");

}

int main(void)

{

    display();

}

// Faster C++ solution for the same problem (measured speedup: 5.277698480405339x):
#include<stdio.h>

#include<stdlib.h>

#include<math.h>



int main()

{

    int a,b,c,r,s,t,d,x=0,u;

    scanf("%d%d%d%d", &a,&b,&c,&d);

    r=abs(a-b);

    s=abs(b-c);

    u=abs(a-c);

    if(r<=d&&s<=d)

        x=1;

    else if(u<=d)

        x=1;

    if(x==1)

        printf("Yes\n");

    else

        printf("No\n");



    return 0;

}
// Slower C++ solution:
		/**Bismillahir Rahmanir Rahim**/





#include<bits/stdc++.h>

using namespace std;

#define ll long long



#define pb push_back

#define io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define clr(v) v.clear()

vector<ll>v;

pair<ll,ll>p;

map<ll,ll>mp;

set<ll>st;

deque<ll>dq;

priority_queue<ll>pq;

#define f(i,b) for(i=0;i<b;i++)

#define f1(i,b) for(i=1;i<=b;i++)

#define fr(i,b)for(i=b-1;i>=0;i--)

ll mn=INT_MAX,mx=INT_MIN;

ll n,m,tc,i,j,tmp,sum,cn,ans,res,pos,flag,l,x,k,dif;



string s,str;





ll a[200007],b[200007];

int main()

{





   ll d,a,b,c;



cin>>a>>b>>c>>d;

if(abs(c-a)<=d)

    cout<<"Yes";

else

{

    ll dif=abs(a-b);

    ll dif1=abs(b-c);

    if(dif>d||dif1>d)

        cout<<"No";

    else cout<<"Yes";

}

return 0;

}








// Faster C++ solution for the same problem (measured speedup: 5.346680315062655x):
#include<stdio.h>

#include<stdlib.h>

#include<math.h>



int main()

{

    int a,b,c,r,s,t,d,x=0,u;

    scanf("%d%d%d%d", &a,&b,&c,&d);

    r=abs(a-b);

    s=abs(b-c);

    u=abs(a-c);

    if(r<=d&&s<=d)

        x=1;

    else if(u<=d)

        x=1;

    if(x==1)

        printf("Yes\n");

    else

        printf("No\n");



    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

bool can(int a,int b,int d){

    return abs(a-b)<=d;

}



int main()

{

    int a,b,c,d;

    while(~scanf("%d%d%d%d",&a,&b,&c,&d)){

        if(can(a,c,d)|| (can(a,b,d) && can(b,c,d))){

            puts("Yes");

        }else{

            puts("No");

        }



    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.232627716902209x):
#include<stdio.h>



#include<stdlib.h>





int main()



{



int a,b,c,d,e,f,g;



scanf("%d%d%d%d",&a,&b,&c,&d);





e=abs(a-c);

f=abs(a-b);

g=abs(b-c);

if((e<=d) || (f<=d && g<=d))



{



printf("Yes\n");



}





else



{



printf("No\n");



}



return 0;



}
// Slower C++ solution:
#include<iostream>

#include <stdio.h>

#include<algorithm>

#include<string.h>

#include<cmath>

#include <vector>

using namespace std;

int main()

{

    int a,b,c,d;

    scanf("%d%d%d%d",&a,&b,&c,&d);

    if(abs(a-c)<=d)printf("Yes");

    else if(abs(a-b)<=d&&abs(b-c)<=d)printf("Yes");

    else printf("No");

}






// Faster C++ solution for the same problem (measured speedup: 5.235157042898675x):
#include<stdio.h>



#include<stdlib.h>





int main()



{



int a,b,c,d,e,f,g;



scanf("%d%d%d%d",&a,&b,&c,&d);





e=abs(a-c);

f=abs(a-b);

g=abs(b-c);

if((e<=d) || (f<=d && g<=d))



{



printf("Yes\n");



}





else



{



printf("No\n");



}



return 0;



}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

void display()

{

    int a, b, c, d;

    cin>>a>>b>>c>>d;

    puts(abs(a-c) <= d || abs(a-b) <= d && abs(b-c) <=d ? "Yes": "No");

}

int main(void)

{

    display();

}

// Faster C++ solution for the same problem (measured speedup: 5.277741631346804x):
#include<stdio.h>



#include<stdlib.h>





int main()



{



int a,b,c,d,e,f,g;



scanf("%d%d%d%d",&a,&b,&c,&d);





e=abs(a-c);

f=abs(a-b);

g=abs(b-c);

if((e<=d) || (f<=d && g<=d))



{



printf("Yes\n");



}





else



{



printf("No\n");



}



return 0;



}
// Slower C++ solution:
		/**Bismillahir Rahmanir Rahim**/





#include<bits/stdc++.h>

using namespace std;

#define ll long long



#define pb push_back

#define io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define clr(v) v.clear()

vector<ll>v;

pair<ll,ll>p;

map<ll,ll>mp;

set<ll>st;

deque<ll>dq;

priority_queue<ll>pq;

#define f(i,b) for(i=0;i<b;i++)

#define f1(i,b) for(i=1;i<=b;i++)

#define fr(i,b)for(i=b-1;i>=0;i--)

ll mn=INT_MAX,mx=INT_MIN;

ll n,m,tc,i,j,tmp,sum,cn,ans,res,pos,flag,l,x,k,dif;



string s,str;





ll a[200007],b[200007];

int main()

{





   ll d,a,b,c;



cin>>a>>b>>c>>d;

if(abs(c-a)<=d)

    cout<<"Yes";

else

{

    ll dif=abs(a-b);

    ll dif1=abs(b-c);

    if(dif>d||dif1>d)

        cout<<"No";

    else cout<<"Yes";

}

return 0;

}








// Faster C++ solution for the same problem (measured speedup: 5.3467240300058565x):
#include<stdio.h>



#include<stdlib.h>





int main()



{



int a,b,c,d,e,f,g;



scanf("%d%d%d%d",&a,&b,&c,&d);





e=abs(a-c);

f=abs(a-b);

g=abs(b-c);

if((e<=d) || (f<=d && g<=d))



{



printf("Yes\n");



}





else



{



printf("No\n");



}



return 0;



}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b,c,d,x,y,z;

    cin>>a>>b>>c>>d;

    if(a>b)

    {

        x=a-b;

    }

    else

    {

        x=b-a;

    }

    if(b>c)

    {

        y=b-c;

    }

    else

    {

        y=c-b;

    }

    if(c>a)

    {

        z=c-a;

    }

    else

    {

        z=a-c;

    }

    if( (x<=d && y<=d)|| z<=d)

    {

        cout<<"Yes"<<endl;

    }

    else

    {

        cout<<"No"<<endl;

    }





    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.306945103256717x):
#include<stdio.h>

#include<stdlib.h>

int main()

{

    int a,b,c,d;

    scanf("%d%d%d%d",&a,&b,&c,&d);

    if((abs(a-b))<=d&&(abs(b-c))<=d)

        {

            printf("Yes");

        }

    else if((abs(a-c))<=d)

        {

            printf("Yes");

        }

    else

        {

            printf("No");

        }





    return 0;



}
// Slower C++ solution:
#include <bits/stdc++.h>



#define PI acos(-1)

#define all(a) a.begin(), a.end()

#define full(a, n) a, a + n

#define ma(type, size) (type *)malloc(sizeof(type) * size)

#define F first

#define S second

#define PB push_back

#define MP make_pair

#define MT make_tuple

#define f0n(i, n) for (i = 0; i < (n); i++)

#define f1n(i, n) for (i = 1; i <= (n); i++)

#define fab(i, a, b) for (i = (a); i <= (b); i++)

#define fr(i, b, a) for (i = (b); i >= (a); i--)



using namespace std;



/*

#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

typedef tree<int,null_type,less<int>,rb_tree_tag,

	tree_order_statistics_node_update> indexed_set;

//*/

typedef long long int ll;

typedef long int lo;

typedef vector<int> vi;

typedef pair<int, int> pi;

typedef tuple<int, int, int> ti;



typedef vector<ll> vll;

typedef pair<ll, ll> pll;

typedef tuple<ll, ll, ll> tll;



//* utility function

inline bool compare(ll i, ll j)

{

    return i < j;

}

//*/



//* function prototypes

template< typename T>

T gcd(T a, T b);

//*/



//int row, column;

int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};

int dy[8] = {0, -1, -1, -1, 0, 1, 1, 1};

ll p2[63] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904};

#ifdef DEBUG

#endif // DEBUG



int main()

{

    //ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);

    //freopen("output.txt", "w", stdout);



    ll number_of_test_case = 1, test_case;

    //cin >> number_of_test_case;

    for (test_case = 1; test_case <= number_of_test_case; test_case++)

    {

        ll a, b, c, d;



        cin >> a >> b >> c >> d;

        if ((abs(a-c) <= d) or ((abs(a-b) <= d) and (abs(b-c) <= d)))

            cout << "Yes\n";

        else cout << "No\n";

    }

    return 0;

}

template< typename T>

T gcd(T a, T b)

{

    if (b == 0)

        return a;

    return gcd(b, a%b);

}


// Faster C++ solution for the same problem (measured speedup: 5.181411786927949x):
#include<stdio.h>

#include<stdlib.h>



int main()

{

    double a, b, c, dif, d1, d2, d3, count=0;

    scanf("%lf%lf%lf%lf", &a, &b, &c, &dif);

    

    d1 = abs(a-c);

    d2 = abs(a-b);

    d3 = abs(b-c);

    

    if(d1<=dif)

        count=1;

    if(d2<=dif && d3<=dif)

        count=1;

    

    if(count==0)

        printf("No\n");

    else

        printf("Yes\n");

    

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define  ll long long int

main()

{

  ll a,b,c,d;

  cin>>a>>b>>c>>d;

 if((abs(b-a)<=d&&abs(c-b)<=d)||abs(c-a)<=d)

    cout<<"Yes"<<endl;

 else cout<<"No"<<endl;



}


// Faster C++ solution for the same problem (measured speedup: 5.195294829450702x):
#include<stdio.h>

#include<stdlib.h>



int main()

{

    double a, b, c, dif, d1, d2, d3, count=0;

    scanf("%lf%lf%lf%lf", &a, &b, &c, &dif);

    

    d1 = abs(a-c);

    d2 = abs(a-b);

    d3 = abs(b-c);

    

    if(d1<=dif)

        count=1;

    if(d2<=dif && d3<=dif)

        count=1;

    

    if(count==0)

        printf("No\n");

    else

        printf("Yes\n");

    

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b,c,d;

    cin>>a>>b>>c>>d;

     if(abs(a-c)<=d)

    {

        cout<<"Yes"<<endl;

    }

    else if(abs(a-b)<=d && abs(b-c)<=d)

    {

         cout<<"Yes"<<endl;

    }

    else

    {

        cout<<"No"<<endl;

    }



}


// Faster C++ solution for the same problem (measured speedup: 5.196987378996844x):
#include<stdio.h>

#include<stdlib.h>



int main()

{

    double a, b, c, dif, d1, d2, d3, count=0;

    scanf("%lf%lf%lf%lf", &a, &b, &c, &dif);

    

    d1 = abs(a-c);

    d2 = abs(a-b);

    d3 = abs(b-c);

    

    if(d1<=dif)

        count=1;

    if(d2<=dif && d3<=dif)

        count=1;

    

    if(count==0)

        printf("No\n");

    else

        printf("Yes\n");

    

    return 0;

}
// Slower C++ solution:
#include<bits//stdc++.h>

using namespace std;

int main()

{

    int a,b,c,i,j,d;

    cin>>a>>b>>c>>d;

    if(abs(a-c)<=d)

        cout<<"Yes"<<endl;

    else if(abs(a-b)<=d && abs(b-c)<=d)

        cout<<"Yes"<<endl;

    else

        cout<<"No"<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 5.196987378996844x):
#include<stdio.h>

#include<stdlib.h>



int main()

{

    double a, b, c, dif, d1, d2, d3, count=0;

    scanf("%lf%lf%lf%lf", &a, &b, &c, &dif);

    

    d1 = abs(a-c);

    d2 = abs(a-b);

    d3 = abs(b-c);

    

    if(d1<=dif)

        count=1;

    if(d2<=dif && d3<=dif)

        count=1;

    

    if(count==0)

        printf("No\n");

    else

        printf("Yes\n");

    

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main()

{

    int a,b,c,d;

    cin >> a >> b >> c >> d;



    if (fabs(a-b)<=d && fabs(b-c)<=d || fabs(a-c)<=d)

    {

        cout<<"Yes";

    }

    else

    {

        cout<<"No";

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.183447453599954x):
#include<stdio.h>

#include<stdlib.h>



int main()

{

    double a, b, c, dif, d1, d2, d3, count=0;

    scanf("%lf%lf%lf%lf", &a, &b, &c, &dif);

    

    d1 = abs(a-c);

    d2 = abs(a-b);

    d3 = abs(b-c);

    

    if(d1<=dif)

        count=1;

    if(d2<=dif && d3<=dif)

        count=1;

    

    if(count==0)

        printf("No\n");

    else

        printf("Yes\n");

    

    return 0;

}
// Slower C++ solution:


#include<bits/stdc++.h>

using namespace std;

main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);



    long long i,j,k,l,m,n,o,p,q;

    while(cin>>m>>n>>o>>p)



    {

        if(abs(m-o)<=p)

            cout<<"Yes"<<endl;

        else  if(abs(m-n)<=p&&abs(n-o)<=p)

            cout<<"Yes"<<endl;

        else

            cout<<"No"<<endl;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.374596359320415x):
#include<stdio.h>

int main()

{

    int a,b,c,d;

    scanf("%d%d%d%d",&a,&b,&c,&d);

    if(((a-b)<=d&&(b-c)<=d&&(a-b)>=-d&&(b-c)>=-d)||((a-c)<=d&&(a-c)>=-d))

    printf("Yes\n");

    else

        printf("No\n");

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

   int a,b,c,d;

   cin>>a>>b>>c>>d;

   if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d))

    cout<<"Yes\n";

   else cout<<"No\n";

}


// Faster C++ solution for the same problem (measured speedup: 5.292514694129033x):
#include<stdio.h>

int main()

{

    int a,b,c,d;

    scanf("%d%d%d%d",&a,&b,&c,&d);

    if(((a-b)<=d&&(b-c)<=d&&(a-b)>=-d&&(b-c)>=-d)||((a-c)<=d&&(a-c)>=-d))

    printf("Yes\n");

    else

        printf("No\n");

}
// Slower C++ solution:


#include<bits/stdc++.h>

using namespace std;

main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);



    long long i,j,k,l,m,n,o,p,q;

    while(cin>>m>>n>>o>>p)



    {

        if(abs(m-o)<=p)

            cout<<"Yes"<<endl;

        else  if(abs(m-n)<=p&&abs(n-o)<=p)

            cout<<"Yes"<<endl;

        else

            cout<<"No"<<endl;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.374745294729056x):
#include<stdio.h>

#include<stdlib.h>



int main()

{



   int a,b,c,d;



    scanf("%d%d%d%d",&a,&b,&c,&d);





            if(abs(a-c)<=d){



                printf("Yes\n");







            }





    else if(abs(a-b)<=d && abs(b-c)<=d){



                printf("Yes\n");



            }





    else{



        printf("No\n");



    }









    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

   int a,b,c,d;

   cin>>a>>b>>c>>d;

   if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d))

    cout<<"Yes\n";

   else cout<<"No\n";

}


// Faster C++ solution for the same problem (measured speedup: 5.292661354973125x):
#include<stdio.h>

#include<stdlib.h>



int main()

{



   int a,b,c,d;



    scanf("%d%d%d%d",&a,&b,&c,&d);





            if(abs(a-c)<=d){



                printf("Yes\n");







            }





    else if(abs(a-b)<=d && abs(b-c)<=d){



                printf("Yes\n");



            }





    else{



        printf("No\n");



    }









    return 0;

}
// Slower C++ solution:


#include<bits/stdc++.h>

using namespace std;

main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);



    long long i,j,k,l,m,n,o,p,q;

    while(cin>>m>>n>>o>>p)



    {

        if(abs(m-o)<=p)

            cout<<"Yes"<<endl;

        else  if(abs(m-n)<=p&&abs(n-o)<=p)

            cout<<"Yes"<<endl;

        else

            cout<<"No"<<endl;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.375017337930752x):
#include<stdio.h>

#include<stdlib.h>

int main()

{

    int a,b,c,d,t;

    scanf("%d%d%d%d",&a,&b,&c,&d);

    if(abs(c-a)<=d)

    {

        t=1;

    }

    else if(abs(a-b)<=d)

    {

        if(abs(b-c)<=d)

            t=1;

            else t=0;

    }

    else t=0;

    if(t==1)

        printf("Yes");

    else printf("No");

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

   int a,b,c,d;

   cin>>a>>b>>c>>d;

   if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d))

    cout<<"Yes\n";

   else cout<<"No\n";

}


// Faster C++ solution for the same problem (measured speedup: 5.292929243489055x):
#include<stdio.h>

#include<stdlib.h>

int main()

{

    int a,b,c,d,t;

    scanf("%d%d%d%d",&a,&b,&c,&d);

    if(abs(c-a)<=d)

    {

        t=1;

    }

    else if(abs(a-b)<=d)

    {

        if(abs(b-c)<=d)

            t=1;

            else t=0;

    }

    else t=0;

    if(t==1)

        printf("Yes");

    else printf("No");

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

#define maxtam 1000



using namespace std;

typedef long long ll;



int main()

{

	ll v[maxtam];

	int nums;

	cin>>nums;

	

	for(int i=0; i<nums; i++)

		cin>>v[i];

		

	sort(v,v+nums);

	cout<<v[nums-1]-v[0]<<endl;

	

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.274238072255118x):
#include <cstdio>

#include <algorithm>

using namespace std;

int n,a,maxi=0,mini=2e9;

int main()

{

	scanf("%d",&n);

	for(int i=0;i<n;i++)

	{

		scanf("%d",&a);

		maxi=max(maxi,a);

		mini=min(mini,a);

	}

	printf("%d",maxi-mini);

	return 0;

}