alexjercan/bugnet huggingface dataset:
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
#define MAX 300

int main(void) {
  int H, W;

  while (1) {
    do {
      cin >> H >> W;
    } while (H < 0 || H > MAX || W < 0 || W > MAX);

    if (W == 0 && H == 0)
      break;

    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if ((i + j) % 2 == 0)
          cout << "#";
        else
          cout << ".";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>
#include <iostream>
using namespace std;
#define MAX 300

int main(void) {
  int H, W;

  while (1) {
    do {
      cin >> H >> W;
    } while (H <= 0 || H > MAX || W <= 0 || W > MAX);

    if (W == 0 && H == 0)
      break;

    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if ((H + W) % 2 == 0)
          cout << "#";
        else
          cout << ".";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int H, W;
  while (1) {
    cin >> H >> W;
    if (H == 0 && W == 0)
      break;
    for (int i = 0; i < H; i++) {
      for (int k = 0; k < W; k++) {
        if (i % 2 == 1) {
          if (k % 2 == 1) {
            cout << "#";
          } else {
            cout << ".";
          }
        } else {
          if (k % 2 == 1) {
            cout << ".";
          } else {
            cout << "#";
          }
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int H, W;
  while (1) {
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
      for (int k = 0; k < H; k++) {
        if (i % 2 == 1) {
          if (k % 2 == 1) {
            cout << "#";
          } else {
            cout << ".";
          }
        } else {
          if (k % 2 == 1) {
            cout << ".";
          } else {
            cout << "#";
          }
        }
      }
      cout << endl;
    }
  }
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main() {
  int a, b;
  while (1) {
    scanf("%d %d", &a, &b);
    if (a == 0 || b == 0)
      break;
    for (int i = 0; i < a; i++) {
      for (int j = 0; j < b; j++) {
        if (i % 2 == 0) {
          if (j % 2 == 0)
            printf("#");
          else
            printf(".");
        } else {
          if (j % 2 == 0)
            printf(".");
          else
            printf("#");
        }
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <stdio.h>

int main() {
  int a, b;
  while (1) {
    scanf("%d %d", &a, &b);
    for (int i = 0; i < a; i++) {
      for (int j = 0; j < b; j++) {
        if (i % 2 == 0) {
          if (j % 2 == 0)
            printf("#");
          else
            printf(".");
        } else {
          if (j % 2 == 0)
            printf(".");
          else
            printf("#");
        }
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>

int main() {
  int H, W;
  for (int i = 0;; i++) {
    scanf("%d %d", &H, &W);
    if (H == 0 && W == 0) {
      break;
    }
    char a[H][W];
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if ((i + j) % 2 == 0) {
          a[i][j] = '#';
        } else if ((i + j) % 2 == 1) {
          a[i][j] = '.';
        }
        printf("%c", a[i][j]);
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <cstdio>

int main() {
  int H, W;
  for (int i = 0;; i++) {
    scanf("%d %d", &H, &W);
    for (int j = 1; j <= H; j++) {
      if (H == 0 && W == 0) {
        break;
      }
      if (j % 2 == 1) {
        for (int k = 1; k <= W; k++) {
          if (k % 2 == 1) {
            printf("#");
          } else {
            printf(".");
          }
        }
        printf("\\n");
      } else {
        for (int k = 1; k <= W; k++) {
          if (k % 2 == 1) {
            printf(".");
          } else {
            printf("#");
          }
        }
        printf("\\n");
      }
    }
    printf("\\n");
  }
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int H, W;
  while (1) {

    cin >> H >> W;
    if (H == 0 && W == 0) {
      break;
    }
    for (int i = 1; i <= H; i++) {
      for (int k = 1; k <= W; k++) {
        if ((i + k) % 2 == 0) {
          cout << '#';
        } else if ((i + k) % 2 != 0) {
          cout << '.';
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int H, W;
  while (1) {
    cin >> H >> W;
    for (int i = 1; i < H; i++) {
      for (int k = 1; k < W; k++) {
        if ((i + k) % 2 == 0) {
          cout << '#';
        } else {
          cout << '.';
        }
      }
      cout << endl;
    }
  }
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int h, w;
  cin >> h >> w;
  while (h != 0 || w != 0) {
    int i, j, k;
    for (i = 0; i < h; i++) {
      for (j = 0; j < w; j++) {
        k = i + j;
        if (k % 2 == 0)
          cout << "#";
        else
          cout << ".";
      }
      cout << endl;
    }
    cout << endl;
    cin >> h >> w;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int h, w;
  cin >> h >> w;
  while (h != 0 || w != 0) {
    int i, j, k;
    for (i = 0; i < h; i++) {
      for (j = 0; j < w; j++) {
        k = i + j;
        if (k % 2 == 0)
          cout << "#";
        else
          cout << ".";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>
int main() {
  int H, W;
  while (1) {
    scanf("%d %d", &H, &W);
    if (H == 0 && W == 0)
      break;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if (i % 2 == 0) {
          if (j % 2 == 0) {
            printf("#");
          } else {
            printf(".");
          }
        } else {
          if (j % 2 == 0) {
            printf(".");
          } else {
            printf("#");
          }
        }
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>
int main() {
  int H, W;
  while (1) {
    scanf("%d %d", &H, &W);
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if (i % 2 == 0) {
          if (j % 2 == 0) {
            printf("#");
          } else {
            printf(".");
          }
        } else {
          if (j % 2 == 0) {
            printf(".");
          } else {
            printf("#");
          }
        }
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int h, w;
  while (1) {
    cin >> h >> w;
    if (h == 0 && w == 0)
      break;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if ((i + j) % 2 == 0)
          cout << "#";
        else
          cout << ".";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int h, w, i, j;
  while (1) {
    cin >> h >> w;
    if (h == 0 && w == 0)
      break;
    for (i = 0; i < h; i++) {
      for (j = 0; i < w; j++) {
        if ((i + j) % 2 == 0)
          cout << "#";
        else
          cout << ".";
      }
      cout << "\\n";
    }
    cout << endl;
  }
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iomanip>
#include <iostream>
using namespace std;

int main() {
  int h, w;
  cin >> h >> w;
  while (h != 0 || w != 0) {
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if ((i + j) % 2 == 0) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
    cin >> h >> w;
  }
}

Error: TLE

Fixed submission:

#include <iomanip>
#include <iostream>
using namespace std;

int main() {
  int h, w;
  cin >> h >> w;
  while (h != 0 || w != 0) {
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if ((i + j) % 2 == 0) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  while (true) {
    int h, w;
    cin >> h >> w;
    if (h == 0 && w == 0)
      break;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++)
        if ((i ^ j) & 1)
          cout << '.';
        else
          cout << '#';
      cout << endl;
    }
    cout << endl;
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  while (true) {
    int h, w;
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++)
        if (i ^ j & 1)
          cout << '.';
        else
          cout << '#';
      cout << endl;
    }
    cout << endl;
  }
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  while (true) {
    int H, W;
    cin >> H >> W;

    if (H == 0 && W == 0)
      break;

    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if ((i + j) % 2 == 0) {
          cout << '#';
        } else {
          cout << '.';
        }
      }
      cout << endl;
    }
    cout << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>

int main() {
  int W, H;
  while (1) {
    std::cin >> W >> H;
    for (int i = 1; i <= H; i++) {
      for (int j = 1; j <= W; j++) {
        if ((i + j) % 2 == 0) {
          std::cout << ".";
        } else {
          std::cout << "#";
        }
        // std::cout <<endl;
      }
      // std::cout <<endl;
    }
  }

  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main(void) {
  int H, W;
  int checkH = 1;
  int checkW = 1;

  while (true) {
    cin >> H >> W;

    if (H == 0 && W == 0)
      break;

    checkH = 1;
    checkW = 1;
    for (int h = 0; h < H; ++h) {
      checkW = checkH;
      for (int w = 0; w < W; ++w) {
        if (checkW == 1) {
          cout << "#";
          checkW = 0;
        } else {
          cout << ".";
          checkW = 1;
        }
      }
      cout << endl;

      if (checkH == 1) {
        checkH = 0;
      } else {
        checkH = 1;
      }
    }
    cout << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main(void) {
  int H, W;
  int checkH = 1;
  int checkW = 1;

  while (true) {
    cin >> H >> W;

    for (int h = 0; h < H; ++h) {
      checkW = checkH;
      for (int w = 0; w < W; ++w) {
        if (checkW == 1) {
          cout << "#";
          checkW = 0;
        } else {
          cout << ".";
          checkW = 1;
        }
      }
      cout << endl;
      if (checkH == 1) {
        checkH == 0;
      } else {
        checkH == 1;
      }
    }
    cout << endl;
  }
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main() {
  int H, W, x, y;
  scanf("%d %d", &H, &W);
  while (!(H == 0 && W == 0)) {
    for (y = 0; y < H; y++) {
      for (x = 0; x < W; x++) {
        if (x % 2 == 0 && y % 2 == 0) {
          printf("#");
        } else if (x % 2 == 0 && y % 2 == 1) {
          printf(".");
        } else if (x % 2 == 1 && y % 2 == 0) {
          printf(".");
        } else if (x % 2 == 1 && y % 2 == 1) {
          printf("#");
        }
      }
      printf("\\n");
    }
    printf("\\n");
    scanf("%d %d", &H, &W);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main() {
  int W, H, x, y, z, h, w;
  scanf("%d %d", &W, &H);
  for (;;) {
    if (W == 0 && H == 0) {
      return 0;
    }
    h = H / 2;
    w = W / 2;
    for (y = 0; y < h; y++) {
      for (x = 0; x < w; x++) {
        printf("#.");
      }
      printf("\\n");
      for (z = 0; z < w; z++) {
        printf(".#");
      }
      printf("\\n");
    }
    printf("\\n");
  }
}
Problem p02405 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  int H, W, i, j, a, b;
  char x[H][W];

  while (1) {
    cin >> H >> W;

    if (H == 0 && W == 0)
      break;

    for (i = 0; i < H; i++) {
      for (j = 0; j < W; j++) {
        /*if(i==0 && j==0){
                cout<<'#';
                x[i][j]='#';
        }
        if(x[i][j-1]=='#'){
                cout<<".";
                x[i][j]='.';
        }
        else if(x[i][j-1]=='.'){
                cout<<"#";
                x[i][j]='#';
        }
        else if(i>0 && x[i-1][0]=='#'){
                cout<<".";
                x[i][j]='.';
        }
        else if(i>0 && x[i-1][0]=='.'){
                cout<<"#";
                x[i][j]='#';
        }*/
        if ((i + j) % 2 == 0)
          cout << "#";
        else
          cout << ".";
      }
      cout << endl;
    }
    cout << endl;
  }
}


Error: WA

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int H, W, i, j, a, b;
  char x[H][W];

  while (1) {
    cin >> H >> W;

    if (H == 0 && W == 0) {
      // cout<<endl;
      break;
    }
    for (i = 0; i < H; i++) {
      for (j = 0; j < W; j++) {
        if (i == 0 && j == 0) {
          cout << '#';
          x[i][j] = '#';
        }
        if (x[i][j - 1] == '#') {
          cout << ".";
          x[i][j] = '.';
        } else if (x[i][j - 1] == '.') {
          cout << "#";
          x[i][j] = '#';
        } else if (i > 0 && x[i - 1][0] == '#') {
          cout << ".";
          x[i][j] = '.';
        } else if (i > 0 && x[i - 1][0] == '.') {
          cout << "#";
          x[i][j] = '#';
        }
      }
      cout << endl;
    }
    cout << endl;
  }
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>
int main() {
  int a[100], b[100], i = 0;
  do {
    scanf("%d %d", &a[i], &b[i]);
    i++;
  } while (a[i - 1] != 0 && b[i - 1] != 0);
  for (int x = 0; x < i - 1; x++) {
    for (int y = 0; y < a[x]; y++) {
      if (y % 2 == 0) {
        for (int z = 0; z < b[x]; z++) {
          if (z % 2 == 0)
            printf("#");
          else
            printf(".");
        }
      }
      if (y % 2 == 1) {
        for (int z = 0; z < b[x]; z++) {
          if (z % 2 == 0)
            printf(".");
          else
            printf("#");
        }
      }
      printf("\\n");
    }
    printf("\\n");
  }
}

Error: TLE

Fixed submission:

#include <stdio.h>
int main() {
  int a[100], b[100], i = 0;
  do {
    scanf("%d %d", &a[i], &b[i]);
    i++;
  } while (a[i - 1] != 0 && b[i - 1] != 0);
  for (int x = 0; x < i - 1; x++) {
    for (int y = 0; y < a[x]; y++) {
      if (y % 2 == 0) {
        for (int z = 0; y < b[x]; z++) {
          if (z % 2 == 0)
            printf("#");
          else
            printf(".");
        }
      }
      if (y % 2 == 1) {
        for (int z = 0; y < b[x]; z++) {
          if (z % 2 == 0)
            printf(".");
          else
            printf("#");
        }
      }
      printf("\\n");
    }
    printf("\\n");
  }
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int H, W;
  while (1) {
    cin >> H >> W;
    if (H == 0 && W == 0) {
      break;
    }
    for (int n = 0; n < H; n++) {
      for (int i = 0; i < W; i++) {
        if (i % 2 == 0 && n % 2 == 0) {
          cout << "#";
        } else if (i % 2 == 1 && n % 2 == 1) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int H, W;
  while (1) {
    cin >> H >> W;
    for (int n = 0; n < H; n++) {
      for (int i = 0; i < W; i++) {
        if (n % 2 == 0) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fr first
#define sc second
#define scl(n) scanf("%lld", &n)
#define scd(n) scanf("%lf", &n)
#define scc(n) scanf(" %c", &n)
#define scs(n) scanf(" %s", n)
#define pll pair<ll, ll>
#define bigprime 9867589359258017
#define pbase 925943
#define pmod 1351782499
#define pi acos(-1.0)

int main() {
  ll n, m, i, j;
  while (1) {
    scl(n);
    scl(m);
    if (n == 0 && m == 0)
      break;
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) {
        if (i % 2 == 1) {
          if (j % 2 == 1)
            printf("#");
          else
            printf(".");
        } else {
          if (j % 2 == 0)
            printf("#");
          else
            printf(".");
        }
      }
      cout << endl;
    }
    cout << endl;
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, m, t;
  while (1) {
    cin >> n >> m;
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) {
        if (i % 2 == 0 && j % 2 == 1)
          printf(".");
        if (i % 2 == 1 && j % 2 == 0)
          printf(".");
        if (i % 2 == 0 && j % 2 == 0)
          printf("#");
        if (i % 2 == 1 && j % 2 == 1)
          printf("#");
      }
      printf("\\n");
    }
  }
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int H, W;

  while (1) {
    cin >> H >> W;
    if (H == 0 && W == 0)
      break;

    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if ((i + j) % 2 == 0) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << "\\n";
    }
    cout << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int H, W;
  cin >> H >> W;
  while (1) {
    if (H == 0 && W == 0)
      break;
    for (int i; i < H; i++) {
      for (int j; j < W; j++) {
        if ((i + j) % 2 == 0) {
          cout << ".";
        } else {
          cout << "#";
        }
        cout << "\\n";
      }
      cout << endl;
    }
  }
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int H = 0, W = 0;
  while (1) {
    cin >> H >> W;
    if (H == 0 && W == 0)
      break;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if (i % 2 == 0 && j % 2 == 0)
          cout << "#";
        if (i % 2 == 0 && j % 2 != 0)
          cout << ".";
        if (i % 2 != 0 && j % 2 == 0)
          cout << ".";
        if (i % 2 != 0 && j % 2 != 0)
          cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int H = 0, W = 0;
  while (1) {
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if (i % 2 == 0 && j % 2 == 0)
          cout << "#";
        if (i % 2 == 0 && j % 2 != 0)
          cout << ".";
        if (i % 2 != 0 && j % 2 == 0)
          cout << ".";
        if (i % 2 != 0 && j % 2 != 0)
          cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;

int main() {
  for (int W = 0;; W++) {
    int A, B;
    cin >> A >> B;
    if (A == 0 && B == 0) {
      break;
    }
    for (int X = 0; X < A; X++) {

      if (X % 2 == 0) {
        for (int Y1 = 0; Y1 < B; Y1++) {
          if (Y1 % 2 == 0) {
            cout << "#";
          } else
            cout << ".";
        }
        cout << endl;
      }

      if (X % 2 != 0) {
        for (int Y2 = 0; Y2 < B; Y2++) {
          if (Y2 % 2 == 0) {
            cout << ".";
          } else
            cout << "#";
        }
        cout << endl;
      }
    }
    cout << endl;
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  for (int W = 0;; W++) {
    int A, B;
    cin >> A >> B;
    for (int X = 0; X < A; X++) {

      if (X % 2 == 0) {
        for (int Y1 = 0; Y1 < B; Y1++) {
          if (Y1 % 2 == 0) {
            cout << "#";
          } else
            cout << ".";
        }
        cout << endl;
      }

      else
        for (int Y2 = 0; Y2 < B; Y2++) {
          if (Y2 % 2 == 0) {
            cout << ".";
          } else
            cout << "#";
        }
      cout << endl;

      cout << endl;
    }
  }
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int W, H = 0;
  char c = '#';
  cin >> H >> W;
  do {
    for (int i = 0; i < H; i++) {
      if (i % 2 == 0) {
        c = '#';
      } else {
        c = '.';
      }
      for (int j = 0; j < W; j++) {
        cout << c;
        if (c == '#') {
          c = '.';
        } else {
          c = '#';
        }
      }
      cout << endl;
    }
    cout << endl;
    cin >> H >> W;
  } while ((H != 0) || (W != 0)); //?¶??¶??????¶
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int W, H = 0;
  char c = '#';
  cin >> H >> W;
  do {
    for (int i = 0; i < H; i++) {
      if (i % 2 == 0) {
        c = '#';
      } else {
        c = '.';
      }
      for (int j = 0; j < W; j++) {
        cout << c;
        if (c == '#') {
          c = '.';
        } else {
          c = '#';
        }
      }
      cout << endl;
    }
  } while ((H != 0) || (W != 0)); //?¶??¶??????¶
  return 0;
}
Problem p02405 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  while (1) {
    int h, w;
    cin >> h >> w;
    if (h == 0 && w == 0) {
      break;
    }
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if ((i + j) % 2 == 0) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  while (1) {
    int h, w;
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if ((i + j) % 2 == 0) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
}