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

#include <bits/stdc++.h>
using namespace std;
#define error(args...)                                                         \\
  {                                                                            \\
    string _s = #args;                                                         \\
    replace(_s.begin(), _s.end(), ',', ' ');                                   \\
    stringstream _ss(_s);                                                      \\
    istream_iterator<string> _it(_ss);                                         \\
    err(_it, args);                                                            \\
  }
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " ; ";
  err(++it, args...);
  cout << endl;
}
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
/*Let's start.............*/
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define srt(v) sort(v.begin(), v.end())
#define inf 2000000000000000000
#define mxn 40000
#define MOD 1000000007
#define pi acos(-1)
#define X first
#define Y second

int main() {
  double keep;
  cin >> keep;
  ll cnt = 0;
  double n = 100.0;
  while (n < keep) {
    cnt++;
    n += (n * 0.01);
    ll peek = n;
    n = peek;
  }
  cout << cnt << endl;
}

/*-------------------------------------------------------------------------------------------------------------------------------------------------------
".....but the truth is that you can increase it slightly."
Day 35.
*/


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define error(args...)                                                         \\
  {                                                                            \\
    string _s = #args;                                                         \\
    replace(_s.begin(), _s.end(), ',', ' ');                                   \\
    stringstream _ss(_s);                                                      \\
    istream_iterator<string> _it(_ss);                                         \\
    err(_it, args);                                                            \\
  }
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " ; ";
  err(++it, args...);
  cout << endl;
}
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
/*Let's start.............*/
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define srt(v) sort(v.begin(), v.end())
#define inf 2000000000000000000
#define mxn 40000
#define MOD 1000000007
#define pi acos(-1)
#define X first
#define Y second

int main() {
  double keep;
  cin >> keep;
  ll cnt = 0;
  double n = 100.0;
  while (n != keep) {
    cnt++;
    n += (n * 0.01);
    if (abs(keep - n) < 1.0)
      break;
  }
  if (n < keep)
    cnt++;
  cout << cnt << endl;
}

/*-------------------------------------------------------------------------------------------------------------------------------------------------------
".....but the truth is that you can increase it slightly."
Day 35.
*/