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

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

int main() {
  int a, b, c;
  while (cin >> a >> b) {
    stringstream s;
    c = a + b;

    s << c;
    cout << s.str().size() << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

int main() {
  while (1) {
    int a, b, c;
    stringstream s;

    cin >> a >> b;
    c = a + b;

    s << c;
    cout << s.str().size() << endl;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int a, b;
  while (cin >> a >> b) {
    a = log10(a + b) + 1;
    cout << a << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int a, b, c, i, j;
  cin >> a >> b;
  for (i = 0; a < 10; i++) {
    c = a / 10;
    a = c;
  }
  for (j = 0; b < 10; j++) {
    c = b / 10;
    b = c;
  }
  c = a + b;
  cout << c << endl;
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>
int main() {
  int a = 0, b = 0;
  int c = 0;
  int count = 1;
  while (scanf("%d %d", &a, &b) != EOF) {
    c = a + b;
    while (1) {
      if (c / 10 < 10) {
        count++;
        break;
      } else {
        c /= 10;
        count++;
      }
    }
    printf("%d\\n", count);
    count = 1;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>
int main() {
  int a = 0, b = 0;
  int c = 0;
  int count = 1;
  while (scanf("%d %d", &a, &b)) {
    if (a == 0 && b == 0) {
      break;
    }
    c = a + b;
    while (1) {
      if (c / 10 < 10) {
        count++;
        break;
      } else {
        c /= 10;
        count++;
      }
    }
    printf("%d\\n", count);
    count = 1;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

int main() {

  int A, B, C, k;

  while (std::cin >> A >> B) {
    C = A + B;
    k = 0;
    while (C >= 1) {
      C /= 10;
      ++k;
    }
    std::cout << k << std::endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>

int main() {

  int a[200];
  int b[200];

  int i = 0, A;

  while (std::cin >> A) {
    a[i] = A;
    std::cin >> b[i];
    ++i;
  }
  int k;

  for (int j = 0; j < i; j++) {
    a[j] += b[j];
    k = 0;
    do {
      a[j] %= 10;
      ++k;
    } while (a[j] != 0);

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

#include <cstdio>
int main() {
  int a, b, c;
  while (scanf("%d", &a) != EOF) {
    scanf(" %d", &b);
    c = a + b;
    int cnt, i;
    i = 1;
    for (cnt = 0;; cnt++) {
      if (c / i == 0)
        break;
      i = i * 10;
    }
    printf("%d\\n", cnt);
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>
using namespace std;

int main() {
  int a, b;
  while (scanf("%d %d", &a, &b)) {
    int total = a + b, ans = 1;
    while (total > 10) {
      total /= 10;
      ++ans;
    }
    printf("%d\\n", ans);
  }
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>
using namespace std;

int main() {
  int a, b;
  while (scanf("%d %d", &a, &b) != EOF) {
    int total = a + b, ans = 1;
    while ((total / 1) >= 10) {
      total /= 10;
      ++ans;
    }
    printf("%d\\n", ans);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>
using namespace std;

int main() {
  int a, b;
  while (scanf("%d %d", &a, &b)) {
    int total = a + b, ans = 1;
    while ((total / 1) >= 10) {
      total /= 10;
      ++ans;
    }
    printf("%d\\n", ans);
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0002&lang=jp*/

#include <cmath>
#include <iostream>

using namespace std;

int main() {
  int a, b;
  while (cin >> a >> b) {
    cout << (int)(log10(a + b) + 1) << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0002&lang=jp*/

#include <cmath>
#include <iostream>

using namespace std;

int main() {
  while (true) {
    int a, b;
    cin >> a >> b;
    cout << (int)(log10(a + b) + 1) << endl;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int a, b;
  int answer[20];
  int count = 0;
  while (cin >> a >> b) {
    answer[count] = (int)log10(a + b) + 1;
    cout << answer[count] << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

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

int main() {
  int a, b;
  int answer[20];
  int count = 0;
  while (cin >> a >> b) {
    answer[count] = (int)log10(a + b) + 1;
    count++;
  }
  for (int i = 0; i < count; i++) {
    cout << answer[i] << endl;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int a, b;
  while (cin >> a >> b) {
    double temp = log10(a + b) + 1;
    cout << floor(temp) << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int a, b;
  while (scanf("%d %d", &a, &b)) {
    double temp = log10(a + b) + 1;
    cout << floor(temp) << endl;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int c = 0;

void keta(int A) {
  if (A > 9) {
    c++;
    keta(A / 10);
  }
  return;
}

int main() {
  int A, B, C;
  while (cin >> A >> B) {
    c = 0;
    A += B;
    keta(A);
    c++;
    cout << c << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int c = 0;

void keta(int C) {
  if (C > 9) {
    c++;
    keta(C / 10);
  }
  return;
}

int main() {
  while (1) {
    c = 0;
    int A, B, C;
    cin >> A >> B;
    C = A + B;
    keta(C);
    c++;
    cout << c << endl;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
  int a = 0, b = 0;
  int v;
  int i = 0;
  while (scanf("%d %d", &a, &b) != EOF) {
    int c = a + b;
    if (a + b < 10) {
      cout << "1" << endl;
    } else if (a + b < 100) {
      cout << "2" << endl;
    } else if (a + b < 1000) {
      cout << "3" << endl;
    } else if (a + b < 10000) {
      cout << "4" << endl;
    } else if (a + b < 100000) {
      cout << "5" << endl;
    } else if (a + b < 1000000) {
      cout << "6" << endl;
    } else {
      cout << "7" << endl;
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
  int a = 0, b = 0;
  int i = 0;
  while (1) {
    cin >> a >> b;
    int c = a + b;
    if (a + b < 10) {
      cout << "1" << endl;
    } else if (a + b < 100) {
      cout << "2" << endl;
    } else if (a + b < 1000) {
      cout << "3" << endl;
    } else if (a + b < 10000) {
      cout << "4" << endl;
    } else if (a + b < 100000) {
      cout << "5" << endl;
    } else if (a + b < 1000000) {
      cout << "6" << endl;
    } else {
      cout << "7" << endl;
    }
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  long long a, b, i, ans, sum = 0;
  while (cin >> a >> b) {
    ans = a + b;
    for (i = 0; ans > 0; i++) {
      ans = ans / 10;
      sum = sum + 1;
    }
    cout << sum << endl;
    sum = 0;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int a, b, i, ans, sum = 0;
  for (;;) {
    cin >> a >> b;
    ans = a + b;
    for (i = 0; ans > 0; i++) {
      ans = ans / 10;
      sum = sum + 1;
    }
    cout << sum << endl;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {

  while (true) {
    int a, b, sum;
    int count = 0;

    cin >> a;

    if (cin.eof())
      break;
    cin >> b;

    sum = a + b;

    for (int i = 1; sum != 0; i++) {

      sum /= 10;
      count = i;
    }

    cout << count << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int a, b, sum;
  int count = 1;
  while (true) {
    cin >> a >> b;
    sum = a + b;

    while (sum > 1) {

      sum = sum / 10;
      count++;
    }

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

#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int a = 0, b = 0, wa = 0, keta = 0;
  while (cin >> a >> b) {
    wa = a + b;
    keta = (int)log10(wa) + 1;
    cout << keta << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
#include <math.h>
using namespace std;
int main() {
  while (1) {
    int a = 0, b = 0, wa = 0, keta = 0;
    cin >> a >> b;
    wa = a + b;
    keta = (int)log10(wa) + 1;
    cout << keta << endl;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int i, o, b = 0, f;
  while (cin >> i >> o) {
    f = i + o;
    for (int j = 1; j <= 1000000; j = j * 10) {
      if (f >= j) {
        b++;
      } else {
        break;
      }
    }
    cout << b << endl;
    b = 0;
  }
  return 0;
}

Error: TLE

Fixed submission:

//
//  main.cpp
//  sanpie
//
//  Created by h3037178 on 2017/07/28.
//  Copyright ?? 2017??´ ?????£?????????. All rights reserved.
//

#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int i, o;
  for (;;) {
    cin >> i >> o;
    if (i + o < 10) {
      cout << "1" << endl;
    } else if (i + o < 100) {
      cout << "2" << endl;
    } else if (i + o < 1000) {
      cout << "3" << endl;
    } else if (i + o < 10000) {
      cout << "4" << endl;
    } else if (i + o < 100000) {
      cout << "5" << endl;
    } else if (i + o < 1000000) {
      cout << "6" << endl;
    } else {
      cout << "7" << endl;
    }
  }
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define REP(i, N) for (int i = 0; i < (int)N; i++)

int main() {
  int a, b;
  while (cin >> a >> b) {
    int c = a + b;
    if (c == 0) {
      cout << 0 << endl;
      continue;
    }
    int count = 1;
    while (c >= 10) {
      c /= 10;
      count++;
    }
    cout << count << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define REP(i, N) for (int i = 0; i < (int)N; i++)

int main() {
  int hako[200][2];
  int i = 0;
  while (cin >> hako[i][0] >> hako[i][1]) {
    i++;
  }
  REP(j, i) {
    int a = 0;
    int sum = hako[j][0] + hako[j][1];
    while (sum > 0)
      sum / 10, a++;
    cout << a << endl;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded


#include <iostream>
using namespace std;
int main() {
  int a, b, c;
  while (cin >> a >> b) {
    int ans = 0;
    c = a + b;
    while (c > 0) {
      ans = ans + 1;
      c = c / 10;
    }
    cout << ans << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int a, b, c, d;
  while (cin >> a >> b) {
    c = a + b;
    d = 0;
    while (a > 0, d++, a / 10)
      ;
    cout << d << endl;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main() {

  int l, m, n, i;

  while (1) {

    if (scanf("%d %d", &l, &m) == EOF)
      break;

    n = l + m;

    for (i = 1; n > 9; i++) {
      n /= 10;
    }

    printf("%d\\n", i);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main() {

  int l, m, n, i;

  while (1) {

    scanf("%d %d", &l, &m);
    if (l == EOF || m == EOF)
      break;
    n = l + m;

    for (i = 1; n >= 9; i++) {
      n /= 10;
    }

    printf("%d\\n", i);
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <math.h>
#include <string>
using namespace std;

int keta(int x) {
  int i = 0;
  while (x / pow(10, i) >= 1) {
    i++;
  }
  if (x == 0) {
    return 1;
  } else
    return i;
}
int main() {
  int a1, b1;
  while (cin >> a1 >> b1) {
    cout << keta(a1 + b1) << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <math.h>
#include <string>
using namespace std;

int keta(int x) {
  int i = 0;
  while (x / pow(10, i) >= 1) {
    i++;
  }
  return i;
}
int main() {

  while (true) {
    int a1, b1;
    cin >> a1 >> b1;
    cout << keta(a1) + keta(b1) << endl;
  }
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <functional>
#include <iostream>
using namespace std;

int main() {
  /*	int a[3];
          cin >> a[0] ;
          a[1] = 3;
          a[2] = a[0] * 10;

          cout << a[0] <<" " << a[1] <<" "<< a[2] << endl;

          for (int i = 0; i < 3; i++) {
                  cout << a[i] << endl;
          }


          sort(a,a+5);
  *//*
	int a[10];
	for (int i = 0; i < 10; i++) {
		cin >> a[i];
	}
	
	sort(a,a+10,greater<int>());

	for (int i = 0; i < 3; i++) {
		cout << a[i]<<endl;
	}
*/
  int ans = 0;
  int a, b, c;
  while (cin >> a >> b) {
    ans = 0;
    c = a + b;

    if (c == 0) {
      ans = 1;
    } else {
      while (c > 0) {
        c /= 10;
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
  ;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <functional>
#include <iostream>
using namespace std;

int main() {
  /*	int a[3];
          cin >> a[0] ;
          a[1] = 3;
          a[2] = a[0] * 10;

          cout << a[0] <<" " << a[1] <<" "<< a[2] << endl;

          for (int i = 0; i < 3; i++) {
                  cout << a[i] << endl;
          }


          sort(a,a+5);
  *//*
	int a[10];
	for (int i = 0; i < 10; i++) {
		cin >> a[i];
	}
	
	sort(a,a+10,greater<int>());

	for (int i = 0; i < 3; i++) {
		cout << a[i]<<endl;
	}
*/
  int ans = 0;
  int a, b, c;
  while (true) {
    ans = 0;
    cin >> a >> b;
    c = a + b;

    if (c == 0) {
      ans = 1;
    } else {
      while (c > 0) {
        c /= 10;
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
  ;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int a, b, c;
kuri:
  while (cin >> a >> b) {
    if (cin.eof()) {
      break;
    }
    c = a + b;
    if (c / 1000000 >= 1) {
      cout << "7" << endl;
      goto kuri;
    }
    if (c / 100000 >= 1) {
      cout << "6" << endl;
      goto kuri;
    }
    if (c / 10000 >= 1) {
      cout << "5" << endl;
      goto kuri;
    }
    if (c / 1000 >= 1) {
      cout << "4" << endl;
      goto kuri;
    }
    if (c / 100 >= 1) {
      cout << "3" << endl;
      goto kuri;
    }
    if (c / 10 >= 1) {
      cout << "2" << endl;
      goto kuri;
    } else {
      cout << "1" << endl;
      goto kuri;
    }
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int a, b, c;
  do {
    cin >> a >> b;
    c = a + b;
    if (c > 1000000)
      cout << "7" << endl;
    else if (c > 100000)
      cout << "6" << endl;
    else if (c > 10000)
      cout << "5" << endl;
    else if (c > 1000)
      cout << "4" << endl;
    else if (c > 100)
      cout << "3" << endl;
    else if (c > 10)
      cout << "2" << endl;
    else
      cout << "1" << endl;
  } while (true);
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

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

{
  int a, b;
  while (cin >> a >> b) {
    cout << (int)log10(a + b) + 1 << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <cmath>
#include <iostream>
using namespace std;
int main() {
  int a, b;
  for (int i = 1; i > 0;) {
    cin >> a >> b;
    cout << (int)log10(a + b) + 1 << endl;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  int a, b, c = 0;
  while (cin >> a >> b) {
    a += b;
    c = 0;
    while (a > 0) {
      a /= 10;
      c++;
    }
    cout << c << endl;
  }
  return 0;
}

Error: 2

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int a, b, c, d = 0;
  cin >> a >> b;
  c = a + b;
  while (c > 0) {
    c /= 10;
    d++;
  }
  return d;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <math.h>
#include <stdio.h>

int main(void) {
  int a, b;
  while (scanf("%d%d", &a, &b) != EOF) {
    int c = a + b;
    int d = (int)log10(c) + 1;
    printf("%d\\n", d);
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <math.h>
#include <stdio.h>

int main(void) {
  int a, b;
  while (scanf("%d%d", &a, &b)) {
    int c = a + b;
    int d = (int)log10(c);
    printf("%d\\n", d);
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::sort;
using std::string;
#define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X))
#define rept(X, Y, Z) for (int(X) = (Y); (X) < (Z); ++(X))
#define repr(X, Y) for (int(X) = (Y); (X) >= 0; --(X))
const double pi = 3.141592653589793283462;
int main() {
  int a, b, c;
  while (cin >> a >> b) {
    int co = 1;
    c = a + b;
    while (1) {
      if (c / 10 >= 1) {
        co += 1;
        c /= 10;
      } else
        break;
    }
    cout << co << endl;
    co = 1;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
int main() {
  int a, b;
  int c1 = 1;
  while (1) {
    cin >> a >> b;
    a += b;
    while (1) {
      if (a / 10 > 0) {
        ++c1;
        a = a / 10;
      } else
        break;
    }
    cout << c1 << endl;
    c1 = 1;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int a, b;
  while (cin >> a >> b) {
    int t = 8650;
    for (int i = t; i; i--) {
      for (int j = i; j; j--) {
        if (i + j == 2)
          a += b;
      }
    }
    int cnt = 0;
    while (a)
      a /= 10, cnt++;
    cout << cnt << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int a, b;
  while (cin >> a >> b) {
    int t = 8700;
    for (int i = t; i; i--) {
      for (int j = i; j; j--) {
        if (i + j == 2)
          a += b;
      }
    }
    int cnt = 0;
    while (a)
      a /= 10, cnt++;
    cout << cnt << endl;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  int a[200], b[200], sum[200], keta[200], cnt = 0, set = 0;

  while (cin >> a[set] >> b[set]) {
    set++;
  }

  for (int i = 0; i < set; i++) {
    sum[i] = a[i] + b[i];
    while (sum[i] != 0) {
      sum[i] = sum[i] / 10;
      cnt++;
    }
    cout << cnt << endl;
    cnt = 0;
  }

  return 0;
}

Error: WA

Fixed submission:

#include <stdio.h>

int main(void) {
  int a[200], b[200], sum[200], keta[200], cnt = 0, set = 0;

  scanf("%d", &set);
  for (int i = 0; i < set; i++) // input
    scanf("%d%d", &a[i], &b[i]);

  for (int i = 0; i < set; i++) {
    sum[i] = a[i] + b[i];
    while (sum[i] != 0) {
      sum[i] = sum[i] / 10;
      cnt++;
    }
    printf("%d\\n", cnt);
    cnt = 0;
  }

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

#include <iostream>
using namespace std;
int main() {
  long int a, b;
  int x[200];
  int n = 0;
  while (cin >> a >> b) {
    x[n] = 1;
    a = a + b;
    while (1) {
      a = a / 10;
      if (a >= 1)
        x[n]++;
      else
        break;
    }
    n++;
  }

  for (int i = 0; i < n; i++)
    cout << x[i] << '\\n';

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  long int a, b;
  int x[200];
  int n = 0;
  while (cin >> a >> b) {
    x[n] = 0;
    a = a + b;
    while (1) {
      a = a / 10;
      if (a >= 10)
        x[n]++;
    }
    n++;
  }

  for (int i = 0; i < n; i++)
    cout << x[i] << '\\n';

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

#include <array>
#include <iostream>

int main() {
  int a;
  int b;
  int sum;
  int digit;
  while (std::cin >> a >> b) {
    sum = a + b;
    digit = 0;
    while (sum != 0) {
      sum = sum / 10;
      digit++;
    }
    std::cout << digit << std::endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <array>
#include <iostream>

int main() {
  int a;
  int b;
  int sum;
  int digit;
  bool flag = true;
  while (flag) {
    std::cin >> a >> b;
    if (a == 0 && b == 0) {
      flag = false;
      break;
    } else {
      sum = a + b;
      digit = 0;
      while (sum != 0) {
        sum = sum / 10;
        digit++;
      }
      std::cout << digit << std::endl;
    }
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int a, b, c, i;
  for (int j = 0; j < 200; j++) {
    if (!(cin >> a >> b))
      break;
    c = a + b;
    for (i = 1; true; i++) {
      c = c / 10;
      if (c == 0)
        break;
    }
    cout << i << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int a, b, c, i;
  while (true) {
    cin >> a >> b;
    if (a == 0 && b == 0)
      break;
    c = a + b;
    for (i = 1; true; i++) {
      c = c / 10;
      if (c == 0)
        break;
    }
    cout << i << "\\n";
  }

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

#include <iostream>
using namespace std;

int main() {
  int a, b, ans;
  while (true) {
    cin >> a;
    if (cin.eof()) {
      break;
    }
    cin >> b;
    int sum = a + b;
    ans = 0;
    while (sum >= 1) {
      sum /= 10;
      ans += 1;
    }
    cout << ans << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int a, b, k;
  cin >> a;
  while (a != ' ') {
    cin >> b;
    b += a;
    k = 0;
    while (b >= 1) {
      b /= 10;
      k += 1;
    }
    cout << k << endl;
    cin >> a;
  }
  return 0;
}
Problem p00002 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <stdio.h>

int main() {
  int a, b, c;
  int i;
  int num;

  while (scanf("%d", &a) != EOF) {
    scanf("%d", &b);

    i = 10;
    num = 1;
    c = a + b;
    while (1) {
      if (c / i != 0) {
        num++;
        i *= 10;
      } else {
        break;
      }
    }
    std::cout << num << std::endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

int main() {
  int a, b, c;
  int i = 1;
  int num = 0;

  std::cin >> a;
  std::cin >> b;

  c = a + b;
  while (1) {
    if (c / i != 0) {
      num++;
    } else {
      break;
    }
  }
  std::cout << num << std::endl;

  return 0;
}