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

#include <iostream>
using namespace std;

int main() {
  int W, H;

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

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

    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {

        cout << "#";
      }
      cout << "\\n";
    }

    cout << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int w, h, i, j;

  cin >> w >> h;

  while (1) {
    for (i = 0; i < h; i++) {
      for (j = 0; j < w; j++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }

  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  int i, j;
  int h, w;

  while (1) {
    scanf("%d %d", &h, &w);
    if (!(h || w))
      break;
    for (i = 0; i < h; i++) {
      for (j = 0; j < w; j++)
        printf("#");
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>

int main() {
  int i, j;
  int h, w;

  while (1) {
    scanf("%d %d", h, w);
    if (!(h || w))
      break;
    for (i = 0; i < h; i++) {
      for (j = 0; j < w; j++)
        printf("#");
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
int main() {
  int H, W;
  while (true) {
    std::cin >> H >> W;
    if (0 == H && 0 == W)
      break;
    for (int a = 0; a < H; a++) {
      for (int b = 0; b < W; b++) {
        std::cout << "#";
      }
      std::cout << std::endl;
    }
    std::cout << std::endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
int main() {
  int H, W;
  std::cin >> H >> W;
  while (true) {
    if (0 == H && 0 == W)
      break;
    for (int a = 0; a < H; a++) {
      for (int b = 0; b < W; b++) {
      }
    }
    std::cout << " " << std::endl;
  }
}
Problem p02403 (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++) {

        cout << "#";
      }

      cout << "\\n";
    }

    cout << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#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 < W; i++) {

      for (int j = 0; j < H; i++) {

        cout << "#";
      }

      cout << "\\n";
    }

    cout << endl;
  }

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

#include <iostream>
using namespace std;
int main() {
  int H, W, i, j;
  for (;;) {

    cin >> H >> W;
    if (H == 0 && W == 0) {
      break;
    }
    for (i = 0; i < H; i++) {
      for (j = 0; j < W; j++) {

        cout << "#";
      }
      { cout << endl; }
    }
    cout << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int H, W, i, j;
  for (;;) {
    cin >> H >> W;
    for (i = 0; i < H; i++) {
      for (j = 0; j < W; j++) {
        if (H == 0 && W == 0) {
          break;
        }
        cout << "#";
      }
      { cout << endl; }
    }
    cout << endl;
  }

  return 0;
}
Problem p02403 (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++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
}


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 j = 0; j < w; j++) {
        cout << "#";
      }
      cout << endl;
      if (h == 0 && w == 0)
        break;
    }
  }
  cin >> h;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  while (!(a == 0 && b == 0)) {
    for (int i = 0; i < a; i++) {
      for (int j = 0; j < b; j++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
    cin >> a >> b;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  while (!(a == 0 && b == 0)) {
    for (int i = 0; i < a; i++) {
      for (int j = 0; j < b; j++) {
        cout << "#";
      }
      cout << endl;
    }
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int H, W;
  for (int r = 0;; r++) {
    cin >> H >> W;
    if (H == 0 && W == 0)
      break;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        cout << '#';
      }
      cout << endl;
    }
    cout << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int H, W;
  for (int r = 0;; r++) {
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        cout << '#';
      }
      cout << endl;
    }
  }

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

#include <cstdio>
#include <cstring>
int main() {
  char ss[301];
  int h, w, i, j;
  while (true) {
    scanf("%d %d", &h, &w);
    if ((h == 0) && (w == 0))
      break;
    strcpy(ss, "#");
    for (i = 0; i < w - 2; i++)
      strcat(ss, ".");
    strcat(ss, "#\\n");
    for (i = 0; i < w; i++)
      printf("#");
    printf("\\n");
    for (i = 0; i < h - 2; i++)
      printf(ss);
    for (i = 0; i < w; i++)
      printf("#");
    printf("\\n\\n");
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>
#include <cstring>
int main() {
  char ss[101];
  int h, w, i, j;
  while (true) {
    scanf("%d %d", &h, &w);
    if ((h == 0) && (w == 0))
      break;
    strcpy(ss, "#");
    for (i = 0; i < w - 2; i++)
      strcat(ss, ".");
    strcat(ss, "#\\n");
    for (i = 0; i < w; i++)
      printf("#");
    printf("\\n");
    for (i = 0; i < h - 2; i++)
      printf(ss);
    for (i = 0; i < w; i++)
      printf("#");
    printf("\\n\\n");
  }
  return 0;
}
Problem p02404 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int a, b;
  while (1) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      break;
    }
    for (int i = 1; i <= a; i++) {
      for (int j = 1; j <= b; j++) {
        if (i == 1 || j == 1 || i == a || j == b) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int a, b;
  while (1) {
    cin >> a >> b;
    for (int i = 1; i <= a; i++) {
      for (int j = 1; j <= b; j++) {
        if (i == 1 || j == 1 || i == a || j == b) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}
Problem p02404 (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;
    }
    if (H == 0 || W == 0) {
      H = W = 0;
    }
    for (int i = 0; i < W; i++) {
      cout << "#";
      W -= 1;
      if (i == W) {
        cout << endl;
      }
      W += 1;
    }
    H -= 2;
    W -= 2;
    for (int i = 0; i < H; i++) {
      cout << "#";

      for (int ii = 0; ii < W; ii++) {
        cout << ".";
      }
      cout << "#" << endl;
    }
    W += 2;
    for (int i = 0; i < W; i++) {
      cout << "#";
      W -= 1;
      if (i == W) {
        cout << endl << endl;
        ;
      }
      W += 1;
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

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

      for (int ii = 0; ii < W; ii++) {
        cout << ".";
      }
      cout << "#" << endl;
    }
    W += 2;
    for (int i = 0; i < W; i++) {
      cout << "#";
    }
    if (H > 0 && W > 0) {
      cout << endl;
    }
  }

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

#include <iostream>

using namespace std;

int main() {
  int h, w;
  cin >> h >> w;
  while (h || w) {
    for (int i = 0; i < w; ++i) {
      cout << "#";
    }
    cout << endl;
    for (int i = 1; i < h - 1; ++i) {
      cout << "#";
      for (int j = 1; j < w - 1; ++j) {
        cout << ".";
      }
      cout << "#" << endl;
    }
    for (int i = 0; i < w; ++i) {
      cout << "#";
    }
    cout << endl << endl;
    cin >> h >> w;
  }
}


Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

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

#include <iostream>
using namespace std;

int main() {
  int h, w;
  while (true) {
    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 == 0 || i == h - 1)
          cout << "#";
        else {
          if (j == 0 || j == w - 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 (true) {
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if (i == 0 || i == h - 1)
          cout << "#";
        else {
          if (j == 0 || j == w - 1)
            cout << "#";
          else
            cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}
Problem p02404 (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 < w; i++)
      cout << '#';
    cout << endl;
    for (int i = 2; i < h; i++) {
      cout << '#';
      for (int j = 2; j < w; j++)
        cout << '.';
      cout << '#' << endl;
    }
    for (int i = 0; i < w; i++)
      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 < w; i++)
      cout << '#';
    cout << endl;
    for (int i = 2; i < h; i++) {
      cout << '#';
      for (int j = 2; j < w; j++)
        cout << '.';
      cout << '#' << endl;
    }
    for (int i = 0; i < w; i++)
      cout << '#';
    cout << endl;
    cout << endl;
  }
}
Problem p02404 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

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


Error: TLE

Fixed submission:

#include <stdio.h>

int main() {
  int h, w;
  while (scanf("%d %d", &h, &w) && (h != 0 || w != 0)) {
    for (int i = 0; i < h; i++) {
      printf("#");
      for (int j = 0; i < h - 2; j++) {
        printf(".");
      }
      printf("#\\n");
    }
    printf("\\n");
  }
  return 0;
}
Problem p02404 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int w, h, a, b;
  while (1) {
    cin >> h >> w;
    if (h == 0 && w == 0) {
      break;
    }
    w -= 2;
    a = w;
    b = h;
    for (; h > 0; h--) {
      cout << '#';
      for (w = a; w > 0; w--) {
        if (h == b || h == 1) {
          cout << '#';
        } else {
          cout << '.';
        }
      }
      cout << '#';
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int w, h, a, b;
  while (1) {
    cin >> h >> w;
    w -= 2;
    a = w;
    b = h;
    if (h == 0 && w == 0) {
      break;
    }
    for (; h > 0; h--) {
      cout << '#';
      for (w = a; w > 0; w--) {
        if (h == b || h == 1) {
          cout << '#';
        } else {
          cout << '.';
        }
      }
      cout << '#';
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}
Problem p02404 (C++) — buggy submission, verdict: Runtime Error

#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 == 0 || i == H - 1) {
          printf("#");
        } else {
          if (j == 0 || j == W - 1) {
            printf("#");
          } else {
            printf(".");
          }
        }
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}

Error: -11

Fixed submission:

#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 == 0 || i == H - 1) {
          printf("#");
        } else {
          if (j == 0 || j == W - 1) {
            printf("#");
          } else {
            printf(".");
          }
        }
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}
Problem p02404 (C++) — buggy submission, verdict: Time Limit Exceeded

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

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

    if (H == 0 && W == 0)
      break;
    for (int a = 0; a < W; a++) {
      printf("#");
    }
    printf("\\n");

    for (int b = 0 + 1; b < H - 1; b++) {
      printf("#");
      for (int c = 0 + 1; c < W - 1; c++) {
        printf(".");
      }
      printf("#");
      printf("\\n");
    }

    for (int d = 0; d < W; d++) {
      printf("#");
    }
    printf("\\n");
    printf("\\n");
  }

  return 0;
}

Error: TLE

Fixed submission:

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

int vartical = 0;
int a = 0;
int b = 0;
int c = 0;

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

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

    while (1) {
      if (vartical == H - 1) {
        c = 0;
        for (; c < W; ++c) {
          printf("#");
        }
        printf("\\n");
        vartical = 0;
        break;
      }

      if (vartical == 0) {
        a = 0;
        for (; a < W; ++a) {
          printf("#");
        }
        printf("\\n");
        ++vartical;
      }

      if (vartical != 0 && vartical != H - 1) {
        b = 0;
        for (; b < W; ++b) {

          if (b == 0 || b == W - 1) {
            printf("#");
          }

          if (b != 0 && b != W - 1) {
            printf(".");
          }
          printf("\\n");
          ++vartical;
        }
      }
    }
  }
}
Problem p02404 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int H, W;
  while (true) {
    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 == 0 || i == H - 1) {
          cout << "#";
        } else if (j == 0 || j == W - 1) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int H, W;
  while (true) {
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
}
Problem p02404 (C++) — buggy submission, verdict: Time Limit Exceeded


#include <cstdio>

int main() {
  int H, W;
  for (int c = 1;; c++) {
    scanf("%d %d", &H, &W);
    if (H == 0 && W == 0) {
      break;
    } else if (H != 0 && W != 0) {
      for (int i = 1; i <= H; i++) { // 高さ1からHまで
        if (i == 1) {                // 高さ1の行
          for (int j = 1; j <= W; j++) {
            if (j < W) {
              printf("#");
            } else {
              printf("#\\n");
            }
          }
        } else if (2 <= i && i <= H - 1) { // 高さ2~H-1の行
          for (int k = 1; k <= W; k++) {
            if (k == 1) {
              printf("#");
            } else if (2 <= k && k <= W - 1) {
              printf(".");
            } else {
              printf("#\\n");
            }
          }
        } else { // 高さHの行
          for (int l = 1; l <= W; l++) {
            if (l < W) {
              printf("#");
            } else {
              printf("#\\n\\n");
            }
          }
        }
      }
    }
  }
  return 0;
}


Error: TLE

Fixed submission:


#include <cstdio>

int main() {
  int H, W;
  for (;;) {
    scanf("%d %d\\n", &H, &W);
    if (H == 0 && W == 0) {
      break;
    } else {
      for (;;) {
        for (int i = 1; i <= H; i++) { // 高さ1からHまで
          if (i == 1) {                // 高さ1の行
            for (int j = 1; j <= W; j++) {
              if (j < W) {
                printf("#");
              } else {
                printf("#\\n");
              }
            }
          } else if (2 <= i && i <= H - 1) { // 高さ2~H-1の行
            for (int k = 1; k <= W; k++) {
              if (k < W) {
                printf("#");
              } else {
                printf("#\\n");
              }
            }
          } else { // 高さHの行
            for (int l = 1; l <= W; l++) {
              if (l < W) {
                printf("#");
              } else {
                printf("#\\n");
              }
            }
          }
        }
      }
    }
  }
  return 0;
}
Problem p02404 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int H, W, i, j;
  for (;;) {
    cin >> H >> W;
    if (H == 0 && W == 0) {
      break;
    }
    for (i = 1; i <= H; i++) {
      for (j = 1; j <= W; j++) {

        if (i == 1 || i == H || j == 1 || j == W) {
          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;
  for (;;) {
    cin >> H >> W;
    for (i = 1; i <= H; i++) {
      for (j = 1; j <= W; j++) {
        if (H == 0 && W == 0) {
          break;
        } else if (i == 1 || i == H || j == 1 || j == W) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}
Problem p02404 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

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

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int i, j, W, H;
  while (cin >> H >> W, H || W) {
    for (i = 1; i <= H; i++) {
      for (j = 1; j <= W; j++) {
        if (j = 1)
          cout << "#";
        else if (j = W)
          cout << "#";
        else
          cout << ".";
      }
      cout << endl;
    }
    cout << endl;
  }
}
Problem p02404 (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) {
    for (int i = 0; i < W; i++) {
      cout << "#";
    }
    cout << endl;
    for (int j = 1; j < H - 1; j++) {
      cout << "#";
      for (int k = 1; k < W - 1; k++) {
        cout << ".";
      }
      cout << "#" << endl;
    }
    for (int i = 0; i < W; i++) {
      cout << "#";
    }
    cout << endl << 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) {
    for (int i = 0; i < W; i++) {
      cout << "#";
    }
    cout << endl;
    for (int j = 1; j < H - 1; j++) {
      cout << "#";
      for (int k = 1; k < W - 1; k++) {
        cout << " ";
      }
      cout << "#" << endl;
    }
    for (int i = 0; i < W; i++) {
      cout << "#";
    }
    cout << endl << endl;
  }
  return 0;
}
Problem p02404 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int H, W;
  int i, j;
  while (1) {
    char fig1[301] = {0};
    char fig2[301] = {0};
    cin >> H >> W;
    if (H == 0 && W == 0)
      break;
    for (i = 0; i < W; i++) {
      fig1[i] = '#';
    }
    fig2[0] = '#';
    fig2[W - 1] = '#';
    for (i = 1; i < W - 1; i++) {
      fig2[i] = '.';
    }
    cout << fig1 << endl;
    for (i = 0; i < H - 2; i++) {
      cout << fig2 << endl;
    }
    cout << fig1 << endl;
    cout << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int H, W;
  int i, j;
  while (1) {
    char fig1[101] = {0};
    char fig2[101] = {0};
    cin >> H >> W;
    if (H == 0 && W == 0)
      break;
    for (i = 0; i < W; i++) {
      fig1[i] = '#';
    }
    fig2[0] = '#';
    fig2[W - 1] = '#';
    for (i = 1; i < W - 1; i++) {
      fig2[i] = '.';
    }
    cout << fig1 << endl;
    for (i = 0; i < H - 2; i++) {
      cout << fig2 << endl;
    }
    cout << fig1 << endl;
    cout << endl;
  }
  return 0;
}
Problem p02404 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main(void) {
  int H, W;
  scanf("%d %d", &H, &W);
  while (!(H == 0 && W == 0)) {
    for (int i = 0; i < W; ++i) {
      printf("#");
    }
    printf("\\n");
    for (int i = 0; i < H - 2; ++i) {
      printf("#");
      for (int j = 0; j < W - 2; ++j) {
        printf(".");
      }
      printf("#");
      printf("\\n");
    }
    for (int i = 0; i < W; ++i) {
      printf("#");
    }
    printf("\\n");
    printf("\\n");
    scanf("%d %d", &H, &W);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main(void) {
  int H, W;
  printf("%d %d", &H, &W);
  while (!(H == 0 && W == 0)) {
    for (int i = 0; i < W; ++i) {
      printf("#");
    }
    printf("_n");
    for (int i = 0; i < H - 2; ++i) {
      for (int j = 0; j < W - 2; ++j) {
        printf(".");
      }
      printf("#");
    }
    for (int i = 0; i < W; ++i) {
      printf("#");
    }
    printf("%d %d", &H, &W);
  }
  return 0;
}