func_code_string: #include <bits/stdc++.h>   const int INF = 0x3f3f3f3f;   using namespace std;   const int N = 255;   int t, n, m, k;   char s[N][N];   int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};   int dy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};   void dfs(int x, int y) {     s[x][y] =  ! ;     k++;     for (int i = 0; i <= 7; i++) {       int xx = x + dx[i];       int yy = y + dy[i];       if (xx > 0 && xx <= n && yy > 0 && yy <= m && s[xx][yy] ==  1 ) dfs(xx, yy);     }   }   int check1(int x, int y) {     int l = 0, r = 0, u = 0, d = 0;     while (y + 1 <= m && s[x][y + 1] ==  1 ) u++, y++;     while (x + 1 <= n && s[x + 1][y] ==  1 ) r++, x++;     while (y - 1 >= 1 && s[x][y - 1] ==  1 ) d++, y--;     while (x - 1 >= 1 && s[x - 1][y] ==  1 ) l++, x--;     if (u == d && l == r && u == l) return u;     return 0;   }   int check2(int x, int y) {     int l = 0, r = 0, u = 0, d = 0;     while (x + 1 <= n && y - 1 >= 1 && s[x + 1][y - 1] ==  1 ) x++, y--, u++;     while (x + 1 <= n && y + 1 <= m && s[x + 1][y + 1] ==  1 ) x++, y++, l++;     while (x - 1 >= 1 && y + 1 <= m && s[x - 1][y + 1] ==  1 ) x--, y++, d++;     while (x - 1 >= 1 && y - 1 >= 1 && s[x - 1][y - 1] ==  1 ) x--, y--, r++;     if (u == d && l == r && u == l) return u;     return 0;   }   int main() {     (ios::sync_with_stdio(false), cin.tie(0), cout.tie(0));     cin >> t;     while (t--) {       cin >> n >> m;       for (int i = 1; i <= n; i++)         for (int j = 1; j <= m; j++) cin >> s[i][j];       int ans = 0;       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= m; j++) {           if (s[i][j] ==  1 ) {             int c1 = check1(i, j);             int c2 = check2(i, j);             k = 0;             dfs(i, j);             if (k == 4 * c1 || k == 4 * c2) ans++;           }         }       }       cout << ans << endl;     }     return 0;   }   