stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

using namespace std;

int main()

{

    int K , X , Y, into;

    cin >> Y >> X;

    K = 500;

    into = K*Y;

    if (into >= X) cout << "Yes" << endl ;

    else cout << "No" << endl;

    return 0;

}

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



int main ()

{

	int k,x;

	scanf("%d %d", &k,&x);

	

	if (k*500>=x){

		printf("Yes");

	}else 

	printf("No");

	

	return 0;

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

using namespace std;

int main()

{

    int a,b;

    cin>>a>>b;

    int c=a*500;



    if(c>=b)

        cout<< "Yes"<<endl;

    if(c<b)

        cout<< "No"<<endl;

    return 0;

}




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



int main ()

{

	int k,x;

	scanf("%d %d", &k,&x);

	

	if (k*500>=x){

		printf("Yes");

	}else 

	printf("No");

	

	return 0;

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

using namespace std;

int main()

{

    int K , X , Y, into;

    cin >> Y >> X;

    K = 500;

    into = K*Y;

    if (into >= X) cout << "Yes" << endl ;

    else cout << "No" << endl;

    return 0;

}

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



int main(){

 	int K,X;

 	scanf("%d %d", &K, &X );

 	int sum = K*500;

 	if(sum >= X){

 		puts("Yes");

	 }

	 else{

	 	puts("No");

	}

	return 0;

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

using namespace std;

int main()

{

    int a,b;

    cin>>a>>b;

    int c=a*500;



    if(c>=b)

        cout<< "Yes"<<endl;

    if(c<b)

        cout<< "No"<<endl;

    return 0;

}




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



int main(){

 	int K,X;

 	scanf("%d %d", &K, &X );

 	int sum = K*500;

 	if(sum >= X){

 		puts("Yes");

	 }

	 else{

	 	puts("No");

	}

	return 0;

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

using namespace std;

int main()

{

    int K , X , Y, into;

    cin >> Y >> X;

    K = 500;

    into = K*Y;

    if (into >= X) cout << "Yes" << endl ;

    else cout << "No" << endl;

    return 0;

}

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



int main()

{

	int x,y,z,hasil;

	z=500;

	hasil=x*y;

	scanf("%d %d", &x, &y);

	if((x*500)<y){

		printf("No\n");

	}

	else{

		printf("Yes\n");

	}

	return 0;	

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

using namespace std;

int main()

{

    int a,b;

    cin>>a>>b;

    int c=a*500;



    if(c>=b)

        cout<< "Yes"<<endl;

    if(c<b)

        cout<< "No"<<endl;

    return 0;

}




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



int main()

{

	int x,y,z,hasil;

	z=500;

	hasil=x*y;

	scanf("%d %d", &x, &y);

	if((x*500)<y){

		printf("No\n");

	}

	else{

		printf("Yes\n");

	}

	return 0;	

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

using namespace std;

int main()

{

    int K , X , Y, into;

    cin >> Y >> X;

    K = 500;

    into = K*Y;

    if (into >= X) cout << "Yes" << endl ;

    else cout << "No" << endl;

    return 0;

}

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



int main ()

{

	int  a,b;

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

	

	if(500*a>=b){

		printf("Yes\n");

	}

	else{

		printf("No\n");

	}

	return 0;

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

using namespace std;

int main()

{

    int a,b;

    cin>>a>>b;

    int c=a*500;



    if(c>=b)

        cout<< "Yes"<<endl;

    if(c<b)

        cout<< "No"<<endl;

    return 0;

}




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



int main ()

{

	int  a,b;

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

	

	if(500*a>=b){

		printf("Yes\n");

	}

	else{

		printf("No\n");

	}

	return 0;

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

using namespace std;



typedef long long int ll;

typedef pair<ll, ll> pll;



#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))

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

#define OF64 std::setprecision(10)



const ll MOD = 1000000007;

const ll INF = (ll)1e15;



bool L[200005];



int main()

{

    ll N;

    string S;

    cin >> N >> S;

    memset(L, 0, sizeof(L));

    ll l = 0;

    REP(i, 2 * N)

    {

        if (l % 2 == 0 && S[i] == 'B')

        {

            L[i] = true;

            l++;

        }

        else if (l % 2 == 1 && S[i] == 'W')

        {

            L[i] = true;

            l++;

        }

        else

            l--;

    }

    if (l != 0)

    {

        cout << 0 << endl;

        return 0;

    }



    ll ans = 1;

    ll r = 0;

    REP(i, 2 * N)

    {

        if (!L[2 * N - 1 - i])

            r++;

        else

            ans = (ans * r--) % MOD;

    }

    REP(i, N)

    {

        ans = (ans * (i + 1)) % MOD;

    }

    cout << ans << endl;

    return 0;

}

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



using namespace std;



typedef long long int ll;

typedef pair<ll, ll> pll;



#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))

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

#define OF64 std::setprecision(10)



const ll MOD = 1000000007;

const ll INF = (ll) 1e15;



int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    ll N;

    cin >> N;

    string S;

    cin >> S;

    ll L = 0;

    ll ans = 1;

    REP(i, 2 * N) {

        if (S[i] == 'W') {

            if (L % 2 == 0) {

                ans = (ans * L) % MOD;

                L--;

            }

            else

                L++;

        }

        else {

            if (L % 2 == 0)

                L++;

            else {

                ans = (ans * L) % MOD;

                L--;

            }

        }

    }

    if (L != 0)

        ans = 0;



    REP(i, N) {

        ans = (ans * (i + 1)) % MOD;

    }

    cout << ans << endl;

    return 0;

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

using namespace std;

#define finish(x) return cout << x << endl, 0

#define ll long long



const int N = 100001;



int n, dp[2 * N], mod = 1e9 + 7;

vector <int> a;



int solve(int idx, int open){

    if(idx == 2 * n) return open == 0;

    if(open < 0) return 0;

    if(dp[idx] != -1) return dp[idx];

    if(((open & 1) ^ a[idx]) == 0) return 1LL * open * solve(idx + 1, open - 1) % mod;

    return solve(idx + 1, open + 1);

}

int main(){

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    memset(dp, -1, sizeof dp);

    cin >> n;

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

        char c;

        cin >> c;

        a.push_back(c == 'W' ? 0 : 1);

    }

    int ans = solve(0, 0);

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

        ans = 1LL * ans * i % mod;

    }

    cout << ans << endl;

}


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

using namespace std;

#define finish(x) return cout << x << endl, 0

#define ll long long



const int N = 100001;



int n, mod = 1e9 + 7;

vector <int> a;



int main(){

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cin >> n;

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

        char c;

        cin >> c;

        a.push_back(c == 'W' ? 0 : 1);

    }

    int open = 0;

    int ans = 1;

    for(auto &i : a){

        if(open < 0) finish(0);

        if(((open & 1) ^ i) == 0){

            ans = 1LL * ans * open % mod;

            open--;

        }

        else open++;

    }

    if(open) finish(0);

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

        ans = 1LL * ans * i % mod;

    }

    cout << ans << endl;

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

using namespace std;



typedef long long ll;

typedef pair<int, int> P;

typedef tuple<int, int, int> T;

const int INF = 1 << 27;

const ll LLINF = (ll)1 << 60;

const ll MOD = 1e9+7;



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

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



int main() {

  int n;

  scanf("%d", &n);

  vector<T> blocks;

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

    int w, s, v;

    scanf("%d %d %d", &w, &s, &v);

    blocks.emplace_back(s, w, v);

  }



  sort(blocks.begin(), blocks.end(), [](T& t1, T& t2) {return get<0>(t1) + get<1>(t1) < get<0>(t2) + get<1>(t2);});



  const int MAXS = 2e4+10;

  vector<vector<ll>> dp(n, vector<ll>(MAXS, 0));

  for (int s = get<1>(blocks[0]); s < MAXS; s++) {

    dp[0][s] = get<2>(blocks[0]);

  }

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

    auto& block = blocks[i];

    int slimit = get<0>(block);

    int w = get<1>(block), v = get<2>(block);

    for (int s = 0; s < w; s++) {

      dp[i][s] = dp[i-1][s];

    }

    for (int s = w; s < MAXS; s++) {

      dp[i][s] = max(dp[i-1][s], v + dp[i-1][min(s - w, slimit)]);

    }

  }

  

  printf("%lld\n", dp[n-1][MAXS - 1]);

}


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

using namespace std;



typedef long long ll;

typedef pair<int, int> P;

typedef tuple<int, int, int> T;

const int INF = 1 << 27;

const ll LLINF = (ll)1 << 60;

const ll MOD = 1e9+7;



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

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



int main() {

  int n;

  scanf("%d", &n);

  vector<T> blocks;

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

    int w, s, v;

    scanf("%d %d %d", &w, &s, &v);

    blocks.emplace_back(s, w, v);

  }



  sort(blocks.begin(), blocks.end(), [](T& t1, T& t2) {return get<0>(t1) + get<1>(t1) < get<0>(t2) + get<1>(t2);});



  const int MAXS = 2e4+10;

  vector<ll> dp(MAXS, 0);

  for (int s = get<1>(blocks[0]); s < MAXS; s++) {

    dp[s] = get<2>(blocks[0]);

  }

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

    auto& block = blocks[i];

    int slimit = get<0>(block);

    int w = get<1>(block), v = get<2>(block);

    for (int s = MAXS - 1; s >= w; s--) {

      dp[s] = max(dp[s], v + dp[min(s - w, slimit)]);

    }

  }



  printf("%lld\n", dp[MAXS - 1]);

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

using namespace std;

typedef long long ll;

#define i_7 (ll)(1E9+7)

#define i_5 (ll)(1E9+5)

ll mod(ll a){

    ll c=a%i_7;

    if(c>=0)return c;

    else return c+i_7;

}

typedef pair<int,int> i_i;

typedef pair<ll,ll> l_l;

ll inf=(ll)1E12;

#define rep(i,l,r) for(ll i=l;i<=r;i++)

#define pb push_back

ll max(ll a,ll b){if(a<b)return b;else return a;}

ll min(ll a,ll b){if(a>b)return b;else return a;}

void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);

void Min(ll * pos,ll val){*pos=min(*pos,val);}

void Add(ll * pos,ll val){*pos=mod(*pos+val);}

const long double EPS=1E-8;

////////////////////////////////////////





struct tower{

    ll w,s,v;

};

bool comp(tower t1,tower t2){

    if(t1.w+t1.s<t2.w+t2.s)return true;

    else return false;

}



int main(){

    ll n;cin>>n;

    tower t[n];

    rep(i,0,n-1){

        cin>>t[i].w>>t[i].s>>t[i].v;

    }

    sort(t,t+n,comp);

    ll N=30005;

    ll dp[n+1][N];

    memset(dp,0,sizeof(dp));

    rep(i,0,n-1){

        rep(j,0,N-1){

            dp[i+1][j]=dp[i][j];

            if(0<=j-t[i].w&&j-t[i].w<=t[i].s)Max(&dp[i+1][j],dp[i][j-t[i].w]+t[i].v);

        }

    }

    /*rep(i,0,n){

        rep(j,0,20){

            cout<<dp[i][j]<<" ";

        }cout<<endl;

    }*/

    ll ans=0;rep(i,0,N-1)Max(&ans,dp[n][i]);

    cout<<ans<<endl;

    return 0;

}










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

using namespace std;

typedef long long ll;

#define i_7 (ll)(1E9+7)

#define i_5 (ll)(1E9+5)

ll mod(ll a){

    ll c=a%i_7;

    if(c>=0)return c;

    else return c+i_7;

}

typedef pair<int,int> i_i;

typedef pair<ll,ll> l_l;

ll inf=(ll)1E12;

#define rep(i,l,r) for(ll i=l;i<=r;i++)

#define pb push_back

ll max(ll a,ll b){if(a<b)return b;else return a;}

ll min(ll a,ll b){if(a>b)return b;else return a;}

void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);

void Min(ll * pos,ll val){*pos=min(*pos,val);}

void Add(ll * pos,ll val){*pos=mod(*pos+val);}

const long double EPS=1E-8;

////////////////////////////////////////





struct tower{

    ll w,s,v;

};

bool comp(tower t1,tower t2){

    if(t1.w+t1.s<t2.w+t2.s)return true;

    else return false;

}



int main(){

    

    ll N=20001;

    ll n;cin>>n;

    tower t[n];

    rep(i,0,n-1){

        cin>>t[i].w>>t[i].s>>t[i].v;

    }

    sort(t,t+n,comp);

    ll dp[n+1][N];

    memset(dp,0,sizeof(dp));

    rep(i,0,n-1){

        rep(j,0,N-1){

            dp[i+1][j]=dp[i][j];

            if(0<=j-t[i].w&&j-t[i].w<=t[i].s)Max(&dp[i+1][j],dp[i][j-t[i].w]+t[i].v);

        }

    }

    /*rep(i,0,n){

        rep(j,0,20){

            cout<<dp[i][j]<<" ";

        }cout<<endl;

    }*/

    ll ans=0;rep(i,0,N-1)Max(&ans,dp[n][i]);

    cout<<ans<<endl;

    return 0;

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

using namespace std;

typedef long long ll;

#define i_7 (ll)(1E9+7)

#define i_5 (ll)(1E9+5)

ll mod(ll a){

    ll c=a%i_7;

    if(c>=0)return c;

    else return c+i_7;

}

typedef pair<int,int> i_i;

typedef pair<ll,ll> l_l;

ll inf=(ll)1E12;

#define rep(i,l,r) for(ll i=l;i<=r;i++)

#define pb push_back

ll max(ll a,ll b){if(a<b)return b;else return a;}

ll min(ll a,ll b){if(a>b)return b;else return a;}

void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);

void Min(ll * pos,ll val){*pos=min(*pos,val);}

void Add(ll * pos,ll val){*pos=mod(*pos+val);}

const long double EPS=1E-8;

////////////////////////////////////////





struct tower{

    ll w,s,v;

};

bool comp(tower t1,tower t2){

    if(t1.w+t1.s<t2.w+t2.s)return true;

    else return false;

}



int main(){

    ll n;cin>>n;

    tower t[n];

    rep(i,0,n-1){

        cin>>t[i].w>>t[i].s>>t[i].v;

    }

    sort(t,t+n,comp);

    ll N=30005;

    ll dp[n+1][N];

    memset(dp,0,sizeof(dp));

    rep(i,0,n-1){

        rep(j,0,N-1){

            dp[i+1][j]=dp[i][j];

            if(0<=j-t[i].w&&j-t[i].w<=t[i].s)Max(&dp[i+1][j],dp[i][j-t[i].w]+t[i].v);

        }

    }

    /*rep(i,0,n){

        rep(j,0,20){

            cout<<dp[i][j]<<" ";

        }cout<<endl;

    }*/

    ll ans=0;rep(i,0,N-1)Max(&ans,dp[n][i]);

    cout<<ans<<endl;

    return 0;

}










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

using namespace std;

typedef long long ll;

#define i_7 (ll)(1E9+7)

#define i_5 (ll)(1E9+5)

ll mod(ll a){

    ll c=a%i_7;

    if(c>=0)return c;

    else return c+i_7;

}

typedef pair<int,int> i_i;

typedef pair<ll,ll> l_l;

ll inf=(ll)1E12;

#define rep(i,l,r) for(ll i=l;i<=r;i++)

#define pb push_back

ll max(ll a,ll b){if(a<b)return b;else return a;}

ll min(ll a,ll b){if(a>b)return b;else return a;}

void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);

void Min(ll * pos,ll val){*pos=min(*pos,val);}

void Add(ll * pos,ll val){*pos=mod(*pos+val);}

const long double EPS=1E-8;

////////////////////////////////////////





struct tower{

    ll w,s,v;

};

bool comp(tower t1,tower t2){

    if(t1.w+t1.s<t2.w+t2.s)return true;

    else return false;

}



int main(){

    ll n;cin>>n;

    tower t[n];

    rep(i,0,n-1){

        cin>>t[i].w>>t[i].s>>t[i].v;

    }

    sort(t,t+n,comp);

    ll N=(ll)2E4+1;

    ll dp[n+1][N];

    memset(dp,0,sizeof(dp));

    rep(i,0,n-1){

        rep(j,0,N-1){

            dp[i+1][j]=dp[i][j];

            if(0<=j-t[i].w&&j-t[i].w<=t[i].s)Max(&dp[i+1][j],dp[i][j-t[i].w]+t[i].v);

        }

    }

    /*rep(i,0,n){

        rep(j,0,20){

            cout<<dp[i][j]<<" ";

        }cout<<endl;

    }*/

    ll ans=0;rep(i,0,N-1)Max(&ans,dp[n][i]);

    cout<<ans<<endl;

    return 0;

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

#include <iostream>



int c[301000];

int a[301000], st[301000], top, n;



void add(int x) {for(int i = x; i <= n; i += i & -i) c[i]++;}

int query(int x) {int ans = 0;for(int i = x; i; i -= i & -i) ans += c[i]; return ans;}



bool check1()

{

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

	{

		if((a[i] - i) & 1) return false;

	}

	return true;

}



bool check2()

{

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

	{

		if(a[i] != i && a[i + 1] != i + 1 && a[i + 2] != i + 2) return false;

	}

	return true;

}



bool check3()

{

	long long sum = 0;

	for(int i = n; i >= 1; i--)

	{

		sum += query(a[i]);

		add(a[i]);

	}

	if(sum % 3 != 0) return false;

	return true;

}



bool check4()

{

	top = 0;

	st[++top] = a[1];

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

	{

		if(st[top] > a[i]) st[++top] = a[i];

		else

		{

			int l = 1, r = top + 1;

			while(l < r)

			{

				int mid = l + r >> 1;

				if(st[mid] < a[i]) r = mid;

				else l = mid + 1;

			}

			st[r] = a[i];

		}

	}

	if(top > 2) return false;

	top = 0;

	st[++top] = a[2];

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

	{

		if(st[top] > a[i]) st[++top] = a[i];

		else

		{

			int l = 1, r = top + 1;

			while(l < r)

			{

				int mid = l + r >> 1;

				if(st[mid] < a[i]) r = mid;

				else l = mid + 1;

			}

			st[r] = a[i];

		}

	}

	if(top > 2) return false;

	return true;

}



int main()

{

	scanf("%d", &n);

	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);

	if(check1() && check2() && check3() && check4()) puts("Yes");

	else puts("No");

	return 0;

}

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

#include<cstring>

#include<algorithm>

#define MN 300005

using namespace std;

inline int in(){

    int x=0;bool f=0;char c;

    for (;(c=getchar())<'0'||c>'9';f=c=='-');

    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');

    return f?-x:x;

}

int a[MN],q[MN],tp,hd,tl,n;

int main()

{

	n=in();hd=tp=1;

	for (int i=1;i<=n;++i) a[i]=in();

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

		tp=min(tp,i); 

		if((a[i]-tp)&1){if(a[i]!=i){printf("No");return 0;}}

		else if (hd>tl||q[tl]<a[i]) q[++tl]=a[i];

		else if (a[i]==tp) tp+=2;

		else {printf("No");return 0;}

		while (hd<=tl&&q[hd]==tp) tp+=2,++hd;

	}printf("Yes");return 0;

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

#include <iostream>



int c[301000];

int a[301000], st[301000], top, n;



void add(int x) {for(int i = x; i <= n; i += i & -i) c[i]++;}

int query(int x) {int ans = 0;for(int i = x; i; i -= i & -i) ans += c[i]; return ans;}



bool check1()

{

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

	{

		if((a[i] - i) & 1) return false;

	}

	return true;

}



bool check2()

{

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

	{

		if(a[i] != i && a[i + 1] != i + 1 && a[i + 2] != i + 2) return false;

	}

	return true;

}



bool check3()

{

	long long sum = 0;

	for(int i = n; i >= 1; i--)

	{

		sum += query(a[i]);

		add(a[i]);

	}

	if(sum % 3 != 0) return false;

	return true;

}



bool check4()

{

	top = 0;

	st[++top] = a[1];

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

	{

		if(st[top] > a[i]) st[++top] = a[i];

		else

		{

			int l = 1, r = top + 1;

			while(l < r)

			{

				int mid = l + r >> 1;

				if(st[mid] < a[i]) r = mid;

				else l = mid + 1;

			}

			st[r] = a[i];

		}

	}

	if(top > 2) return false;

	top = 0;

	st[++top] = a[2];

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

	{

		if(st[top] > a[i]) st[++top] = a[i];

		else

		{

			int l = 1, r = top + 1;

			while(l < r)

			{

				int mid = l + r >> 1;

				if(st[mid] < a[i]) r = mid;

				else l = mid + 1;

			}

			st[r] = a[i];

		}

	}

	if(top > 2) return false;

	return true;

}



int main()

{

	scanf("%d", &n);

	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);

	if(check1() && check2() && check3() && check4()) puts("Yes");

	else puts("No");

	return 0;

}

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

using namespace std;

int n,a,b,c,l1,l2;

int main()

{

	scanf("%d",&n);

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

	{

		scanf("%d",&a);

		if((a^i)&1){printf("No\n");return 0;}

		if(a>i||(l1&&!((l1^a)&1))){if(!l1)l1=a;else if(a<l2){printf("No\n");return 0;}else if(a<l1)l2=a;else l1=a;}

		if(i&1){if(b<a)b=a;}else if(c<a)c=a;

		if(b>i&&c>i){printf("No\n");return 0;}

		if(b<=i&&c<=i)l1=l2=0;

	}

	printf("Yes\n");

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

#define fr(i,x,y) for(int i=x;i<=y;++i)

#define rf(i,x,y) for(int i=x;i>=y;--i)

#define LL long long

using namespace std;

const int N=3e5+10;

int a[N],b[N];



void fail(){

	printf("No\n");

	exit(0);

}



bool check(int l,int r){

	int L=0,R=0;

	fr(i,l,r){

		if(b[i]<l||b[i]>r) return false;

		if(b[i]<i)

			if(L>b[i]) return false;

			 else L=b[i];

		else if(b[i]>i)

			if(R>b[i]) return false;

			 else R=b[i];

	}

	return true;

}



int main(){

	int n;scanf("%d",&n);

	fr(i,1,n) scanf("%d",&b[i]),a[i]=(b[i]==i);

	fr(i,2,n-1) if(!a[i-1]&&!a[i]&&!a[i+1]) fail();

	fr(i,1,n){

		if(!a[i]){

			int l=i,r=i,nw=0;

			while((a[r+1]^nw)&&r+1<=n) r++,nw^=1;

			//printf("%d %d\n",l,r);

			if(!check(l,r)) fail();

			i=r;

		}

	}

	printf("Yes\n");

	return 0;

}

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

using namespace std;

int n,a,b,c,l1,l2;

int main()

{

	scanf("%d",&n);

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

	{

		scanf("%d",&a);

		if((a^i)&1){printf("No\n");return 0;}

		if(a>i||(l1&&!((l1^a)&1))){if(!l1)l1=a;else if(a<l2){printf("No\n");return 0;}else if(a<l1)l2=a;else l1=a;}

		if(i&1){if(b<a)b=a;}else if(c<a)c=a;

		if(b>i&&c>i){printf("No\n");return 0;}

		if(b<=i&&c<=i)l1=l2=0;

	}

	printf("Yes\n");

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

#include <cstring>

#include <cmath>

#include <bitset>

#include <algorithm>

#include <iostream>

typedef long long ll;

using namespace std;

const int maxn=300100;

int ai[maxn];

int n;



bool check(int l,int r){

    int minx=n+10,maxx=0;

    for(int i=l;i<=r;i++){

        minx=min(minx,ai[i]);

        maxx=max(maxx,ai[i]);

    }

    if(minx<l||maxx>r) return true;

    int x1=0,x2=0;

    for(int i=l;i<=r;i++){

        if(ai[i]!=i){

            if(ai[i]>i){

                if(x1<ai[i]) x1=ai[i];

                else return true;

            }else{

                if(x2<ai[i]) x2=ai[i];

                else return true;

            }

        }

    }

    return false;

}



int main(){

    scanf("%d",&n);

    for(int i=1;i<=n;i++) scanf("%d",&ai[i]);

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

        if(ai[i]!=i){

            int x;

            for(x=i;ai[x+1]==x+1&&ai[x+2]!=x+2;){

                x+=2;

            }

            x=min(x,n);

            //cout<<i<<"   "<<x<<endl;

            if(check(i,x)) return puts("No"),0;

            i=x;

        }

    }

    puts("Yes");

    return 0;

}

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

using namespace std;

int n,a,b,c,l1,l2;

int main()

{

	scanf("%d",&n);

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

	{

		scanf("%d",&a);

		if((a^i)&1){printf("No\n");return 0;}

		if(a>i||(l1&&!((l1^a)&1))){if(!l1)l1=a;else if(a<l2){printf("No\n");return 0;}else if(a<l1)l2=a;else l1=a;}

		if(i&1){if(b<a)b=a;}else if(c<a)c=a;

		if(b>i&&c>i){printf("No\n");return 0;}

		if(b<=i&&c<=i)l1=l2=0;

	}

	printf("Yes\n");

}//