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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1001001001
using ll = long long;
using dd = long double;

const int D = 60;
const int MAX_N = 200005;
int to[D][MAX_N];

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

  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1001001001
using ll = long long;
using dd = long double;

const int D = 60;
const int MAX_N = 200005;
int to[D][MAX_N];

int main() {
  std::ifstream in("input.txt");
  std::cin.rdbuf(in.rdbuf());

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

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

#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n - m; i++) {
    if (a[i] < a[i + m]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
  int n, k;
  cin >> n >> k;
  int sum = 1, p;
  int a[n + 1];
  a[0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> p;
    sum *= p;
    a[i] = sum;
    // cout<<a[i]<<endl;
  }
  vector<int> v;
  int temp;
  for (int i = k; i <= n; i++) {
    temp = a[i] / a[i - k];
    v.push_back(temp);
    // cout<<temp<<endl;
  }
  for (int i = 0; i < v.size() - 1; i++) {
    if (v[i + 1] > v[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
Problem p02602 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int N, K;
  vector<int> A(200000);

  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  int pre_point;
  int chukan_point = 1;
  int now_point;
  int flag0 = 0;

  // chukan
  for (int j = 0; j < K - 1; j++) {
    chukan_point *= A[K - 1 - j];
  }

  int kaisu = N - K;
  for (int i = 0; i < kaisu; i++) {

    pre_point = A[K + i - K];
    now_point = A[K + i];

    if ((pre_point < now_point) && (flag0 == 0)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }

    // next shori
    chukan_point /= pre_point;
    chukan_point *= now_point;
    flag0 = 0;
  }
  return 0;
}


Error: TLE

Fixed submission:

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

int main() {
  int N, K;
  vector<int> A(200000);

  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  int pre_point = 1;
  int now_point = 1;
  int flag0 = 0;

  int kaisu = N - K;
  for (int i = 0; i < kaisu; i++) {
    // 0check
    for (int j = 0; j < K - 1; j++) {
      if (A[K - 1 - j] == 0) {
        flag0 = 1;
      }
    }
    pre_point = A[K + i - K];
    now_point = A[K + i];

    if ((pre_point < now_point) && (flag0 == 0)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }

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

#include <iostream>
using namespace std;
int main() {

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

  return 0;
}


Error: 0

Fixed submission:

#include <iostream>
using namespace std;
int main() {

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

  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: 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;
using P = pair<int, int>;

int main() {
  // int n, k;
  // cin >> n >> k;
  // int cnt = k;
  // vector<ll> a(n);
  // vector<ll> b(k);
  // b[0] = 1;
  // rep(i,n) cin >> a[i];
  // while(cnt > 0){
  //     b[0] *= a[cnt - 1];
  //     --cnt;
  // }
  // rep(i, n-k){
  //     int cnt = k;
  //     b[i+1] = b[i]/a[i] * a[cnt+i];
  //     if(b[i+1] > b[i]) cout << "Yes" << endl;
  //     else cout << "No" << endl;
  //     cnt--;
  // }
  int n, k;
  cin >> n >> k;
  vector<int> 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;
}

Error: 0

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;
using P = pair<int, int>;

int main() {
  int n, k;
  cin >> n >> k;
  int cnt = k;
  vector<ll> a(n);
  vector<ll> b(k);
  b[0] = 1;
  rep(i, n) cin >> a[i];
  while (cnt > 0) {
    b[0] *= a[cnt - 1];
    --cnt;
  }
  rep(i, n - k) {
    int cnt = k;
    b[i + 1] = b[i] / a[i] * a[cnt + i];
    if (b[i + 1] > b[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    cnt--;
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  int n, k;

  scanf("%d%d", &n, &k);
  long long int termscore[n + 100];
  long long int score[n + 100];
  for (int i = 0; i <= n + 100; i++) {
    termscore[i] = 1;
    score[i] = 0;
  }
  int first = 1;
  int index = k + 1;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &score[i]);
    if (i <= k)
      termscore[k] += score[i];
    else if (k < i) {
      termscore[i] = termscore[i - 1] - score[first] + score[i];
      first++;
      index++;
    }
  }
  for (int i = k; i < n; i++) {
    // printf("Termscore[%d] : %d\\n",i,termscore[i]);
    if (termscore[i] < termscore[i + 1])
      printf("Yes\\n");
    else
      printf("No\\n");
  }

  return 0;
}

Error: 0

Fixed submission:

#include <stdio.h>

int main() {
  int a, b, i, j;
  int sum[100];
  scanf("%d %d", &a, &b);
  int arr[1000];
  for (i = 0; i < a; i++) {
    scanf("%d", &arr[i]);
  }

  for (i = 0; i < a - b + 1; i++) {
    sum[i] = 1;
    for (j = 0; j < b; j++) {
      sum[i] *= arr[i + j];
    }
  }

  for (i = 0; i < a - b; i++) {
    if (sum[i + 1] > sum[i]) {
      printf("Yes\\n");
    } else {
      printf("No\\n");
    }
  }

  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: 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];
  }

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


Error: WA

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];
  }

  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;
    }
  }
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

#define ll long long
#define X first
#define Y second
#define MP make_pair

using namespace std;

const int N = 2e5 + 12, bs = 500;
const ll inf = 1e9;
const double EPS = 0.000001;

int n, k;
ll gr[N], a[N];

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

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

Error: 0

Fixed submission:

#include <bits/stdc++.h>

#define ll long long
#define X first
#define Y second
#define MP make_pair

using namespace std;

const int N = 2e5 + 12, bs = 500;
const ll inf = 1e9;
const double EPS = 0.000001;

int n, k;
ll gr[N], a[N];

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

  ll val = 1;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    val *= a[i];
    if (i < k) {
      continue;
    } else if (i == k) {
      gr[i] = val;
    } else {
      val /= a[i - k];
      gr[i] = val;
    }
    assert(val > 0);
  }
  for (int i = k + 1; i <= n; i++) {
    if (gr[i] > gr[i - 1]) {
      cout << "Yes\\n";
    } else {
      cout << "No\\n";
    }
  }
}
Problem p02602 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); i++)

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> cnt(n + 1, 0);
  vector<ll> h(n + 1, 0);
  REP(i, n) {
    ll a;
    cin >> a;
    cnt[i + 1] = a;
  }

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

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); i++)

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> cnt(n + 1, 0);
  REP(i, n) {
    ll a;
    cin >> a;
    cnt[i + 1] = a;
  }

  vector<ll> h(n + 1, 0);
  for (int i = k; i < n + 1; i++) {
    for (int j = i - k + 1; j <= i; j++) {
      h[i] += cnt[j];
    }
  }

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

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

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


Error: 0

Fixed submission:

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

#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
// #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void) {
  int N, K;
  cin >> N >> K;
  lli a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = K; i < N; i++) {
    if (a[i] > a[i - K]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}


Error: 0

Fixed submission:

#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
// #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void) {
  int N, K;
  cin >> N >> K;
  int a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  lli b[N + 1];
  fill(b, b + N + 1, 0);
  b[0] = 1;
  for (int i = 1; i <= N; i++) {
    b[i] = b[i - 1] * a[i - 1];
  }
  for (int i = K + 1; i <= N; i++) {
    if (b[i] / b[i - K] > b[i - 1] / b[i - K - 1]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  rep(i, N) cin >> A.at(i);

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


Error: 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;
using P = pair<int, int>;

int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N), score(N), product(N);
  rep(i, N) cin >> A.at(i);
  rep(i, N) {
    if (i == 0)
      product.at(0) = A.at(0);
    else
      product.at(i) = product.at(i - 1) * A.at(i);
  }
  rep(i, N) {
    if (i < K - 1)
      continue;
    if (i == K - 1)
      score.at(i) = product.at(i);
    else
      score.at(i) = product.at(i) / product.at(i - K);
  }
  ll max_score = score.at(K - 1);
  for (int i = K; i < N; ++i) {
    if (score.at(i) > max_score) {
      cout << "Yes" << endl;
      max_score = score.at(i);
    } else
      cout << "No" << endl;
  }
}
Problem p02602 (C++) — buggy submission, verdict: Time Limit Exceeded

#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[i];
  }
  vector<long long int> s(N + 1, 0);
  for (int i = 0; i < N; ++i)
    s[i + 1] = s[i] + A[i];
  for (int i = 0; i < N - K; i++) {
    long long int X = s[K + i] - s[i];
    long long int Y = s[K + i + 1] - s[i + 1];
    if (X < Y) {
      cout << "Yes"
           << "\\n";
    } else {
      cout << "No"
           << "\\n";
    }
  }
}

Error: TLE

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[i];
  }
  for (int i = 0; i < N - K; i++) {
    long long int X = A[i];
    long long int Y = A[i + 1];
    for (int j = 0; j < K - 1; j++) {
      X = X + A[i + 1 + j];
      Y = Y + A[i + 2 + j];
    }
    if (X < Y) {
      cout << "Yes"
           << "\\n";
    } else {
      cout << "No"
           << "\\n";
    }
  }
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

int main() {
  int t;
  t = 1;
  while (t--) {
    long long int a[300000];

    long long int i, j, k, n;
    long long dp[300000], prod;

    cin >> n >> k;

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

    prod = 1;

    prod = a[0];

    if (k == 1) {
      for (i = 1; i < n; i++) {
        if (a[i] > a[i - 1])
          cout << "Yes\\n";

        else
          cout << "No\\n";
      }

    }

    else {

      for (i = k; i < n; i++) {
        if (a[i] > a[i - k])
          cout << "Yes\\n";

        else
          cout << "No\\n";

        //	prod=(prod*a[i])/(a[i-k]);
      }
    }
  }
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int rec(int a, int b, int c, int k) {
  if (k == 0)
    return 0;
  //	cout<<a<<"  "<<b<<"  "<<c<<"   \\n";

  if (a < b && b < c)
    return 1;

  return rec(a, 2 * b, c, k - 1) + rec(a, b, c * 2, k - 1);
}
int main() {
  int t;
  t = 1;
  while (t--) {
    long long int a[300000];

    long long int i, j, k, n;
    long long dp[300000], prod;

    cin >> n >> k;

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

    prod = 1;

    dp[0] = a[0];
    for (i = 1; i < n; i++) {
      dp[i] = dp[i - 1] * a[i];
    }

    for (i = k; i < n; i++) {
      if (i == k) {
        if ((dp[i] / dp[i - k]) > dp[k - 1])
          cout << "Yes\\n";

        else
          cout << "No\\n";

      }

      else {
        if ((dp[i] / dp[i - k]) > (dp[i - 1] / dp[i - k - 1]))
          cout << "Yes\\n";

        else
          cout << "No\\n";
      }
    }
  }
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int a[200001];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }

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

  return 0;
}

Error: WA

Fixed submission:

#include <stdio.h>

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int angka[10000] = {0};

  for (int i = 0; i < n; i++) {
    scanf("%d", &angka[i]);
  }
  int flag = 0;
  for (int i = 0; i < n - k; i++) {
    if (angka[i] < angka[k + i]) {
      puts("Yes\\n");
    } else {
      puts("No\\n");
    }
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  int N, K;
  scanf("%d %d", &N, &K);
  int n[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &n[i]);
  }
  for (int i = K; i < N; i++) {
    if (n[i - K] < n[i]) {
      printf("Yes\\n");
    } else {
      printf("No\\n");
    }
  }
}

Error: WA

Fixed submission:

#include <stdio.h>
#include <string.h>

int main() {
  int K, N;
  int num[10000] = {0};
  scanf("%d %d", &N, &K);

  for (int i = 0; i < N; i++) {
    scanf("%d", &num[i]);
  }

  for (int i = 0; i < N; i++) {
    if (num[i] > num[i - K]) { // misal 0 1 2 3 4 5  dan K nya 2
      printf("Yes\\n"); // bandingin aja arr 0 dan arr 2 karena ngebandingin 0*1
                       // dan 1*2
    } else {
      printf("No\\n");
    }
  }

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

/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog ender-zzm.enbar.cn
*/
#include <bits/stdc++.h>
using namespace std;

inline int read() {
  register int x = 0, flag = 1;
  register char ch;
  while (!isdigit(ch = getchar()))
    if (ch == '-')
      flag = -1;
  while (x = x * 10 + (ch & 15), isdigit(ch = getchar()))
    ;
  return x * flag;
}

template <class T> inline void write(T x) {
  if (x < 0)
    putchar('-'), x = -x;
  if (x >= 10)
    write(x / 10);
  putchar(x % 10 + '0');
}

template <class T> inline bool Chkmax(T &x, const T &y) {
  return x < y ? x = y, true : false;
}
template <class T> inline bool Chkmin(T &x, const T &y) {
  return x > y ? x = y, true : false;
}

#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)

#define int long long
int n, k;
int a[202020], p[202020];
int Sum[202020];
signed main() {
  n = read();
  k = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
  }
  for (int i = k + 1; i <= n; i++) {
    if (a[i] > a[i - k]) {
      puts("Yes");
    } else
      puts("No");
  }
  return 0;
}


Error: 0

Fixed submission:

/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog ender-zzm.enbar.cn
*/
#include <bits/stdc++.h>
using namespace std;

inline int read() {
  register int x = 0, flag = 1;
  register char ch;
  while (!isdigit(ch = getchar()))
    if (ch == '-')
      flag = -1;
  while (x = x * 10 + (ch & 15), isdigit(ch = getchar()))
    ;
  return x * flag;
}

template <class T> inline void write(T x) {
  if (x < 0)
    putchar('-'), x = -x;
  if (x >= 10)
    write(x / 10);
  putchar(x % 10 + '0');
}

template <class T> inline bool Chkmax(T &x, const T &y) {
  return x < y ? x = y, true : false;
}
template <class T> inline bool Chkmin(T &x, const T &y) {
  return x > y ? x = y, true : false;
}

#define For(i, x, y) for (int i = (x); i <= (y); i++)
#define Rep(i, x, y) for (int i = (x); i >= (y); i--)

#define int long long
int n, k;
int a[202020], p[202020];
int Sum[202020];
signed main() {
  n = read();
  k = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
  }
  Sum[0] = 1;
  for (int i = 1; i <= n; i++) {
    Sum[i] = Sum[i - 1] * a[i];
  }
  for (int i = k; i <= n; i++) {
    p[i] = Sum[i] / Sum[i - k];
  }
  for (int i = k + 1; i <= n; i++) {
    if (p[i] > p[i - 1]) {
      printf("Yes\\n");
    } else
      printf("No\\n");
  }
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  int N, K;
  scanf("%d %d", &N, &K);
  int A[N + 1];

  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i + 1]);
  }
  for (int i = K + 1; i <= N; i++) {
    if (A[i] > A[i - K]) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
}

Error: WA

Fixed submission:

#include <stdio.h>
#include <string.h>

int main() {
  int K, N;
  scanf("%d %d", &N, &K);
  long long int num[100] = {0};

  for (int i = 0; i < N; i++) {
    scanf("%lld", &num[i]);
  }

  for (int i = 0; i < N; i++) {
    if (num[i] < num[i + K]) { // misal 0 1 2 3 4 5  dan K nya 2
      printf("Yes\\n"); // bandingin aja arr 0 dan arr 2 karena ngebandingin 0*1
                       // dan 1*2
    } else {
      printf("No\\n");
    }
  }

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

#include <bits/stdc++.h>

using namespace std;
#define ll long long
int main() {
  ll n, k;
  cin >> n >> k;
  ll a[n];
  for (ll i = 0; i < n; i++)
    cin >> a[i];
  vector<ll> v;
  ll pre = 0;
  for (int i = 0; i < k; i++)
    pre += a[i];
  v.push_back(pre);
  int i = 1, j = k;
  while (j < n) {
    pre += a[j];
    pre -= a[i - 1];
    i++;
    j++;
    v.push_back(pre);
  }
  for (int i = 1; i < v.size(); i++) {

    if (v[i] <= v[i - 1]) {
      cout << "No" << endl;
    } else
      cout << "Yes" << endl;
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

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

    if (i + k - 1 < n) {
      int j = i, c = 0;
      while (c < k) {
        sum += a[j];
        j++;
        c++;
      }
      v.push_back(sum);
    }
  }

  for (int i = 1; i < v.size(); i++) {

    if (v[i] <= v[i - 1]) {
      cout << "No" << endl;
    } else
      cout << "Yes" << endl;
  }
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, k;
ll a[200005];
int main(void) {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i >= k) {
      if (a[i] > a[i - k]) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, k;
ll a[100005];
int main(void) {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i >= k) {
      if (a[i] > a[i - k]) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
}