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

#define endl '\n'

#include <algorithm>

using namespace std;





int main()

{

    int n,k;

    cin >> n;

    pair<int,int> a[n];

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

    {

        cin >> k;

        a[i] = {k,i};

    }

    sort(a,a+n);

    int c = 0;

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

    {

        int j = a[i].second;

        if(i%2 == 0 && j%2 != 0)

            c++;

        if(i%2 != 0 && j%2 == 0)

            c++;

    }

    cout << c/2 << endl;

    return 0;

}


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

#include <cstdio>

 

#define REDIRECT(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)

#define CLOSEALL() fclose(stdin), fclose(stdout)

 

using namespace std;

 

const int MAXN = 3e5 + 10;

 

int N;

pair <int, int> a[MAXN];

 

int main()

{

	//REDIRECT("sort");

 

	int cnt = 0;

	scanf("%d", &N);

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

		scanf("%d", &a[i].first), a[i].second = i;

	sort(&a[1], &a[N + 1]);

 

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

		if((a[i].second % 2) != (i % 2))

			cnt++;

 

	printf("%d\n", cnt / 2);

 

	CLOSEALL();

 

	return 0;

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

using namespace std;

using namespace __gnu_cxx;



int main(){

    int n;

    cin >> n;

    int arr[n];

    int ind = 0;

    while(ind < n)

        cin >> arr[ind++];

    int op1 = 0;

    vector<int> arr2;

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

        arr2.push_back(arr[i]);

    sort(arr2.begin(), arr2.end());

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

        auto bs = lower_bound(arr2.begin(), arr2.end(), arr[i]);



        int x = (bs - arr2.begin());

        if (i % 2 != x % 2)

            op1++;

    }

    cout << op1/2 << "\n";

}

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

#include <cstdio>

 

#define REDIRECT(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)

#define CLOSEALL() fclose(stdin), fclose(stdout)

 

using namespace std;

 

const int MAXN = 3e5 + 10;

 

int N;

pair <int, int> a[MAXN];

 

int main()

{

	//REDIRECT("sort");

 

	int cnt = 0;

	scanf("%d", &N);

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

		scanf("%d", &a[i].first), a[i].second = i;

	sort(&a[1], &a[N + 1]);

 

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

		if((a[i].second % 2) != (i % 2))

			cnt++;

 

	printf("%d\n", cnt / 2);

 

	CLOSEALL();

 

	return 0;

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

#define ll long long

using namespace std;

const ll M=1e5+100;

ll a[M] , b[M];

map<ll , bool> m;

int main()

{

    ll n , ans=0;

    cin>>n;

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

    {

        cin>>a[i];

        b[i]=a[i];

        if( i % 2 == 0)

        {

            m[a[i]]=true;

        }

    }

    sort( b , b+n );

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

    {

        if( i % 2 == 0 && m[b[i]] == false )

        {

            ans++;

        }

    }

    cout<<ans;

    return 0;

}


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

#include <cstdio>

 

#define REDIRECT(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)

#define CLOSEALL() fclose(stdin), fclose(stdout)

 

using namespace std;

 

const int MAXN = 3e5 + 10;

 

int N;

pair <int, int> a[MAXN];

 

int main()

{

	//REDIRECT("sort");

 

	int cnt = 0;

	scanf("%d", &N);

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

		scanf("%d", &a[i].first), a[i].second = i;

	sort(&a[1], &a[N + 1]);

 

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

		if((a[i].second % 2) != (i % 2))

			cnt++;

 

	printf("%d\n", cnt / 2);

 

	CLOSEALL();

 

	return 0;

}
// Slower C++ solution:
//In the name of God

#include<bits/stdc++.h>



using namespace std ;



const int N = (int)1e5 + 10 ;



int n ;

pair < int , int > a[N] ;



int32_t main() {

	cin >> n ;

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

		cin >> a[j].first ;

		a[j].second = j ; 

	}

	sort(a , a + n) ;

	int res = 0 ;

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

		(res += a[i].second % 2 != i % 2) ;

	cout << res << endl ; 

}


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

#include <cstdio>

 

#define REDIRECT(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)

#define CLOSEALL() fclose(stdin), fclose(stdout)

 

using namespace std;

 

const int MAXN = 3e5 + 10;

 

int N;

pair <int, int> a[MAXN];

 

int main()

{

	//REDIRECT("sort");

 

	int cnt = 0;

	scanf("%d", &N);

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

		scanf("%d", &a[i].first), a[i].second = i;

	sort(&a[1], &a[N + 1]);

 

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

		if((a[i].second % 2) != (i % 2))

			cnt++;

 

	printf("%d\n", cnt / 2);

 

	CLOSEALL();

 

	return 0;

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

#define F first

#define S second

#define PB push_back

#define LB lower_bound

#define UB upper_bound

#define SP fixed << setprecision(10)

#define ER(x) cout << #x << " = " << x << endl;



using namespace std;



typedef long long ll;

typedef pair <int , int> pii;

typedef double DB;



const int N = 100100;

pii a[N];



int main(){



	ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

	

	int n , t(0);

	cin >> n;



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

		cin >> a[i].F;

		a[i].S = i;

	}

	

	sort(a , a+n);



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

		if(a[i].S%2 != i%2){

			t++;

		}

	}



	cout << t/2 << endl;



	return 0;

}

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

#include <cstdio>

 

#define REDIRECT(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)

#define CLOSEALL() fclose(stdin), fclose(stdout)

 

using namespace std;

 

const int MAXN = 3e5 + 10;

 

int N;

pair <int, int> a[MAXN];

 

int main()

{

	//REDIRECT("sort");

 

	int cnt = 0;

	scanf("%d", &N);

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

		scanf("%d", &a[i].first), a[i].second = i;

	sort(&a[1], &a[N + 1]);

 

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

		if((a[i].second % 2) != (i % 2))

			cnt++;

 

	printf("%d\n", cnt / 2);

 

	CLOSEALL();

 

	return 0;

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

using namespace std;



const int N = 1e5 + 10;

int n, ans, u, d, ar[2][N], tmp[N];

map <int, bool> mp;



int main() {

	cin >> n;

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

		if (i & 1)

			cin >> ar[1][d], tmp[i] = ar[1][d++];

		else

			cin >> ar[0][u], tmp[i] = ar[0][u++];

	}

	sort(ar[0], ar[0] + u);

	sort(ar[1], ar[1] + d);

	sort(tmp, tmp + n);

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

		mp[tmp[i]] = (i & 1);

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

		if (i & 1) {

			if (mp[ar[1][i / 2]] != (i & 1))

				ans++;

		}

		else {

			if (mp[ar[0][i / 2]] != (i & 1))

				ans++;

		}

	}

	cout << (ans + 1) / 2;

}

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

#include <cstdio>

 

#define REDIRECT(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)

#define CLOSEALL() fclose(stdin), fclose(stdout)

 

using namespace std;

 

const int MAXN = 3e5 + 10;

 

int N;

pair <int, int> a[MAXN];

 

int main()

{

	//REDIRECT("sort");

 

	int cnt = 0;

	scanf("%d", &N);

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

		scanf("%d", &a[i].first), a[i].second = i;

	sort(&a[1], &a[N + 1]);

 

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

		if((a[i].second % 2) != (i % 2))

			cnt++;

 

	printf("%d\n", cnt / 2);

 

	CLOSEALL();

 

	return 0;

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

#define ll long long

#define MODV 1000000007

#define INFLL (1LL<<62) // 9223372036854775807

#define EPS 1e-9

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

#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)

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

#define endl "\n"

#define vi vector<ll>

#define vvi vector<vector<ll>>

#define Yes() cout << "Yes" << endl

#define YES() cout << "YES" << endl

#define No() cout << "No" << endl

#define NO() cout << "NO" << endl

template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }

template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }

using namespace std;



// 素因数分解：nの素因数分解を{素数, 指数}の形で昇順に返す。

ll primeFactorize(long long n){

    ll sum = 1;

    vector<pair<long long, long long>> ret;

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

        if(n%i != 0) continue;

        long long ex = 0;

        while(n%i == 0){ ex++; n /= i; }

        sum *= (ex+1);

    }

    if(n != 1) sum *= 2;

    return sum;

}



int main(){

    ll n;

    cin >> n;



    vector<bool> chkPrime(1000001, true);

    for(long long i=2; i<=1000001; i++){

        if(chkPrime[i]){

            for(long long j=2*i; j<=n; j+=i) chkPrime[j]=false;

        }

    }

    chkPrime[1] = false;

    vi isOK(n+1, 0);



    ll ans = 0;

    for(ll c=1; c<n; c++){

        ll tn = n-c, p = 1;

        if(chkPrime[tn]){

            ans += 2;

            continue;

        }

        ans += primeFactorize(tn);

    }

    cout << ans << endl;

    return 0;

}

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

#define ll long long

#define MODV 1000000007

#define INFLL (1LL<<62) // 9223372036854775807

#define EPS 1e-9

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

#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)

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

#define endl "\n"

#define vi vector<ll>

#define vvi vector<vector<ll>>

#define Yes() cout << "Yes" << endl

#define YES() cout << "YES" << endl

#define No() cout << "No" << endl

#define NO() cout << "NO" << endl

#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);

template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }

template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }

using namespace std;



int main(){

    Init();

    ll n;

    cin >> n;

    ll sum = 0;



    // a*b<nとなる正の整数(a,b)の組に対して、cは一意となる。

    // cが取りうる値は1~n-1である。

    // aを固定したとき、a*b<nを満たすようなbのとり方はfloor(n/a)通りある。

    // cは最小でも1以上必要なので、floor((n-1)/a)

    // aを1～n-1まで動かして和を取る。

    for(ll i=1; i<=n-1; i++) sum += (ll)floor((double)(n-1)/i);

    cout << sum << endl;

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

#include<vector>

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;



int cnt[27];

char s[100010];



int main()

{

	scanf("%s",s+1);

	int len=strlen(s+1);

	if(len==2)

	{

		if(s[1]==s[2])

		{

			puts("1 2");

		}

		else

		{

			puts("-1 -1");

		}

		return 0;

	}

	cnt[s[1]-'a']++;

	cnt[s[2]-'a']++;

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

	{

		cnt[s[i+2]-'a']++;

		for(int j=0;j<26;j++)

		{

			if(cnt[j]>=2)

			{

				return printf("%d %d",i,i+2),0;

			}

		}

		cnt[s[i]-'a']--;

	}

	puts("-1 -1");

}

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

#include<cstring>

const int MAXN=100005;



int n;

char str[MAXN];

int cnt[30];



int main()

{

	scanf("%s",str+1);

	n=strlen(str+1);

	if(n==2)

	{

		if(str[1]==str[2])

			puts("1 2");

		else

			puts("-1 -1");

		return 0;

	}

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

	{

		if(str[i]==str[i+1]||str[i]==str[i+2]||str[i+1]==str[i+2])

		{

			printf("%d %d\n",i,i+2);

			return 0;

		}

	}

	puts("-1 -1");

	

	return 0;

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

#define ft first

#define sc second

#define pt(sth) cout << sth << "\n"

#define moca(a, s, b) a=((a)s(b)+MOD)%MOD

using namespace std;

typedef long long ll;

typedef pair<ll, ll> pll;

template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}

template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}

static const ll INF=1e18;

static const ll MAX=101010;

static const ll MOD=1e9+7;





//for(i=0; i<N; i++) cin >> a[i];





int main(void) {

  ll i, j, k, l;

  

  ll N;

  cin >> N;

  ll a[MAX*2];

  ll cnt[66][66]={};

  pll f[MAX*2]={};

  

  map<double, ll> mp;

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

    double tt;

    cin >> tt;

    a[i]=llround(tt*1e9);

    

    ll t=a[i];

    ll c2=0, c5=0;

    while(t%2==0) {c2++; t/=2;}

    while(t%5==0) {c5++; t/=5;}

    cnt[c2][c5]++;

    f[i]={c2, c5};

  }

  

  

  ll ans=0;

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

    ll n2=max(18-f[i].ft, 0LL);

    ll n5=max(18-f[i].sc, 0LL);

    

    for(j=n2; j<66; j++) {

      for(k=n5; k<66; k++) {

        ans+=cnt[j][k];

      }

    }

    

    if(n2<=f[i].ft && n5<=f[i].sc) ans--;

  }

  ans/=2;

  pt(ans);

}


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

#define ft first

#define sc second

#define pt(sth) cout << sth << "\n"

#define moca(a, s, b) a=((a)s(b)+MOD)%MOD

using namespace std;

typedef long long ll;

typedef pair<ll, ll> pll;

template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}

template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}

static const ll INF=1e18;

static const ll MAX=101010;

static const ll MOD=1e9+7;





//for(i=0; i<N; i++) cin >> a[i];





int main(void) {

  ll i, j, k, l;

  

  ll N;

  cin >> N;

  ll a[MAX*2];

  ll cnt[22][22]={};

  

  map<double, ll> mp;

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

    double tt;

    cin >> tt;

    a[i]=llround(tt*1e9);

    

    ll t=a[i];

    ll c2=0, c5=0;

    while(t%2==0) {c2++; t/=2;}

    while(t%5==0) {c5++; t/=5;}

    cnt[min(18LL, c2)][min(18LL, c5)]++;

    

  }

  

  

  ll ans=0;

  for(i=0; i<22; i++) {

    for(j=0; j<22; j++) {

      for(k=0; k<22; k++) {

        for(l=0; l<22; l++) {

          if(i==k && j==l) continue;

          

          if(i+k>=18 && j+l>=18) {

            ans+=cnt[i][j]*cnt[k][l];

          }

        }

      }

    }

  }

  ans/=2;

  

  for(i=9; i<22; i++) {

    for(j=9; j<22; j++) {

      ans+=cnt[i][j]*(cnt[i][j]-1)/2;

    }

  }

  pt(ans);

  

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

using namespace std;

int main(){

	string s;

	cin>>s;

	int n=s.size();

	int ok=0;

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

		int j=n-i-1;

		if(s[i]=='q'&&s[j]=='p'){}

		else {

		    if(s[i]=='b'&&s[j]=='d'){}

		    else {

			if(s[i]=='d'&&s[j]=='b'){}

		          else {if(s[i]=='p'&&s[j]=='q'){}

		          else ok=1;

	              }

            }

        }

    }

	if(ok==0){

		cout<<"Yes"<<endl;return 0;

	}

	ok=0;

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

		if(s[i]=='p')s[i]=='q';

		if(s[i]=='q')s[i]=='p';

		if(s[i]=='b')s[i]=='d';

		if(s[i]=='d')s[i]=='b';

	}

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

		int j=n-i-1;

		if(s[i]=='q'&&s[j]=='p'){}

		else {

		    if(s[i]=='b'&&s[j]=='d'){}

		    else {

			if(s[i]=='d'&&s[j]=='b'){}

		          else {if(s[i]=='p'&&s[j]=='q'){}

		          else ok=1;

	              }

            }

        }

    }

    if(ok==0)cout<<"Yes"<<endl;

    else cout<<"No";

	return 0;

} 

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

#include<cstring>

using namespace std;

const int maxl=100010;

int l;

char str[maxl];

int main(){

	scanf("%s",&str);

	l=strlen(str);

	if(l%2!=0){

		printf("No\n");

		return 0;

	}

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

		if(str[i]=='b'&&str[l-i-1]!='d'){

			printf("No\n");

		    return 0;

		}

		if(str[i]=='d'&&str[l-i-1]!='b'){

		    printf("No\n");

		    return 0;

		}

		if(str[i]=='p'&&str[l-i-1]!='q'){

			printf("No\n");

		    return 0;

		}

		if(str[i]=='q'&&str[l-i-1]!='p'){

			printf("No\n");

		    return 0;

		}

	}

	printf("Yes\n");

	return 0;

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

#include<iostream>

#include<cstring>

#include<stack>

using namespace std;

stack<char>s;

string a;

int main(){

    cin>>a;

    int n=a.size();

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

        s.push(a[i]);

    }

    bool ju=1;

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

        char top=s.top();

        if(top=='b') top='d';

        else if(top=='d') top='b';

        else if(top=='p') top='q';

        else if(top=='q') top='p';

        if(top==a[i]) {

            ju=1;

            s.pop();

        }

        else {

            ju=0;

            break;

        }

    }

    if(ju==0) printf("No");

    else printf("Yes");

    return 0;

}

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

#include<cstring>

using namespace std;

const int maxl=100010;

int l;

char str[maxl];

int main(){

	scanf("%s",&str);

	l=strlen(str);

	if(l%2!=0){

		printf("No\n");

		return 0;

	}

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

		if(str[i]=='b'&&str[l-i-1]!='d'){

			printf("No\n");

		    return 0;

		}

		if(str[i]=='d'&&str[l-i-1]!='b'){

		    printf("No\n");

		    return 0;

		}

		if(str[i]=='p'&&str[l-i-1]!='q'){

			printf("No\n");

		    return 0;

		}

		if(str[i]=='q'&&str[l-i-1]!='p'){

			printf("No\n");

		    return 0;

		}

	}

	printf("Yes\n");

	return 0;

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

#include<cstdio>

#include<cstring>

#include<cmath>;

using namespace std;

string s;

int main(){

    cin>>s;

    int k=s.size();

    if(k%2!=0){

        printf("No");

        return 0;

    }

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

        int u=abs(s[i]-s[k-i-1]);

        if(u!=1&&u!=2){

            printf("No");

            return 0;

        }

    }

    printf("Yes");

    return 0;

}

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

#include<cstring>

using namespace std;

const int maxl=100010;

int l;

char str[maxl];

int main(){

	scanf("%s",&str);

	l=strlen(str);

	if(l%2!=0){

		printf("No\n");

		return 0;

	}

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

		if(str[i]=='b'&&str[l-i-1]!='d'){

			printf("No\n");

		    return 0;

		}

		if(str[i]=='d'&&str[l-i-1]!='b'){

		    printf("No\n");

		    return 0;

		}

		if(str[i]=='p'&&str[l-i-1]!='q'){

			printf("No\n");

		    return 0;

		}

		if(str[i]=='q'&&str[l-i-1]!='p'){

			printf("No\n");

		    return 0;

		}

	}

	printf("Yes\n");

	return 0;

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

using namespace std;

int main(){

	string s;

	cin>>s;

	int n=s.size();

	int ok=0;

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

		int j=n-i-1;

		if(s[i]=='q'&&s[j]=='p'){}

		else {

		    if(s[i]=='b'&&s[j]=='d'){}

		    else {

			if(s[i]=='d'&&s[j]=='b'){}

		          else {if(s[i]=='p'&&s[j]=='q'){}

		          else ok=1;

	              }

            }

        }

    }

	if(ok==0){

		cout<<"Yes"<<endl;return 0;

	}

	ok=0;

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

		if(s[i]=='p')s[i]=='q';

		if(s[i]=='q')s[i]=='p';

		if(s[i]=='b')s[i]=='d';

		if(s[i]=='d')s[i]=='b';

	}

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

		int j=n-i-1;

		if(s[i]=='q'&&s[j]=='p'){}

		else {

		    if(s[i]=='b'&&s[j]=='d'){}

		    else {

			if(s[i]=='d'&&s[j]=='b'){}

		          else {if(s[i]=='p'&&s[j]=='q'){}

		          else ok=1;

	              }

            }

        }

    }

    if(ok==0)cout<<"Yes"<<endl;

    else cout<<"No";

	return 0;

} 

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

#include<cstring>

using namespace std;

int len;

char str1[100001],str2[100001];

int main()

{

	scanf("%s",str1);

	strcpy(str2,str1);

	len=strlen(str1);

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

		str2[len-i-1]=str1[i];

	if(strcmp(str1,str2)==0)

	{

		printf("Yes");

		return 0;

	}

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

		switch(str2[i])

		{

			case 'b':str2[i]='d';break;

			case 'd':str2[i]='b';break;

			case 'p':str2[i]='q';break;

			case 'q':str2[i]='p';break;

		}

	if(strcmp(str1,str2)==0)

		printf("Yes");

	else

		printf("No");

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

#include<iostream>

#include<cstring>

#include<stack>

using namespace std;

stack<char>s;

string a;

int main(){

    cin>>a;

    int n=a.size();

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

        s.push(a[i]);

    }

    bool ju=1;

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

        char top=s.top();

        if(top=='b') top='d';

        else if(top=='d') top='b';

        else if(top=='p') top='q';

        else if(top=='q') top='p';

        if(top==a[i]) {

            ju=1;

            s.pop();

        }

        else {

            ju=0;

            break;

        }

    }

    if(ju==0) printf("No");

    else printf("Yes");

    return 0;

}

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

#include<cstring>

using namespace std;

int len;

char str1[100001],str2[100001];

int main()

{

	scanf("%s",str1);

	strcpy(str2,str1);

	len=strlen(str1);

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

		str2[len-i-1]=str1[i];

	if(strcmp(str1,str2)==0)

	{

		printf("Yes");

		return 0;

	}

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

		switch(str2[i])

		{

			case 'b':str2[i]='d';break;

			case 'd':str2[i]='b';break;

			case 'p':str2[i]='q';break;

			case 'q':str2[i]='p';break;

		}

	if(strcmp(str1,str2)==0)

		printf("Yes");

	else

		printf("No");

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

#include<cstdio>

#include<cstring>

#include<cmath>;

using namespace std;

string s;

int main(){

    cin>>s;

    int k=s.size();

    if(k%2!=0){

        printf("No");

        return 0;

    }

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

        int u=abs(s[i]-s[k-i-1]);

        if(u!=1&&u!=2){

            printf("No");

            return 0;

        }

    }

    printf("Yes");

    return 0;

}

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

#include<cstring>

using namespace std;

int len;

char str1[100001],str2[100001];

int main()

{

	scanf("%s",str1);

	strcpy(str2,str1);

	len=strlen(str1);

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

		str2[len-i-1]=str1[i];

	if(strcmp(str1,str2)==0)

	{

		printf("Yes");

		return 0;

	}

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

		switch(str2[i])

		{

			case 'b':str2[i]='d';break;

			case 'd':str2[i]='b';break;

			case 'p':str2[i]='q';break;

			case 'q':str2[i]='p';break;

		}

	if(strcmp(str1,str2)==0)

		printf("Yes");

	else

		printf("No");

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

using namespace std;

stack<char>m;

string a;

int main()

{

    cin>>a;

    int n=a.size();

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

      m.push(a[i]);

    bool j=1;

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

	{

        char top=m.top();

        if (top=='b')

		  top='d';

        else if (top=='d')

		  top='b';

        else if (top=='p')

		  top='q';

        else if (top=='q')

		  top='p';

        if (top==a[i])

		{

            j=1;

            m.pop();

        }

        else

		{

            j=0;

            break;

        }

    }

    if(j==0)

      cout<<"No"<<endl;

    else

      cout<<"Yes"<<endl;

    return 0;

}

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

#include<cstring>

using namespace std;

int len;

char str1[100001],str2[100001];

int main()

{

	scanf("%s",str1);

	strcpy(str2,str1);

	len=strlen(str1);

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

		str2[len-i-1]=str1[i];

	if(strcmp(str1,str2)==0)

	{

		printf("Yes");

		return 0;

	}

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

		switch(str2[i])

		{

			case 'b':str2[i]='d';break;

			case 'd':str2[i]='b';break;

			case 'p':str2[i]='q';break;

			case 'q':str2[i]='p';break;

		}

	if(strcmp(str1,str2)==0)

		printf("Yes");

	else

		printf("No");

}