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

#define pb       push_back

#define mp       make_pair

#define mod      1000000007

#define first    ff

#define second   ss

#define pi       acos(-1.0)

typedef long long ll;

using namespace std;

vector<int>node[10001];



int main()

{      





     ios::sync_with_stdio(false);

     cin.tie(NULL);

     cout.tie(NULL);

     

     string s;

      string ans="";

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

     {

        cin>>s;

        ans+=s[i];

     }

     cout<<ans<<endl;





      return 0;

    

 }       


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



using namespace std;



int main()

{

    string s1, s2, s3;

    cin >> s1 >>s2 >>s3;

    cout <<s1[0] <<s2[1] <<s3[2];

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

#define pb       push_back

#define mp       make_pair

#define mod      1000000007

#define first    ff

#define second   ss

#define pi       acos(-1.0)

typedef long long ll;

using namespace std;

vector<int>node[10001];



int main()

{      





     ios::sync_with_stdio(false);

     cin.tie(NULL);

     cout.tie(NULL);

     

     string s;

      string ans="";

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

     {

        cin>>s;

        ans+=s[i];

     }

     cout<<ans<<endl;





      return 0;

    

 }       


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

using namespace std;

int main()

{

    char s[10][10];

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

{

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

{

cin>>s[i][j];

}cout<<endl;}

cout<<s[0][0]<<s[1][1]<<s[2][2]<<endl;

return 0;

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

using namespace std;

int main()

{

        char a[3][3];

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

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

            cin>>a[i][j];

        cout<<a[0][0]<<a[1][1]<<a[2][2];

   return 0;

   }

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

#include<string.h>



int main()

{

	char str[3], str1[3], str2[3];

	scanf("%s %s %s", str, str1, str2);

	

	printf("%c%c%c\n", str[0], str1[1], str2[2]);

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

#include<math.h>

using namespace std;

int main()

{

	char s[3][3];

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

	{

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

		{

			cin >> s[i][j];

		}

	}

	cout << s[0][0] << s[1][1] << s[2][2];

}

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

#include<string.h>



int main()

{

	char str[3], str1[3], str2[3];

	scanf("%s %s %s", str, str1, str2);

	

	printf("%c%c%c\n", str[0], str1[1], str2[2]);

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

#include<cmath>

#include<math.h>

#include<algorithm>

#include<fstream>

#include<queue>

using namespace std;

void ll(){

	std::ios_base::sync_with_stdio(0);

	cin.tie(NULL);

	cout.tie(0);

}

int main()

{

	ll();



	int i = 0, j = 0;

	char arr[100][100];

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

	{

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

		

			cin>>arr[i][j];

		

	}

	while (i < 3 && j < 3)

	{

		cout<<arr[i++][j++];

	}

	cout << endl;

}

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

#include<string.h>



int main()

{

	char str[3], str1[3], str2[3];

	scanf("%s %s %s", str, str1, str2);

	

	printf("%c%c%c\n", str[0], str1[1], str2[2]);

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

using namespace std;

int main()

{

    string s;

    string a,b,c;

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

    {

        cin >> s;

        if(i==0) a = s[0];

        if(i==1) b = s[1];

        if(i==2) c = s[2];

    }

    cout << a << b << c << endl;

}


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

#include<string.h>



int main()

{

	char str[3], str1[3], str2[3];

	scanf("%s %s %s", str, str1, str2);

	

	printf("%c%c%c\n", str[0], str1[1], str2[2]);

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

using namespace std;

typedef long long ll;

#define mod 1000000007

int main()

{

string s,s1,s2;

cin>>s>>s1>>s2;

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

{

    cout<<s[0];

    break;

}

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

{

    cout<<s1[1];

    break;

}

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

{

    cout<<s2[2];

    break;

}



}


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

#include<string.h>



int main()

{

	char str[3], str1[3], str2[3];

	scanf("%s %s %s", str, str1, str2);

	

	printf("%c%c%c\n", str[0], str1[1], str2[2]);

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

#define ll long long

#define endl '\n'

#define PI acos(-1)

#define sz 18500000

#define RUN_FAST ios::sync_with_stdio(false);

using namespace std;



int main()

{

    RUN_FAST; cin.tie(nullptr);

    string s1, s2, s3;

    cin >> s1 >> s2 >> s3;

    cout << s1[0] << s2[1] << s3[2] << endl;

    return 0;

}


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

#include<string.h>



int main()

{

	char str[3], str1[3], str2[3];

	scanf("%s %s %s", str, str1, str2);

	

	printf("%c%c%c\n", str[0], str1[1], str2[2]);

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

using namespace std;

#define   nl   <<'\n'

#define   pi   acos(-1.0);

#define   ll   long long

#define   pb   push_back

#define   eb   emplace_back

#define   tc   int t; cin>>t; while(t--)

#define   fio  ios_base::sync_with_stdio(0); cin.tie(0)



int main()

{

    string s;

    cin>>s;

    cout<<s[0];

    cin>>s;

    cout<<s[1];

    cin>>s;

    cout<<s[2];

}  

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

#include<string.h>



int main()

{

	char str[3], str1[3], str2[3];

	scanf("%s %s %s", str, str1, str2);

	

	printf("%c%c%c\n", str[0], str1[1], str2[2]);

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

using namespace std;



int main(){

    char str[3][3];

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

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

            cin >> str[i][j];

        }

    }

    cout << str[0][0] << str[1][1] << str[2][2] << endl;

    return 0;

}

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

#include<string.h>



int main()

{

	char str[3], str1[3], str2[3];

	scanf("%s %s %s", str, str1, str2);

	

	printf("%c%c%c\n", str[0], str1[1], str2[2]);

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

#define pb       push_back

#define mp       make_pair

#define mod      1000000007

#define first    ff

#define second   ss

#define pi       acos(-1.0)

typedef long long ll;

using namespace std;

vector<int>node[10001];



int main()

{      





     ios::sync_with_stdio(false);

     cin.tie(NULL);

     cout.tie(NULL);

     

     string s;

      string ans="";

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

     {

        cin>>s;

        ans+=s[i];

     }

     cout<<ans<<endl;





      return 0;

    

 }       


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

#include<string.h>



int main()

{

	char str[3], str1[3], str2[3];

	scanf("%s %s %s", str, str1, str2);

	

	printf("%c%c%c\n", str[0], str1[1], str2[2]);

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



using namespace std;



int main()

{

    string s1, s2, s3;

    cin >> s1 >>s2 >>s3;

    cout <<s1[0] <<s2[1] <<s3[2];

}


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

#include<string.h>



int main()

{

	char str[3], str1[3], str2[3];

	scanf("%s %s %s", str, str1, str2);

	

	printf("%c%c%c\n", str[0], str1[1], str2[2]);

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

using namespace std;

int main()

{

    char s[10][10];

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

{

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

{

cin>>s[i][j];

}cout<<endl;}

cout<<s[0][0]<<s[1][1]<<s[2][2]<<endl;

return 0;

}

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

#include<string.h>



int main()

{

	char str[3], str1[3], str2[3];

	scanf("%s %s %s", str, str1, str2);

	

	printf("%c%c%c\n", str[0], str1[1], str2[2]);

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

using namespace std;

int main()

{

    string S1,S2,S3;

    cin>>S1>>S2>>S3;

    cout<<S1[0]<<S2[1]<<S3[2]<<endl;





    return 0;

}

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

#include <cstring>

using namespace std;



char s[10];



int main() {

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

        scanf("%s", s);

        if(i == 0)

            printf("%c", s[0]);

        if(i == 1)

            printf("%c", s[1]);

        if(i == 2)

            printf("%c", s[2]);

    }

    printf("\n");

}
// Slower C++ solution:
//  ©   ___MRX___



#include <bits/stdc++.h>

    using namespace std;



#define ll long long int



int main()

{

    string a, b, c;



    cin >> a >> b >> c;

    cout << a[0] << b[1] << c[2] << '\n';



    return 0;

}


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

#include <cstring>

using namespace std;



char s[10];



int main() {

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

        scanf("%s", s);

        if(i == 0)

            printf("%c", s[0]);

        if(i == 1)

            printf("%c", s[1]);

        if(i == 2)

            printf("%c", s[2]);

    }

    printf("\n");

}
// Slower C++ solution:
/*

* @Author: Kabid

* @Date:   {{create_time}}

* @Last Modified by:   Kabid

* @Last Modified time: 2020-09-19 13:59:26

*/

#include<bits/stdc++.h>

using namespace std;

#define ll long long

#define  in(x) scanf("%d",&x);

#define out(x) printf("%d",x);

#define  ins(x)  scanf("%s",x);

#define outs(x) printf("%s",x);

#define lin puts("");

#define _ putchar(' ');



int t;       //test cases

ll i, j;	 //iterators

ll n, k , p, q,  d, m, c, c1, c2, d1; //variables;

ll mx = LLONG_MIN, mn = LLONG_MAX;		// max min

string s, s1, s2;		// string

ll a [1000001], b [200001] , mox [200001];	// array

map <int, int > mp;

vector <vector<ll>> vc;

vector <ll> v;

set <ll> st;

bool r;



int main() {

	ios_base::sync_with_stdio(0);

	cin.tie(0);

	//cin >> t; q = t;

	t = 1;

	

	while (t--) {





		/*cin >> s;

		n = s.size();

		for (i = n - 1; i > 0; i--) {

			for (j = i - 1; j >= 0; j--) {

				if (s[i] > s[j]) {

					swap(s[i], s[j]);

					cout << s << endl;

					break;

				}

			}

			if(j!=-1) break;

		}

		if (i == 0) {

			cout << "no answer" << endl;

		}*/

		cin >> s;

		cout<<s[0];

		cin >> s;

		cout<<s[1];

		cin >> s;

		cout<<s[2];

		//n=s.size();

		

		cout<<endl;

	}





	return 0;



}

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

#include <cstring>

using namespace std;



char s[10];



int main() {

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

        scanf("%s", s);

        if(i == 0)

            printf("%c", s[0]);

        if(i == 1)

            printf("%c", s[1]);

        if(i == 2)

            printf("%c", s[2]);

    }

    printf("\n");

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

using namespace std;



#define ll unsigned long long

#define pb push_back

int main()

{

    char c[5][5];

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

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

            cin >> c[i][j];

    cout << c[0][0] << c[1][1] << c[2][2];

    return 0;

}


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

#include <cstring>

using namespace std;



char s[10];



int main() {

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

        scanf("%s", s);

        if(i == 0)

            printf("%c", s[0]);

        if(i == 1)

            printf("%c", s[1]);

        if(i == 2)

            printf("%c", s[2]);

    }

    printf("\n");

}
// Slower C++ solution:
/*

   * * * * *       *        * * * * * * * * * * * * * * * * * * * * * * * *     * * * * * * *               * *               * * * * * * * * * *

   * * * * *      * *       * * * * * * * * * * * * * * * * * * * * * *    *    * * * * * * *              * * *             * ** * * * * * * * * *

   * *           * * *            * *     * *     * *      * *          * * *   * * *       *             * * * *           * * * *       * *    * *

   * * * * *    * * * *           * *     * *     * *       * * * * * * *  * *  * * * * * * *            * * * * *         * *  * *       * * * * *

   * * * * *   * * * * *          * *     * *     * *        * * * * ** *   * * * * * * * * *           * * * * * *       * *   * * * *   * * * *

         * *  * * * * * *   * *   * *     * *     * *       * * * * * * *    * ** *     * * *          * * * * * * *     * *    * * * *   * *  * *

         * * * *       * *  * *   * *     * *     * *      * *          *     * * *     * * *         * *       * * *   * *     * *       * *   * *

   * * * * ** *         * * * * * * * * * * * * * * * * * * * * * * * * *      *  * * * * * * * * * ** *         * * * * *      * * * * * * *    * *

   * * * * * *           * ** * * * * * * * * * * * * * * * * * * * * * *       * * * * * * * * * * * *           * * * *       * * * * * * *     * *

*/



#include <iostream>

#include <algorithm>

#include <string>

#include <vector>

#include <cstdio>

#include <cmath>

#include <cstring>

#include <cstdlib>

#include <set>

#define ll long long

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

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

#define shit while(t--)

#define fr for(int i=0;i<n;i++)

int maxo=1e9+7;

using namespace std;

int arr[95];

int main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

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

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

    {

        cin>>a[i]>>b[i]>>c[i];

    }

    cout<<a[0]<<b[1]<<c[2];

    return 0;

}




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

#include <cstring>

using namespace std;



char s[10];



int main() {

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

        scanf("%s", s);

        if(i == 0)

            printf("%c", s[0]);

        if(i == 1)

            printf("%c", s[1]);

        if(i == 2)

            printf("%c", s[2]);

    }

    printf("\n");

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

using namespace std;

#define ll long long int



int main(){

	int t;

	char g;

	string a="";

	scanf("%d", &t);

	scanf("%c", &g);

	a += g;

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

		for(int ii=0; ii<5; ii++) scanf("%c", &g);

		a += g;

	}

	cout << a << "\n";

}

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

#include <cstring>

using namespace std;



char s[10];



int main() {

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

        scanf("%s", s);

        if(i == 0)

            printf("%c", s[0]);

        if(i == 1)

            printf("%c", s[1]);

        if(i == 2)

            printf("%c", s[2]);

    }

    printf("\n");

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



using namespace std;



typedef long long ll;



int main()

{

    string s;

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

    {

        cin >> s[i];

    }

    cout << s[0] << s[4] << s[8] << endl;

return 0;}


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

#include <cstring>

using namespace std;



char s[10];



int main() {

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

        scanf("%s", s);

        if(i == 0)

            printf("%c", s[0]);

        if(i == 1)

            printf("%c", s[1]);

        if(i == 2)

            printf("%c", s[2]);

    }

    printf("\n");

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

using namespace std;



typedef long long int ll;

typedef vector<long long>lve;

typedef vector<pair<ll,ll> > lvp;

typedef vector<vector<int> > ivve;



#define sp         ' '

#define endl       '\n'

#define F          first

#define S          second

#define pb         push_back

#define mp         make_pair 

#define GCD(x,y)   __gcd(x,y)

#define lb         lower_bound

#define up         upper_bound

#define setp       setprecision

#define bs         binary_search

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

#define LCM(x,y)   ((x*y)/__gcd(x,y))

#define spc(x)     cout<<fixed<<setp(x)



const   long long  inf = 1e18;

const   long long  cs =  200005;

const   long long  mod = 1000000007;

const   double     PI =  2 * acos(0.0);

void solve()

{

    ll t,n,m,a,b,c,d,e,i,j,k,x,y,z,cnt=0,cnt1=0;

    bool flag = false;

    

    string s,s1,s2;

    cin>>s>>s1>>s2;

    cout<<s[0]<<s1[1]<<s2[2]<<endl;

}

int32_t main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);    cout.tie(NULL);



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

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



    // int32_t tc;

    // cin>>tc;

    // while(tc--)

    solve();



    return 0;

}

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

#include <cstring>

using namespace std;



char s[10];



int main() {

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

        scanf("%s", s);

        if(i == 0)

            printf("%c", s[0]);

        if(i == 1)

            printf("%c", s[1]);

        if(i == 2)

            printf("%c", s[2]);

    }

    printf("\n");

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

#define sz 3

using namespace std;



int main()

{

    char s1[sz],s2[sz],s3[sz];

    cin>>s1;

    cin>>s2;

    cin>>s3;

    printf("%c%c%c\n",s1[0],s2[1],s3[2]);



    return 0;

}


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

#include <cstring>

using namespace std;



char s[10];



int main() {

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

        scanf("%s", s);

        if(i == 0)

            printf("%c", s[0]);

        if(i == 1)

            printf("%c", s[1]);

        if(i == 2)

            printf("%c", s[2]);

    }

    printf("\n");

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

#include<iostream>

using namespace std;

int main()

{char a[3][3];

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

cout<<a[0][0]<<a[1][1]<<a[2][2]<<endl;}

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

int main()

{char a[10][10];

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

printf("%c%c%c",a[0][0],a[1][1],a[2][2]);}
// Slower C++ solution:
/*

	容斥原理 + 递推

	不重复地选择一些的集合

	答案要求的是每一种元素必须出现两次以上

	ans = \sum (-1)^i f[i]

	其中 f[i] 表示至少有 i 个元素不满足条件

	考虑枚举这 i 个元素, 有 C(n, i) 种方式

	这 i 个元素放在集合的个数是 O(n) 级别的, 而且最后答案也跟集合个数有关

	就先设 g[i][j] 为考虑了前 i 个元素放在 j 个集合里, 且都不满足条件的方案数

	g[i][j] = g[i - 1][j - 1] + g[i - 1][j] * (j + 1)

	前一个表示这个元素就放在第 j 个集合里

	后一个表示这个元素可以放在 j 个集合里, 也可以不放 

*/

#include <bits/stdc++.h>

#define N 3005



using namespace std;



const int bl = 32761;



int n, mod;

int comb[N][N], g[N][N];



int pw[2][2][bl + 1];



void init(int a[2][bl + 1], int x, const int mo) {

	a[0][0] = 1;

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

		a[0][i] = 1LL * x * a[0][i - 1] % mo;

	a[1][0] = 1;

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

		a[1][i] = 1LL * a[0][bl] * a[1][i - 1] % mo;

}

inline int fpm(int typ, int y) {

	return 1LL * pw[typ][1][y / bl] * pw[typ][0][y % bl] % mod;

}



int main() {

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

	

	init(pw[0], 2, mod);

	init(pw[1], 2, mod - 1);

	

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

		comb[i][0] = 1;

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

			comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % mod;

	}

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

		g[i][0] = 1;

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

			g[i][j] = (g[i - 1][j - 1] +

			(j + 1LL) * g[i - 1][j]) % mod;

	}

	

	int ans = 0;

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

		int res = 0;

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

			res = (res + 1LL * comb[n][i] * g[i][j] % mod

				   * fpm(0, (n - i) * j) % mod

				   * fpm(0, fpm(1, n - i))) % mod;

		}

		if(i & 1) {

			ans = (ans + mod - res) % mod;

		} else {

			ans = (ans + res) % mod;

		}

	}

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

	return 0;

}

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

#define N 3050

using namespace std;

int n,m;

int s[N][N],c[N][N];

inline int qpow(int d,int z,const int mod=m){

	int ret=1;

	for(;z;z>>=1,d=1ll*d*d%mod)

		if(z&1)ret=1l*ret*d%mod;

	return ret;

}

inline void init(int n,const int mod=m){

	s[0][0]=1;

	for(int i=0;i<=n;++i){c[i][0]=1;

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

			s[i][j]=(s[i-1][j-1]+1ll*s[i-1][j]*j)%mod;

			c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;

		}

	}

}

int main(){

	cin>>n>>m;init(n+1);

	int ans=0;

	const int mod=m;

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

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

			if(i&1)ans+=mod-1ll*c[n][i]*s[i+1][j+1]%mod*qpow(2,qpow(2,n-i,mod-1))%mod*qpow(qpow(2,n-i),j)%mod;

			else ans+=1ll*c[n][i]*s[i+1][j+1]%mod*qpow(2,qpow(2,n-i,mod-1))%mod*qpow(qpow(2,n-i),j)%mod;

			if(ans>=mod)ans-=mod;

		}

	}

	cout<<ans<<endl;

	return 0;

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

using namespace std;

int a[1003][1003],b[1003][1003];

int s1[1003][1003],s2[1003][1003];

int n,k;

char t;

int dfs(int x,int y)

{

	int i=0,j=0;

	i=s1[k][k]-s1[x][k]-s1[k][y]+s1[x][y]+s1[x][y];

	i+=s2[x][k]+s2[k][y]-s2[x][y]-s2[x][y];

	j+=s2[k][k]-s2[x][k]-s2[k][y]+s2[x][y]+s2[x][y];

	j+=s1[x][k]+s1[k][y]-s1[x][y]-s1[x][y];

	return max(i,j);

}

int main()

{

    int ans,x,y;

	cin>>n>>k;

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

	{

		cin>>x>>y>>t;

		int tx=x,ty=y;

		x%=k;y%=k;

		if (x==0)x=k;

		if (y==0)y=k;

		if (((abs(tx-x)+abs(ty-y))/k)%2==1)

		{

			if (t=='W')t='B';else t='W';

		}

		if (t=='W')b[x][y]++;else a[x][y]++;

	}

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

	{

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

		{

			s1[i][j]=s1[i-1][j]+s1[i][j-1]-s1[i-1][j-1]+a[i][j];

			s2[i][j]=s2[i-1][j]+s2[i][j-1]-s2[i-1][j-1]+b[i][j];

		}

	}

	for (int i=0;i<=k+1;i++)

	{

		for (int j=0;j<=k+1;j++)

		{

			ans=max(ans,dfs(i,j));

		}

	}

	cout<<ans;

	return 0;

}


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

#include<string.h>

#include<algorithm>

#include<math.h>

using namespace std;

int a[1010][1010],b[1010][1010];

int s1[1010][1010],s2[1010][1010];

int n,m;

char c[10];

int dfs(int x,int y)

{

    int i=0,j=0;

    i=s1[m][m]-s1[x][m]-s1[m][y]+s1[x][y]*2;

    i=i+s2[x][m]+s2[m][y]-s2[x][y]*2;

    j=s2[m][m]-s2[x][m]-s2[m][y]+s2[x][y]*2;

    j=j+s1[x][m]+s1[m][y]-s1[x][y]*2;

    return max(i,j);

}

int main()

{

    int i,j,k,x,y,ans;

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

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

    {

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

        j=x%m;

        k=y%m;

        if(j==0)

            j=m;

        if(k==0)

            k=m;

        if(((abs(x-j)+abs(y-k))/m)%2==1)

        {

            if(c[0]=='W')

                c[0]='B';

            else

                c[0]='W';

        }

        if(c[0]=='W')

            a[j][k]++;

        else

            b[j][k]++;

    }

    for(i=1;i<=m;i++)

    for(j=1;j<=m;j++)

    {

        s1[i][j]=s1[i-1][j]+s1[i][j-1]-s1[i-1][j-1]+a[i][j];

        s2[i][j]=s2[i-1][j]+s2[i][j-1]-s2[i-1][j-1]+b[i][j];

    }

    ans=0;

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

    for(j=0;j<=m;j++)

    ans=max(ans,dfs(i,j));

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

}