func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast,no-stack-protector )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   #pragma GCC optimize( unroll-loops )   #pragma GCC optimize( fast-math )   using namespace std;   template <class T>   ostream &operator<<(ostream &str, vector<T> &a) {     for (auto &i : a) {       str << i <<    ;     }     return str;   }   template <class T>   istream &operator>>(istream &str, vector<T> &a) {     for (auto &i : a) {       str >> i;     }     return str;   }   template <class T>   ostream &operator<<(ostream &str, pair<T, T> &a) {     str << a.first <<     << a.second;     return str;   }   template <class T>   istream &operator>>(istream &str, pair<T, T> &a) {     str >> a.first >> a.second;     return str;   }   void solve();   signed main() {     srand(time(0));     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cout.setf(ios::fixed);     cout.precision(6);     solve();     return 0;   }   int n, m;   int get_sum(vector<vector<int>> &b, int i1, int j1, int i2, int j2) {     return b[i2][j2] - b[i1 - 1][j2] - b[i2][j1 - 1] + b[i1 - 1][j1 - 1];   }   bool check(int k, vector<vector<int>> &a, vector<vector<int>> &b,              vector<vector<int>> &tmp) {     int len = 2 * k + 1;     if (len > n || len > m) {       return false;     }     vector<vector<int>> v(m + 2, vector<int>(n + 2));     for (int i = 1; i <= n - len + 1; ++i) {       for (int j = 1; j <= m - len + 1; ++j) {         int sum = get_sum(b, i, j, i + len - 1, j + len - 1);         if (sum == len * len) {           tmp[i + len / 2][j + len / 2] = 1;           v[j][i] += 1, v[j][i + len] -= 1;           v[j + len][i] -= 1, v[j + len][i + len] += 1;         }       }     }     for (int j = 1; j <= m; ++j) {       for (int i = 1; i <= n; ++i) {         v[j][i] = v[j][i - 1] + v[j][i];       }     }     vector<vector<int>> c(n + 1, vector<int>(m + 1));     for (int j = 1; j <= m; ++j) {       for (int i = 1; i <= n; ++i) {         c[i][j] = v[j][i];       }     }     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         c[i][j] = c[i][j - 1] + c[i][j];       }     }     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         if (a[i][j] && c[i][j] == 0) {           return false;         }       }     }     return true;   }   void solve() {     cin >> n >> m;     vector<vector<int>> a(n + 1, vector<int>(m + 1));     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         char ch;         cin >> ch;         a[i][j] = (ch ==  X  ? 1 : 0);       }     }     vector<vector<int>> b = a;     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         b[i][j] = b[i][j] + b[i - 1][j] + b[i][j - 1] - b[i - 1][j - 1];       }     }     vector<vector<int>> ans(n + 1, vector<int>(m + 1));     int l = 0, r = min(n, m);     while (r - l > 1) {       int k = (r + l) / 2;       vector<vector<int>> tmp(n + 1, vector<int>(m + 1));       if (check(k, a, b, tmp)) {         ans = tmp;         l = k;       } else {         r = k;       }     }     check(l, a, b, ans);     cout << (l) <<   n ;     ;     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         cout << (ans[i][j] ?  X  :  . );       }       cout <<   n ;     }   }   