Problem p00036 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>

using namespace std;

char field[11][11], field2[11][11];

int main(void) {
  while (1) {
    int i, j;
    bool flag = false;
    for (j = 0; j < 11; j++) {
      for (i = 0; i < 11; i++) {
        field[i][j] = '\\0';
        field2[i][j] = '\\0';
      }
    }
    for (i = 0; i < 8; i++) {
      if (scanf("%s", field[i]) == EOF) {
        flag = true;
        break;
      }
    }
    if (flag)
      break;
    for (j = 0; j < 8; j++) {
      for (i = 0; i < 8; i++) {
        field2[i][j] = field[j][i];
      }
    }
    for (j = 0; j < 8; j++) {
      for (i = 0; i < 8; i++) {
        if (field2[i][j] == '1' && field2[i + 1][j] == '1' &&
            field2[i][j + 1] == '1' && field2[i + 1][j + 1] == '1')
          printf("A\\n");
        if (field2[i][j] == '1' && field2[i][j + 1] == '1' &&
            field2[i][j + 2] == '1' && field2[i][j + 3] == '1')
          printf("B\\n");
        if (field2[i][j] == '1' && field2[i + 1][j] == '1' &&
            field2[i + 2][j] == '1' && field2[i + 3][j] == '1')
          printf("C\\n");
        if (field2[i + 1][j] == '1' && field2[i + 1][j + 1] == '1' &&
            field2[i][j + 1] == '1' && field2[i][j + 2] == '1')
          printf("D\\n");
        if (field2[i][j] == '1' && field2[i + 1][j] == '1' &&
            field2[i + 1][j + 1] == '1' && field2[i + 2][j + 1] == '1')
          printf("E\\n");
        if (field2[i][j] == '1' && field2[i][j + 1] == '1' &&
            field2[i + 1][j + 1] == '1' && field2[i + 1][j + 2] == '1')
          printf("F\\n");
        if (field2[i][j + 1] == '1' && field2[i + 1][j + 1] == '1' &&
            field2[i + 1][j] == '1' && field2[i + 2][j] == '1')
          printf("G\\n");
      }
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>

using namespace std;

char field[11][11], field2[11][11];

int main(void) {
  while (1) {
    int i, j;
    bool flag = false;
    for (j = 0; j < 11; j++) {
      for (i = 0; i < 11; i++) {
        field[i][j] = '\\0';
        field2[i][j] = '\\0';
      }
    }
    for (i = 0; i < 8; i++) {
      if (scanf("%s", field[i]) == EOF) {
        flag = true;
        break;
      }
      if (flag)
        break;
    }
    for (j = 0; j < 8; j++) {
      for (i = 0; i < 8; i++) {
        field2[i][j] = field[j][i];
      }
    }
    for (j = 0; j < 8; j++) {
      for (i = 0; i < 8; i++) {
        if (field2[i][j] == '1' && field2[i + 1][j] == '1' &&
            field2[i][j + 1] == '1' && field2[i + 1][j + 1] == '1')
          printf("A\\n");
        if (field2[i][j] == '1' && field2[i][j + 1] == '1' &&
            field2[i][j + 2] == '1' && field2[i][j + 3] == '1')
          printf("B\\n");
        if (field2[i][j] == '1' && field2[i + 1][j] == '1' &&
            field2[i + 2][j] == '1' && field2[i + 3][j] == '1')
          printf("C\\n");
        if (field2[i + 1][j] == '1' && field2[i + 1][j + 1] == '1' &&
            field2[i][j + 1] == '1' && field2[i][j + 2] == '1')
          printf("D\\n");
        if (field2[i][j] == '1' && field2[i + 1][j] == '1' &&
            field2[i + 1][j + 1] == '1' && field2[i + 2][j + 1] == '1')
          printf("E\\n");
        if (field2[i][j] == '1' && field2[i][j + 1] == '1' &&
            field2[i + 1][j + 1] == '1' && field2[i + 1][j + 2] == '1')
          printf("F\\n");
        if (field2[i][j + 1] == '1' && field2[i + 1][j + 1] == '1' &&
            field2[i + 1][j] == '1' && field2[i + 2][j] == '1')
          printf("G\\n");
      }
    }
  }
  return 0;
}