func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX = 1005;   int a[MAX][MAX], u[MAX][MAX], d[MAX][MAX], l[MAX][MAX], r[MAX][MAX];   int main() {     int n, m, q;     scanf( %d %d %d , &n, &m, &q);     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) scanf( %d , &a[i][j]);     for (int j = 0; j < m; j++)       if (a[0][j])         u[0][j] = -1;       else         u[0][j] = 0;     for (int i = 1; i < n; i++)       for (int j = 0; j < m; j++)         if (a[i][j])           u[i][j] = u[i - 1][j];         else           u[i][j] = i;     for (int j = 0; j < m; j++)       if (a[n - 1][j])         d[n - 1][j] = n;       else         d[n - 1][j] = n - 1;     for (int i = n - 2; i >= 0; i--)       for (int j = 0; j < m; j++)         if (a[i][j])           d[i][j] = d[i + 1][j];         else           d[i][j] = i;     for (int i = 0; i < n; i++)       if (a[i][0])         l[i][0] = -1;       else         l[i][0] = 0;     for (int i = 0; i < n; i++)       for (int j = 1; j < m; j++)         if (a[i][j])           l[i][j] = l[i][j - 1];         else           l[i][j] = j;     for (int i = 0; i < n; i++)       if (a[i][m - 1])         r[i][m - 1] = m;       else         r[i][m - 1] = m - 1;     for (int i = 0; i < n; i++)       for (int j = m - 2; j >= 0; j--)         if (a[i][j])           r[i][j] = r[i][j + 1];         else           r[i][j] = j;     while (q--) {       int op;       scanf( %d , &op);       int x, y;       scanf( %d %d , &x, &y);       x--;       y--;       if (op == 1) {         if (a[x][y]) {           a[x][y] = 0;           l[x][y] = y;           r[x][y] = y;           u[x][y] = x;           d[x][y] = x;           for (int i = x - 1; i >= 0; i--)             if (a[i][y])               d[i][y] = x;             else               break;           for (int i = x + 1; i < n; i++)             if (a[i][y])               u[i][y] = x;             else               break;           for (int j = y - 1; j >= 0; j--)             if (a[x][j])               r[x][j] = y;             else               break;           for (int j = y + 1; j < m; j++)             if (a[x][j])               l[x][j] = y;             else               break;         } else {           a[x][y] = 1;           int ans;           if (x == n - 1)             ans = n;           else             ans = d[x + 1][y];           for (int i = x; i >= 0; i--)             if (a[i][y])               d[i][y] = ans;             else               break;           if (x == 0)             ans = -1;           else             ans = u[x - 1][y];           for (int i = x; i < n; i++)             if (a[i][y])               u[i][y] = ans;             else               break;           if (y == m - 1)             ans = m;           else             ans = r[x][y + 1];           for (int j = y; j >= 0; j--)             if (a[x][j])               r[x][j] = ans;             else               break;           if (y == 0)             ans = -1;           else             ans = l[x][y - 1];           for (int j = y; j < m; j++)             if (a[x][j])               l[x][j] = ans;             else               break;         }       } else {         int ans = 0;         int lo = d[x][y], hi = u[x][y];         for (int j = y; j < r[x][y]; j++) {           lo = min(lo, d[x][j]);           hi = max(hi, u[x][j]);           ans = max(ans, (j - y + 1) * (lo - hi - 1));         }         lo = d[x][y];         hi = u[x][y];         for (int j = y; j > l[x][y]; j--) {           lo = min(lo, d[x][j]);           hi = max(hi, u[x][j]);           ans = max(ans, (y - j + 1) * (lo - hi - 1));         }         int le = l[x][y], ri = r[x][y];         for (int i = x; i < d[x][y]; i++) {           le = max(le, l[i][y]);           ri = min(ri, r[i][y]);           ans = max(ans, (i - x + 1) * (ri - le - 1));         }         le = l[x][y];         ri = r[x][y];         for (int i = x; i > u[x][y]; i--) {           le = max(le, l[i][y]);           ri = min(ri, r[i][y]);           ans = max(ans, (x - i + 1) * (ri - le - 1));         }         printf( %d n , ans);       }     }     return 0;   }   