stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

#include <bits/stdc++.h>

typedef long long ll;

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

#define rlp(i,n) for(ll i = ll(n);i >= 0;i--)

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

#define wh(t) while(t)

#define re return

#define pb push_back

#define sz(s) (ll)(s.size())

#define fx(n) fixed<<setprecision(n)

#define NeverGiveUp ios::sync_with_stdio(0), ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

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

#define allr(c) c.rbegin(),c.rend()

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

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

using namespace std;

/*ll mx = INT_MIN;

ll mn = INT_MAX;*/

/*ll xd,dx[4]={1,0,-1,0};

ll yd,dy[4]={0,1,0,-1};

bool valid(ll xd,ll yd,ll n,ll m){return xd>-1&&xd<n&&yd>-1&&yd<m;}*/

const int sz = 2e6+5;

const ll md = 1e9+7;

//ll lcm(ll a,ll b){return a*b/__gcd(a,b);}

ll n,ans=1,c,num;map<ll,ll>mp;

int main()

{

    NeverGiveUp

    cin>>n;

    rg(i,2,n){

        num=i;

        for(ll j=2;j<=num;j++){

            while(!(num%j)){

                num/=j;

                mp[j]++;

            }

        }

    }

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

        ans=(ans*(mp[i]+1))%md;

    }

    cout<<ans;

    re 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>



using namespace std;



const int M = 1e9+7,N = 1e3+1;



int freq[N];



int main()

{

    int n;long div=1;

    scanf("%d",&n);

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

    {

        int x=i;

        for(int j=2;j*j<=x;j++)

        {

            while(x%j==0)

            {

            	x/=j;

                freq[j]++;

            }

        }

        if(x!=1)

          freq[x]++;

    }

    for(int i=2;i<=n;i++){

        div*=(freq[i]+1);

        div%=M;

    }

    printf("%ld\n",div);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cmath>

#include <map>

#define ll long long

const int mod = 1e9+7;

using namespace std;

map<int,int>m;

void fcount(ll x){

  ll i=2;

  while(x>1){

    if(x%i==0){

      while(x%i==0){

        m[i]++;

        x/=i;

      }

    }

    i++;

  }//cout<<"1"<<endl;

}

ll shu(){

  ll ans=1;

  map<int,int>::iterator it;

  for(it = m.begin();it!=m.end();++it){

    //cout<<(*it).first<<' '<<(*it).second<<endl;

    ans=(ans%mod*((*it).second+1))%mod;

  }

  return ans;

}

int main(){

  int n;

  ll sum=1,ans=0;

  cin>>n;

  for(int i=1;i<=n;i++){

    fcount(i);

  }

  //cout<<sum<<endl;

  cout<<shu()<<endl;

  return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#define MD (1000000007)

int f[1010];

int main(){

	int n,ans=1;

	scanf("%d",&n);

	for (int i=2;i<=n;i++){

		if (!f[i]){

			int s=0;

			for (int k=n/i;k>0;k/=i){

				s+=k;

			}

			ans=1ll*ans*(s+1)%MD;

			for (int j=i*i;j<=n;j+=i){

				f[j]=1;

			}

		}

	}

	printf("%d\n",ans);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cmath>

#include<iostream> 

#define ll long long

//参考阶乘因数公式； 

using namespace std;

ll cal(ll n,ll p){

	if(n<p)return 0;

	else return (n/p+cal(n/p,p));

}ll prime(ll x){

	ll q=sqrtl(x);

	for(ll i=2;i<=q;i++)

	if(x%i==0)return 0;

	return 1;

}

int main()

{

	ll n,s=1;

	cin>>n;

	for(ll i=2;i<=n;i++){

		if(prime(i)){

		s*=(cal(n,i)+1);

		s%=1000000007;

		}

	}cout<<s;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#define MD (1000000007)

int f[1010];

int main(){

	int n,ans=1;

	scanf("%d",&n);

	for (int i=2;i<=n;i++){

		if (!f[i]){

			int s=0;

			for (int k=n/i;k>0;k/=i){

				s+=k;

			}

			ans=1ll*ans*(s+1)%MD;

			for (int j=i*i;j<=n;j+=i){

				f[j]=1;

			}

		}

	}

	printf("%d\n",ans);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cmath>

#include <cstring>

#include <algorithm>

#include <vector>

#include <map>

#include <cstdlib>

#include <set>

#include <queue>

using namespace std;



#define X first

#define Y second

#define N 1010

typedef long long ll;

typedef pair<int,int> pii;

const int Mod=1000000007;



const double INF=1e18;



bool flag[N];

int p[N],b[N];



void work(int x)

{

	for (int i=1;i<=p[0] && p[i]<=x;i++)

	{

		while (x%p[i]==0) x/=p[i],b[i]++;

	}

}



int main()

{

	//freopen("in.in","r",stdin);

	//freopen("out.out","w",stdout);

	

	int n,ans=1; cin >> n;

	for (int i=2;i<N;i++)

	{

		if (!flag[i]) p[++p[0]]=i;

		for (int j=1;j<=p[0] && i*p[j]<N;j++)

		{

			flag[i*p[j]]=true;

			if (i%p[j]==0) break;

		}

	}

	for (int i=2;i<=n;i++) work(i);

	for (int i=1;i<=p[0];i++) ans=1ll*ans*(b[i]+1)%Mod;

	cout<<ans<<endl;

	return 0;



}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#define MD (1000000007)

int f[1010];

int main(){

	int n,ans=1;

	scanf("%d",&n);

	for (int i=2;i<=n;i++){

		if (!f[i]){

			int s=0;

			for (int k=n/i;k>0;k/=i){

				s+=k;

			}

			ans=1ll*ans*(s+1)%MD;

			for (int j=i*i;j<=n;j+=i){

				f[j]=1;

			}

		}

	}

	printf("%d\n",ans);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int T[1010],prime[1010],cnt;

bool ok[1010];

typedef long long LL;

LL MOD = 1000000007;



int main()

{	

	memset(ok,true,sizeof(ok));

	for (int i=2;i<=1000;i++)

	{

		if (ok[i]) prime[++cnt]=i;

		for (int j=2*i;j<=1000;j+=i)ok[j]=false;

	}

	//for (int i=1;i<=cnt;i++)printf("%d\n",prime[i]);

	int N;

	scanf("%d",&N);

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

	{

		int tmp=i;

		for (int j=1;j<=cnt;j++)

		{

			while(tmp%prime[j]==0)

			{

				tmp/=prime[j];

				T[j]++;

			}

		}

	}

	LL ans=1;

	for (int i=1;i<=cnt;i++)ans=ans*LL(T[i]+1)%MOD;

	cout<<ans<<endl;

}

// Optimized solution to the same problem (faster):
//#include <bits/stdc++.h>

#include<cstdio>

#include<math.h>

#include<algorithm>

using namespace std;

typedef long long LL;



const int mod=1e9+7;



int a[1010],num;

LL bit[1010];



bool isprime(int x){

    if(x==1) return false;

    int q=sqrt(x);

    for(int i=2;i<=q;i++)

        if(x%i==0) return false;

    return true;

}



void init(){

    num=0;

    for(int i=1;i<=1000;i++)

        if(isprime(i)) a[num++]=i;

}



void solve(int n){

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

        if(n%a[i]) continue;

        while(n%a[i]==0){

            bit[i]++;

            n/=a[i];

        }

    }

}



int main()

{

    int n;

    scanf("%d",&n);

    if(n==1){

        puts("1");

        return 0;

    }

    init();

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

        bit[i]=1;

    for(int i=2;i<=n;i++){

        solve(i);

    }

    LL ans=1;

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

        ans=ans*bit[i]%mod;

    }

    printf("%lld\n",ans);

    return 0;

}






// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

#define LL long long



const LL MOD = 1e9 + 7;

LL n;



LL get(LL x, LL y)

{

    LL ret = 0;

    while(x >= y) {

        ret += x / y;

        x /= y;

    }

    return ret;

}





bool prime(int x)

{

    if(x < 2) return false;

    if(x == 2) return true;

    if(x % 2 == 0) return false;

    for(int i=3;i*i<=x;i+=2) if(x % i == 0) return false;

    return true;

}



int main()

{



    while(cin >> n){

        LL ans = 1;

        for(int i=2;i<=n;i++){

            if(!prime(i)) continue;

            LL dv = get(n, i);

//            cout << i << ' ' << dv << '\n';

            ans = (ans * (dv + 1LL)) % MOD;

        }

        cout << ans << '\n';

    }

    return 0;

}


// Optimized solution to the same problem (faster):
//#include <bits/stdc++.h>

#include<cstdio>

#include<math.h>

#include<algorithm>

using namespace std;

typedef long long LL;



const int mod=1e9+7;



int a[1010],num;

LL bit[1010];



bool isprime(int x){

    if(x==1) return false;

    int q=sqrt(x);

    for(int i=2;i<=q;i++)

        if(x%i==0) return false;

    return true;

}



void init(){

    num=0;

    for(int i=1;i<=1000;i++)

        if(isprime(i)) a[num++]=i;

}



void solve(int n){

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

        if(n%a[i]) continue;

        while(n%a[i]==0){

            bit[i]++;

            n/=a[i];

        }

    }

}



int main()

{

    int n;

    scanf("%d",&n);

    if(n==1){

        puts("1");

        return 0;

    }

    init();

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

        bit[i]=1;

    for(int i=2;i<=n;i++){

        solve(i);

    }

    LL ans=1;

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

        ans=ans*bit[i]%mod;

    }

    printf("%lld\n",ans);

    return 0;

}






// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



#define mod 1000000007

#define SIZE 10000000



vector<int>prime;



bool marked[SIZE];

int p[SIZE];

int e[SIZE];



bool isPrime(int n) {

  if (n < 2) return false;

  if (n == 2) return true;

  if (n % 2 == 0) return false;

  return marked[n] == false;

}



void sieve(int n) {

    int sqrtn = (int)sqrt(n);

  for (int i = 3; i <= sqrtn; i+=2) {

    if (marked[i] == false) {

      for (int j = i * i; j <= n; j += i + i) {

        marked[j] = true;

      }

    }

  }

}





int main(){



    int n;



    cin>>n;



    sieve(n);



    if(n>=2) prime.push_back(2);



    for(int i=3;i<=n;i=i+2){

        if(isPrime(i)) prime.push_back(i);

    }





    int p = prime.size();



    //cout<<p<<"\n";



    long long fac = 1;



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

        //cout<<prime[i]<<" : ";

        long long sum = 1;

        long long pow = 1;

        for(long long j=1;pow*prime[i]<=n;j++){

            pow = pow*prime[i];

            //cout<<"("<<pow<<") ";

            long long k = n/pow;

            sum = sum + k;

            //cout<<k<<" "<<sum;

        }





        fac = ((fac % mod) * (sum % mod))%mod ;



        //cout<<" "<<fac<<"\n";



    }



    cout<<fac<<"\n";





}


// Optimized solution to the same problem (faster):
//#include <bits/stdc++.h>

#include<cstdio>

#include<math.h>

#include<algorithm>

using namespace std;

typedef long long LL;



const int mod=1e9+7;



int a[1010],num;

LL bit[1010];



bool isprime(int x){

    if(x==1) return false;

    int q=sqrt(x);

    for(int i=2;i<=q;i++)

        if(x%i==0) return false;

    return true;

}



void init(){

    num=0;

    for(int i=1;i<=1000;i++)

        if(isprime(i)) a[num++]=i;

}



void solve(int n){

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

        if(n%a[i]) continue;

        while(n%a[i]==0){

            bit[i]++;

            n/=a[i];

        }

    }

}



int main()

{

    int n;

    scanf("%d",&n);

    if(n==1){

        puts("1");

        return 0;

    }

    init();

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

        bit[i]=1;

    for(int i=2;i<=n;i++){

        solve(i);

    }

    LL ans=1;

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

        ans=ans*bit[i]%mod;

    }

    printf("%lld\n",ans);

    return 0;

}






// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



long long int N, a, an = 1, i, j;

long long int p[168] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};



int main(){

    scanf("%lld", &N);

    for(i = 0; i < 168 && p[i] <= N; ++i, a = 0){

        for(j = p[i]; j <= N; j *= p[i]){

            a += N / j;

        }

        an *= a + 1;

        an %= 1000000007;

    }

    cout << an << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

 

long long N, a, an = 1, i, j;

constexpr int p[168] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};

 

int main(){

    scanf("%lld", &N);

    for(i = 0; i < 168 && p[i] <= N; ++i, a = 0){

        for(j = p[i]; j <= N; j *= p[i]){

            a += N / j;

        }

        an = an * (a + 1) % 1000000007;

    }

    printf("%lld", an);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



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

#define REP(i,n)   FOR(i,0,n)

long long INF = 1e18;

const int MOD = 1e9 + 7;



using namespace std;



int main(){

    int n;

    long long ans=1;

    scanf("%d",&n);

    map<int,int> res;



    for(int k=2;k<=n;++k){

        int nk=k;

        FOR(i,2,i*i){

            while(nk%i==0){

                ++res[i];

                nk/=i;

            }

        }

        if(nk!=1) res[nk] = 1;

    }



    for(auto itr=res.begin();itr!=res.end();++itr){

        ans = ans * (itr->second+1) % MOD;

    }



    printf("%lld\n",ans);

    return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>



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

#define REP(i,n)   FOR(i,0,n)

long long INF = 1e18;

const int MOD = 1e9 + 7;



using namespace std;



int main(){

    vector<pair<int,int>> prime;

    int n,a=2;

    long long ans=1;

    scanf("%d",&n);



    while(a<=n){

        int k=a;

        for(int i=0;k!=1&&i<prime.size();){

            if(k%prime[i].first){

                ++i;

                continue;

            }else{

                if(prime[i].first==0) printf("#%d!\n",i);

                k/=prime[i].first;

                ++prime[i].second;

            }

        }

        if(k!=1) prime.push_back(make_pair(k,1));

        ++a;

    }



    REP(i,prime.size()) ans = ans*(prime[i].second+1)%MOD;



    printf("%lld\n",ans);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#define ll long long

using namespace std;

const int mod = 1e9 + 7;

int main(){

	ll n,x,count=1;

	ll num[101000]={0};

	cin>>n;

	for(int i=2;i<=n;i++){

		x=i;

		for(int j=2;j<=x;j++){

			while(x%j==0){ 

				num[j]++;

				num[j]%=mod; 

				x/=j;

			}

		}

		if(x!=1)

			num[x]++;

	}

	for(int i=1;i<=n;i++){

		if(num[i])

			count=(count*((num[i]+1)%mod))%mod;

	}

	cout<<count;

	return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<int, pii> pipii;

typedef pair<pii, int> piipi;

typedef pair<pii, pii> piipii;



#define mp make_pair

#define fi first

#define se second

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

#define sz(a) (int)(a).size()

#define eb emplace_back

const int mod = 1e9+7;



bool vis[1005];

int main(){

    int n;

    scanf("%d", &n);

    int ans = 1;

    for(int i=2;i<=n;i++){

        if(vis[i]) continue;

        int res = 0;

        for(int j=i;j<=n;j+=i){

            vis[j] = 1;

            int x = j, cnt = 0;

            while(x%i == 0) x/=i, cnt++;

            res += cnt;

        }

        ans = ans*1ll*(res+1)%mod;

    }

    printf("%d\n", ans);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//### In The Name Of GOD ###



//%% Remember; (((He))) is The (((Accepter))) %%



// GOD IS GREATER ...



#include <bits/stdc++.h>



using namespace std;



typedef long long ll ;

typedef long double ld ;



#define int ll

#define pb push_back

#define bp pop_back

#define pf push_front

#define fp pop_front

#define X first

#define Y second

#define IO ios_base::sync_with_stdio(false);

#define sz(a) (int)(a.size())

#define sg(a, b) (a + b - 1) / b



const int MOD = 1000 * 1000 * 1000 + 7;

const int INF = 8 * 1000 * 1000 + 200;

const int MAXN = 1000 + 1;

const int MLOG = 18;

const int NMAX = 20;



vector<int> prime;



int is_p(int a){

	for(int i : prime)

		if(a % i == 0) return false;

	return true;

}



signed main(){

	IO;

	for(int i = 2; i <= MAXN; i++){

		if(is_p(i)) prime.pb(i);

	}

	//cout << prime[0] << prime[1] << prime[2] << prime[3];

	int cnt[sz(prime)] = {};

	int n;

	cin >> n;

	for(int l = 1; l <= n; l++){

		int r = l;

		for(int i = 0; i < sz(prime); i++){

			while(r % prime[i] == 0) {

				cnt[i]++;

				r /= prime[i];

			}

		}

	}

	int ans = 1;

	for(int i = 0; i < sz(prime); i++){

		ans *= ++cnt[i];

		ans %= MOD;

	}

	cout << ans;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<int, pii> pipii;

typedef pair<pii, int> piipi;

typedef pair<pii, pii> piipii;



#define mp make_pair

#define fi first

#define se second

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

#define sz(a) (int)(a).size()

#define eb emplace_back

const int mod = 1e9+7;



bool vis[1005];

int main(){

    int n;

    scanf("%d", &n);

    int ans = 1;

    for(int i=2;i<=n;i++){

        if(vis[i]) continue;

        int res = 0;

        for(int j=i;j<=n;j+=i){

            vis[j] = 1;

            int x = j, cnt = 0;

            while(x%i == 0) x/=i, cnt++;

            res += cnt;

        }

        ans = ans*1ll*(res+1)%mod;

    }

    printf("%d\n", ans);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#include<string.h>



using namespace std;



int main()

{

    char line[50];

    cin.getline(line,50);

    char a,b,c,d;

    int count=0;

    for(int i=0;i<strlen(line);i++)

    {

        if(line[i]==' ')

        {

            if(count==0)

            {

            a=line[i-1];

            b=line[i+1];

            count=1;

            }

            else

            {

              c=line[i-1];

              d=line[i+1];

            }

        }

    }

    if(a==b && c==d)

    {

        cout<<"YES";

    }

    else{

        cout<<"NO";

    }

    return 0;

}




// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <string.h>



int main() {

	

	char a[11],b[11],c[11];

	

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

	

	int p = strlen(a), q = strlen(b);

	

	

	if(a[p-1] == b[0] && b[q-1] == c[0]){

		puts("YES");

	}else{

		puts("NO");

	}

	







	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string.h>



using namespace std;



int main()

{

    char a[20],b[20],c[20];

    int x,y;

    cin>>a>>b>>c;

    x=strlen(a);

    y=strlen(b);

    if(a[x-1]==b[0])

    {

        if(b[y-1]==c[0])

        {

            cout<<"YES";

        }

        else

        {

            cout<<"NO";

        }

    }

    else

    {

        cout<<"NO";

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <string.h>



int main() {

	

	char a[11],b[11],c[11];

	

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

	

	int p = strlen(a), q = strlen(b);

	

	

	if(a[p-1] == b[0] && b[q-1] == c[0]){

		puts("YES");

	}else{

		puts("NO");

	}

	







	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main()

{

    string s,a,e;

    int c,d,j;

    cin>>s>>a>>e;

    c = s.size();

    d = a.size();

    j = e.size();

    if(s[c-1]==a[0]&&a[d-1]==e[0])

        cout<<"YES"<<endl;

    else

        cout<<"NO"<<endl;

    return 0;



}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	char arr[355];

	scanf("%[^\n]", &arr);

	int test = 1;

	for(int i=0;arr[i]!='\0';i++){

		if(arr[i]==' '&&arr[i-1]!=arr[i+1]){

			test=0;

			break;

		}

	}

	if(test==1){

		printf("YES\n");

	}

	else {

		printf("NO\n");

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main(void)

{

    char A[11],B[11],C[11];

    cin>>A>>B>>C;

    if(A[strlen(A)-1]==B[0] && B[strlen(B)-1]==C[0])

        cout<<"YES"<<endl;

    else

        cout<<"NO"<<endl;



}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	char arr[355];

	scanf("%[^\n]", &arr);

	int test = 1;

	for(int i=0;arr[i]!='\0';i++){

		if(arr[i]==' '&&arr[i-1]!=arr[i+1]){

			test=0;

			break;

		}

	}

	if(test==1){

		printf("YES\n");

	}

	else {

		printf("NO\n");

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

  char str[31], ctr = 0;

  scanf("%[^\n]", str);



  for(int i = 0; str[i] != '\0'; i++) {

    if(str[i] == ' ' && str[i-1] == str[i+1]) {

      ctr++;

    }

  }

  if(ctr == 2) {

    puts("YES");

  }

  else {

    puts("NO");

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

  char str[31], ctr = 0;

  scanf("%[^\n]", str);



  for(int i = 0; str[i] != '\0'; i++) {

    if(str[i] == ' ' && str[i-1] == str[i+1]) {

      ctr++;

    }

  }

  if(ctr == 2) {

    puts("YES");

  }

  else {

    puts("NO");

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#include<string.h>

using namespace std;



main() {

    char A[100],B[100],C[100];

    int a,b,c;

    cin>>A;

    cin>>B;

    cin>>C;



    a=strlen(A);

    b=strlen(B);

    c=strlen(C);



    if(A[a-1]==B[0] && B[b-1]==C[0])

        cout<<"YES";

    else

        cout<<"NO";

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <string.h>



int main(){



    char tulisanA[11];

    char tulisanB[11];

    char tulisanC[11];



    scanf("%s %s %s", &tulisanA, &tulisanB, &tulisanC);



    int panjangA = strlen (tulisanA);

    int panjangB = strlen(tulisanB);



    if(tulisanA[panjangA-1] == tulisanB[0] && tulisanB[panjangB-1] == tulisanC[0]){

        puts("YES");

    }

    else{

        puts("NO");

    }

	return 0;

}




// Fastest known solution for this problem: