func_code_string: #include <bits/stdc++.h>   #pragma G++ optimize( Ofast,no-stack-protector )   #pragma G++ optimize( -O3,-O2,-O1 )   #pragma G++ target(         sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native )   #pragma G++ optimize( unroll-loops )   using namespace std;   long long binpow(long long a, long long n, long long mod) {     long long ans = 1;     while (n) {       if (n & 1) ans = (ans * a) % mod;       a = (a * a) % mod;       n >>= 1;     }     return ans;   }   long long binpow(long long a, long long n) {     long long ans = 1;     while (n) {       if (n & 1) ans *= a;       a *= a;       n >>= 1;     }     return ans;   }   vector<long long> pr;   void PrDoX(long long x) {     if (pr.size() > 0) return;     vector<long long> p(x + 1);     for (long long i = 2; i <= x; i++) {       if (p[i] == 0) {         pr.push_back(i);         for (long long j = i + i; j <= x; j += i) p[j] = 1;       }     }   }   vector<long long> fact(long long x) {     PrDoX(sqrt(1e9));     vector<long long> ans;     long long i = 0, c = sqrt(x), n = pr.size();     while (x > 1 and pr[i] <= c and i < n) {       if (x % pr[i] == 0) {         x /= pr[i];         ans.push_back(pr[i]);         c = sqrt(x);       } else         i++;     }     if (x != 1) ans.push_back(x);     return ans;   }   int dp[501][26][26], cost[501][26][26];   pair<int, int> ans[501][26][26];   int main() {     cin.tie(0);     cout.tie(0);     ios::sync_with_stdio(0);     for (int i = 1; i < 501; i++)       for (int j = 0; j < 26; j++)         for (int l = 0; l < 26; l++) dp[i][j][l] = 1e9;     int n, m;     cin >> n >> m;     vector<vector<int> > v(n, vector<int>(m));     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         char c;         cin >> c;         v[i][j] = c -  a ;       }     }     for (int i = 0; i < n; i++) {       for (int A = 0; A < 26; A++) {         for (int B = 0; B < 26; B++) {           if (A == B) continue;           for (int j = 0; j < m; j++)             cost[i][A][B] +=                 ((A != v[i][j]) * (j % 2 == 0) + (B != v[i][j]) * (j % 2 == 1));         }       }     }     for (int i = 0; i < 26; i++) {       for (int j = 0; j < 26; j++) dp[1][i][j] = cost[0][i][j];     }     for (int i = 1; i <= n; i++) {       for (int A = 0; A < 26; A++) {         for (int B = 0; B < 26; B++) {           if (A == B) continue;           for (int A2 = 0; A2 < 26; A2++) {             if (A2 == A) continue;             for (int B2 = 0; B2 < 26; B2++) {               if (B2 == B or A2 == B2) continue;               if (dp[i - 1][A2][B2] + cost[i - 1][A][B] < dp[i][A][B]) {                 dp[i][A][B] = dp[i - 1][A2][B2] + cost[i - 1][A][B];                 ans[i][A][B] = {A2, B2};               }             }           }         }       }     }     int mn = 1e9;     pair<int, int> x = {0, 0};     for (int i = 0; i < 26; i++) {       for (int j = 0; j < 26; j++) {         if (i != j and dp[n][i][j] < mn) mn = dp[n][i][j], x = {i, j};       }     }     cout << mn <<   n ;     vector<pair<int, int> > Ans;     for (int i = n; i > 0; i--) {       Ans.push_back(x);       x = ans[i][x.first][x.second];     }     for (int i = n - 1; i >= 0; i--) {       for (int j = 0; j < m; j++) {         if (j % 2 == 0)           cout << char(Ans[i].first +  a );         else           cout << char(Ans[i].second +  a );       }       cout <<   n ;     }     return 0;   }   