func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( O3 )   const long long INF = 0x3f3f3f3f3f3f3f3f;   const long long llinf = (1LL << 61);   const int inf = (1 << 30);   const int nmax = 1e3 + 50;   const int mod = 1e9 + 7;   using namespace std;   int n, m, i, j, a[nmax][nmax], aa[nmax][nmax], b[nmax][nmax], bb[nmax][nmax],       ca[nmax][nmax], cb[nmax][nmax], mn;   char c[nmax][nmax];   vector<pair<pair<int, int>, int> > ans;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cerr.tie(0);     cout.tie(0);     cin >> n >> m;     for (i = 1; i <= n; i++)       for (j = 1; j <= m; j++) cin >> c[i][j];     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++)         if (c[i][j] ==  * ) a[i][j] = a[i][j - 1] + 1;       for (j = m; j >= 1; j--)         if (c[i][j] ==  * ) aa[i][j] = aa[i][j + 1] + 1;     }     for (i = 1; i <= m; i++) {       for (j = 1; j <= n; j++)         if (c[j][i] ==  * ) b[j][i] = b[j - 1][i] + 1;       for (j = n; j >= 1; j--)         if (c[j][i] ==  * ) bb[j][i] = bb[j + 1][i] + 1;     }     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++) {         if (c[i][j] ==  * ) {           mn = min(min(a[i][j], aa[i][j]), min(b[i][j], bb[i][j]));           if (mn > 1) {             ca[i][j - mn + 1]++;             ca[i][j + mn]--;             cb[i - mn + 1][j]++;             cb[i + mn][j]--;             ans.push_back({{i, j}, mn - 1});           }         }       }     }     for (i = 1; i <= n; i++)       for (j = 1; j <= m; j++) ca[i][j] += ca[i][j - 1];     for (i = 1; i <= m; i++)       for (j = 1; j <= n; j++) cb[j][i] += cb[j - 1][i];     for (i = 1; i <= n; i++)       for (j = 1; j <= m; j++)         if (c[i][j] ==  *  && !ca[i][j] && !cb[i][j])           return cout << -1 << endl, 0;     cout << ans.size() << endl;     for (i = 0; i < ans.size(); i++)       cout << ans[i].first.first <<     << ans[i].first.second <<                << ans[i].second << endl;     return 0;   }   