prithivMLmods/Coder-Stat huggingface dataset:
Problem p02601 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

#define sws                                                                    \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define fo(i, n) for (int i = 0; i < n; i++)

const int INF = 1e9;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;

int main() {
  sws;

  int a, b, c, k;
  cin >> a >> b >> c >> k;

  while (k > 0) {
    while (k > 0 and (c <= a or c <= b)) {
      c *= 2;
      k--;
    }

    while (k > 0 and b <= a) {
      b *= 2;
      k--;
    }
  }

  if (b > a and c > a and c > b) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }

  return 0;
}

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

#define sws                                                                    \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define fo(i, n) for (int i = 0; i < n; i++)

const int INF = 1e9;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;

int main() {
  sws;

  int a, b, c, k;
  cin >> a >> b >> c >> k;

  while (k > 0 and (c <= a or b <= a or c <= b)) {
    while (k > 0 and (c <= a or c <= b)) {
      c *= 2;
      k--;
    }

    while (k > 0 and b <= a) {
      b *= 2;
      k--;
    }
  }

  if (b > a and c > a and c > b) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }

  return 0;
}
Problem p02601 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, l, r) for (int i = (l); i < (r); i++)

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

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, l, r) for (int i = (l); i < (r); i++)

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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
#define ll long long int

int main() {
  int a, b, c;
  int k;
  cin >> a >> b >> c;
  cin >> k;
  int i = 0, x = 0;
  int flag = 0;
  while (i < k) {
    if (x == 0) {
      if (b <= a) {
        b *= 2;
        i++;
      }
      if (b > a) {
        x = 1;
      }
    } else if (x == 1) {
      if (c <= b) {
        c *= 2;
        i++;
      }
      if (c > b) {
        flag = 1;
      }
    }
  }
  if (flag == 1)
    cout << "Yes";
  else
    cout << "No";

  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
#define ll long long int

int main() {
  int a, b, c;
  int k;
  cin >> a >> b >> c;
  cin >> k;
  int i = 0, x = 0;
  int flag = 0;
  while (i < k) {
    if (x == 0) {
      if (b <= a) {
        b *= 2;
        i++;
      }
      if (b > a) {
        x = 1;
      }
    } else if (x == 1) {
      if (c <= b) {
        c *= 2;
        i++;
      }
      if (c > b) {
        flag = 1;
        break;
      }
    }
  }
  if (flag == 1)
    cout << "Yes";
  else
    cout << "No";

  return 0;
}
Problem p02601 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;

#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define x first
#define y second

const int MOD = 1e9 + 7;

void setIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  //    freopen((s+".in").c_str(),"r",stdin);
  //    freopen((s+".text").c_str(),"w",stdout);
}

// ctrl q is comment
// ctrl b is run
// ctrl s is compile
// alt r is search & replace
// alt d is delete a line

int main() {
  setIO();
  int a, b, c, K;
  cin >> a >> b >> c >> K;
  int k2 = K;
  bool ok = false;
  int p2[10];
  int p = 0, m = 1;
  p2[0] = 1;
  while (p < 10) {
    ++p;
    m *= 2;
    p2[p] = m;
  }
  K = k2;
  for (int i = 0; i < 7; ++i) {
    for (int j = 0; j < 7; ++j) {
      for (int k = 0; k < 7; ++k) {
        if (i + j + k > K)
          continue;
        int ra = a * p2[i];
        int rb = b * p2[j];
        int rc = c * p2[k];
        if (rb > ra && rc > rb) {
          ok = true;
        }
      }
    }
  }
  cout << (ok ? "Yes\n" : "No\n");
}

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

using ll = long long;
using pii = pair<int, int>;

#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define x first
#define y second

const int MOD = 1e9 + 7;

void setIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  //    freopen((s+".in").c_str(),"r",stdin);
  //    freopen((s+".text").c_str(),"w",stdout);
}

// ctrl q is comment
// ctrl b is run
// ctrl s is compile
// alt r is search & replace
// alt d is delete a line

int main() {
  setIO();
  int a, b, c, K;
  cin >> a >> b >> c >> K;
  int k2 = K;
  bool ok = false;
  int p2[10];
  int p = 0, m = 1;
  p2[0] = 1;
  while (p < 9) {
    ++p;
    m *= 2;
    p2[p] = m;
  }
  K = k2;
  for (int i = 0; i < 7; ++i) {
    for (int j = 0; j < 7; ++j) {
      for (int k = 0; k < 7; ++k) {
        if (i + j + k > K)
          continue;
        int ra = a * p2[i];
        int rb = b * p2[j];
        int rc = c * p2[k];
        if (rb > ra && rc > rb) {
          ok = true;
        }
      }
    }
  }
  cout << (ok ? "Yes\n" : "No\n");
}
Problem p02601 (C++)

Buggy submission (status: 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;
const int inf = 1001001001;

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

  while (k > 0) {
    if (b <= a) {
      b *= 2;
      k--;
      continue;
    }
    if (c <= b) {
      c *= 2;
      k--;
      continue;
    }
  }

  if (a < b && b < c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;

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

  while (k > 0) {
    if (b <= a) {
      b *= 2;
      k--;
      continue;
    }
    if (c <= b) {
      c *= 2;
      k--;
      continue;
    }
    k--;
  }

  if (a < b && b < c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02601 (Python)

Buggy submission (status: Runtime Error):
a, b, c = 7, 4, 2
k = int(input())

while a >= b and k > 0:
    b *= 2
    k -= 1

while b >= c and k > 0:
    c *= 2
    k -= 1

if a < b < c:
    print("Yes")
else:
    print("No")


Fixed submission:
a, b, c = map(int, input().split())
k = int(input())

while a >= b and k > 0:
    b *= 2
    k -= 1

while b >= c and k > 0:
    c *= 2
    k -= 1

if a < b < c:
    print("Yes")
else:
    print("No")
Problem p02601 (Python)

Buggy submission (status: Time Limit Exceeded):
A, B, C = map(int, input().split())
K = int(input())

while K > 0:
    if A >= B:
        B *= 2
        K -= 1
    elif B >= C:
        C *= 2
        K -= 1
if C > B and B > A:
    print("Yes")
else:
    print("No")


Fixed submission:
A, B, C = map(int, input().split())
K = int(input())

while K > 0:
    if A >= B:
        B *= 2
        K -= 1
    elif B >= C:
        C *= 2
        K -= 1
    if C > B and B > A:
        break
if C > B and B > A:
    print("Yes")
else:
    print("No")
Problem p02601 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

using namespace std;

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

  cin >> a >> b >> c >> k;

  while (k > 0) {
    if (c <= b || c <= a) {
      c *= 2;
      k--;
    }

    else if (b <= a) {
      b *= 2;
      k--;
    }
  }

  (c > b && b > a) ? cout << "Yes" << endl : cout << "No" << endl;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;

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

  cin >> a >> b >> c >> k;

  while (k > 0) {
    if (c <= b || c <= a) {
      c *= 2;
      k--;
    }

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

  (c > b && b > a) ? cout << "Yes" << endl : cout << "No" << endl;

  return 0;
}
Problem p02601 (C++)

Buggy submission (status: 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 = *min_element(success.begin(), success.end());

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

  return 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 = 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;
}
Problem p02601 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int N = 1e5 + 5, mod = 1e9 + 7;

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

  while (k) {
    if (g <= r) {
      g *= 2;
      --k;
    } else if (b <= g) {
      b *= 2;
      --k;
    }
  }

  if (g > r && b > g) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--)
    solve();
  return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
const int N = 1e5 + 5, mod = 1e9 + 7;

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

  while (k) {
    if (g <= r) {
      g *= 2;
      --k;
    } else if (b <= g) {
      b *= 2;
      --k;
    }
    if (g > r && b > g) {
      break;
    }
  }

  if (g > r && b > g) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--)
    solve();
  return 0;
}
Problem p02601 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, k;
  int cnt = 0;
  cin >> a >> b >> c >> k;
  while (a >= b) {
    cnt += 1;
    b *= 2;
  }
  while (b >= c) {
    cnt += 1;
    c * 2;
  }
  if (cnt <= k)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, k;
  int cnt = 0;
  cin >> a >> b >> c >> k;
  while (a >= b) {
    cnt += 1;
    b *= 2;
  }
  while (b >= c) {
    cnt += 1;
    c *= 2;
  }
  if (cnt <= k)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int main() {

  long long int n, k;
  scanf("%lld", &n);
  scanf("%lld", &k);

  long long int a[100];
  for (long long int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  for (long long int j = 0; j < n - k; j++) {
    if (a[k + j] > a[j]) {
      printf("Yes\n");
    } else
      printf("No\n");
  }

  return 0;
}

Fixed submission:
#include <stdio.h>
int main() {

  long long int n, k;
  scanf("%lld", &n);
  scanf("%lld", &k);

  long long int a[200000];
  for (long long int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  for (long long int j = 0; j < n - k; j++) {
    if (a[k + j] > a[j]) {
      printf("Yes\n");
    } else
      printf("No\n");
  }

  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <vector>
using namespace std;
int main() {
  long N;
  cin >> N;
  long K;
  cin >> K;
  vector<long> avec;
  vector<long> zeros;
  for (long i = 0; i < N; ++i) {
    long a;
    cin >> a;
    avec.emplace_back(a);
    if (a == 0) {
      zeros.emplace_back(i);
    }
  }

  unsigned int currentZeroIdx = 0u;
  int currentZero = -1;
  if (zeros.size() > 0) {
    currentZero = zeros[currentZeroIdx];
  }
  for (long i = K; i < N; ++i) {
    if (currentZero < i - K + 1) {
      currentZeroIdx++;
      if (zeros.size() - 1 < currentZeroIdx) {
        currentZero = -1;
      } else {
        currentZero = zeros[currentZeroIdx];
      }
    }

    if ((currentZero != -1) && (i - K + 1 <= currentZero && currentZero < i)) {
      cout << "No" << endl;
    } else {
      if (avec[i] > avec[i - K]) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
}

Fixed submission:
#include <iostream>
#include <vector>
using namespace std;
int main() {
  long N;
  cin >> N;
  long K;
  cin >> K;
  vector<long> avec;
  vector<long> zeros;
  for (long i = 0; i < N; ++i) {
    long a;
    cin >> a;
    avec.emplace_back(a);
    if (a == 0) {
      zeros.emplace_back(i);
    }
  }

  unsigned int currentZeroIdx = 0u;
  int currentZero = -1;
  if (zeros.size() > 0) {
    currentZero = zeros[currentZeroIdx];
  }
  for (long i = K; i < N; ++i) {
    if ((zeros.size() > 0) && currentZero < i - K + 1) {
      currentZeroIdx++;
      if (zeros.size() - 1 < currentZeroIdx) {
        currentZero = -1;
      } else {
        currentZero = zeros[currentZeroIdx];
      }
    }

    if ((currentZero != -1) && (i - K + 1 <= currentZero && currentZero < i)) {
      cout << "No" << endl;
    } else {
      if (avec[i] > avec[i - K]) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <climits>
#include <cstdint> // int64_t, int*_t
#include <cstdio>  // printf
#include <deque>   // deque
#include <functional>
#include <iomanip> //setprecision
#include <iostream>
#include <map> // map
#include <math.h>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define mod 1000000007
vector<ll> to[1000005];
ll dp[2000000];
int gcd(int a, int b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
int main() {
  ll a, b;
  cin >> a >> b;
  vector<ll> c(a);
  rep(i, a) cin >> c[i];
  rep(i, b - 1) {
    if (c[i] < c[i + b])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    // cout<<c[i+b];
  }
}


Fixed submission:
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <climits>
#include <cstdint> // int64_t, int*_t
#include <cstdio>  // printf
#include <deque>   // deque
#include <functional>
#include <iomanip> //setprecision
#include <iostream>
#include <map> // map
#include <math.h>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define mod 1000000007
vector<ll> to[1000005];
ll dp[2000000];
int gcd(int a, int b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
int main() {
  ll a, b;
  cin >> a >> b;
  vector<ll> c(a);
  rep(i, a) cin >> c[i];
  rep(i, a - b) {
    if (c[i] < c[i + b])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    // cout<<c[i+b];
  }
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <numeric>
using namespace std;

int main() {
  int n, k;
  vector<int> a(n);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = k; i < n; ++i) {
    if (a[i - k] < a[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}


Fixed submission:
#include <bits/stdc++.h>
#include <numeric>
using namespace std;

int main() {
  int n, k;
  int a[200005];
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = k; i < n; ++i) {
    if (a[i - k] < a[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1000000007;
const ll INF = 1LL << 60;

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

  V<ll> sums(n + 2, 1);
  for (int i = 0; i < n; i++) {
    sums[i + 2] = sums[i + 1] * a[i];
  }
  V<ll> ans;
  for (int i = k + 1; i <= n + 1; i++) {
    ans.push_back(sums[i] / sums[i - k]);
  }
  for (int i = 1; i < (int)ans.size(); i++) {
    if (ans[i - 1] < ans[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }

  return 0;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  int n, k;
  cin >> n >> k;
  V<ll> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = k; i < n; i++) {
    if (a[i - k] < a[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }

  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int lt[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &lt[i]);
  }
  int c = n - k;
  for (int i = 0; i < c; i++) {
    if (lt[i] < lt[i + c]) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
  return 0;
}

Fixed submission:
#include <stdio.h>

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int lt[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &lt[i]);
  }
  int c = n - k;
  for (int i = 0; i < c; i++) {
    if (lt[i] < lt[i + k]) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  vector<ll> s(n + 1);
  s[0] = 1;
  rep(i, n) s[i + 1] = s[i] * a[i];
  for (int i = k + 1; i <= n; i++) {
    if (s[i] / s[i - k] > s[i - 1] / s[i - k - 1])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  for (int i = k; i < n; i++) {
    if (a[i - k] < a[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int a[20000];
int main() {
  int N, K, i;
  scanf("%d%d", &N, &K);

  for (i = 0; i < N; i++)
    scanf("%d", &a[i]);

  for (i = 0; i < N - K; i++)
    if (a[i] < a[K + i])
      printf("Yes\n");
    else
      printf("No\n");

  return 0;
}

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

int a[200001];
int main() {
  int N, K, i;
  scanf("%d%d", &N, &K);

  for (i = 0; i < N; i++)
    scanf("%d", &a[i]);

  for (i = 0; i < N - K; i++)
    if (a[i] < a[K + i])
      printf("Yes\n");
    else
      printf("No\n");

  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
using P = pair<int, int>;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

ll MOD = 1000000007;
ll INF = 1 << 30;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> A(n);
  rep(i, n) cin >> A[i];
  rep(i, k + i < n) {
    if (A[k + i] > A[i]) {
      cout << "Yes" << endl;
    } else
      cout << "No" << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
using P = pair<int, int>;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

ll MOD = 1000000007;
ll INF = 1 << 30;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> A(n);
  rep(i, n) cin >> A[i];
  rep(i, n - k) {
    if (A[k + i] > A[i]) {
      cout << "Yes" << endl;
    } else
      cout << "No" << endl;
  }
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long K, std::vector<long long> A) {
  vector<long long> cumsum(N, 0);
  cumsum[0] = A[0];
  for (long long i = 1; i <= N; ++i) {
    cumsum[i] = cumsum[i - 1] * A[i];
  }
  // for(long long i = 0; i < N; ++i) cout << cumsum[i] << endl;
  // cout << cumsum[K-1] << endl;
  // for(long long i = K; i < N; ++i) cout << cumsum[i] / cumsum[i-K] << endl;
  for (long long i = K; i < N; ++i) {
    if (i == K) {
      if (cumsum[i] / cumsum[i - K] > cumsum[i - 1])
        cout << YES << endl;
      else
        cout << NO << endl;
    } else {
      if ((cumsum[i] / cumsum[i - K]) > (cumsum[i - 1] / cumsum[i - K - 1]))
        cout << YES << endl;
      else
        cout << NO << endl;
    }
  }
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, K, std::move(A));
  return 0;
}


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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long K, std::vector<long long> A) {
  for (int i = K; i < N; ++i) {
    // cout << A[i] << ":" << A[i-K] << endl;
    if (A[i] > A[i - K])
      cout << YES << endl;
    else
      cout << NO << endl;
  }
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, K, std::move(A));
  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int64_t N, K;
  cin >> N >> K;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  int64_t chk = N - K;
  for (int i = 0; i < chk; i++) {
    if (A.at(i) < A.at(i + chk - 1)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}

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

int main() {
  int64_t N, K;
  cin >> N >> K;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < N - K; i++) {
    if (A.at(i) < A.at(i + K)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
Problem p02602 (Python)

Buggy submission (status: Time Limit Exceeded):
n, k = map(int, input().split(" "))
a = list(map(int, input().split(" ")))

score: list = []
for i in range(k - 1, n):
    tmp_score = 1
    for j in range(k):
        tmp_score *= a[i - j]
    score.append(tmp_score)

for i in range(len(score) - 1):
    # print(score[i], score[i + 1])
    if score[i + 1] > score[i]:
        print("Yes")
    else:
        print("No")


Fixed submission:
n, k = map(int, input().split(" "))
a = list(map(int, input().split(" ")))

for i in range(k, n):
    if a[i - k] < a[i]:
        print("Yes")
    else:
        print("No")
Problem p02602 (Python)

Buggy submission (status: Runtime Error):
from collections import deque

n, k = map(int, input().split())
a = list(map(int, input().split()))
queue = deque()
for i in range(n):
    if i < k - 1:
        queue.append(a[i])
    elif i >= k:
        x = queue.popleft()
        if x < a[i]:
            print("Yes")
        else:
            print("No")
        queue.append(a[i])


Fixed submission:
from collections import deque

n, k = map(int, input().split())
a = list(map(int, input().split()))
queue = deque()
for i in range(n):
    if i <= k - 1:
        queue.append(a[i])
    elif i >= k:
        x = queue.popleft()
        if x < a[i]:
            print("Yes")
        else:
            print("No")
        queue.append(a[i])
Problem p02602 (Python)

Buggy submission (status: Time Limit Exceeded):
n, k = map(int, input().split())
aa = tuple(map(int, input().split()))

s = 1
ps = 1
for i in range(n):
    s *= aa[i]
    if i >= k:
        s //= aa[i - k]
        if ps < s:
            print("Yes")
        else:
            print("No")
    ps = s


Fixed submission:
n, k = map(int, input().split())
aa = tuple(map(int, input().split()))

for i in range(k, n):
    if aa[i - k] < aa[i]:
        print("Yes")
    else:
        print("No")
Problem p02602 (Python)

Buggy submission (status: Time Limit Exceeded):
s = input().split()
N = int(s[0])
K = int(s[1])
A = input().split()

for i in range(K, N):
    m1 = 1
    m2 = 1
    for j in range(K):
        m1 *= int(A[i - j - 1])
        m2 *= int(A[i - j - 0])
    print("Yes" if m1 < m2 else "No")


Fixed submission:
s = input().split()
N = int(s[0])
K = int(s[1])
A = input().split()

for i in range(K, N):
    m1 = int(A[i - K])
    m2 = int(A[i])
    print("Yes" if m1 < m2 else "No")
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define ford(i, a, b) for (int i = (a); i >= b; i--)
#define rep1(i, a, b) for (int i = (a); (i) <= (b); (i)++)
#define rep(i, a, b) for (int i = (a); (i) < (b); (i)++)
#define ll long long
#define N 105
#define pql priority_queue<ll>
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rev(a, n) reverse(a, a + n)
using namespace std;
int n, k, a[N];
int main() {
  cin >> n >> k;
  rep1(i, 1, n) {
    cin >> a[i];
    if (i > k) {
      if (a[i - k] < a[i])
        cout << "Yes\n";
      else
        cout << "No\n";
    }
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define ford(i, a, b) for (int i = (a); i >= b; i--)
#define rep1(i, a, b) for (int i = (a); (i) <= (b); (i)++)
#define rep(i, a, b) for (int i = (a); (i) < (b); (i)++)
#define ll long long
#define N 200005
#define pql priority_queue<ll>
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rev(a, n) reverse(a, a + n)
using namespace std;
int n, k, a[N];
int main() {
  cin >> n >> k;
  rep1(i, 1, n) {
    cin >> a[i];
    if (i > k) {
      if (a[i - k] < a[i])
        cout << "Yes\n";
      else
        cout << "No\n";
    }
  }
  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1e9, mod = 1e9 + 7;
#define endl '\n'
int a[20005];
void solve() {}

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

  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++)
    cin >> a[i];
  for (int i = 1; i <= n - k; i++) {
    cout << (a[i] < a[i + k] ? "Yes\n" : "No\n");
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1e9, mod = 1e9 + 7;
#define endl '\n'
int a[200005];
void solve() {}

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

  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++)
    cin >> a[i];
  for (int i = 1; i <= n - k; i++) {
    cout << (a[i] < a[i + k] ? "Yes\n" : "No\n");
  }
  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <math.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(vs) (ll)(vs.size())
#define rep(i, a, b) for (ll i = a; i < b; ++i)
#define rep_(i, a, b) for (ll i = a; i > b; --i)
#define iter(i, c) for (auto i : c)
#define endl '\n'
const ll mod = 1e9 + 7;

const ll maxn = 1e5;

ll n, k;
ll a[maxn];

void solve() {
  cin >> n >> k;
  rep(i, 0, n) cin >> a[i];
  rep(i, k, n) {
    if (a[i] > a[i - k])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}

void aux() {}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
  aux();
  ll _ = 1;
  // cin>>_;
  while (_--) {
    solve();
  }
  return 0;
}

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

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(vs) (ll)(vs.size())
#define rep(i, a, b) for (ll i = a; i < b; ++i)
#define rep_(i, a, b) for (ll i = a; i > b; --i)
#define iter(i, c) for (auto i : c)
#define endl '\n'
const ll mod = 1e9 + 7;

const ll maxn = 2e6 + 5;

ll n, k;
ll a[maxn];

void solve() {
  cin >> n >> k;
  rep(i, 0, n) cin >> a[i];
  rep(i, k, n) {
    if (a[i] > a[i - k])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}

void aux() {}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
  aux();
  ll _ = 1;
  // cin>>_;
  while (_--) {
    solve();
  }
  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for (ll i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<ll> s(n + 1);
  s[0] = 1;
  for (ll i = 0; i < n; ++i) {
    s[i + 1] = s[i] * a[i];
  }
  for (ll i = k; i < n; ++i) {
    ll x = s[i] / s[i - k];
    ll y = s[i + 1] / s[i + 1 - k];
    if (x < y) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


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

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for (ll i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (ll i = 0; i < n - k; ++i) {
    if (a[i] < a[i + k]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (ll i = 0; i < n; i++)
#define per(i, n) for (ll i = n - 1; i >= 0; i--)
#define REP(i, n) for (ll i = 1; i < n; i++)
#define PER(i, n) for (ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 62) - 1;
ll ceil(const ll &a, const ll &b) { return ((a) + (b)-1) / b; }
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 main() {
  int n, k;
  cin >> n >> k;
  vi a(n);
  rep(i, n) cin >> a[i];
  for (int i = k; i < n; i++) {
    YesorNo(a[k - i] < a[i]);
  }
}

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

#define rep(i, n) for (ll i = 0; i < n; i++)
#define per(i, n) for (ll i = n - 1; i >= 0; i--)
#define REP(i, n) for (ll i = 1; i < n; i++)
#define PER(i, n) for (ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 62) - 1;
ll ceil(const ll &a, const ll &b) { return ((a) + (b)-1) / b; }
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 main() {
  int n, k;
  cin >> n >> k;
  vi a(n);
  rep(i, n) cin >> a[i];
  for (int i = k; i < n; i++) {
    YesorNo(a[i - k] < a[i]);
  }
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
using ll = long long;

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);

  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  vector<ll> t(n + 1, 1);
  vector<ll> ans(n - k);
  int count = 0;

  for (int i = 1; i < n + 1; i++) {
    t[i] = t[i - 1] * a[i - 1];
    if (i == k) {
      ans[count] = t[i];
      count++;
    }
    if (i > k) {
      ans[count] = t[i] / t[i - k];
      cout << ans[count] << endl;
      count++;
    }
  }

  for (int i = 0; i < n - k; i++) {
    if (ans[i] < ans[i + 1]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
using ll = long long;

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);

  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  for (int i = k; i < n; i++) {
    if (a[i - k] < a[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int n, k;
int a[100010];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++)
    scanf("%d", a + i);
  for (int i = k + 1; i <= n; i++) {
    if (a[i] > a[i - k])
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}

Fixed submission:
#include <stdio.h>
int n, k;
int a[200010];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++)
    scanf("%d", a + i);
  for (int i = k + 1; i <= n; i++) {
    if (a[i] > a[i - k])
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
int main() {
  using namespace std;
  long long n, k, a[2000];
  cin >> n >> k;
  for (long long j = 0; j < n; ++j) {
    cin >> a[j];
  }
  for (long long i = 0; i < n - k; ++i) {
    if (a[i] < a[i + k])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
int main() {
  using namespace std;
  long long n, k, a[200000];
  cin >> n >> k;
  for (long long j = 0; j < n; ++j) {
    cin >> a[j];
  }
  for (long long i = 0; i < n - k; ++i) {
    if (a[i] < a[i + k])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
// https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_c

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

int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n + 1);
  a[0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] *= a[i - 1];
  }
  for (int i = k + 1; i <= n; i++) {
    if (a[i] / a[i - k] > a[i - 1] / a[i - k - 1])
      cout << "Yes\n";
    else
      cout << "No\n";
  }

  return 0;
}

Fixed submission:
// https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_c

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

int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n + 1);
  a[0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (i <= k)
      ;
    else {
      if (a[i] > a[i - k])
        cout << "Yes\n";
      else
        cout << "No\n";
    }
  }

  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1 << 30) - 1)
#define LINF (1LL << 60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

ll a[100010];

int main() {
  int n, k;
  cin >> n >> k;
  rep(i, n) cin >> a[i + 1];

  vector<string> ans;

  for (int i = k + 1; i <= n; i++) {
    if (a[i] > a[i - k])
      ans.push_back("Yes");
    else
      ans.push_back("No");
  }

  for (auto e : ans)
    cout << e << endl;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1 << 30) - 1)
#define LINF (1LL << 60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

ll a[200010];

int main() {
  int n, k;
  cin >> n >> k;
  rep(i, n) cin >> a[i + 1];

  vector<string> ans;

  for (int i = k + 1; i <= n; i++) {
    if (a[i] > a[i - k])
      ans.push_back("Yes");
    else
      ans.push_back("No");
  }

  for (auto e : ans)
    cout << e << endl;

  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = K + 1; i <= N; i++) {
    if (A.at(i - K) < A.at(i)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = K; i < N; i++) {
    if (A.at(i - K) < A.at(i)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
Problem p02602 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, n;
  cin >> n >> k;
  long long a[n + 1];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  i = 0;
  j = k;
  while (j < n) {
    if (a[j] > a[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, n;
  cin >> n >> k;
  long long a[n + 1];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  i = 0;
  j = k;
  while (j < n) {
    if (a[j] > a[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    i++;
    j++;
  }
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() { printf("yes\n"); }
void no() { printf("no\n"); }
void Yes() { printf("Yes\n"); }
void No() { printf("No\n"); }
void YES() { printf("YES\n"); }
void NO() { printf("NO\n"); }

int N, K;
int A[int(1e5 + 5)];
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++)
    cin >> A[i];

  for (int i = K; i < N; i++) {
    if (A[i - K] < A[i])
      Yes();
    else
      No();
  }

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() { printf("yes\n"); }
void no() { printf("no\n"); }
void Yes() { printf("Yes\n"); }
void No() { printf("No\n"); }
void YES() { printf("YES\n"); }
void NO() { printf("NO\n"); }

int N, K;
int A[int(2e5 + 5)];
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++)
    cin >> A[i];

  for (int i = K; i < N; i++) {
    if (A[i - K] < A[i])
      Yes();
    else
      No();
  }

  return 0;
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctype.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define all(vec) vec.begin(), vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll kai(ll x, ll y, ll m) {
  ll res = 1;
  for (ll i = x - y + 1; i <= x; i++) {
    res *= i;
    res %= m;
  }
  return res;
}
ll mod_pow(ll x, ll y, ll m) {
  ll res = 1;
  while (y > 0) {
    if (y & 1) {
      res = res * x % m;
    }
    x = x * x % m;
    y >>= 1;
  }
  return res;
}

ll comb(ll x, ll y, ll m) {
  if (y > x)
    return 0;
  return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n, k, a[100010];

signed main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = k; i < n; i++) {
    if (a[i - k] < a[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctype.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define all(vec) vec.begin(), vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll kai(ll x, ll y, ll m) {
  ll res = 1;
  for (ll i = x - y + 1; i <= x; i++) {
    res *= i;
    res %= m;
  }
  return res;
}
ll mod_pow(ll x, ll y, ll m) {
  ll res = 1;
  while (y > 0) {
    if (y & 1) {
      res = res * x % m;
    }
    x = x * x % m;
    y >>= 1;
  }
  return res;
}

ll comb(ll x, ll y, ll m) {
  if (y > x)
    return 0;
  return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n, k, a[200010];

signed main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = k; i < n; i++) {
    if (a[i - k] < a[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  deque<ll> inter;
  for (int i = 0; i < K; ++i) {
    inter.push_back(A[i]);
  }
  for (int i = K; i < N; ++i) {
    ll first = inter.front();
    inter.pop_front();
    ll last = A[i];
    if (first < last)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  deque<ll> inter;
  for (int i = 0; i < K; ++i) {
    inter.push_back(A[i]);
  }
  for (int i = K; i < N; ++i) {
    ll first = inter.front();
    inter.pop_front();
    ll last = A[i];
    inter.push_back(A[i]);
    if (first < last)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
Problem p02602 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long int n, k;
  cin >> n >> k;
  vector<int> v;
  for (int i = 0; i < n; i++)
    cin >> v[i];
  for (int i = 0; i < n - k; i++) {
    if (v[i + k] > v[i])
      cout << "Yes";
    else
      cout << "No";
    cout << endl;
  }
  return 0;
}


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

int main() {
  long long int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];
  for (int i = 0; i < n - k; i++) {
    if (v[i + k] > v[i])
      cout << "Yes";
    else
      cout << "No";
    cout << endl;
  }
  return 0;
}