Problem p02694 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
#define LEN 100005
#define rep(i, n) for (int i = 0; i < n; i++)
#define Rep(i, n) for (ll i = 0; i < n; i++)
#define For(i, m, n) for (int i = m; i < n; i++)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
using namespace std;
using ll = long long;
double pi() { return 3.14; }
int sum(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }
ll LGCD(ll x, ll y) {
  if (x % y == 0)
    return y;
  else
    return LGCD(y, x % y);
}
ll LLCM(ll x, ll y) { return x * y / LGCD(x, y); }

int GCD(int x, int y) {
  if (x % y == 0)
    return y;
  else
    return GCD(y, x % y);
}
int LCM(int x, int y) { return x * y / GCD(x, y); }
ll dpc[10000][10000];

// void nCr(ll n, ll r) {
//	ll ans = 1;
//	for (int i = n; i > n - r; --i) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1; ++i) {
//		ans = ans / i;
//	}
//	printf("%d",ans);
// }

ll combination(ll n, ll r) {
  if (n == r) {
    return dpc[n][n] = 1;
  } else if (r == 0) {
    return dpc[n][0] = 1;
  } else if (r == 1) {
    return dpc[n][1] = n;
  } else if (dpc[n][r]) {
    return dpc[n][r];
  } else {
    return dpc[n][r] = combination(n - 1, r - 1) + combination(n - 1, r);
  }
}

// cout << fixed << setprecision(10);

ll checkman(vector<int> s, int i) {

  int mozila = 1;
  int n = s.size();
  int tmp = 0;
  ll ans = 0;
  for (int k = i; k < n; k++) {
    tmp = tmp + s[k];
    if (tmp % 2019 == 0)
      ans++;

    tmp = (tmp * 10) % 2019;
  }
  return ans;
}

int main() {
  ll x;
  cin >> x;
  ll i = 0;
  ll a = 100;
  while (1) {
    i++;
    a = a * 101 / 100;
    if (a >= x)
      break;
  }
  cout << i << endl;
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
#define LEN 100005
#define rep(i, n) for (int i = 0; i < n; i++)
#define Rep(i, n) for (ll i = 0; i < n; i++)
#define For(i, m, n) for (int i = m; i < n; i++)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
using namespace std;
using ll = long long;
double pi() { return 3.14; }
int sum(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }
ll LGCD(ll x, ll y) {
  if (x % y == 0)
    return y;
  else
    return LGCD(y, x % y);
}
ll LLCM(ll x, ll y) { return x * y / LGCD(x, y); }

int GCD(int x, int y) {
  if (x % y == 0)
    return y;
  else
    return GCD(y, x % y);
}
int LCM(int x, int y) { return x * y / GCD(x, y); }
ll dpc[10000][10000];

// void nCr(ll n, ll r) {
//	ll ans = 1;
//	for (int i = n; i > n - r; --i) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1; ++i) {
//		ans = ans / i;
//	}
//	printf("%d",ans);
// }

ll combination(ll n, ll r) {
  if (n == r) {
    return dpc[n][n] = 1;
  } else if (r == 0) {
    return dpc[n][0] = 1;
  } else if (r == 1) {
    return dpc[n][1] = n;
  } else if (dpc[n][r]) {
    return dpc[n][r];
  } else {
    return dpc[n][r] = combination(n - 1, r - 1) + combination(n - 1, r);
  }
}

// cout << fixed << setprecision(10);

ll checkman(vector<int> s, int i) {

  int mozila = 1;
  int n = s.size();
  int tmp = 0;
  ll ans = 0;
  for (int k = i; k < n; k++) {
    tmp = tmp + s[k];
    if (tmp % 2019 == 0)
      ans++;

    tmp = (tmp * 10) % 2019;
  }
  return ans;
}

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