func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, m;     cin >> n >> m;     vector<vector<int>> grid(n, vector<int>(m, 0));     vector<vector<int>> up(n, vector<int>(m, 0));     vector<vector<int>> down(n, vector<int>(m, 0));     vector<vector<int>> left(n, vector<int>(m, 0));     vector<vector<int>> right(n, vector<int>(m, 0));     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cin >> grid[i][j];       }     }     for (int i = 0; i < n; i++) {       left[i][0] = grid[i][0];       for (int j = 1; j < m; j++) {         left[i][j] = left[i][j - 1] + grid[i][j];       }     }     for (int i = 0; i < n; i++) {       right[i][m - 1] = grid[i][m - 1];       for (int j = m - 2; j >= 0; j--) {         right[i][j] = right[i][j + 1] + grid[i][j];       }     }     for (int j = 0; j < m; j++) {       up[0][j] = grid[0][j];       for (int i = 1; i < n; i++) {         up[i][j] = up[i - 1][j] + grid[i][j];       }     }     for (int j = 0; j < m; j++) {       down[n - 1][j] = grid[n - 1][j];       for (int i = n - 2; i >= 0; i--) {         down[i][j] = down[i + 1][j] + grid[i][j];       }     }     int ans = 0;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (grid[i][j] == 1) continue;         if (up[i][j] - grid[i][j] > 0) ans++;         if (down[i][j] - grid[i][j] > 0) ans++;         if (left[i][j] - grid[i][j] > 0) ans++;         if (right[i][j] - grid[i][j] > 0) ans++;       }     }     cout << ans;   }   