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

#include<algorithm>

#include<math.h>

#include<string>

#include<iostream>

#include<vector>

#include<cstdlib>

using namespace std;

 

template <class T> using V = vector<T>;

 

template<class T> inline bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}

template<class T> inline bool chmax(T& a, T b) {

    if (a < b) {

        a = b;

        return true;

    }

    return false;

}

 

const long long INF = 1LL << 60;

 

using ll = long long;

using db = double;

using st = string;

using ch = char;

using bl = bool;

using vll = V<ll>;

using vpll =V<pair<ll,ll>>;

using vst = V<st>;

using vdb = V<db>;

using vch = V<ch>;

using vbl = V<bl>;

 

 

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

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

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

#define bgn begin()

#define en end()

#define SORT(a) sort((a).bgn,(a).en)

#define REV(a) reverse((a).bgn,(a).en)

#define M(a,b) max(a,b)

#define rM(a,b) min(a,b)

#define fi first

#define se second

#define sz size()

#define gcd(a,b) __gcd(a,b)

#define co(a) cout<<a<<endl;

#define ci(a) cin>>a;

 



vll dp(100100);



ll sum(ll n) {

ll m=0;

  FOR(i,0,20){

    m+=n%10;

    n/=10;

    if(n==0){

      break;

    }

  }

  return m;

}

 

 

const int MAX = 510000;

const int MOD = 1000000007;

 

long long fac[MAX], finv[MAX], inv[MAX];

 

void Comuse() {

    fac[0] = fac[1] = 1;

    finv[0] = finv[1] = 1;

    inv[1] = 1;

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

        fac[i] = fac[i - 1] * i % MOD;

        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;

        finv[i] = finv[i - 1] * inv[i] % MOD;

    }

}

 

 

#define comuse Comuse()

 

ll combi(int n, int k){

    if (n < k) return 0;

    if (n < 0 || k < 0) return 0;

    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;

}

 

 

 

 

ll lcm(ll a,ll b){

  ll n;

  n=a/gcd(a,b)*b;

  return n;

}





 

/****************************************\

| Thank you for viewing my code:)        |

| Written by RedSpica a.k.a. RanseMirage |

| Twitter:@asakaakasaka                  | 

\****************************************/

 

 

signed main() {

  ll n,k;

    ci(n>>k);

  st s;

    ci(s);



  ll count=1;

  FOR(i,1,n-1){

    if(s[i]!=s[i-1]){

      count++;

    }

  }



  if(s[n-1]!=s[n-2]){

    count++;

  }



  ll ans=n-count+2*k;



  co(min(n-1,ans))

  }

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

using namespace std;

 

int main() {

  int N,K,A=0;

  string S;

  cin >> N >> K >> S;

  int count=1;

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

    if(S[i] != S[i-1]){

      count ++;

    }

  }

  cout <<N+min(-1,-count+2*K)<<endl;

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

#include<algorithm>

#include<math.h>

#include<string>

#include<iostream>

#include<vector>

#include<cstdlib>

using namespace std;

 

template <class T> using V = vector<T>;

 

template<class T> inline bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}

template<class T> inline bool chmax(T& a, T b) {

    if (a < b) {

        a = b;

        return true;

    }

    return false;

}

 

const long long INF = 1LL << 60;

 

using ll = long long;

using db = double;

using st = string;

using ch = char;

using bl = bool;

using vll = V<ll>;

using vpll =V<pair<ll,ll>>;

using vst = V<st>;

using vdb = V<db>;

using vch = V<ch>;

using vbl = V<bl>;

 

 

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

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

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

#define bgn begin()

#define en end()

#define SORT(a) sort((a).bgn,(a).en)

#define REV(a) reverse((a).bgn,(a).en)

#define M(a,b) max(a,b)

#define rM(a,b) min(a,b)

#define fi first

#define se second

#define sz size()

#define gcd(a,b) __gcd(a,b)

#define co(a) cout<<a<<endl;

#define ci(a) cin>>a;

 



vll dp(100100);



ll sum(ll n) {

ll m=0;

  FOR(i,0,20){

    m+=n%10;

    n/=10;

    if(n==0){

      break;

    }

  }

  return m;

}

 

 

const int MAX = 510000;

const int MOD = 1000000007;

 

long long fac[MAX], finv[MAX], inv[MAX];

 

void Comuse() {

    fac[0] = fac[1] = 1;

    finv[0] = finv[1] = 1;

    inv[1] = 1;

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

        fac[i] = fac[i - 1] * i % MOD;

        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;

        finv[i] = finv[i - 1] * inv[i] % MOD;

    }

}

 

 

#define comuse Comuse()

 

ll combi(int n, int k){

    if (n < k) return 0;

    if (n < 0 || k < 0) return 0;

    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;

}

 

 

 

 

ll lcm(ll a,ll b){

  ll n;

  n=a/gcd(a,b)*b;

  return n;

}





 

/****************************************\

| Thank you for viewing my code:)        |

| Written by RedSpica a.k.a. RanseMirage |

| Twitter:@asakaakasaka                  | 

\****************************************/

 

 

signed main() {

  ll n,k;

    ci(n>>k);

  st s;

    ci(s);

  vll A;

  ll count=1;

  FOR(i,1,n-1){

    if(s[i]!=s[i-1]){

      A.push_back(count);

      count=1;

    }

    else{

      count++;

    }

  }



  if(s[n-1]!=s[n-2]){

    A.push_back(count);

    A.push_back(1);

  }

  else{

    A.push_back(count+1);

  }



  ll a=A.sz;

  ll ans=0;

  FOR(i,0,a){

    ans+=A[i]-1;

  }

  ans+=2*k; 

  co(min(n-1,ans))

  }


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

using namespace std;

 

int main() {

  int N,K;

  string S;

  cin >> N >> K >> S;

  int count=1;

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

    if(S[i] != S[i-1]){

      count ++;

    }

  }

  cout <<N+min(-1,-count+2*K)<<endl;

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

#include<algorithm>

#include<math.h>

#include<string>

#include<iostream>

#include<vector>

#include<cstdlib>

using namespace std;

 

template <class T> using V = vector<T>;

 

template<class T> inline bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}

template<class T> inline bool chmax(T& a, T b) {

    if (a < b) {

        a = b;

        return true;

    }

    return false;

}

 

const long long INF = 1LL << 60;

 

using ll = long long;

using db = double;

using st = string;

using ch = char;

using bl = bool;

using vll = V<ll>;

using vpll =V<pair<ll,ll>>;

using vst = V<st>;

using vdb = V<db>;

using vch = V<ch>;

using vbl = V<bl>;

 

 

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

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

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

#define bgn begin()

#define en end()

#define SORT(a) sort((a).bgn,(a).en)

#define REV(a) reverse((a).bgn,(a).en)

#define M(a,b) max(a,b)

#define rM(a,b) min(a,b)

#define fi first

#define se second

#define sz size()

#define gcd(a,b) __gcd(a,b)

#define co(a) cout<<a<<endl;

#define ci(a) cin>>a;

 



vll dp(100100);



ll sum(ll n) {

ll m=0;

  FOR(i,0,20){

    m+=n%10;

    n/=10;

    if(n==0){

      break;

    }

  }

  return m;

}

 

 

const int MAX = 510000;

const int MOD = 1000000007;

 

long long fac[MAX], finv[MAX], inv[MAX];

 

void Comuse() {

    fac[0] = fac[1] = 1;

    finv[0] = finv[1] = 1;

    inv[1] = 1;

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

        fac[i] = fac[i - 1] * i % MOD;

        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;

        finv[i] = finv[i - 1] * inv[i] % MOD;

    }

}

 

 

#define comuse Comuse()

 

ll combi(int n, int k){

    if (n < k) return 0;

    if (n < 0 || k < 0) return 0;

    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;

}

 

 

 

 

ll lcm(ll a,ll b){

  ll n;

  n=a/gcd(a,b)*b;

  return n;

}





 

/****************************************\

| Thank you for viewing my code:)        |

| Written by RedSpica a.k.a. RanseMirage |

| Twitter:@asakaakasaka                  | 

\****************************************/

 

 

signed main() {

  ll n,k;

    ci(n>>k);

  st s;

    ci(s);



  ll count=1;

  FOR(i,1,n-1){

    if(s[i]!=s[i-1]){

      count++;

    }

  }



  if(s[n-1]!=s[n-2]){

    count++;

  }



  ll ans=n-count+2*k;



  co(min(n-1,ans))

  }

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

using namespace std;

 

int main() {

  int N,K;

  string S;

  cin >> N >> K >> S;

  int count=1;

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

    if(S[i] != S[i-1]){

      count ++;

    }

  }

  cout <<N+min(-1,-count+2*K)<<endl;

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

#include<algorithm>

#include<math.h>

#include<string>

#include<iostream>

#include<vector>

#include<cstdlib>

using namespace std;

 

template <class T> using V = vector<T>;

 

template<class T> inline bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}

template<class T> inline bool chmax(T& a, T b) {

    if (a < b) {

        a = b;

        return true;

    }

    return false;

}

 

const long long INF = 1LL << 60;

 

using ll = long long;

using db = double;

using st = string;

using ch = char;

using bl = bool;

using vll = V<ll>;

using vpll =V<pair<ll,ll>>;

using vst = V<st>;

using vdb = V<db>;

using vch = V<ch>;

using vbl = V<bl>;

 

 

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

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

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

#define bgn begin()

#define en end()

#define SORT(a) sort((a).bgn,(a).en)

#define REV(a) reverse((a).bgn,(a).en)

#define M(a,b) max(a,b)

#define rM(a,b) min(a,b)

#define fi first

#define se second

#define sz size()

#define gcd(a,b) __gcd(a,b)

#define co(a) cout<<a<<endl;

#define ci(a) cin>>a;

 



vll dp(100100);



ll sum(ll n) {

ll m=0;

  FOR(i,0,20){

    m+=n%10;

    n/=10;

    if(n==0){

      break;

    }

  }

  return m;

}

 

 

const int MAX = 510000;

const int MOD = 1000000007;

 

long long fac[MAX], finv[MAX], inv[MAX];

 

void Comuse() {

    fac[0] = fac[1] = 1;

    finv[0] = finv[1] = 1;

    inv[1] = 1;

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

        fac[i] = fac[i - 1] * i % MOD;

        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;

        finv[i] = finv[i - 1] * inv[i] % MOD;

    }

}

 

 

#define comuse Comuse()

 

ll combi(int n, int k){

    if (n < k) return 0;

    if (n < 0 || k < 0) return 0;

    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;

}

 

 

 

 

ll lcm(ll a,ll b){

  ll n;

  n=a/gcd(a,b)*b;

  return n;

}





 

/****************************************\

| Thank you for viewing my code:)        |

| Written by RedSpica a.k.a. RanseMirage |

| Twitter:@asakaakasaka                  | 

\****************************************/

 

 

signed main() {

  ll n,k;

    ci(n>>k);

  st s;

    ci(s);

  vll A;

  ll count=1;

  FOR(i,1,n-1){

    if(s[i]!=s[i-1]){

      A.push_back(count);

      count=1;

    }

    else{

      count++;

    }

  }



  if(s[n-1]!=s[n-2]){

    A.push_back(count);

    A.push_back(1);

  }

  else{

    A.push_back(count+1);

  }



  ll a=A.sz;

  ll ans=0;

  FOR(i,0,a){

    ans+=A[i]-1;

  }

  ans+=2*k; 

  co(min(n-1,ans))

  }


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

using namespace std;

 

int main() {

  int N,K;

  string S;

  cin >> N >> K >> S;

  int count=1;

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

    if(S[i] != S[i-1]) count ++;

  }

  cout <<N+min(-1,-count+2*K)<<endl;

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

#include<algorithm>

#include<math.h>

#include<string>

#include<iostream>

#include<vector>

#include<cstdlib>

using namespace std;

 

template <class T> using V = vector<T>;

 

template<class T> inline bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}

template<class T> inline bool chmax(T& a, T b) {

    if (a < b) {

        a = b;

        return true;

    }

    return false;

}

 

const long long INF = 1LL << 60;

 

using ll = long long;

using db = double;

using st = string;

using ch = char;

using bl = bool;

using vll = V<ll>;

using vpll =V<pair<ll,ll>>;

using vst = V<st>;

using vdb = V<db>;

using vch = V<ch>;

using vbl = V<bl>;

 

 

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

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

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

#define bgn begin()

#define en end()

#define SORT(a) sort((a).bgn,(a).en)

#define REV(a) reverse((a).bgn,(a).en)

#define M(a,b) max(a,b)

#define rM(a,b) min(a,b)

#define fi first

#define se second

#define sz size()

#define gcd(a,b) __gcd(a,b)

#define co(a) cout<<a<<endl;

#define ci(a) cin>>a;

 



vll dp(100100);



ll sum(ll n) {

ll m=0;

  FOR(i,0,20){

    m+=n%10;

    n/=10;

    if(n==0){

      break;

    }

  }

  return m;

}

 

 

const int MAX = 510000;

const int MOD = 1000000007;

 

long long fac[MAX], finv[MAX], inv[MAX];

 

void Comuse() {

    fac[0] = fac[1] = 1;

    finv[0] = finv[1] = 1;

    inv[1] = 1;

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

        fac[i] = fac[i - 1] * i % MOD;

        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;

        finv[i] = finv[i - 1] * inv[i] % MOD;

    }

}

 

 

#define comuse Comuse()

 

ll combi(int n, int k){

    if (n < k) return 0;

    if (n < 0 || k < 0) return 0;

    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;

}

 

 

 

 

ll lcm(ll a,ll b){

  ll n;

  n=a/gcd(a,b)*b;

  return n;

}





 

/****************************************\

| Thank you for viewing my code:)        |

| Written by RedSpica a.k.a. RanseMirage |

| Twitter:@asakaakasaka                  | 

\****************************************/

 

 

signed main() {

  ll n,k;

    ci(n>>k);

  st s;

    ci(s);



  ll count=1;

  FOR(i,1,n-1){

    if(s[i]!=s[i-1]){

      count++;

    }

  }



  if(s[n-1]!=s[n-2]){

    count++;

  }



  ll ans=n-count+2*k;



  co(min(n-1,ans))

  }

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

using namespace std;

 

int main() {

  int N,K;

  string S;

  cin >> N >> K >> S;

  int count=1;

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

    if(S[i] != S[i-1]) count ++;

  }

  cout <<N+min(-1,-count+2*K)<<endl;

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



using namespace std;



#define ll long long



const int INF = 1e9+9999;



int main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    int n, k, arr=0;

    string s;

    cin >> n >> k >> s;

    s.push_back('W');

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

        if (s[i] != s[i+1])

            ++arr;

    int ans = n - arr;

    while (k && arr) {

        if (arr == 2)

            ++ans, ++arr;

        else

            ans+=2;

        --k;

        arr-=2;

    }

    cout << min(ans, n-1);

}


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

#include <algorithm>



using std::min;



const int MAXN=100005;



int main()

{

    int N,K,diffs=0;

    char str[MAXN];



    scanf("%d%d%s",&N,&K,str);



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

        if (str[i]!=str[i-1]) diffs++;

    printf("%d",min(N-1-diffs+2*K,N-1));



    return 0;

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

using namespace std;

int a[100100];

int main()

{

	int n,k;

	int i,j;

	cin>>n>>k;

	int t=1;

	getchar();

	while(t<=n){

		char x;

		x=getchar();

		if(x=='L') a[t]=1;

		else if(x=='R')a[t]=2;

		t++;

	}

	int pre=a[1];

	int cnt=1;

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

		if(a[i]==pre) continue;

		else if(a[i]!=pre&&i!=n){

			pre=a[i];

			cnt++;

		}

		else cnt+=1;

	}

	cnt-=k*2;

	if(cnt<=0)cout<<n-1<<endl;

	else cout<<n-cnt<<endl;

} 

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

#include <algorithm>



using std::min;



const int MAXN=100005;



int main()

{

    int N,K,diffs=0;

    char str[MAXN];



    scanf("%d%d%s",&N,&K,str);



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

        if (str[i]!=str[i-1]) diffs++;

    printf("%d",min(N-1-diffs+2*K,N-1));



    return 0;

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

using namespace std;

int main(){

	ios::sync_with_stdio(0);

	string str;

	string tmp;

	while(cin>>str){

		cin>>tmp;

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

		if(str==tmp) cout<<"YES"<<endl;

		else cout<<"NO"<<endl;

	}

}

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

#include <cstdlib>

#include <cstring>

using namespace std;

int main()

{

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

        int i,j;

         memset(a,0,sizeof(a));

        memset(b,0,sizeof(b));

        memset(c,0,sizeof(c));

        scanf("%s",&a);

        scanf("%s",&b);

        int len=strlen(b);

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

        {

            c[i]=b[j];

        }

        if(strcmp(a,c)==0)

            printf("YES\n");

        else

            printf("NO\n");

  return 0;

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

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <string>

#include <cmath>

#include <map>

#include <set>

#include <vector>

#include <iterator>

#include <list>

#include <stack>

#include <queue>

#include <cstdlib>

using namespace std;



int main()

{

    string a,b,c;

    cin >> a >> b;

    int flag = 0;

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

    {

        if(a[i] != b[2-i])

        {

            flag = 1;

            break;

        }

    }

    if(flag == 0) cout << "YES" << endl;

    else cout << "NO" << endl;

    return 0;

}


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

#include <cstdlib>

#include <cstring>

using namespace std;

int main()

{

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

        int i,j;

         memset(a,0,sizeof(a));

        memset(b,0,sizeof(b));

        memset(c,0,sizeof(c));

        scanf("%s",&a);

        scanf("%s",&b);

        int len=strlen(b);

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

        {

            c[i]=b[j];

        }

        if(strcmp(a,c)==0)

            printf("YES\n");

        else

            printf("NO\n");

  return 0;

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

#include <queue>

#include <cstdio>

#include <cstdlib>

#include <algorithm>

#include <cstring>

using namespace std;

char a[10][10];

int main()

{

    int f=0;

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

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

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

    {

        if(a[1][i]==a[2][2-i])

        {

            f=1;

        }

        else

        {

            f=0;

            break;

        }

    }

    if(f==1)

        printf("YES\n");

    else

    {

        printf("NO\n");

    }

    return 0;

}




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

#include <cstdlib>

#include <cstring>

using namespace std;

int main()

{

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

        int i,j;

         memset(a,0,sizeof(a));

        memset(b,0,sizeof(b));

        memset(c,0,sizeof(c));

        scanf("%s",&a);

        scanf("%s",&b);

        int len=strlen(b);

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

        {

            c[i]=b[j];

        }

        if(strcmp(a,c)==0)

            printf("YES\n");

        else

            printf("NO\n");

  return 0;

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

using namespace std;

int main(){

	ios::sync_with_stdio(0);

	string str;

	string tmp;

	while(cin>>str){

		cin>>tmp;

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

		if(str==tmp) cout<<"YES"<<endl;

		else cout<<"NO"<<endl;

	}

}

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



int main(){

	

	char board[5][5];

	

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

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

			scanf("%c",&board[i][j]);

		}

		getchar();

	}

	

	if(board[0][0] == board[1][2] && board[1][0] == board[0][2] && board[0][1] == board[1][1]){

		printf("YES\n");

	}else{

		printf("NO\n");

	}

	

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

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <string>

#include <cmath>

#include <map>

#include <set>

#include <vector>

#include <iterator>

#include <list>

#include <stack>

#include <queue>

#include <cstdlib>

using namespace std;



int main()

{

    string a,b,c;

    cin >> a >> b;

    int flag = 0;

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

    {

        if(a[i] != b[2-i])

        {

            flag = 1;

            break;

        }

    }

    if(flag == 0) cout << "YES" << endl;

    else cout << "NO" << endl;

    return 0;

}


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



int main(){

	

	char board[5][5];

	

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

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

			scanf("%c",&board[i][j]);

		}

		getchar();

	}

	

	if(board[0][0] == board[1][2] && board[1][0] == board[0][2] && board[0][1] == board[1][1]){

		printf("YES\n");

	}else{

		printf("NO\n");

	}

	

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

#include <queue>

#include <cstdio>

#include <cstdlib>

#include <algorithm>

#include <cstring>

using namespace std;

char a[10][10];

int main()

{

    int f=0;

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

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

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

    {

        if(a[1][i]==a[2][2-i])

        {

            f=1;

        }

        else

        {

            f=0;

            break;

        }

    }

    if(f==1)

        printf("YES\n");

    else

    {

        printf("NO\n");

    }

    return 0;

}




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



int main(){

	

	char board[5][5];

	

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

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

			scanf("%c",&board[i][j]);

		}

		getchar();

	}

	

	if(board[0][0] == board[1][2] && board[1][0] == board[0][2] && board[0][1] == board[1][1]){

		printf("YES\n");

	}else{

		printf("NO\n");

	}

	

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

using namespace std;



bool same(char *top, char *bottom) {

	int length = ((string) top).length();

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

		if (top[i] != bottom[length - i - 1]) return false;

	}

	

	return true;

}



int main() {

	char top[5], bottom[5];

	scanf("%s\n%s", top, bottom);

	printf("%s", same(top, bottom) ? "YES" : "NO");

	return 0;

}

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



int main(){

	

	char board[5][5];

	

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

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

			scanf("%c",&board[i][j]);

		}

		getchar();

	}

	

	if(board[0][0] == board[1][2] && board[1][0] == board[0][2] && board[0][1] == board[1][1]){

		printf("YES\n");

	}else{

		printf("NO\n");

	}

	

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

#include <cstring>

#include <stack>

#include <cstdlib>

#include <queue>

#include <cmath>

#include <cstdio>

#include <algorithm>

#include <string>

#include <iomanip>

using namespace std;

int main()

{

    char c[10][10];

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

    {

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

        {

            scanf("%c",&c[i][j]);

        }

    }

    if(c[1][1]==c[2][3]&&c[1][2]==c[2][2]&&c[1][3]==c[2][1])

    {

        printf("YES\n");

    }

    else printf("NO\n");

    return 0;

}


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

#include <cstdlib>

#include <cstring>

using namespace std;

int main()

{

    char a[10]={'\0'},b[10]={'\0'},c[10]={'\0'};

        int i,j;

        scanf("%s",&a);

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

        if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0])

            printf("YES\n");

        else

            printf("NO\n");

  return 0;

}