prithivMLmods/Coder-Stat huggingface dataset:
Problem p00001 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>

using namespace std;

int main(void) {
  int i, array[10];

  for (i = 0; i < 10; i++)
    scanf("%d", &array[i]);
  sort(array, array + 10);
  for (i = 9; i >= 7; i++)
    printf("%d\n", array[i]);

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cstdio>

using namespace std;

int main(void) {
  int i, array[10];

  for (i = 0; i < 10; i++)
    scanf("%d", &array[i]);
  sort(array, array + 10);
  for (i = 9; i >= 7; i--)
    printf("%d\n", array[i]);

  return 0;
}
Problem p00001 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

typedef long long ll;

using namespace std;

int main(void) {
  int h[10];
  for (int i = 0; i < 10; i++) {
    cin >> h[i];
  }

  sort(h, h + 10, greater<int>());

  cout << h[0] << endl << h[1] << endl << h[2];
  while (1)
    ;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

typedef long long ll;

using namespace std;

int main(void) {
  int h[10];
  for (int i = 0; i < 10; i++) {
    cin >> h[i];
  }

  sort(h, h + 10, greater<int>());

  cout << h[0] << endl << h[1] << endl << h[2] << endl;

  return 0;
}
Problem p00001 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
  vector<int> line;
  int pro;
  for (int i = 0; i < 10; ++i) {
    cin >> pro;
    line.push_back(pro);
  }
  sort(line.begin(), line.end());
  for (int i = 9; i > 6; -i) {
    cout << line[i] << endl;
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
  vector<int> line;
  int pro;
  for (int i = 0; i < 10; ++i) {
    cin >> pro;
    line.push_back(pro);
  }
  sort(line.begin(), line.end());
  for (int i = 9; i > 6; --i) {
    cout << line[i] << endl;
  }
  return 0;
}
Problem p00001 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int a[10];
  for (int i = 0; i < 10; i++) {
    cin >> a[i];
  }
  sort(a, a + 10);
  for (int i = 9; i > 6; i++) {
    cout << a[i] << endl;
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int a[10];
  for (int i = 0; i < 10; i++) {
    cin >> a[i];
  }
  sort(a, a + 10);
  for (int i = 9; i > 6; i--) {
    cout << a[i] << endl;
  }
  return 0;
}
Problem p00001 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  int i, m[10];

  for (i = 0; i < 10; i++) {
    while (1) {
      cin >> m[i];
      if (m[i] > 0 && m[i] < 10001)
        break;
    }
  }

  sort(m, m + 10);

  for (i = 9; i > 6; i--) {
    cout << m[i] << endl;
  }
}

Fixed submission:
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  int i, m[10];

  for (i = 0; i < 10; i++) {
    cin >> m[i];
  }

  sort(m, m + 10);

  for (i = 9; i > 6; i--) {
    cout << m[i] << endl;
  }
}
Problem p00001 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>
int main(void) {
  int a = 0, b = 0, c = 0, n, t;
  while (scanf("%d", &n)) {
    if (n > a)
      t = n, n = a, a = t;
    if (n > b)
      t = n, n = b, b = t;
    if (n > c)
      c = n;
  }
  printf("%d\n%d\n%d\n", a, b, c);
  return 0;
}

Fixed submission:
#include <stdio.h>
int main(void) {
  int a = 0, b = 0, c = 0, n, t;
  while (scanf("%d", &n) > 0) {
    if (n > a)
      t = n, n = a, a = t;
    if (n > b)
      t = n, n = b, b = t;
    if (n > c)
      c = n;
  }
  printf("%d\n%d\n%d\n", a, b, c);
  return 0;
}
Problem p00001 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int n, a[50];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> a[i];
  sort(a + 1, a + 1 + n);
  for (int i = n; i >= n - 2; i--) {
    cout << a[i] << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int n, a[50];
int main() {
  n = 10;
  for (int i = 1; i <= n; i++)
    cin >> a[i];
  sort(a + 1, a + 1 + n);
  for (int i = n; i >= n - 2; i--) {
    cout << a[i] << endl;
  }
}
Problem p00001 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>

using namespace std;

const int N = 10;
int a[N];

int main() {
  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + N);
  for (int i = N - 1; i > N - 4; i++)
    printf("%d/n", a[i]);
}

Fixed submission:
#include <algorithm>
#include <cstdio>

using namespace std;

const int N = 10;
int a[N];

int main() {
  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + N);
  for (int i = 1; i < 4; i++)
    printf("%d\n", a[N - i]);
}
Problem p00001 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>

int main() {
  int height[10], rank[3] = {0};
  int i;

  for (i = 0; i < 10; i++) {
    scanf("%d\n", height[i]);

    if (rank[0] < height[i]) {
      rank[2] = rank[1];
      rank[1] = rank[0];
      rank[0] = height[i];
    } else if (rank[1] < height[i]) {
      rank[2] = rank[1];
      rank[1] = height[i];
    } else if (rank[2] < height[i]) {
      rank[2] = height[i];
    }
  }

  for (i = 0; i < 3; i++) {
    printf("%d\n", rank[i]);
  }

  return 0;
}

Fixed submission:
#include <stdio.h>

int main() {
  int height[10], rank[3] = {0};
  int i;

  for (i = 0; i < 10; i++) {
    scanf("%d\n", &height[i]);

    if (rank[0] < height[i]) {
      rank[2] = rank[1];
      rank[1] = rank[0];
      rank[0] = height[i];
    } else if (rank[1] < height[i]) {
      rank[2] = rank[1];
      rank[1] = height[i];
    } else if (rank[2] < height[i]) {
      rank[2] = height[i];
    }
  }

  for (i = 0; i < 3; i++) {
    printf("%d\n", rank[i]);
  }

  return 0;
}
Problem p00001 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int main(void) {
  int i, j, n[10], w;
  for (i = 0; i < 10; i++) {
    scanf("%d", n[i]);
  }
  for (i = 0; i < 10; i++) {
    for (j = 0; j <= 10; j++) {
      if (n[j] <= n[i]) {
        w = n[i];
        n[i] = n[j];
        n[j] = w;
      }
    }
  }
  for (i = 0; i < 3; i++) {
    printf("%d\n", n[i]);
  }
  return 0;
}

Fixed submission:
#include <stdio.h>
int main(void) {
  int i, j, n[10], w;
  for (i = 0; i < 10; i++) {
    scanf("%d", &n[i]);
  }
  for (i = 0; i < 10; i++) {
    for (j = 0; j <= 10; j++) {
      if (n[j] <= n[i]) {
        w = n[i];
        n[i] = n[j];
        n[j] = w;
      }
    }
  }
  for (i = 0; i < 3; i++) {
    printf("%d\n", n[i]);
  }
  return 0;
}
Problem p00001 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  vector<int> mountain;
  for (int i = 0; i < 10; i++) {
    cin >> mountain.at(i);
  }
  sort(mountain.begin(), mountain.end());
  reverse(mountain.begin(), mountain.end());

  for (int i = 0; i < 3; i++) {
    cout << mountain.at(i) << endl;
  }
}


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

int main() {
  vector<int> mountain(10);
  for (int i = 0; i < 10; i++) {
    cin >> mountain.at(i);
  }
  sort(mountain.begin(), mountain.end());
  reverse(mountain.begin(), mountain.end());

  for (int i = 0; i < 3; i++) {
    cout << mountain.at(i) << endl;
  }
}
Problem p00001 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define EXIST2(s, e) (find(ALL(s), (e)) != (s).end())
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EACH(t, i, c) for (t::iterator i = (c).begin(); i != (c).end(); ++i)
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main() {
  vi a;
  REP(i, 10) { cin >> a[i]; }
  sort(RALL(a));
  cout << a[0] << endl;
  cout << a[1] << endl;
  cout << a[2] << endl;
}

Fixed submission:
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define EXIST2(s, e) (find(ALL(s), (e)) != (s).end())
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EACH(t, i, c) for (t::iterator i = (c).begin(); i != (c).end(); ++i)
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main() {
  vi a(10);
  REP(i, 10) { cin >> a[i]; }
  sort(RALL(a));
  cout << a[0] << endl;
  cout << a[1] << endl;
  cout << a[2] << endl;
}
Problem p00001 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <vector>
using namespace std;

void bubbleSort(vector<int> &h) {
  int tmp;
  for (int i = 0; i < h.size() - 1; i++) {
    for (int j = 0; j < h.size() - 1 - i; j++) {
      if (h[j] < h[j + 1]) {
        tmp = h[j + 1];
        h[j + 1] = h[j];
        h[j] = tmp;
      }
    }
  }
}

int main() {
  vector<int> height(10);
  for (int i = 0; i < 10; i++) {
    cin >> height[i];
  }
  bubbleSort(height);
  for (int i : height) {
    cout << i << endl;
  }
  return 0;
}


Fixed submission:
#include <iostream>
#include <vector>
using namespace std;

void bubbleSort(vector<int> &h) {
  int tmp;
  for (int i = 0; i < h.size() - 1; i++) {
    for (int j = 0; j < h.size() - 1 - i; j++) {
      if (h[j] < h[j + 1]) {
        tmp = h[j + 1];
        h[j + 1] = h[j];
        h[j] = tmp;
      }
    }
  }
}

int main() {
  vector<int> height(10);
  for (int i = 0; i < 10; i++) {
    cin >> height[i];
  }
  bubbleSort(height);
  for (int i = 0; i < 3; i++) {
    cout << height[i] << endl;
  }
  return 0;
}
Problem p00001 (Python)

Buggy submission (status: Runtime Error):
num = [int(input()) for i in range(10)]
num.sort(reverse=True)
for i in range[0:3]:
    print(num[i])


Fixed submission:
num = [int(input()) for i in range(10)]
num.sort(reverse=True)
for i in range(3):
    print(num[i])
Problem p00001 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  bool flag;
  int result[3], buf, temp[10];
  for (int i = 0; i < 10; i++) {
    cin >> temp[i];
  }
  for (int l = 0; l < 3; l++) {
    while (1) {
      for (int j = l; j < 9; j++) {
        if (temp[j] < temp[j + 1]) {
          buf = temp[j + 1];
          temp[j + 1] = temp[j];
          temp[j] = buf;
        }
      }
      flag = false;
      for (int k = 0; k < 9; k++) {
        if (temp[l] < temp[k])
          flag = true;
      }
      if (flag != true) {
        result[l] = temp[l];
        break;
      }
    }
  }
  cout << result[0] << endl;
  cout << result[1] << endl;
  cout << result[2] << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  bool flag;
  int result[3], buf, temp[10];
  for (int i = 0; i < 10; i++) {
    cin >> temp[i];
  }
  for (int l = 0; l < 3; l++) {
    while (1) {
      for (int j = l; j < 9; j++) {
        if (temp[j] < temp[j + 1]) {
          buf = temp[j + 1];
          temp[j + 1] = temp[j];
          temp[j] = buf;
        }
      }
      flag = false;
      for (int k = l; k < 9; k++) {
        if (temp[l] < temp[k])
          flag = true;
      }
      if (flag != true) {
        result[l] = temp[l];
        break;
      }
    }
  }
  cout << result[0] << endl;
  cout << result[1] << endl;
  cout << result[2] << endl;
  return 0;
}
Problem p00001 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>

using namespace ::std;

int main() {
  int array[10];

  for (int i = 0; i < 10; i++)
    cin >> array[i];

  sort(array, array + 10);

  for (int i = 9; i > 6; i++)
    cout << array[i] << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>

using namespace ::std;

int main() {
  int array[10];

  for (int i = 0; i < 10; i++)
    cin >> array[i];

  sort(array, array + 10);

  for (int i = 9; i > 6; i--)
    cout << array[i] << endl;
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>

int main() {
  int a, b;
  char temp[100];

  while (scanf("%d %d", &a, &b) != 0) {
    printf("%d\n", sprintf(temp, "%d", a + b));
  }

  return 0;
}

Fixed submission:
#include <cstdio>

int main() {
  int a, b;
  char temp[100];

  while (scanf("%d %d", &a, &b) != EOF) {
    printf("%d\n", sprintf(temp, "%d", a + b));
  }

  return 0;
}
Problem p00002 (C++)

Buggy submission (status: 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() {
  while (true) {
    int a, b;
    cin >> a >> b;
    cout << (int)(log10(a + b) + 1) << endl;
  }
  return 0;
}

Fixed submission:
/*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;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <sstream>
using namespace std;

int main() {
  int a, b;
  while (true) {
    cin >> a >> b;
    stringstream ss;
    ss << a + b;
    cout << ss.str().size() << endl;
  }
}

Fixed submission:
#include <iostream>
#include <sstream>
using namespace std;

int main() {
  int a, b;
  while (cin >> a >> b) {
    stringstream ss;
    ss << a + b;
    cout << ss.str().size() << endl;
  }
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>
#include <iostream>
#include <math.h>

using namespace std;

int a, b;
int sum;
int ans = 0;
int digit;

int main() {
  while (scanf("%d%d", &a, &b)) {
    sum = a + b;
    digit = sum / 10;

    printf("%d\n", (int)log10(sum) + 1);
  }
  return 0;
}

Fixed submission:
#include <cstdio>
#include <iostream>
#include <math.h>

using namespace std;

int a, b;
int sum;
int ans = 0;
int digit;

int main() {
  while (cin >> a >> b) {
    sum = a + b;
    digit = sum / 10;

    printf("%d\n", (int)log10(sum) + 1);
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <queue>
using namespace std;

int main() {

  int a, b, s, d;
  while (1) {
    cin >> a >> b;
    s = a + b;
    d = 0;
    {
      while (s) {
        s /= 10;
        d++;
      }
      cout << d << endl;
    }
  }

  return 0;
}

Fixed submission:
#include <iostream>
#include <queue>
using namespace std;

int main() {

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

  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int a, b;
  while (cin >> a >> b) {
    int t = 9000;
    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;
}

Fixed submission:
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int a, b;
  while (cin >> a >> b) {
    int t = 8000;
    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 (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

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

Fixed submission:
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int a, b;
  while (cin >> a >> b) {
    int d = 0;
    a += b;
    while (a) {
      d++;
      a /= 10;
    }
    if (!d)
      d++;
    cout << d << endl;
  }
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int a, b, sum;

  while (1) {
    cin >> a >> b;
    sum = a + b;

    for (int i = 1;; ++i) {
      if (sum < 10) {
        cout << i << endl;
        break;
      } else {
        sum /= 10;
      }
    }
  }

  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int a, b, sum;

  while (1) {
    cin >> a >> b;
    if (cin.eof()) {
      break;
    }

    sum = a + b;

    for (int i = 1;; ++i) {
      if (sum < 10) {
        cout << i << endl;
        break;
      } else {
        sum /= 10;
      }
    }
  }

  return 0;
}
Problem p00002 (C++)

Buggy submission (status: 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)) {
    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;
}

Fixed submission:
#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;
}
Problem p00002 (C++)

Buggy submission (status: 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;
    count++;
  }
  for (int i = 0; i < count; i++) {
    cout << answer[i] << endl;
  }
  return 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;
    cout << answer[count] << endl;
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#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;
}


Fixed submission:
#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;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

void solve() {
  while (true) {
    int a, b;
    cin >> a >> b;
    int sum = a + b;
    int count = 0;
    while (sum) {
      sum /= 10;
      ++count;
    }
    cout << count << endl;
  }
}

int main() {
  solve();
  return (0);
}

Fixed submission:
#include <iostream>

using namespace std;

void solve() {
  int a;
  while (cin >> a) {
    int b;
    cin >> b;
    int sum = a + b;
    int count = 0;
    while (sum) {
      sum /= 10;
      ++count;
    }
    cout << count << endl;
  }
}

int main() {
  solve();
  return (0);
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int a, b;
  while (scanf("%d%d", &a, &b)) {
    int c = to_string(a + b).length();
    printf("%d\n", c);
  }
}

Fixed submission:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int a, b;
  while (cin >> a >> b) {
    int c = to_string(a + b).length();
    printf("%d\n", c);
  }
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>
int main() {
  for (;;) {
    int a, b, c;
    scanf("%d %d", &a, &b);
    if (a == EOF)
      break;
    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;
}

Fixed submission:
#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;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>
using namespace std;
int main() {
  int a, b;
  while (scanf("%d %d", &a, &b)) {
    char c[255];
    printf("%d\n", sprintf(c, "%d", a + b));
  }
  return 0;
}

Fixed submission:
#include <cstdio>
using namespace std;
int main() {
  int a, b;
  while (scanf("%d %d", &a, &b) != EOF) {
    char c[255];
    printf("%d\n", sprintf(c, "%d", a + b));
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#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;
}

Fixed submission:
#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;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <math.h>
using namespace std;

int main() {

  // 変数の宣言

  int a, b, sum, i = 0;

  /////メイン処理/////

  while (cin >> a >> b) {
    // 入力
    sum = a + b;
    // 桁数の計算

    while (1) {
      if (pow(10, i) <= sum && pow(10, i + 1) > sum) {
        cout << i + 1 << endl;
        break;
      }
      i++;
    }
  }

  return 0;
}

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

int main() {

  // 変数の宣言

  int a, b, sum, i = 0;

  /////メイン処理/////

  while (cin >> a >> b) {
    // 入力
    sum = a + b;
    // 桁数の計算

    while (1) {
      if (pow(10, i) <= sum && pow(10, i + 1) > sum) {
        cout << i + 1 << endl;
        break;
      }
      i++;
    }

    i = 0;
  }

  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

int getDigitNumber(int n) { return n > 0 ? 1 + getDigitNumber(n / 10) : 0; }

int main(int argc, char const *argv[]) {
  while (true) {
    int a, b;
    cin >> a >> b;
    cout << getDigitNumber(a + b) << endl;
  }
  return 0;
}


Fixed submission:
#include <iostream>

using namespace std;

int getDigitNumber(int n) { return n > 0 ? 1 + getDigitNumber(n / 10) : 0; }

int main(int argc, char const *argv[]) {
  while (true) {
    int a, b;
    cin >> a >> b;
    if (cin.eof()) {
      break;
    }
    cout << getDigitNumber(a + b) << endl;
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main() {
  int a, b, c;
  char ans[100];
  while (1) {
    cin >> a >> b;
    sprintf(ans, "%d", a + b);
    c = strlen(ans);
    cout << c << endl;
  }
  return 0;
}

Fixed submission:
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main() {
  int a, b, c;
  char ans[100];
  while (cin >> a >> b) {
    sprintf(ans, "%d", a + b);
    c = strlen(ans);
    cout << c << endl;
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

int main() {

  while (1) {
    int a, b;
    cin >> a >> b;
    int count = 0;
    int result = a + b;
    while (1) {
      if (result == 0) {
        cout << count << "\n";
        break;
      }
      result /= 10;
      count++;
    }
  }
  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

int main() {
  int a, b;
  while (cin >> a >> b) {
    int count = 0;
    int result = a + b;
    while (1) {
      if (result == 0) {
        cout << count << "\n";
        break;
      }
      result /= 10;
      count++;
    }
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int a, b, i, c = 0;
  while (1) {
    cin >> a >> b;
    a = a + b;
    for (i = 1; i < 10000000000; i *= 10) {
      if (a / i == 0)
        break;
      c++;
    }

    cout << c << endl;
  }
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int jud(int x) {
  int c = 0;
  while (x) {
    x /= 10;
    c++;
  }
  return c;
}
int main(void) {
  int a, b;
  while (cin >> a >> b) {
    cout << jud(a + b) << endl;
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int a, b;
  while (true) {
    cin >> a >> b;
    cout << to_string(a + b).size() << endl;
  }
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int a, b;
  while (cin >> a >> b) {
    cout << to_string(a + b).size() << endl;
  }
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int a, b;
  while (1) {
    cin >> a >> b;
    a += b;
    b = 0;
    while (a) {
      a /= 10;
      b++;
    }
    cout << b << endl;
  }
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int a, b;
  while (1) {
    cin >> a >> b;
    if (cin.eof())
      break;
    a += b;
    b = 0;
    while (a) {
      a /= 10;
      b++;
    }
    cout << b << endl;
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cctype>
#include <cstdio>
using namespace std;

int main() {
  long long int a, b;
  int ans;
  while (true) {
    scanf("%lld %lld", &a, &b);
    if (a == 0 && b == 0)
      break;
    a += b;
    ans = 0;
    while (a > 0) {
      a = a / 10;
      ans++;
    }
    printf("%d\n", ans);
  }
  return 0;
}

Fixed submission:
#include <cctype>
#include <cstdio>
using namespace std;

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

Buggy submission (status: Time Limit Exceeded):
#include <cmath>
#include <iostream>
using namespace std;
int main() {
  int a, b;
  while (1) {
    cin >> a;
    if (a == EOF)
      break;
    cin >> b;
    if (b == EOF)
      break;
    int ans = log10(a + b) + 1;
    cout << ans << endl;
  }
  return 0;
}

Fixed submission:
#include <cmath>
#include <iostream>
using namespace std;
int main() {
  int a, b;
  while (cin >> a >> b) {
    int ans = log10(a + b) + 1;
    cout << ans << endl;
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

int main() {
  int a, b, sum, count;

  while (cin >> a >> b) {

    sum = a + b;
    count = 0;

    for (int i = sum; i >= 1; i / 10) {
      count++;
    }

    cout << count << endl;
  }

  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

int main() {
  int a, b, sum, count;

  while (cin >> a >> b) {

    sum = a + b;
    count = 0;

    for (int i = sum; i >= 1; i = i / 10) {
      count++;
    }

    cout << count << endl;
  }

  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>

int main() {
  int a, b;
  while (scanf("%d %d ", &a, &b)) {
    a += b;
    b = 0;
    while (a > 0) {
      b++;
      a /= 10;
    }
    printf("%d\n", (b ? b : 1));
  }

  return 0;
}

Fixed submission:
#include <stdio.h>

int main() {
  int a, b;
  while (scanf("%d %d ", &a, &b) > 0) {
    a += b;
    b = 0;
    while (a > 0) {
      b++;
      a /= 10;
    }
    printf("%d\n", (b ? b : 1));
  }

  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {

  long a, b;

  while (1) {
    cin >> a >> b;

    long c = a + b;
    long d = 1;
    long e = 10;
    for (int j = 0; j < 10; j++) {
      if (c == 0) {
        cout << 1 << endl;
      } else if (c >= d && c < e) {
        cout << j + 1 << endl;
      }
      d = d * 10;
      e = e * 10;
    }
  }
  return 0;
}

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

  long a, b;

  while (cin >> a >> b) {
    long c = a + b;
    long d = 1;
    long e = 10;
    for (int j = 0; j < 10; j++) {
      if (c == 0) {
        cout << 1 << endl;
      } else if (c >= d && c < e) {
        cout << j + 1 << endl;
      }
      d = d * 10;
      e = e * 10;
    }
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main(void) {
  long long n, i, j, k;
  while (1) {
    cin >> j >> k;
    int x = j + k;
    stringstream str;
    str << x;
    string st = str.str();
    cout << st.size() << endl;
  }
}

Fixed submission:
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main() {
  int x, y;
  while (cin >> x >> y) {
    x = x + y;
    stringstream a;
    a << x;
    string str = a.str();
    y = str.size();
    cout << y << endl;
  }
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

using namespace std;

int main() {
  int a, b;
  while (true) {
  }
  int n = a + b;
  if (n > 99999) {
    cout << 6 << endl;
  } else if (n > 9999) {
    cout << 5 << endl;
  } else if (n > 999) {
    cout << 4 << endl;
  } else if (n > 99) {
    cout << 3 << endl;
  } else if (n > 9) {
    cout << 2 << endl;
  } else {
    cout << 1 << endl;
  }
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;

int main() {
  int a, b;
  while (cin >> a >> b) {
    int n = a + b;
    if (n > 999999) {
      cout << 7 << endl;
    } else if (n > 99999) {
      cout << 6 << endl;
    } else if (n > 9999) {
      cout << 5 << endl;
    } else if (n > 999) {
      cout << 4 << endl;
    } else if (n > 99) {
      cout << 3 << endl;
    } else if (n > 9) {
      cout << 2 << endl;
    } else {
      cout << 1 << endl;
    }
  }
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>
int main() {
  int a, b, c, i, count;
  while (scanf("%d%d", &a, &b)) {
    count = 1;
    if (a >= 0 && b >= 0) {
      c = a + b;
      for (i = 10; i <= c; i *= 10) {
        count++;
      }
      printf("%d\n", count);
    }
  }
  return 0;
}

Fixed submission:
#include <stdio.h>
int main() {
  int a, b, c, i, count;
  while (scanf("%d%d", &a, &b) != EOF) {
    count = 1;
    if (a >= 0 && b >= 0) {
      c = a + b;
      for (i = 10; i <= c; i *= 10) {
        count++;
      }
      printf("%d\n", count);
    }
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>
#include <iostream>
using namespace std;

int main(void) {
  int i;
  int x, y;

  for (;;) {
    scanf("%d %d", &x, &y);
    x += y;
    for (i = 1;; i++) {
      x /= 10;
      if (x == 0) {
        break;
      }
    }
    printf("%d\n", i);
  }

  return 0;
}

Fixed submission:
#include <cstdio>
#include <iostream>
using namespace std;

int main(void) {
  int i;
  int x, y;

  for (;;) {
    if (scanf("%d %d", &x, &y) == EOF) {
      break;
    }
    x += y;
    for (i = 1;; i++) {
      x /= 10;
      if (x == 0) {
        break;
      }
    }
    printf("%d\n", i);
  }

  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>
int main(void) {
  int a, b, d = 1;
  while (1) {
    scanf("%d %d", &a, &b);
    for (size_t i = 10;; i *= 10) {
      if ((a + b) / i == 0)
        break;
      d++;
    }
    printf("%d\n", d);
    a = 0;
    b = 0;
    d = 1;
  }
  return 0;
}

Fixed submission:
#include <stdio.h>
int main(void) {
  int a, b, d = 1;
  while (scanf("%d %d", &a, &b) != EOF) {
    for (size_t i = 10;; i *= 10) {
      if ((a + b) / i == 0)
        break;
      d++;
    }
    printf("%d\n", d);
    a = 0;
    b = 0;
    d = 1;
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int getDigital(int sum) {
  int a = 1;
  while (sum / 10) {
    a++;
    sum /= 10;
  }
  return a;
}

int main() {
  int a, b, c;
  while (1) {
    cin >> a >> b;
    c = getDigital(a + b);
    cout << c << endl;
  }
}

Fixed submission:
#include <iostream>
using namespace std;

int getDigital(int sum) {
  int a = 1;
  while (sum / 10) {
    a++;
    sum /= 10;
  }
  return a;
}

int main() {
  int a, b, c;
  while (cin >> a >> b) {
    c = getDigital(a + b);
    cout << c << endl;
  }
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int a, b, z, ans;
  while (1) {
    cin >> a >> b;
    ans = a + b;
    z = 0;
    while (1) {
      z++;
      if (ans / 10 == 0) {
        break;
      }
      ans = ans / 10;
    }
    cout << z << endl;
  }
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int a, b, z, ans;
  while (cin >> a >> b) {
    ans = a + b;
    z = 0;
    while (1) {
      z++;
      if (ans / 10 == 0) {
        break;
      }
      ans = ans / 10;
    }
    cout << z << endl;
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b;
  while (scanf("%d %d", &a, &b)) {
    int sum = a + b, cnt = 1;
    while (sum /= 10)
      cnt++;
    cout << cnt << endl;
  }
}

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

int main() {
  int a, b;
  while (scanf("%d %d", &a, &b) != EOF) {
    int sum = a + b, cnt = 1;
    while (sum /= 10)
      cnt++;
    cout << cnt << endl;
  }
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
using namespace std;

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

Fixed submission:
#include <algorithm>
#include <iostream>
using namespace std;

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

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
class DigitNumber {
public:
  void solve(int a, int b) {
    string sum = to_string(a + b);
    if (sum == "0")
      cout << 0 << endl;
    else
      cout << sum.length() << endl;
  }
};
int main() {
  DigitNumber inst;
  int a, b;
  while (true) {
    cin >> a >> b;
    inst.solve(a, b);
  }
}

Fixed submission:
#include <iostream>
using namespace std;
class DigitNumber {
public:
  void solve(int a, int b) {
    string sum = to_string(a + b);
    if (sum == "0")
      cout << 0 << endl;
    else
      cout << sum.length() << endl;
  }
};
int main() {
  DigitNumber inst;
  int a, b;
  while (cin >> a >> b) {
    inst.solve(a, b);
  }
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
// ------------------------------------
// Date:2018/ 2/11
// Problem:0002 : DigitNumber 2.cpp
//
// ------------------------------------

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

#define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define REP(i, n) FOR(i, 0, n)

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


Fixed submission:
// ------------------------------------
// Date:2018/ 2/11
// Problem:0002 : DigitNumber 2.cpp
//
// ------------------------------------

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

#define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define REP(i, n) FOR(i, 0, n)

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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define MOD 1000000007 // 10^9+7
#define INF 1000000000 // 10^9

int main(int argc, const char *argv[]) {
  double a, b;
  while (1) {
    cin >> a >> b;
    if (a == 0 && b == 0)
      return 0;
    int k = log10(a + b) + 1;
    cout << k;
  }
}

Fixed submission:
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define MOD 1000000007 // 10^9+7
#define INF 1000000000 // 10^9

int main() {
  string str;
  while (getline(cin, str)) {
    bool f = 0;
    int a = 0, b = 0;
    for (int i = 0; i < (int)str.length(); i++) {
      if (str[i] == ' ')
        f = 1;
      else if (!f)
        a = a * 10 + (str[i] - '0');
      else
        b = b * 10 + (str[i] - '0');
    }
    cout << (int)log10(a + b) + 1 << endl;
  }
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>
int main(void) {
  int a, b, i = 1;
  while (1) {
    scanf("%d %d", &a, &b);
    a = a + b;
    for (i = 1; i < 8; i++) {
      if (a < 10)
        break;
      a = a / 10;
    }
    printf("%d\n", i);
  }
  return 0;
}

Fixed submission:
#include <stdio.h>
int main(void) {
  int a, b, i, k;
  while (scanf("%d %d", &a, &b) != EOF) {
    a = a + b;
    for (i = 1; i < 8; i++) {
      if (a < 10)
        break;
      a = a / 10;
    }
    printf("%d\n", i);
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
  int a, b;
  while (cin >> a >> b) {
    int sum = a + b;
    int cnt = 1;
    while (sum / 10) {
      cnt++;
    }
    cout << cnt << endl;
  }
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
  int a, b;
  while (cin >> a >> b) {
    int sum = a + b;
    int cnt = 1;
    while (sum /= 10) {
      cnt++;
    }
    cout << cnt << endl;
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#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;
}

Fixed submission:
#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;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include "bits/stdc++.h"
using namespace std;

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

Fixed submission:
#include "bits/stdc++.h"
using namespace std;

int main() {
  int a, b;
  while (cin >> a >> b) {
    int n = a + b;
    int ans = 0;
    while (n > 0) {
      n /= 10;
      ans++;
    }
    if (ans == 0)
      ans++;
    cout << ans << endl;
  }
  return 0;
}
Problem p00002 (C++)

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

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

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <math.h>
#define REP(i, a, b) for (i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define INF (1 << 30)

using namespace std;

int main() {
  int a, b, i, j, k, n;

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

Fixed submission:
#include <iostream>
#include <math.h>
#define REP(i, a, b) for (i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define INF (1 << 30)

using namespace std;

int main() {
  int a, b, i, j, k, n;

  while (cin >> a >> b) {
    k = 0, n = a + b;
    while (n > 0, ++k, n /= 10)
      ;
    cout << k << endl;
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: 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 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;
}

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 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;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int a, b, i = 0;
  while (cin >> a >> b, a + b != 0) {
    if (i == 199)
      break;
    int num = 1;
    int c = a + b;
    while (c / 10 != 0) {
      num++;
      c /= 10;
    }
    cout << num << endl;
  }
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int a, b;
  while (cin >> a >> b) {
    int num = 1;
    int c = a + b;
    while (c / 10 != 0) {
      num++;
      c /= 10;
    }
    cout << num << endl;
  }
  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>
int main() {
  int d, n, a, b;
  while (true) {
    d = 0;
    if (scanf("%d %d", &a, &b) == 0)
      break;
    n = a + b;
    while (n > 0) {
      d++, n /= 10;
    };
    printf("%d\n", d);
  };
  return 0;
};

Fixed submission:
#include <cstdio>
int main() {
  int d, n, a, b;
  while (true) {
    d = 0;
    if (scanf("%d %d", &a, &b) == EOF)
      break;
    n = a + b;
    while (n > 0) {
      d++, n /= 10;
    };
    printf("%d\n", d);
  };
  return 0;
};
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <string>

using namespace std;

int main() {
  for (;;) {
    int a, b, i;

    scanf("%d%d", &a, &b);

    if (a == EOF || b == EOF) {
      break;
    }

    a += b;

    for (i = 1;; i++) {
      if (a < 10) {
        break;
      }
      a = a / 10;
    }

    cout << i << endl;
  }
}

Fixed submission:
#include <iostream>
#include <string>

using namespace std;

int main() {
  int a, b, i;
  while (cin >> a >> b) {
    a += b;

    for (i = 1;; i++) {
      if (a < 10) {
        break;
      }
      a = a / 10;
    }

    cout << i << endl;
  }
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <math.h>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long

using namespace std;

string Num2Str(int num) {
  stringstream ss;
  ss << num;
  return ss.str();
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int a, b;
  string s;
  // code
  while (true) {
    cin >> a >> b;
    s = Num2Str(a + b);
    cout << s.size() << endl;
  }

  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <math.h>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long

using namespace std;

string Num2Str(int num) {
  stringstream ss;
  ss << num;
  return ss.str();
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int a, b;
  string s;
  // code
  while (cin >> a >> b) {
    s = Num2Str(a + b);
    cout << s.size() << endl;
  }

  return 0;
}
Problem p00002 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <string>
using namespace std;

int main() {
  while (true) {
    int a, b;
    cin >> a >> b;
    string s(to_string(a + b));
    cout << s.size() << endl;
  }
  return 0;
}

Fixed submission:
#include <iostream>
#include <string>
using namespace std;

int main() {
  int a, b;
  while (cin >> a >> b) {
    string s(to_string(a + b));
    cout << s.size() << endl;
  }
  return 0;
}