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

#include <iostream>
#include <list>
#include <vector>

#define ll unsigned long long

using namespace std;

int main() {

  ll n, k, x;
  cin >> n >> k;

  vector<ll> vs;

  for (ll i = 0; i < k; i++) {
    cin >> x;
    vs.push_back(x);
  }

  for (ll i = k; i < n; i++) {
    cin >> x;
    vs.push_back(x);
    if (x > vs[i - k])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    // prev=curr;
  }

  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
#include <list>
#include <vector>

#define ll unsigned long long

using namespace std;

int main() {

  ll n, k, x;
  cin >> n >> k;

  vector<ll> vs;
  ll prev = 1, curr = 1;

  for (ll i = 0; i < k; i++) {
    cin >> x;
    vs.push_back(x);
    curr *= x;
  }

  // prev = curr;

  for (ll i = k; i < n; i++) {
    cin >> x;
    if (x > vs[i - k])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    // prev=curr;
  }

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

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

#define IOS                                                                    \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define watch(x)                                                               \\
  ;                                                                            \\
  cout << "\\n" << #x << " is: " << x << "\\n";
#define ll long long int
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define pb push_back
#define nl cout << "\\n"
#define gcd(a, b) __gcd(a, b)
#define sq(a) (a) * (a)
#define loop(i, a, b) for (int i = a; i <= b; i++)
#define rloop(i, a, b) for (int i = a; i >= b; i--)
#define sz(a) a.size()
#define mod 1e9 + 7
#define PI 2 * acos(0.0)

int main() {
  IOS int T = 1;
  // cin>>T;
  while (T--) {
    ll n, k;
    cin >> n >> k;
    ll a[n], mn = INT_MAX;
    for (ll i = 0; i < n; i++) {
      cin >> a[i];
      mn = min(a[i], mn);
    }
    for (ll i = 0; i < n; i++) {
      a[i] = a[i] - mn + 1;
    }
    for (ll i = 1; i < n; i++)
      a[i] = (a[i] + a[i - 1]);
    ll x = a[k - 1];
    for (ll i = k; i < n; i++) {
      if (a[i] - a[i - k] > x)
        cout << "Yes";
      else
        cout << "No";
      nl;
      x = a[i] - a[i - k];
    }
  }
  return 0;
}


Error: 0

Fixed submission:

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

#define IOS                                                                    \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define watch(x)                                                               \\
  ;                                                                            \\
  cout << "\\n" << #x << " is: " << x << "\\n";
#define ll long long int
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define pb push_back
#define nl cout << "\\n"
#define gcd(a, b) __gcd(a, b)
#define sq(a) (a) * (a)
#define loop(i, a, b) for (int i = a; i <= b; i++)
#define rloop(i, a, b) for (int i = a; i >= b; i--)
#define sz(a) a.size()
#define mod 1e9 + 7
#define PI 2 * acos(0.0)

int main() {
  IOS int T = 1;
  // cin>>T;
  while (T--) {
    ll n, k;
    cin >> n >> k;
    ll a[n], mn = INT_MAX;
    for (ll i = 0; i < n; i++) {
      cin >> a[i];
      mn = min(a[i], mn);
    }
    for (ll i = 0; i < n; i++) {
      a[i] = a[i] - mn + 1;
    }
    for (ll i = 1; i < n; i++)
      a[i] = (a[i] * a[i - 1]);
    ll x = a[k - 1];
    for (ll i = k; i < n; i++) {
      if (a[i] / a[i - k] > x)
        cout << "Yes";
      else
        cout << "No";
      nl;
      x = a[i] / a[i - k];
    }
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  long long N, K;
  cin >> N >> K;

  long long A[N + 1];

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

  long long past = 0;
  long long current = 0;

  for (int i = 1; i <= K; i++) {
    past += A[i];
  }

  for (int i = K + 1; i <= N; i++) {
    current = past - A[i - K] + A[i];
    if (current > past) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    past = current;
  }

  return 0;
}


Error: TLE

Fixed submission:

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

int main() {
  long long N, K;
  cin >> N >> K;

  long long A[N + 1];

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

  long long past = 0;
  long long current = 0;

  for (int i = 1; i <= K; i++) {
    past += A[i];
  }

  for (int i = K + 1; i <= N; i++) {
    current = 0;
    for (int n = 0; n < K; n++) {
      current += A[i - n];
    }
    if (current > past) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    past = current;
  }

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

#include <stdio.h>

int main() {
  int N, K;
  scanf("%d %d", &N, &K);

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

Error: WA

Fixed submission:

#include <stdio.h>
int main() {
  int a, b;
  int nilai[a];
  scanf("%d %d", &a, &b);
  for (int i = 0; i < a; i++) {
    scanf("%d", &nilai[i]);
  }
  for (int i = b; i < a; i++) {
    if (nilai[i - b] < nilai[i]) {
      printf("Yes\\n");
    } else {
      printf("No\\n");
    }
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

// a
#include <stdio.h>

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int a[n];

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

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

  return 0;
}

Error: 0

Fixed submission:

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

int main() {
  int K, N;
  int num[100001];
  scanf("%d %d", &N, &K);

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

  for (int i = K; 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 01
                       // dan 12
    } else {
      printf("No\\n");
    }
  }

  return 0;
}
Problem p02602 (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++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

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


Error: TLE

Fixed submission:

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

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

#include <iostream>
#include <vector>
using namespace std;
typedef long long li;
#define yn(i) ((i) ? "Yes" : "No")
#define rep(i, n) for (int i = 0; i < (n); i++)
#define df 0
template <class T> void print(const T &t) { cout << t << "\\n"; }
template <class T, class... Ts> void print(const T &t, const Ts &...ts) {
  cout << t;
  if (sizeof...(ts))
    cout << " ";
  print(ts...);
}

int main() {
  int n, k;
  cin >> n >> k;
  vector<li> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n - k) { print(yn(a[i + k] > a[i])); }
}


Error: -11

Fixed submission:

#include <iostream>
#include <vector>
using namespace std;
typedef long long li;
#define yn(i) ((i) ? "Yes" : "No")
#define rep(i, n) for (int i = 0; i < (n); i++)
#define df 0
template <class T> void print(const T &t) { cout << t << "\\n"; }
template <class T, class... Ts> void print(const T &t, const Ts &...ts) {
  cout << t;
  if (sizeof...(ts))
    cout << " ";
  print(ts...);
}

int main() {
  int n, k;
  cin >> n >> k;
  vector<li> a;
  rep(i, n) cin >> a[i];
  rep(i, n - k) { yn(a[i + k] > a[i]); }
}
Problem p02602 (C++) — buggy submission, verdict: 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];
  }
  for (ll i = 0; i < n - k; ++i) {
    if (a[i] < a[i + k]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


Error: 0

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

//
//  main.cpp
//  A
//
//  Created by Yoshinao Itakura on 2020/07/25.
//  Copyright © 2020 Yoshinao Itakura. All rights reserved.
//

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

int main(int argc, const char *argv[]) {
  // insert code here...
  int N, K;
  cin >> N >> K;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

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

  return 0;
}


Error: 0

Fixed submission:

//
//  main.cpp
//  A
//
//  Created by Yoshinao Itakura on 2020/07/25.
//  Copyright © 2020 Yoshinao Itakura. All rights reserved.
//

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

int main() {
  // insert code here...
  int N, K;
  cin >> N >> K;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  int E[K];
  for (int i = 0; i < K; ++i) {
    E[i] = 1;
    for (int j = i; j < i + K; ++j) {
      E[i] = E[i] * A[j];
    }
  }
  for (int i = 0; i < K - 1; ++i) {
    if (E[i] < E[i + 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() {
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  vector<ll> mul(n + 1, 0);
  rep(i, n) mul[i + 1] = mul[i] + a[i];
  for (int i = k + 1; i <= n; i++) {
    ll mul1 = mul[i] - mul[i - k];
    ll mul2 = mul[i - 1] - mul[i - 1 - k];
    if (mul1 > mul2) {
      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 < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: 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];
    if (i <= k)
      ;
    else {
      if (a[i] > a[i - k])
        cout << "Yes\\n";
      else
        cout << "No\\n";
    }
  }

  return 0;
}


Error: 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];
    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;
}
Problem p02602 (C++) — buggy submission, verdict: 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 l = k; l < n; l++) {
    if (a.at(l) > a.at(l - k)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}

Error: -6
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc


Fixed submission:

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

int main() {
  int n, k, tmp;
  vector<int> a(n);
  cin >> n >> k;
  tmp = 0;

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

  for (int j = 0; j < k; j++) {
    tmp += a.at(j);
  }

  for (int l = k; l < n; l++) {
    if (tmp < tmp + a.at(l) - a.at(l - k)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

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

typedef long long ll;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

const char nl = '\\n';

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  // freopen("input.in", "r", stdin);
  // freopen("input.out", "w", stdout);
  int n, k;
  cin >> n >> k;
  vector<ll> a(n + 1);
  FOR(i, 1, n + 1) { cin >> a[i]; }
  FOR(i, k + 1, n + 1) {
    if (a[i - k] < a[i])
      cout << "Yes" << nl;
    else
      cout << "No" << nl;
  }
}

Error: 0

Fixed submission:

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

typedef long long ll;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

const char nl = '\\n';

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  // freopen("input.in", "r", stdin);
  // freopen("input.out", "w", stdout);
  int n, k;
  cin >> n >> k;
  vector<ll> a(n + 1, 1);
  F0R(i, n) {
    cin >> a[i + 1];
    a[i + 1] *= a[i];
  }
  ll p = a[k] / a[0];
  FOR(i, k + 1, n + 1) {
    if (a[i] / a[i - k] <= p)
      cout << "No" << nl;
    else
      cout << "Yes" << nl;
    p = a[i] / a[i - k];
  }
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

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

Error: 0

Fixed submission:

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

#include <bits/stdc++.h>

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(), (v).end()

using namespace std;

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

const ll LINF = 1LL << 60;
const int INF = 1 << 29;
const int MOD = 2019;

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 + 1; i <= N; i++) {
    if (A[i - 1] > A[i - 1 - K])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(), (v).end()

using namespace std;

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

const ll LINF = 1LL << 60;
const int INF = 1 << 29;
const int MOD = 2019;

int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<ll> s(N + 1, 1);
  for (int i = 0; i < N; i++) {
    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 - 1 - K])
      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++)
#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;
}


Error: 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[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;
}
Problem p02602 (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++)
#define rep_s(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

#define MOD 1000000007

int main() {
  int n, k;
  cin >> n >> k;

  vi a(n);
  rep(i, n) { cin >> a[i]; }

  int before_index = -1 * k;
  rep(i, n) {
    if (before_index >= 0) {
      if (a[i] > a[before_index]) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
    before_index++;
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_s(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

#define MOD 1000000007

int main() {
  int n, k;
  cin >> n >> k;

  vi a(n);
  rep(i, n) { cin >> a[i]; }

  vll points = vector<ll>(n, 1);

  // ポイント計算
  rep(i, n) {
    if (i < k - 1) {
      rep(_i, i + 1) { points[i] *= a[_i]; }
    } else {
      rep_s(_i, i - k + 1, i + 1) { points[i] *= a[_i]; }
    }
  }

  // int before_index = -1 * k;
  // rep(i, n) {
  //   if (before_index >= 0) {
  //     points[i] = points[i - 1] / a[before_index];
  //     points[i] *= a[i];
  //   } else {
  //     if (i == 0) {
  //         points[i] = a[i];
  //       } else {
  //         points[i] = a[i] * points[i - 1];
  //     }
  //   }

  //   before_index++;
  // }

  for (int i = k; i < n; i++) {
    if (points[i] > points[i - 1]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
Problem p02602 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

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

void solve(long long N, long long K, std::vector<long long> A) {
  long long score = 1;
  rep(i, K) score *= A[i];
  loop(i, K, N) {
    auto prev = A[i - K];
    auto next = A[i];
    if (prev < next)
      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;
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;
using boost::multiprecision::cpp_int;

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

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

void solve(long long N, long long K, std::vector<long long> A) {
  cpp_int score = 1;
  rep(i, K) score *= cpp_int(A[i]);
  loop(i, K, N) {
    auto prev = score;
    score /= cpp_int(A[i - K]);
    score *= cpp_int(A[i]);
    if (prev < score)
      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;
}