alexjercan/bugnet huggingface dataset:
Problem p02601 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int k;
  cin >> k;
  string ans = "No";
  for (int i = 0; i <= k; ++i) {
    for (int j = 0; i + j <= k; ++j) {
      int ta = a;
      int tb = b * pow(2, i);
      int tc = c * pow(2, j);
      if (ta < tb && tb < tc)
        ans = "Yes";
    }
  }

  cout << ans << endl;
}

Error: -8

Fixed submission:

#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i];

  long long temp = 1;
  for (int i = 0; i < k; ++i)
    temp *= a[i];
  for (int i = 0; i < n - k; ++i) {
    string ans;
    long long before = temp;
    temp /= a[i];
    temp *= a[i + k];
    long long after = temp;
    if (before < after)
      ans = "Yes";
    else
      ans = "No";
    cout << ans << endl;
  }
}
Problem p02601 (C++) — buggy submission, verdict: Runtime Error

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

int main(void) {
  int A, B, C, K;
  cin >> A >> B >> C >> K;

  vector<int> success;

  for (int r = 0; r <= K; r++) {
    for (int g = 0; g <= K; g++) {
      for (int b = 0; b <= K; b++) {
        int rval = A * (1 << r);
        int gval = B * (1 << g);
        int bval = C * (1 << b);
        if (rval < gval && gval < bval)
          success.push_back(r + g + b);
      }
    }
  }

  int min_op = 0;
  if (success.size() > 0) {
    min_op = *min_element(success.begin(), success.end());
  } else {
    cout << "No" << endl;
    return 0;
  }

  if (min_op <= K) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Error: 0

Fixed submission:

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

int main(void) {
  int A, B, C, K;
  cin >> A >> B >> C >> K;

  vector<int> success;

  for (int r = 0; r <= K; r++) {
    for (int g = 0; g <= K; g++) {
      for (int b = 0; b <= K; b++) {
        int rval = A * (1 << r);
        int gval = B * (1 << g);
        int bval = C * (1 << b);
        if (rval < gval && gval < bval)
          success.push_back(r + g + b);
      }
    }
  }

  int min_op = *min_element(success.begin(), success.end());

  if (min_op <= K) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

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

#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
  int A, B, C, K;
  cin >> A >> B >> C;
  cin >> K;
  int count = 0;
  while (count < K && !(B > A && C > B)) {
    if (B <= A) {
      B = B * 2;
      count++;
    } else if (count < K && C <= B) {
      C = C * 2;
      count++;
    }
  }
  if (B > A && C > B)
    printf("Yes\\n");
  else
    printf("No\\n");
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
  int A, B, C, K;
  cin >> A >> B >> C;
  cin >> K;
  int count = 0;
  while (count < K) {
    if (B <= A) {
      B = B * 2;
      count++;
    } else if (count < K && C <= B) {
      C = C * 2;
      count++;
    }
  }
  if (B > A && C > B)
    printf("Yes\\n");
  else
    printf("No\\n");
  return 0;
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main() {
  int A, B, C, K;
  bool flag = false;
  cin >> A >> B >> C >> K;
  for (int i = 0; i <= K; ++i) {
    for (int j = 0; j <= K; ++j) {
      for (int l = 0; l <= K; ++l) {
        int x = A * (1 << i), y = B * (1 << j), z = C * (1 << l);
        if (x < y && y < z && i + j + l <= K)
          flag = true;
      }
    }
  }

  if (flag == true)
    cout << "Yes";
  else
    cout << "No";
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int A, B, C, K;
  bool flag = false;

  for (int i = 0; i <= K; ++i) {
    for (int j = 0; j <= K; ++j) {
      for (int l = 0; l <= K; ++l) {
        int x = A * (1 << i), y = B * (1 << j), z = C * (1 << l);
        if (x < y && y < z && i + j + l <= K)
          flag = true;
      }
    }
  }

  if (flag == true)
    cout << "Yes";
  else
    cout << "No";
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded


#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

#define REP(i, a, b) for (int i = a; i <= b; i++)
#define ALL(a) a.begin(), a.end()
#define ALLN(a, n) (a, a + n)
#define MAX 10000007
#define MIN -10000007

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
#endif

  int t;
  t = 1;
  //  cin>>t;
  while (t--) {
    int a, b, c, l, j = 0;
    bool flag = false;
    cin >> a >> b >> c >> l;
    while (a >= b) {
      b *= 2;
      j++;
    }
    while (b >= c) {
      c *= 2;
      j++;
    }

    if (j <= l)
      cout << "Yes";
    else
      cout << "No";
  }
  cerr << "Time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}


Error: TLE

Fixed submission:



#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

#define REP(i, a, b) for (int i = a; i <= b; i++)
#define ALL(a) a.begin(), a.end()
#define ALLN(a, n) (a, a + n)
#define MAX 10000007
#define MIN -10000007

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
#endif

  int t;
  t = 1;
  //  cin>>t;
  while (t--) {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    if (b > a && c > b) {
      cout << "Yes";
      return 0;
    }
    while (k) {
      if (a > b)
        b *= 2, k--;
      if (b > c && k > 0)
        c *= 2, k--;
      if (b > a && c > b)
        break;
    }
    if (b > a && c > b)
      cout << "Yes";
    else
      cout << "No";
  }
  cerr << "Time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
Problem p02601 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a) for (int i = 0; i < (a); i++)
const ll MOD = 1000000007;
// const ll MOD=998244353;

int main() {
  int A[3], K;
  cin >> A[0] >> A[1] >> A[2] >> K;
  int X = 1;
  rep(i, K) X *= 3;
  rep(i, X) {
    int bit = i;
    int B[3];
    rep(i, 3) B[i] = A[i];
    rep(j, K) {
      B[bit % 3] *= 2;
      bit /= 3;
    }
    if (B[0] < B[1] && B[1] < B[2]) {
      cout << "Yes\\n";
      return 0;
    }
  }
  cout << "No\\n";
  return 0;
}

Error: -6
*** stack smashing detected ***: terminated


Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a) for (int i = 0; i < (a); i++)
const ll MOD = 1000000007;
// const ll MOD=998244353;

int main() {
  int A[3], K;
  cin >> A[0] >> A[1] >> A[2] >> K;
  int X = 1;
  rep(i, K) X *= 3;
  rep(bit, X) {
    bool flag = 1;
    rep(j, K) {
      A[(1 << j) & bit] *= 2;
      if (A[0] < A[1] && A[1] < A[2])
        continue;
      else
        flag = 0;
    }
    if (flag) {
      cout << "Yes\\n";
      return 0;
    }
  }
  cout << "No\\n";
  return 0;
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
}

inline void work() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  // c > b > a
  while (k) {
    if (b <= a) {
      b *= 2;
      k--;
    } else if (c <= b) {
      c *= 2;
      k--;
    } else
      break;
  }
  if (c > b && b > a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

int main() {
  // freopen(".txt", "r", stdin);
  quickread();
  work();
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
}

inline void work() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  // c > b > a
  while (k) {
    if (b <= a) {
      b *= 2;
      k--;
    } else if (c <= b) {
      c *= 2;
      k--;
    }
  }
  if (c > b && b > a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

int main() {
  // freopen(".txt", "r", stdin);
  quickread();
  work();
  return 0;
}
Problem p02601 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int k;
  cin >> k;

  for (int i = 0; i < k; i++) {

    if (a < b && c > b) {
      break;
    } else if (a >= b) {
      b = b * 2;
      continue;
    } else if (c <= b) {
      c = c * 2;
      continue;
    }
  }

  if (a < b && c > b) {
    cout << "Yes";

  } else
    cout << "No";
}


Error: WA

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int k;
  cin >> k;

  for (int i = 0; i < k; i++) {

    if (a < b && c > b) {
      cout << "yes";
      exit(4);
    } else if (a > b)
      b = b * 2;
    else if (c < b)
      c = c * 2;
  }

  if (a < b && c > b) {
    cout << "yes";

  } else
    cout << "no";
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int A, B, C, K;
  cin >> A >> B >> C;
  cin >> K;

  while (K > 0) {
    if (B > A && C > B) {
      break;
    }

    if (B <= A) {
      B *= 2;
      K--;
    } else if (C <= B) {
      C *= 2;
      K--;
    }
  }

  if (B > A && C > B) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:

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

int main() {
  int A, B, C, K;
  cin >> A >> B >> C;
  cin >> K;

  while (K > 0) {
    if (B <= A) {
      B *= 2;
      K--;
    } else if (C <= B) {
      C *= 2;
      K--;
    }
  }

  if (B > A && C > B) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}
Problem p02601 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int i = 0;
  int K;
  cin >> K;
  for (i = 0; i < K; ++i) {
    if (A >= B) {
      B *= 2;
    } else if (B >= C) {
      C *= 2;
    }
  }
  if (B > A && C > B) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int i = 0;
  int K;
  cin >> K;
  for (i = 0; i < K; ++i) {
    if (A > B) {
      B *= 2;
    } else if (B > C) {
      C *= 2;
    } else {
      return A * 2 or B * 2 or C * 2;
    }
  }
  if (B > A && C > B) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 1; i <= (n); i++)
typedef long long ll;
#define ALL(obj) (obj).begin(), (obj).end()

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  int k;
  cin >> k;

  int cnt = 0;

  while (a >= b) {
    cnt++;
    b *= 2;
  }

  while (b >= c) {
    cnt++;
    c *= 2;
  }

  if (cnt <= k) {
    cout << "Yes" << endl;
  }

  else {
    cout << "No" << endl;
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 1; i <= (n); i++)
typedef long long ll;
#define ALL(obj) (obj).begin(), (obj).end()

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  int k;
  cin >> k;

  int cnt = 0;

  while (a >= b) {
    cnt++;
    b *= 2;
  }

  while (b >= c) {
    cnt++;
    c = 2;
  }

  if (cnt < k) {
    cout << "Yes" << endl;
  }

  else {
    cout << "No" << endl;
  }
}
Problem p02601 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (c > b && b > a)
    cout << "Yes";
  else {
    bool e = 0;
    for (int i = 1; i <= d; i++) {
      if (b >= c) {
        c *= 2;
        continue;
      }
      if (a >= b) {
        b *= 2;
        continue;
      }
      cout << "Yes";
      e = 1;
      break;
    }
    if (c > b && b > a && e == 0)
      cout << "Yes";
    else if (e == 0)
      cout << "No";
  }
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  long long n, m = 1000;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long s;
  for (ll i = 0; i < n - 1; i++) {
    if (arr[i] >= arr[i + 1])
      continue;
    else {
      s = m / arr[i];
      m = m % arr[i];
      m = m + s * arr[i + 1];
    }
  }
  cout << m << endl;
  return 0;
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

bool judgment(int A, int B, int C) {
  if (A < B && B < C) {
    // cout << A << " " << B << " " << C << " " << endl;
    cout << "Yes" << endl;
    return true;
  } else {
    // cout << A << " " << B << " " << C << " " << endl;
    return false;
  }
}

int main() {
  int A, B, C, K, cnt = 0;
  cin >> A >> B >> C;
  cin >> K;

  rep(i, K) {
    if (B <= A) {
      B *= 2;
      ++cnt;
    } else if (C <= B) {
      C *= 2;
      ++cnt;
    }

    if (judgment(A, B, C)) {
      return 0;
    } else {
      continue;
    }
  }

  if (A < B && B < C) {
    cout << "Yes" << endl;
    return 0;
  } else {
    cout << "No" << endl;
    return 0;
  }

  return 0;
}


Error: TLE

Fixed submission:

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int A, B, C, K, cnt = 0;
  cin >> A >> B >> C;
  cin >> K;
  while (cnt < K) {

    if (A > B) {
      B *= 2;
      cnt++;

    } else if (B > C) {
      C *= 2;
      cnt++;
    }
    if (A < B && B < C && cnt <= K) {
      // cout << A << " " << B << " " << C << " " << endl;
      cout << "Yes" << endl;
      return 0;
    } else if (cnt <= K) {
      // cout << A << " " << B << " " << C << " " << endl;
      continue;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int64_t A, B, C, K;
  cin >> A >> B >> C >> K;

  bool state = true;
  int64_t count = 0;

  for (int64_t i = 0; i < K; i++) {
    if (A < B)
      break;
    B = B * 2;
    count++;
    if (A < B)
      break;
    if (count == K)
      break;
  }

  for (int64_t i = count; i < K; i++) {
    C = C * 2;
    count++;
    if (count == K)
      break;
  }

  if (A >= B || B >= C) {
    state = false;
  }

  // cout << A << B << C << endl;
  if (state) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

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

int main() {
  int64_t A, B, C, K;
  cin >> A >> B >> C >> K;

  bool state = true;
  int64_t count = 0;

  for (;;) {
    if (A < B)
      break;
    B = B * 2;
    count++;
    if (count == K)
      break;
  }

  for (;;) {
    C = C * 2;
    count++;
    if (count == K)
      break;
  }

  if (A >= B || B >= C) {
    state = false;
  }

  // cout << A << B << C << endl;
  if (state) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int K;
  cin >> K;
  while ((B <= A) && (K > 0)) {
    B *= 2;
    K--;
  }
  while ((B > A) && (K > 0)) {
    C *= 2;
    K--;
  }
  if ((C > B) && (B > A)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int K;
  cin >> K;
  while ((B <= A) && (K > 0)) {
    B *= 2;
    K--;
  }
  while ((B > A) && (K > 0)) {
    C *= 2;
  }
  if ((C > B) && (B > A)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded


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

int main() {
  int a, b, c, k;
  cin >> a >> b >> c;
  cin >> k;
  while (k) {

    if (a >= b) {
      b = b * 2;
      k--;
      // cout<<b<<k;
    } else if (b >= c) {
      c = c * 2;
      k--;
      // cout<<c<<k;
    } else {
      k--;
    }
  }
  if (a < b && b < c) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}


Error: TLE

Fixed submission:


#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, k;
  cin >> a >> b >> c;
  cin >> k;
  while (k) {

    if (a > b) {
      b = b * 2;
      k--;
      // cout<<b<<k;
    }
    if (b > c) {
      c = c * 2;
      k--;
      // cout<<c<<k;
    }
  }
  if (a < b && b < c && k == 0) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}
Problem p02601 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

int main() {

  int v[3];

  for (int i = 0; i < 3; ++i)
    cin >> v[i];

  int k;
  cin >> k;

  int p = 1;
  while (k-- and p < 3) {
    if (v[p] <= v[p - 1])
      v[p] *= 2;
    else
      p++, k++;
  }

  if (v[0] < v[1] and v[1] < v[2])
    cout << "Yes\\n";
  else
    cout << "No\\n";
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {

  int v[3];

  for (int i = 0; i < 3; ++i)
    cin >> v[i];

  int k;
  cin >> k;

  int p = 1;
  while (k--) {
    if (v[p] <= v[p - 1])
      v[p] *= 2;
    else
      p++, k++;
  }

  if (v[0] < v[1] and v[1] < v[2])
    cout << "Yes\\n";
  else
    cout << "No\\n";
  return 0;
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int A, B, C, K;
  int count = 0;
  cin >> A >> B >> C >> K;

  while (A >= B) {
    count++;
    B *= 2;
  }
  while (B >= C) {
    count++;
    C *= 2;
  }
  if (K >= count) {
    cout << "Yes";
  } else
    cout << "No";

  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int A, B, C, K;
  int count = 0;
  cin >> A >> B >> C >> K;

  while (A >= B)
    count++;
  B *= 2;
  while (B >= C)
    count++;
  C *= 2;
  if (K >= count) {
    cout << "Yes";
  } else
    cout << "No";

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

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define INF int(1e6 + 1)
#define rep(i, n, m) for (int i = n; i < m; i++)

using namespace std;

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int k;
  cin >> k;
  int ans = 0;
  while (g - r <= 0) {
    g *= 2;
    ans++;
    if (ans > 8)
      break;
  }
  while (b - g <= 0) {
    b *= 2;
    ans++;
    if (ans > 8)
      break;
  }
  if (ans <= k)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define INF int(1e6 + 1)
#define rep(i, n, m) for (int i = n; i < m; i++)

using namespace std;

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int k;
  cin >> k;
  int ans = 0;
  while (g - r <= 0) {
    g *= g;
    ans++;
  }
  while (b - g <= 0) {
    b *= b;
    ans++;
  }
  if (ans <= k)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int a, b, c, k;
int main() {
  cin >> a >> b >> c >> k;
  while (k != 0) {
    if (a < b && b < c) {
      cout << "Yes";
      return 0;
    }
    if (a >= b) {
      k--;
      b *= 2;
    } else if (b >= c) {
      k--;
      c *= 2;
    }
  }
  if (a < b && b < c) {
    cout << "Yes";
    return 0;
  }
  cout << "No";
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int a, b, c, k;
int main() {
  cin >> a >> b >> c >> k;
  while (k != 0) {

    if (a >= b) {
      k--;
      b *= 2;
    } else if (b >= c) {
      k--;
      c *= 2;
    } else if (a >= c) {
      k--;
      c *= 2;
    }
  }
  if (a < b && b < c) {
    cout << "Yes";
    return 0;
  }
  cout << "No";
  return 0;
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int k;
  cin >> k;
  for (int i = 0; i < k; i++) {
    if (!(b > g)) {
      b = b * 2;
    } else if (!(g > r)) {
      g = g * 2;
    }
  }
  if (b > g && g > r)
    printf("Yes\\n");
  else
    printf("No\\n");
  return 0;
}


Error: TLE

Fixed submission:

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

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int k;
  cin >> k;

  while (k) {
    if (k < 0) {
      break;
    }
    if (b < g) {
      b = b * 2;
      k--;
    }
    if (r > g) {
      g = g * 2;
      k--;
    }
    // printf("%d ", k);
  }
  if (b > g && g > r)
    printf("Yes\\n");
  else
    printf("No\\n");
  return 0;
}
Problem p02601 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int i;

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

  int a, b, c, k;
  cin >> a >> b >> c >> k;
  if (b > a && c > b) {
    cout << "Yes" << endl;
    return 0;
  }
  for (i = 0; k > 0 || !(b > a && c > b); i++) {
    if (!(b > a)) {
      b *= 2;
      k--;
    }
    if (k <= 0)
      break;
    if (!(c > b)) {
      c *= 2;
      k--;
    }
    if (k <= 0)
      break;
    if (b > a && c > b && k > 0) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (b > a && c > b)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int i;

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

  int a, b, c, k;
  cin >> a >> b >> c >> k;
  if (b > a && c > b) {
    cout << "Yes" << endl;
    return 0;
  }
  for (i = 0; k > 0; i++) {
    if (!(b > a)) {
      b *= 2;
      k--;
    }
    if (k <= 0)
      break;
    if (!(c > b)) {
      c *= 2;
      k--;
    }
    if (k <= 0)
      break;
  }
  if (!(b > a) || !(c > b))
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}