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


#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
  int i, j, x, y;
  x = 0;
  y = 0;
  i = 0;
  j = 0;
  while (1) {
    cin >> x >> y;
    if (x == 0 && y == 0)
      break;
    for (i = 1; i <= x; i++) {
      for (j = 1; j <= y; j++) {
        printf("#");
      }
      printf("\\n");
      j = 0;
    }
    printf("\\n");
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
  int i, j, x, y;
  i = 0;
  j = 0;
  while (1) {
    cin >> x >> y;
    if (x == 0 && y == 0) {

      break;
    }

    while (i = x) {
      while (j == y) {
        cout << "#";
        j++;
      }
      cout << endl;
      i++;
      j = 0;
    }
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>;
using namespace std;
int main() {
  int H, W, i, j;
  while (1) {
    cin >> H >> W;
    if (W == 0 && H == 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;
  while (1) {
    cin >> H >> W;
    for (i = 0; i < H; i++) {
      if (W == 0 && H == 0)
        break;
      for (j = 0; j < W; j++) {
        cout << "#";
      }
      cout << endl;
    }
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int h;
  int w;
  int a;
  while (true) {
    cin >> h >> w;
    if (h == 0 && w == 0)
      break;
    while (h > 0) {
      a = w;
      while (a > 0) {
        cout << "#";
        a--;
      }
      cout << endl;
      h--;
    }
    cout << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int h;
  int w;
  int a;
  while (true) {
    h = 3;
    w = 4;
    if (h == 0 && w == 0)
      break;
    while (h > 0) {
      a = w;
      while (a > 0) {
        cout << "#";
        a--;
      }
      cout << endl;
      h--;
    }
    cout << endl;
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int a, b, j;
  while (cin >> a >> b, a || b) {
    for (; a; a--) {
      for (j = b; j; j--)
        cout << "#";
      cout << endl;
    }
    cout << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int a, b, j;
  while (cin >> a >> b, a || b) {
    for (; a; a--) {
      for (j = b; j; j++)
        cout << "#";
      cout << endl;
    }
    cout << endl;
  }
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <strings.h>
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 k = 0; k < b; k++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
    cin >> a >> b;
  }
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  while (true) {
    if (a == 0 && b == 0)
      break;
    for (int s = 0; s < b; s++) {
      for (int d = 0; d < a; d++) {
        printf("#");
      }
      printf("\\n");
    }
  }
}
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 (W == 0 && H == 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;
  while (cin >> H >> W) {
    if (W == 0 || H == 0) {
      break;
    }
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; i++) {
        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, a, b;
  for (;;) {
    cin >> h >> w;
    if (h == 0 && w == 0) {
      return 0;
    }
    a = h;
    b = w;
    for (h = a; h > 0; h = h - 1) {
      for (w = b; w > 0; w = w - 1) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int h, w, a, b;
  for (;;) {
    cin >> h >> w;
    a = h;
    b = w;
    for (h = a; h > 0; h = h - 1) {
      for (w = b; w > 0; w = w - 1) {
        cout << "#";
      }
      cout << 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 j = 0; j < h; j++) {
      for (int i = 0; i < w; i++) {
        cout << "#";
      };
      cout << endl;
    };
    cout << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int x, y;
  while (1) {
    cin >> x >> y;
    if (x == 0 && y == 0) {
      break;
    } else {
      for (int i = 1; i <= x; x++) {
        for (int n = 1; n <= y; y++) {
          cout << '#';
        }
        cout << endl;
      }
      cout << endl;
    }
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  while (1) {
    int a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      break;
    for (int i = 1; i <= a; i++) {
      for (int j = 1; j <= b; j++) {
        cout << "#";
      }
      cout << "\\n";
    }
    cout << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

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

        cout << "#";
      }
      cout << endl;
    }
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {

  while (1) {
    int H, W;
    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 << endl;
    }
    cout << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int H, W;
  cin >> H >> W;
  while (1) {
    if (W == 0 && H == 0)
      break;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        cout << "#";
      }
      cout << endl;
    }
  }
  return 0;
}
Problem p02403 (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++) {
      for (int z = 0; z < b[x]; z++) {
        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] != 0 && b[i] != 0);
  for (int x = 0; x < i; i++) {
    for (int y = 0; y < a[x]; y++) {
      for (int z = 0; z < b[x]; z++)
        printf("#");
    }
    printf("\\n");
  }
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

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

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int d, r;
  while (1) {
    cin >> d >> r;
    if (d != 0 || r != 0) {
      for (int i = 0; i < r; i++) {
        for (int j = 0; j < d; 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;
  while (1) {
    cin >> H >> W;

    if (H == 0 && W == 0) {
      break;
    }
    for (int i = 0; i < H; i++) {
      for (int ii = 0; ii < W; ii++) {
        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;
    if (H == 0 || W == 0) {
      H = W = -1;
      if (H == 0 && W == 0) {
        break;
      }
    }
    for (int i = 0; i < H; i++) {
      for (int ii = 0; ii < W; ii++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }

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

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

int main() {
  int H = 0, W = 0;
  int i, k;

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

    for (k = 0; k < H; k++) {
      for (i = 0; i < W; i++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int H = 0, W = 0;
  int i, k;

  cin >> H >> W;
  while (1) {
    if (H == 0 && W == 0) {
      break;
    }
    for (k = 0; k < H; k++) {
      for (i = 0; i < W; i++) {
        cout << "#";
      }
      cout << endl;
    }
  }

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

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

typedef long long ll;
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
using namespace std;

int main() {
  int H, W;
  while (true) {
    cin >> H >> W;
    if ((H != 0) || (W != 0)) {
      REP(i, H) {
        REP(j, W) { cout << "#"; }
        cout << endl;
      }
      cout << endl;
    } else
      break;
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

typedef long long ll;
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
using namespace std;

int main() {
  int H, W;
  while (true) {
    cin >> H >> W;
    if ((H != 0) || (W != 0)) {
      REP(i, H) {
        REP(j, W) { cout << "#"; }
        cout << endl;
      }
      cout << endl;
    }
  }

  return 0;
}
Problem p02403 (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 i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#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 i = 0; i < H; i++) {
      for (int j = 0; j < W; i++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

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

#include <iostream>
using namespace std;
int main() {
  int i, j, h, w;
  while (1) {
    cin >> h >> w;
    if (h == 0 && w == 0)
      break;
    for (i = 0; i <= h - 1; i++) {

      for (j = 0; j <= w - 2; j++) {
        cout << "#";
      }
      cout << "#" << endl;
    }
    cout << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int i, j, 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++) {
        cout << "#";
      }
    }
  }
  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;
  }
  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 = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

//============================================================================
// Name        : (^o^).cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
  int a, b, t, m;
  t = 0;
  m = 0;
  while (1) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      return 0;
    }
    while (1) {
      cout << "#";
      t++;
      if (t == b) {
        cout << endl;
        t = 0;
        m++;
      }
      if (m == a) {
        m = 0;
        break;
      }
    }
    cout << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

//============================================================================
// Name        : (^o^).cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
  int a, b, t, m;
  t = 1;
  m = 0;
  while (1) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      return 0;
    }
    while (1) {
      cout << "#";
      t++;
      if (t == b) {
        cout << "#" << endl;
        t = 1;
        m++;
      }
      if (m == a) {
        m = 0;

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

#include <iostream>
using namespace std;

int main() {
  int a, b;
  for (int i = 0; i >= 0; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0)
      break;
    for (int j = 0; j < a; j++) {
      for (int k = 0; k < b; k++) {
        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;
    if (H == 0 && W == 0) {
      break;
    }
    for (int i = 0; i < H; i++) {
      for (int j = 0; i < W; j++) {
        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 (true) {
    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;
  while (true) {
    cin >> H >> W;
    if (H == 0 && W == 0)
      break;
    for (int i = 0; i < H; ++i) {
      for (int j = 0; i < W; ++j) {
        cout << '#';
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>
int main() {
  int H[10000], W[10000];
  int length;
  int i = 0, j, k;
  do {
    scanf("%d %d", &H[i], &W[i]);
    i += 1;
  } while (H[i - 1] != 0 || W[i - 1] != 0);
  length = i;
  for (i = 0; i < length - 1; i++) {
    for (j = 0; j < H[i]; j++) {
      for (k = 0; k < W[i]; k++) {
        printf("#");
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>
int main() {
  int H[10000], W[10000];
  int length;
  int i = 0, j, k;
  do {
    scanf("%d %d");
    i += 1;
  } while (H[i - 1] == 0 || W[i - 1] == 0);
  length = i;
  for (i = 0; i < length - 1; i++) {
    for (j = 0; j < H[i]; j++) {
      for (k = 0; k < W[i]; k++) {
        printf("#");
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Runtime Error

#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++) {
      for (int j = 0; j < w; j++) {
        printf("#");
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}


Error: -11

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++) {
      for (int j = 0; j < w; j++) {
        printf("#");
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main(void) {
  int x, y;
  int i, j;
  while (1) {
    scanf("%d %d\\n", &x, &y);
    if (x == 0 && y == 0)
      break;
    for (i = 0; i < x; i++) {
      for (j = 0; j < y; j++) {
        printf("#");
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <stdio.h>

int main(void) {
  int x, y;
  int i, j;
  while (1) {
    scanf("%d %d\\n", &x, &y);
    for (i = 0; i < x; i++) {
      for (j = 0; j < y; j++) {
        printf("#");
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>

using namespace std;

int main() {
  int h = 1, w = 1;

  while (1) {
    cin >> h >> w;
    if (h == 0 && w == 0) {
      return 0;
    };
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        cout << '#';
      }
      cout << endl;
    }
    cout << endl;
  }
}

Error: TLE

Fixed submission:

#include <cstdio>
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>

using namespace std;

int main() {
  int h = 1, w = 1;
  while (1) {
    cin >> h >> w;
    if (h == w == 0)
      break;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        cout << '#';
      }
      cout << endl;
    }
    cout << endl;
  }
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int tate = 1, yoko = 1;
  while (1) {
    cin >> tate >> yoko;
    if (tate == 0 && yoko == 0)
      break;
    for (int i = 0; i < tate; i++) {
      for (int j = 0; j < yoko; j++) {
        printf("#");
      }
      printf("\\n");
    }
    printf("\\n");
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int tate = 1, yoko = 1;
  while (1) {
    cin >> tate >> yoko;
    if (tate == 0 && yoko == 0)
      for (int i = 0; i < tate; i++) {
        for (int j = 0; j < yoko; j++) {
          printf("#");
        }
        printf("\\n");
      }
    printf("\\n");
  }
  return 0;
}
Problem p02403 (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++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
}


Error: TLE

Fixed submission:

#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; i < W; j++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>

using namespace std;

int main(void) {
  int h, w;
  while (true) {
    cin >> h >> w;
    if (h == 0 && w == 0)
      break;
    for (int i = 0; i < h; i++) {
      for (int i = 0; i < w; i++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>

using namespace std;

int main(void) {
  int h, w;
  while (true) {
    cin >> h >> w;
    for (int i = 0; i < w; i++) {
      for (int i = 0; i < h; i++) {
        cout << "#";
      }
      cout << 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 n = 0; n < W; n++) {
        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;
    if (H == 0 && W == 0) {
      break;
    }
    for (int i = 0; i < H; H++) {
      for (int n = 0; n < W; W++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

void drawRectangle(int H, int W) {
  int i, j;

  for (i = 0; i < H; i++) {
    for (j = 0; j < W; j++) {
      printf("#");
    }
    printf("\\n");
  }
  printf("\\n");
  return;
}

int main(void) {
  int H, W;

  for (;;) {
    scanf("%d%d", &H, &W);
    if (0 == H && 0 == W) {
      break;
    }

    drawRectangle(H, W);
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>
int main(void) {
  int H, W, flag = 1;

  while (flag = 1) {
    scanf("%d%d", &H, &W);
    if (H != 0 && W != 0) {
      for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
          printf("#");
        }
        printf("\\n");
      }
    } else
      flag = 0;
  }
}
Problem p02403 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {

  int H, W;
  cin >> H >> W;

  while (1) {
    if ((H == 0) && (W == 0))
      break;
    for (int h = 1; h <= H; h++) {
      for (int w = 1; w <= W; w++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
    cin >> H >> W;
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {

  int H, W, h, w;
  cin >> h >> w;

  while (1) {
    for (h = 1; h <= H; h++) {
      for (w = 1; w <= W; w++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
    cin >> h >> w;
  }

  return 0;
}