Problem p02694 (C++) — buggy submission, verdict: Time Limit Exceeded

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x, y) CPP_CAT_I(x, y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x, y) x##y
#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end)                                                     \\
  for (i64 i = (start), CPP_CAT(i, xxxx_end) = (end);                          \\
       i < CPP_CAT(i, xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f, c, ...)                                                         \\
  (([&](decltype((c)) cccc) {                                                  \\
    return (f)(std::begin(cccc), std::end(cccc), ##__VA_ARGS__);               \\
  })(c))
template <typename C> i64 SIZE(const C &c) {
  return static_cast<i64>(c.size());
}
template <typename T, size_t N> i64 SIZE(const T (&)[N]) {
  return static_cast<i64>(N);
}
template <typename T, typename U, typename Comp = less<>>
bool chmax(T &xmax, const U &x, Comp comp = {}) {
  if (comp(xmax, x))
    xmax = x;
  return true;
  return false;
}
template <typename T, typename U, typename Comp = less<>>
bool chmin(T &xmin, const U &x, Comp comp = {}) {
  if (comp(x, xmin))
    xmin = x;
  return true;
  return false;
}
struct ProconInit {
  static constexpr int IOS_PREC = 15;
  static constexpr bool AUTOFLUSH = false;
  ProconInit() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(IOS_PREC);
    if (AUTOFLUSH)
      cout << unitbuf;
  }
} PROCON_INIT;
ll mod_pow(ll x, ll n) {
  if (n == 0)
    return 1;
  if (n % 2 == 0)
    return mod_pow(x * x % MOD, n / 2) % MOD;
  else
    return x * mod_pow(x, (n - 1)) % MOD;
}
ll mod_pow_r(ll x, ll n) {
  if (x == 0)
    return 0;
  if (n == 0)
    return 1;
  ll ret = 1;
  while (n)
    if (n & 1)
      ret = ret * x % MOD;
  x = x * x % MOD;
  n /= 2;
  return ret;
}
ll factorial(ll n) {
  ll ret = 1;
  REP(i, n) ret *= (i + 1);
  ret %= MOD;
  return ret;
}
ll combination(ll n, ll r) {
  if (n < 0 || n < r || r < 0)
    return 0;
  ll fn = factorial(n);
  ll fr = factorial(r);
  ll fn_r = factorial(n - r);
  ll d = (mod_pow(fr, MOD - 2) * mod_pow(fn_r, MOD - 2)) % MOD;
  ll u = fn % MOD;
  return u * d % MOD;
}

void solve() {
  ll x;
  cin >> x;
  ll count = 0;
  ll value = 100;
  while (true) {
    value += value / 100;
    count++;
    if (value >= x)
      break;
  }
  cout << count;
}

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

Error: TLE

Fixed submission:

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x, y) CPP_CAT_I(x, y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x, y) x##y
#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end)                                                     \\
  for (i64 i = (start), CPP_CAT(i, xxxx_end) = (end);                          \\
       i < CPP_CAT(i, xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f, c, ...)                                                         \\
  (([&](decltype((c)) cccc) {                                                  \\
    return (f)(std::begin(cccc), std::end(cccc), ##__VA_ARGS__);               \\
  })(c))
template <typename C> i64 SIZE(const C &c) {
  return static_cast<i64>(c.size());
}
template <typename T, size_t N> i64 SIZE(const T (&)[N]) {
  return static_cast<i64>(N);
}
template <typename T, typename U, typename Comp = less<>>
bool chmax(T &xmax, const U &x, Comp comp = {}) {
  if (comp(xmax, x))
    xmax = x;
  return true;
  return false;
}
template <typename T, typename U, typename Comp = less<>>
bool chmin(T &xmin, const U &x, Comp comp = {}) {
  if (comp(x, xmin))
    xmin = x;
  return true;
  return false;
}
struct ProconInit {
  static constexpr int IOS_PREC = 15;
  static constexpr bool AUTOFLUSH = false;
  ProconInit() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(IOS_PREC);
    if (AUTOFLUSH)
      cout << unitbuf;
  }
} PROCON_INIT;
ll mod_pow(ll x, ll n) {
  if (n == 0)
    return 1;
  if (n % 2 == 0)
    return mod_pow(x * x % MOD, n / 2) % MOD;
  else
    return x * mod_pow(x, (n - 1)) % MOD;
}
ll mod_pow_r(ll x, ll n) {
  if (x == 0)
    return 0;
  if (n == 0)
    return 1;
  ll ret = 1;
  while (n)
    if (n & 1)
      ret = ret * x % MOD;
  x = x * x % MOD;
  n /= 2;
  return ret;
}
ll factorial(ll n) {
  ll ret = 1;
  REP(i, n) ret *= (i + 1);
  ret %= MOD;
  return ret;
}
ll combination(ll n, ll r) {
  if (n < 0 || n < r || r < 0)
    return 0;
  ll fn = factorial(n);
  ll fr = factorial(r);
  ll fn_r = factorial(n - r);
  ll d = (mod_pow(fr, MOD - 2) * mod_pow(fn_r, MOD - 2)) % MOD;
  ll u = fn % MOD;
  return u * d % MOD;
}

void solve() {
  int x;
  cin >> x;
  int val = 100;
  int count = 0;
  while (x > val) {
    val += val / 100;
    ++count;
  }
  cout << count;
}

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