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

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
typedef pair<int, int> P;

const int INF = 1001001001;

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

  ll x, i = 0, a = 100;
  cin >> x;
  while (1) {
    i++;
    a *= 1.01;
    if (a >= x) {
      cout << i << endl;
      break;
    }
  }

  cout << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
typedef pair<int, int> P;

const int INF = 1001001001;

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

  int x, i = 0, a = 100;
  cin >> x;
  while (1) {
    i++;
    a *= 1.01;
    if (a >= x) {
      cout << i << endl;
      break;
    }
  }

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

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  ll X;
  cin >> X;

  ll money = 100;
  int year = 0;
  while (true) {
    if (money >= X)
      break;
    money += money / 100;
    year++;
  }

  cout << year << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  ll X;
  cin >> X;

  ll money = 100;
  ll year = 0;
  while (true) {
    if (money >= X)
      break;
    money = money * 101;
    money /= 100;
    year++;
  }

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

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <cmath>
#include <cstring>
#include <iostream>
#include <set>
#include <string>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FIXED_FLOAT(x) std::fixed << std::setprecision(7) << (x)
#define MAX 100
#define fast                                                                   \\
  ios::sync_with_stdio(0);                                                     \\
  cin.tie(0);                                                                  \\
  cout.tie(0)
#define INF 1e9
#define ll long long
#define vi vector<int>
#define all(a) a.begin(), a.end()
#define pb push_back
#define ull unsigned long long

using namespace std;
const int N = 1e3 + 5;

void solve() {
  ll n;
  cin >> n;
  ll p = 100, nas = 0;
  while (p < n) {
    p *= 1.01;
    nas++;
  }
  cout << nas << '\\n';
}
int main() {
  fast;
  solve();
}


Error: TLE

Fixed submission:

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <cmath>
#include <cstring>
#include <iostream>
#include <set>
#include <string>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FIXED_FLOAT(x) std::fixed << std::setprecision(7) << (x)
#define MAX 100
#define fast                                                                   \\
  ios::sync_with_stdio(0);                                                     \\
  cin.tie(0);                                                                  \\
  cout.tie(0)
#define INF 1e9
#define ll long long
#define vi vector<int>
#define all(a) a.begin(), a.end()
#define pb push_back
#define ull unsigned long long

using namespace std;
const int N = 1e3 + 5;

void solve() {
  ll n;
  cin >> n;
  int p = 100, nas = 0;
  while (p < n) {
    p *= 1.01;
    nas++;
  }
  cout << nas << '\\n';
}
int main() {
  fast;
  solve();
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;

using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */

int main() {
  Bint x;
  cin >> x;
  Bint mon = 100;
  int num = 0;
  while (x > mon) {
    mon *= 101;
    mon /= 100;
    num++;
  }
  cout << num << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007 // 1e9+7
using namespace std;
typedef long long unsigned int ll;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef vector<string> vecstr;
typedef vector<bool> vecbool;
typedef vector<vector<int>> vec2int;
typedef pair<int, int> P;
////////////////////////////////////////////////
void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
////////////////////////////////////////////////
int main() {
  init();
  ll x;
  cin >> x;
  // cout << x << endl;
  ll mon = 100;
  int num = 0;
  ll a = 101LL;
  ll b = 100LL;
  if (x == 1e18) {
    cout << 3760 << endl;
    return 0;
  }
  while (mon < x) {
    mon *= a;
    mon /= b;
    num++;
    // cout << mon << endl;
  }
  cout << num << endl;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long num, solve;
  while (cin >> num) {
    int count = 0;
    solve = 100;
    while (num > solve) {
      solve = solve + (solve / 100);
      count++;
    }
    cout << count << endl;
    break;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long num, solve;
  while (cin >> num) {
    int count = 0;
    solve = 100;
    while (num != solve) {
      int percentage = solve / 100;
      solve += percentage;
      count++;
    }
    cout << count << endl;
    break;
  }
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  long long int X;
  cin >> X;

  long long int count = 0;
  long long int total = 100;

  for (long long int i = 0;; i++) {
    count += 1;
    total = total * 1.01;
    if (total >= X) {
      cout << count << endl;
      return 0;
    }
  }
}


Error: TLE

Fixed submission:

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

int main() {
  long long int X;
  cin >> X;

  long long int count = 0;
  long long int total = 100;

  for (long long int i = 0; true; i++) {
    count += 1;
    total = (total * 101) / 100;
    if (total >= X) {
      cout << count << endl;
      return 0;
    }
  }
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  long long x;
  cin >> x;
  long long m = 100;
  long long ans = 0;
  long long task = 0;
  while (x > m) {
    task = m / 100;
    m += task;
    ans++;
  }
  cout << ans << endl;
}

Error: TLE

Fixed submission:

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

int main() {
  long long x;
  cin >> x;
  long long m = 100;
  long long ans = 1;
  while (1) {
    m *= 101;
    m /= 100;
    if (x <= m)
      break;
    ans++;
  }
  cout << ans << endl;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
  unsigned long long X;
  cin >> X;
  unsigned long long a = 100, i = 0;
  while (a < X) {
    a += (a / 100);
    i++;
  }
  cout << i << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
  int X;
  cin >> X;
  int a = 100, i = 0;
  while (a < X) {
    double b = (double)a;
    b *= 1.01;
    a = (int)b;
    i++;
  }
  cout << i << endl;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  long long X;
  cin >> X;

  long long money = 100;
  for (int i = 1;; i++) {
    money += money / 100;
    if (money >= X) {
      cout << i << endl;
      break;
    }
  }
}

Error: TLE

Fixed submission:

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

int main() {
  long long X;
  cin >> X;

  long long money = 100;
  for (int i = 1;; i++) {
    money *= 101;
    money /= 100;
    if (money >= X) {
      cout << i << endl;
      break;
    }
  }
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long int x, count = 0;
  cin >> x;
  unsigned long long int n = 100;
  while (n < x) {
    n = n + n / 100;
    count++;
  }
  cout << count << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long int x, count = 0;
  cin >> x;
  unsigned long long int n = 100;
  while (n < x) {
    n = n * 101 / 100;
    count++;
  }
  cout << count << endl;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
  unsigned long long x;
  cin >> x;

  unsigned long long ans = 100;
  int count = 0;
  while (ans < x) {
    unsigned long long a = ans / 100;
    ans += a;
    ++count;
  }

  cout << count << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
  ll x;
  cin >> x;
  ll ans = 100;
  ll count = 0;
  while (ans < x) {
    ans = ans * 101 / 100;
    ++count;
  }
  cout << count << endl;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;

long interest(long g) { return g = g * 1.01; }

int main(void) {
  long x;
  long tmp = 100;
  int ans = 0;
  cin >> x;
  while (tmp < x) {
    tmp = interest(tmp);
    ans += 1;
  }
  // cout << "tmp = " << tmp << endl;
  cout << ans << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int interest(int g) { return g = g * 1.01; }

int main(void) {
  int x;
  int tmp = 100;
  int ans = 0;
  cin >> x;
  while (tmp < x) {
    tmp = interest(tmp);
    ans += 1;
  }
  cout << ans << endl;
  return 0;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <iostream>  // cout, endl, cin
#include <string>    // string, to_string, stoi
#include <vector>    // vector
using namespace std;

int main() {
  long long X, ans = 0, Q = 100;
  cin >> X;
  while (Q < X) {

    Q += Q / 100;
    ans++;
  }
  cout << ans << endl;
}


Error: TLE

Fixed submission:

#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <iostream>  // cout, endl, cin
#include <string>    // string, to_string, stoi
#include <vector>    // vector
using namespace std;

int main() {
  int X, ans = 1, ok;
  cin >> X;
  while (ok < 10000000000000) {
    ok = 100 ^ ans;

    if (X <= ok) {
      cout << ans << endl;
    }
    ans++;
  }
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define MIN -10000000
#define MAX 10000000
#define debug printf("%d", __LINE__)
using namespace std;
int main() {
  unsigned long long n, mn = 100, cnt = 0;
  cin >> n;
  while (mn < n) {
    mn += mn / 100;
    cnt = cnt + 1;
  }
  cout << cnt;
  return 0;
}


Error: TLE

Fixed submission:

#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define MIN -10000000
#define MAX 10000000
#define debug printf("%d", __LINE__)
using namespace std;
int main() {
  int n, now = 100;
  cin >> n;
  int cnt = 0;
  for (int i = 1;; i++) {
    cnt++;
    now *= 1.01;
    if (now == n)
      cout << cnt << endl, exit(0);
  }
  return 0;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  unsigned long long x, a, b;
  cin >> x;
  a = 100;
  b = 0;

  while (x > a) {
    a = a + a * 0.01;
    b++;
  }
  cout << b << endl;
}

Error: TLE

Fixed submission:

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

int main() {
  unsigned long int x, a, b;
  cin >> x;
  a = 100;
  b = 0;

  while (x != a) {
    a = a + a * 0.01;
    b++;
  }
  cout << b << endl;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  long long X;
  cin >> X;
  long long sum = 100;
  int count = 0;
  for (int i = 0; i < 100000; ++i) {
    sum += sum * 0.01;
    count++;
    if (sum >= X) {
      cout << count << endl;
      return 0;
    }
  }
  // cout << count << endl;
  // return 0;
}


Error: TLE

Fixed submission:

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

int main() {
  int X;
  cin >> X;
  int sum = 100.0;
  int count = 0;
  for (int i = 0; i < 1000000000; ++i) {
    sum = sum + sum * 0.01;
    count++;
    if (sum >= X)
      break;
  }
  cout << count << endl;
  return 0;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long X;
  cin >> X;
  long long Y = 100;
  long long ans = 0;
  while (Y < X) {
    ans++;
    Y += Y / 100;
  }
  cout << ans << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int X;
  cin >> X;
  int Y = 100;
  int ans = 0;
  while (Y < X) {
    ans++;
    Y += Y / 100;
  }
  cout << ans << endl;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep1(i, n) for (ll i = 1; i <= n; i++)
#define all(n) n.begin(), n.end()
#define yn(x) cout << (x ? "Yes" : "No") << endl;

int main() {
  ll x;
  cin >> x;
  ll yen = 100;
  ll ans = 0;
  while (yen < x) {
    yen *= 1.01;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep1(i, n) for (ll i = 1; i <= n; i++)
#define all(n) n.begin(), n.end()
#define yn(x) cout << (x ? "Yes" : "No") << endl;

int main() {
  int x;
  cin >> x;
  int yen = 100;
  int ans = 0;
  while (yen < x) {
    yen *= 1.01;
    ans++;
  }
  cout << ans << endl;
  return 0;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  long s;
  long t = 100;
  long c = 0;
  cin >> s;
  while (t < s) {
    t += t / 100;
    c++;
  }
  cout << c << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  long s;
  int t = 100;
  int c = 0;
  cin >> s;
  while (t < s) {
    t += t / 100;
    c++;
  }
  cout << c << endl;
  return 0;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  long long int x, cnt = 0, y = 100;
  cin >> x;
  while (y < x) {
    y = y + y / 100;
    cnt++;
  }
  cout << cnt;
  return 0;
}


Error: TLE

Fixed submission:

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

int main() {
  int x, cnt = 0, y = 100;
  cin >> x;
  while (y < x) {
    int v = ((1 / 100) * y) + y;
    cnt++;
  }
  cout << cnt;
  return 0;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long X;
  cin >> X;
  long long F = 100;
  long long year = 0;
  while (F < X) {
    year++;
    F = F * 1.01 / 1;
  }
  cout << year;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long s = 100, x = 0;
  do {
    s = s * 1.01 / 1;
    x++;
  } while (s != n);
  cout << x;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
namespace fastio {
template <typename tn> void read(tn &a) {
  tn x = 0, f = 1;
  char c = ' ';
  for (; !isdigit(c); c = getchar())
    if (c == '-')
      f = -1;
  for (; isdigit(c); c = getchar())
    x = x * 10 + c - '0';
  a = x * f;
}
template <typename tn> void print(tn a) {
  if (a < 0)
    putchar('-'), a = -a;
  if (a > 9)
    print(a / 10);
  putchar(a % 10 + '0');
}
}; // namespace fastio
using namespace fastio;
long long x;
int main() {
  read(x);
  long long n = 100;
  long long ans = 0;
  while (n < x) {
    n = 1.01 * n;
    ans++;
  }
  print(ans);
  puts("");
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int x;
int main() {
  cin >> x;
  int n = 100;
  int ans = 0;
  while (n < x) {
    n = 1.01 * n;
    ans++;
  }
  cout << ans << endl;
  return 0;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

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

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
using ll = long long;
string char_to_string(char val) { return string(1, val); }
int char_to_int(char val) { return val - '0'; }
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance(vec.begin(), itr);
  if (index != vec.size()) { // 発見できたとき
    return 1;
  } else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  ll X;
  cin >> X;
  ll i = 100;
  int ans = 0;
  while (true) {
    i += i / 100;
    ans++;
    if (i >= X || i < 0)
      break;
  }
  cout << ans << endl;
}

Error: TLE

Fixed submission:

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

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
using ll = long long;
string char_to_string(char val) { return string(1, val); }
int char_to_int(char val) { return val - '0'; }
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance(vec.begin(), itr);
  if (index != vec.size()) { // 発見できたとき
    return 1;
  } else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  ll X;
  cin >> X;
  ll i = 100;
  int ans = 0;
  while (true) {
    i = i * 101;
    i = i / 100;
    ans++;
    if (i >= X)
      break;
  }
  cout << ans << endl;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  double a;
  cin >> a;
  double b = 100;
  double i = 0;
  double c = 0;
  while (b < a) {
    c = floor(b / 100);
    b = b + c;
    i++;
  }
  cout << i << endl;
}

Error: TLE

Fixed submission:

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

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

#include <bits/stdc++.h>

using namespace std;

int main(void) {
  long long N;
  cin >> N;
  long long init = 100;

  int count = 0;
  while (1) {
    init += init / 100;
    count++;
    if (init >= N) {
      cout << count << endl;
      return 0;
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main(void) {
  int N;
  cin >> N;

  int count = 0;
  int t = 100;
  while (1) {
    count++;
    t = t + t * 0.01;
    if (t >= N) {
      cout << count << endl;
      return 0;
    }
  }
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
#define int int128_t
#define fr(a, b) for (int i = a; i < b; i++)
#define frn(a, b) for (int i = a; i >= b; i--)

int32_t main() {

  int x;
  cin >> x;
  int a = 100;
  int t = 0;
  while (a < x) {
    a = a * 101;
    a = a / 100;
    t++;
  }
  cout << t;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fr(a, b) for (int i = a; i < b; i++)
#define frn(a, b) for (int i = a; i >= b; i--)

int32_t main() {

  int x;
  cin >> x;
  int a = 100;
  int t = 0;
  while (a < x) {
    a = 101 * a;
    a = a / 100;
    t++;
  }
  cout << t;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int64_t X;
  cin >> X;

  int i = 0;
  int64_t money = 100;

  while (true) {
    i++;
    money *= 1.01;
    if (money >= X)
      break;
  }

  cout << i << endl;

  return 0;
}


Error: TLE

Fixed submission:

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

int main() {
  int64_t X;
  cin >> X;

  int i = 0;
  int money = 100;

  while (true) {
    i++;
    money *= 1.01;
    if (money >= X)
      break;
  }

  cout << i << endl;

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

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep_bit(n) for (int bit = 0; bit < (1 << n); ++bit)
#define ll long long
using namespace std;

int main() {

  ll X;
  cin >> X;
  ll money = 100;
  ll time = 0;
  while (money < X) {
    money = money * 1.01;
    time++;
  }
  cout << time << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep_bit(n) for (int bit = 0; bit < (1 << n); ++bit)
#define ll long long
using namespace std;

int main() {

  ll X;
  cin >> X;
  ll money = 100;
  ll time = 0;
  while (money < X) {
    money = int(money * 1.01);
    time++;
  }
  cout << time << endl;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long X;
  cin >> X;
  long long i = 100, year = 0;
  while (i < X) {
    i = i * 1.01;
    year++;
  }
  cout << year << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, year = 0, i = 100;
  cin >> x;
  while (i < x) {
    i = i * 1.01;
    year++;
  }
  cout << year << endl;
}
Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  long long X;
  cin >> X;
  long long okane = 100;
  long long count = 0;
  while (okane < X) {
    okane += okane / 100;
    count++;
  }
  cout << count << endl;
}

Error: TLE

Fixed submission:

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

int main() {
  int X;
  cin >> X;
  int okane = 100;
  int count = 0;
  while (okane < X) {
    okane += okane / 100;
    count++;
  }
  cout << count << endl;
}