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

using namespace std;

int main()

{char a[100005];int n,i;

scanf("%s",a);

n=strlen(a);

if(n%2==1)

  {cout<<"No"<<endl;

  return 0;

  }

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

  if((a[i]==a[n-i-1])||(a[i]=='q'&&a[n-i-1]=='d')||(a[i]=='q'&&a[n-i-1]=='b')||(a[i]=='p'&&a[n-i-1]=='d')||(a[i]=='p'&&a[n-i-1]=='b'))

    {cout<<"No"<<endl;

    return 0;

	}

cout<<"Yes"<<endl;

return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.266842569867014x):
#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<string>

#include<cmath>;

using namespace std;

string s;

int main(){

    cin>>s;

    int k=s.size();

    if(k%2!=0){

        cout<<"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){

            cout<<"No"; 

            return 0;

        }

    }

    cout<<"Yes";

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.292572924859918x):
#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> 

using namespace std;

char a[100007],b[100007];

int main()

{

	scanf("%s",a);

	int len=strlen(a);

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

		{

			b[i]=a[len-i-1];

			b[len-i-1]=a[i];

		}

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

		{

			if(b[i]=='b')

				{

				b[i]='d';

				continue;

				}

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

				{

				b[i]='b';

				continue;

				}

			if(b[i]=='p')

					{

				b[i]='q';

				continue;

				}

			if(b[i]=='q')

				{

				b[i]='p';

				continue;

				}

		}

	int k=0;

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

		{

			if(a[i]==b[i])

				continue;

			else

				{

					k=1;

					break;

				}

		}

	if(k==0)

		cout<<"Yes";

	else

		cout<<"No";

}

// Faster C++ solution for the same problem (measured speedup: 5.2530335253529525x):
#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;

string s1;

int len;

stack<char> x;

int main()

{

	cin>>s1;

	len=s1.size();

	if(len%2!=0)

	{cout<<"No";return 0;}

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

	{

		x.push(s1[i]);

	}

	int flag=1;

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

	{

		char k=x.top();

		x.pop();

		{

			if(k=='b')

			k='d';

			else

			if(k=='d')

			k='b';

			else if(k=='p')

			k='q';

			else if(k=='q')

			k='p';

			if(k!=s1[i])

			{flag=0;break;}

		}

	}

	if(flag)

	cout<<"Yes";

	else

	cout<<"No";

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.339900502295305x):
#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;

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.316217361062162x):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),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.355902976292039x):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),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.2651095685959985x):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}
// 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.384380867690721x):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

using namespace std;

int main()

{char a[100005];int n,i;

scanf("%s",a);

n=strlen(a);

if(n%2==1)

  {cout<<"No"<<endl;

  return 0;

  }

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

  if((a[i]==a[n-i-1])||(a[i]=='q'&&a[n-i-1]=='d')||(a[i]=='q'&&a[n-i-1]=='b')||(a[i]=='p'&&a[n-i-1]=='d')||(a[i]=='p'&&a[n-i-1]=='b'))

    {cout<<"No"<<endl;

    return 0;

	}

cout<<"Yes"<<endl;

return 0;

}

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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

#include<string>

#include<cmath>;

using namespace std;

string s;

int main(){

    cin>>s;

    int k=s.size();

    if(k%2!=0){

        cout<<"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){

            cout<<"No"; 

            return 0;

        }

    }

    cout<<"Yes";

    return 0;

}

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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

#include<cstdio>

#include<cstring> 

using namespace std;

char a[100007],b[100007];

int main()

{

	scanf("%s",a);

	int len=strlen(a);

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

		{

			b[i]=a[len-i-1];

			b[len-i-1]=a[i];

		}

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

		{

			if(b[i]=='b')

				{

				b[i]='d';

				continue;

				}

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

				{

				b[i]='b';

				continue;

				}

			if(b[i]=='p')

					{

				b[i]='q';

				continue;

				}

			if(b[i]=='q')

				{

				b[i]='p';

				continue;

				}

		}

	int k=0;

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

		{

			if(a[i]==b[i])

				continue;

			else

				{

					k=1;

					break;

				}

		}

	if(k==0)

		cout<<"Yes";

	else

		cout<<"No";

}

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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

using namespace std;

string s1;

int len;

stack<char> x;

int main()

{

	cin>>s1;

	len=s1.size();

	if(len%2!=0)

	{cout<<"No";return 0;}

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

	{

		x.push(s1[i]);

	}

	int flag=1;

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

	{

		char k=x.top();

		x.pop();

		{

			if(k=='b')

			k='d';

			else

			if(k=='d')

			k='b';

			else if(k=='p')

			k='q';

			else if(k=='q')

			k='p';

			if(k!=s1[i])

			{flag=0;break;}

		}

	}

	if(flag)

	cout<<"Yes";

	else

	cout<<"No";

	return 0;

}

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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

#include <iostream>

#include <string>



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



int len;

std::string a, b;



int main()

{

    std::cin >> a;

    b = a;

    len = a.length();

    std::reverse(a.begin(), a.end());

    Rep(i, 0, len)

    {

        if (a[i] == 'b')

            a[i] = 'd';

        else if (a[i] == 'd')

            a[i] = 'b';

        else if (a[i] == 'p')

            a[i] = 'q';

        else if (a[i] == 'q')

            a[i] = 'p';

    }

    if (a == b)

        std::cout << "Yes";

    else

        std::cout << "No";

    return 0;

}

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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

#include<string>

using namespace std;

string s;

int main()

{

	cin>>s;

	string s1=s;

	int n=s.length();

	if(n%2){cout<<"No";return 0;}

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

	{		

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

		else if(s1[i]=='d')s1[i]='b';

		else if(s1[i]=='q')s1[i]='p';

		else if(s1[i]=='p')s1[i]='q';

		if(s1[n-i-1]=='b')s1[n-i-1]='d';

		else if(s1[n-i-1]=='d')s1[n-i-1]='b';

		else if(s1[n-i-1]=='q')s1[n-i-1]='p';

		else if(s1[n-i-1]=='p')s1[n-i-1]='q';

		char t=s1[i];s1[i]=s1[n-i-1];s1[n-i-1]=t;

	}

//	cout<<s1<<endl<<s;

	if(s1==s)cout<<"Yes";

	else cout<<"No";

	return 0;

}


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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

using namespace std;

char s[100010],s1[100010];

int main()

{

    cin>>s;

    int l=strlen(s);

    if(l&1)

    {

    	cout<<"No";

    	return 0;

	}

    for(int i=0;i<l;i++)s1[i]=s[l-i-1];

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

    {

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

        else if(s1[i]=='d')s1[i]='b';

        else if(s1[i]=='p')s1[i]='q';

        else s1[i]='p';

    }

    if(!strcmp(s1,s))cout<<"Yes";

    else cout<<"No";

    return 0;

}

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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#define rep(i,a,b,k) for(register ll i=a;i<=b;i+=k)

#define drep(i,a,b,k) for(register ll i=a;i>=b;i-=k)

#define ll long long

#define mod 1000000007

using namespace std;

char a[100005];

int len;

bool flag=1;

int main()

{

	cin>>a;

	len=strlen(a)-1;

	if(!(len&1))

		puts("No"),exit(0);

	for(int i=0,j=len;i<j;i++,j--)

	{

		if((a[i]=='p'&&a[j]=='q')||(a[i]=='q'&&a[j]=='p')||(a[i]=='d'&&a[j]=='b')||(a[i]=='b'&&a[j]=='d'));

		else

		{

			flag=0;

			break;

		}

	}

	if(flag)

		puts("Yes"),exit(0);

	puts("No");

	return 0;

}

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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

using namespace std;

int main(){

    string a;

    cin>>a;

    string b=a;

    reverse(a.begin(),a.end());

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

    {

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

        else if(a[i]=='d') a[i]='b';

        else if(a[i]=='p') a[i]='q';

        else if(a[i]=='q') a[i]='p';

    }

    if(a==b) cout<<"Yes";

    else cout<<"No";

}

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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

# include <cstring>

# include <algorithm>

# include <string>

# include <iostream>

using namespace std;

int main()

{

	string a;

	cin>>a;

	string a1=a;

	reverse(a.begin(),a.end());

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

	{

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

		else if(a[i]=='p') a[i]='q';

		else if(a[i]=='b') a[i]='d';

		else if(a[i]=='d') a[i]='b';

	}

	if(a==a1) printf("Yes\n");

	else printf("No\n");

	return 0;

}

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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

#include<cstdio>

#include<iostream>

#include<cmath>

#include<algorithm>

#include<iomanip>

using namespace std;

string s;

int main(){

	getline(cin,s);

	int n=s.size();

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

		if(s[i]=='p'&&s[n-i-1]=='q') continue;

		if(s[i]=='q'&&s[n-i-1]=='p') continue;

		if(s[i]=='b'&&s[n-i-1]=='d') continue;

		if(s[i]=='d'&&s[n-i-1]=='b') continue;

		cout<<"No";

		return 0;

	}

	cout<<"Yes";

	return 0;

} 

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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

using namespace std;



int main() {

	string s1; cin >> s1;

	string s2 = s1;

	reverse(s2.begin(), s2.end());

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

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

		else if(s2[i] == 'd') s2[i] = 'b';

		else if(s2[i] == 'p') s2[i] = 'q';

		else if(s2[i] == 'q') s2[i] = 'p';

	if(s1 == s2) cout << "Yes" << endl;

	else cout << "No" << endl;

	return 0;

}

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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

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

using namespace std;

long long n,m,i,j,sum,ans;

string a,b,c;

int main()

{

    cin>>a;

    for(i=0;i<a.size();i++) 

	   b=a[i]+b;

    for(i=0;i<a.size();i++)

    {

        if(a[i]=='b')

          a[i]='d';

    	else

          if(a[i]=='d')

            a[i]='b';

          else

            if(a[i]=='p')

              a[i]='q';

            else 

              if(a[i]=='q')

                a[i]='p';      

    }

    if(a==b)

    {

        cout<<"Yes";

    }

    else

        cout<<"No";

    return 0;

}

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

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}