alexjercan/bugnet huggingface dataset:
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;
typedef long long ll;

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

  vector<ll> b(n);
  rep(i, n) {
    if (i == 0)
      b[i] = a[i];
    else
      b[i] = b[i - 1] + a[i];
  }

  for (int i = 0; k + i < n; i++) {
    ll x;
    if (i == 0) {
      x = b[k - 1 + i];
    } else {
      x = b[k - 1 + i] - b[i - 1];
    }
    ll y = b[k + i] - b[i];
    if (x < y) {
      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;
typedef long long ll;

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

  vector<ll> b(n);
  rep(i, n) {
    if (i == 0)
      b[i] = a[i];
    else
      b[i] = b[i - 1] * a[i];
  }

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

#include <bits/stdc++.h>
using namespace std;
#define pi 2 * asin(1.0)

// template functions
/////////////////////////
long Comb(long N, long M) { // nCm
  long ans = 1;
  for (long i = N; i > N - M; i--) {
    ans = ans * i;
  }
  for (long i = M; i > 0; i--) {
    ans = ans / i;
  }
  return ans;
}
long Perm(long N, long M) { // nPm
  long ans = 1;
  for (long i = N; i > N - M; i--) {
    ans = ans * i;
  }
  return ans;
}
/////////////////////////

// Answer

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

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define pi 2 * asin(1.0)

// template functions
/////////////////////////
long Comb(long N, long M) { // nCm
  long ans = 1;
  for (long i = N; i > N - M; i--) {
    ans = ans * i;
  }
  for (long i = M; i > 0; i--) {
    ans = ans / i;
  }
  return ans;
}
long Perm(long N, long M) { // nPm
  long ans = 1;
  for (long i = N; i > N - M; i--) {
    ans = ans * i;
  }
  return ans;
}
/////////////////////////

// Answer

int main() {
  long N, K;
  int flag = 0;
  cin >> N >> K;
  vector<long> A(N);
  for (long i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (long i = K; i < N; i++) {
    flag = 0;
    for (long j = i - (K - 1); j < i + 1; j++) {
      if (A.at(j) == 0) {
        flag = 1;
        break;
      }
    }
    if (A.at(i - K) >= A.at(i)) {
      flag = 1;
    }
    if (flag == 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
Problem p02602 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::multiprecision;

int main(void) {

  long long N, K;
  cin >> N >> K;
  vector<long long> A(N);
  long long S;
  for (long long i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  S = 1;
  for (long long i = 0; i <= K - 1; i++) {
    S *= A.at(i);
  }
  // cout << S.at(K-1) << endl;
  for (long long i = 0; i < N - K; i++) {

    // cout << S.at(K+i) << endl;
    if (A.at(K + i) > A.at(i)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::multiprecision;

int main(void) {

  long long N, K;
  cin >> N >> K;
  vector<long long> A(N);
  cpp_int S;
  for (long long i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  S = 1;
  for (long long i = 0; i <= K - 1; i++) {
    S *= A.at(i);
  }
  // cout << S.at(K-1) << endl;
  for (long long i = 0; i < N - K; i++) {
    cpp_int newS;
    newS = S / A.at(i) * A.at(K + i);
    // cout << S.at(K+i) << endl;
    if (newS > S) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    S = newS;
  }
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

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

int main(void) {
  long N, k;
  cin >> N >> k;
  vector<long long> a(N, 0);

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

  for (long 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;

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

  vector<long long> seki(N + 1, 1);
  for (int i = 1; i < N + 1; i++) {
    seki[i] = seki[i - 1] * a[i - 1];
  }

  long long now = 0;
  long long last = seki[k];
  for (int i = k + 1; i < N + 1; i++) {
    now = seki[i] / seki[i - k];
    if (now > last)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;

    last = now;
  }
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<double> v(n);
    for (int i = 0; i < n; i++) {
      cin >> v[i];
    }
    double ans = 0;
    for (int i = 0; i < k; i++) {
      ans = ans + log(v[i]);
    }
    double prev = ans;
    int j = 0;
    int i = k;
    while (i < n) {
      ans -= log(v[i - k]);
      ans += log(v[i]);
      if (ans > prev) {
        cout << "Yes\\n";
      } else {
        cout << "No\\n";
      }
      prev = ans;
      i++;
      j++;
    }
  }
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  //   cin>>t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<long long int> v(n);
    for (int i = 0; i < n; i++) {
      cin >> v[i];
    }
    vector<long long int> mul(n + 1);
    mul[0] = 1;
    for (int i = 1; i <= n; i++) {
      mul[i] = v[i - 1] * mul[i - 1];
    }
    int j = 0;
    for (int i = k; i < n; i++) {
      // cout<<mul[k]/mul[j]<<" "<<mul[k+1]/mul[j+1]<<"\\n";
      if ((mul[i] / mul[j]) < (mul[i + 1] / mul[j + 1])) {
        cout << "Yes\\n";
      } else
        cout << "No\\n";
      j++;
    }
  }
  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<long long> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < n - k; i++) {
    if (a[i] < a[i + k])
      cout << "Yes\\n";
    else
      cout << "No\\n";
  }
  return 0;
}

Error: 0

Fixed submission:

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

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

  rep(i, N - K) {
    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 < (n); ++i)
using namespace std;
using ll = long long;

int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> A(N), G(N - K + 1, 1);
  rep(i, N) cin >> A[i];

  rep(i, K) { G[0] = G[0] * A[i]; }
  rep(i, N - K + 1) {
    G[i + 1] = G[i] * A[i + K] / A[i];
    // cout << G[i] << endl;
  }

  rep(i, N - K) {
    if (G[i + 1] > G[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#include <iomanip>
#include <math.h>
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int INF = 1001001001;
vector<pair<int64_t, int64_t>> prime_factorize(int64_t x) {
  vector<pair<int64_t, int64_t>> p;
  for (int64_t i = 2; i * i <= x; i++) {
    int cnt = 0;
    if (x % i == 0) {
      while (x % i == 0) {
        cnt++;
        x /= i;
      }
      p.push_back(make_pair(i, cnt));
    }
  }
  if (x != 1) {
    p.push_back(make_pair(x, 1));
  }
  return p;
}
int main() {
  int64_t N, K;
  cin >> N >> K;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int64_t 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>
using namespace std;
#include <iomanip>
#include <math.h>
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int INF = 1001001001;
vector<pair<int64_t, int64_t>> prime_factorize(int64_t x) {
  vector<pair<int64_t, int64_t>> p;
  for (int64_t i = 2; i * i <= x; i++) {
    int cnt = 0;
    if (x % i == 0) {
      while (x % i == 0) {
        cnt++;
        x /= i;
      }
      p.push_back(make_pair(i, cnt));
    }
  }
  if (x != 1) {
    p.push_back(make_pair(x, 1));
  }
  return p;
}
int main() {
  int64_t N, K;
  cin >> N >> K;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<int64_t> table(N + 1);
  table[0] = 1;
  int64_t sum = 1;
  for (int i = 0; i < N; i++) {
    sum *= A[i];
    table[i + 1] = sum;
  }

  for (int i = K; i <= N - 1; i++) {
    if (table[i] / table[i - K] < table[i + 1] / table[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 Int int64_t

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 = K; i < N; ++i) {
    cout << (A[i] > A[i - K] ? "Yes" : "No") << endl;
  }

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
  Int N, K;
  cin >> N >> K;
  vector<Int> A(N + 1, 1);
  for (int i = 1; i <= N; ++i) {
    cin >> A[i];
    A[i] *= A[i - 1];
  }

  for (int i = K + 1; i <= N; ++i) {
    Int x = A[i] / A[i - K];
    Int y = A[i - 1] / A[i - K - 1];
    cout << (x > y ? "Yes" : "No") << 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++)

int main(void) {
  long long n, k, i, b, j = 0, v;
  cin >> n >> k;
  vector<long long> a(n + 1), ans(n - k + 1);
  rep(i, n) {
    cin >> b;

    if (i == 0) {
      a[i] = b;
    } else {
      a[i] = a[i - 1] + b;
    }
  }

  ans[0] = a[k - 1];
  for (i = k; i < n; i++) {
    ans[i - (k - 1)] = (a[i] - a[i - k]);

    if (i != k - 1) {
      if (ans[i - (k - 1)] > ans[i - k]) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

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

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

int main(void) {
  long long n, k, i, b, j = 0, v;
  cin >> n >> k;
  vector<long long> a(n + 1), ans(n - k + 1), z(n);
  rep(i, n) {
    cin >> b;
    if (b == 0) {
      z[j] = i;
      j++;
    }
    if (i == 0) {
      a[i] = b;
    } else {
      a[i] = a[i - 1] + b;
    }
  }

  ans[0] = a[k - 1];
  for (i = k; i < n; i++) {
    ans[i - (k - 1)] = (a[i] - a[i - k]);
    /*for (j = i - k; j <= i; j++) {
            if (a[j] == 0) {
                    ans[i - (k - 1)] = 0;
            }
    }*/
    for (j = 0; j < z.size(); j++) {
      if (z[j] <= i && z[j] > i - k)
        ans[i - (k - 1)] = 0;
    }

    // cout << ans[i - (k - 1)];

    if (i != k - 1) {
      if (ans[i - (k - 1)] > ans[i - k]) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }

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

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

Error: 0

Fixed submission:

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

/***** author :  C0d1ngPhenomena *****/

#include <bits/stdc++.h>
#define endl "\\n"
#define ll long long int
#define TestCases                                                              \\
  int T;                                                                       \\
  cin >> T;                                                                    \\
  while (T--)
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define revrep(i, a, b) for (ll i = b - 1; i >= a; i--)
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define mp(x, y) make_pair(x, y)
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(), c.end()
#define alld(c) c.begin(), c.end(), greater<int>()
#define mem(a, val) memset(a, val, sizeof(a))
#define f first
#define s second
#define pb push_back
using namespace std;

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}

int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n, k;
  cin >> n >> k;
  vll arr(n);
  rep(i, 0, n) cin >> arr[i];

  rep(i, 0, n - k) {
    if (arr[i] < arr[k + i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }

  return 0;
}


Error: 0

Fixed submission:

/***** author :  C0d1ngPhenomena *****/

#include <bits/stdc++.h>
#define endl "\\n"
#define ll long long int
#define TestCases                                                              \\
  int T;                                                                       \\
  cin >> T;                                                                    \\
  while (T--)
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define revrep(i, a, b) for (ll i = b - 1; i >= a; i--)
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define mp(x, y) make_pair(x, y)
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(), c.end()
#define alld(c) c.begin(), c.end(), greater<int>()
#define mem(a, val) memset(a, val, sizeof(a))
#define f first
#define s second
#define pb push_back
using namespace std;

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}

int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n, k;
  cin >> n >> k;
  vll arr(n);
  rep(i, 0, n) cin >> arr[i];

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

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

// Copyright 2020 yaito3014
#include <iostream>
#include <vector>
int main() {
  int N, K;
  std::cin >> N >> K;
  std::vector<int> A(N);
  for (auto &e : A)
    std::cin >> e;
  for (int i = K; i < N; ++i)
    std::cout << (A[i - K] < A[i] ? "Yes" : "No") << '\\n';
}


Error: TLE

Fixed submission:

// Copyright 2020 yaito3014
#include <boost/multiprecision/cpp_int.hpp>
#include <cstdint>
#include <iostream>
#include <vector>

int main() {
  int N, K;
  std::cin >> N >> K;
  std::vector<int> A(N);
  for (auto &e : A)
    std::cin >> e;
  using boost::multiprecision::cpp_int;
  cpp_int v = 1;
  for (int i = 0; i < N; ++i) {
    cpp_int w = v * A[i];
    if (i >= K) {
      w /= A[i - K];
      std::cout << (v < w ? "Yes" : "No") << '\\n';
    }
    v = w;
  }
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\\n"
#define rep(i, a, n) for (int i = a; i < n; ++i)

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, 0, n) cin >> a[i];

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


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\\n"
#define rep(i, a, n) for (int i = a; i < n; ++i)

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, 0, n) cin >> a[i];

  vector<ll> s(n + 1, 1);
  rep(i, 0, n) s[i + 1] = s[i] * a[i];
  ll last = s[k] / s[0];
  rep(i, k + 1, n + 1) {
    ll now = s[i] / s[i - k];
    if (now > last) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    last = now;
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
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() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for (ll i = 0; i < n; i++)
    cin >> a[i];
  for (ll i = k; i < n; i++) {
    if (a[i - k] < a[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
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;
}
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
int main() {
  ll n, k;
  cin >> n >> k;
  vector<Bint> a(n);
  for (ll i = 0; i < n; i++)
    cin >> a[i];
  vector<Bint> grade(n, 1);
  for (ll i = 0; i < k; i++) {
    grade[k - 1] *= a[i];
  }
  for (ll i = k; i < n; i++) {
    Bint tmp = grade[i - 1];
    grade[i] = tmp * a[i] / a[i - k];
    if (grade[i] > tmp)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define sz size()
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)

#define ll long long

int main() {

  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, k;
  int i, j;
  cin >> n >> k;

  std::vector<int> a(n);

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

  for (j = k; j < n; j++)
    if (a[j] > a[j - k])
      cout << "Yes\\n";
    else
      cout << "No\\n";

  return 0;
}

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;

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define sz size()
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)

#define ll long long

int main() {

  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, k;
  int i, j;
  std::vector<int> a(n);

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

  for (j = k; j < n; j++)
    if (a[j] > a[j - k])
      cout << "Yes\\n";
    else
      cout << "No\\n";

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

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

int main() {
  std::ios::sync_with_stdio(false);
  lld tc = 1;
  // cin >> tc;
  while (tc--) {
    lld n, k;
    cin >> n >> k;
    vector<lld> v(n);
    for (lld i = 0; i < n; i++) {
      cin >> v[i];
    }
    map<lld, lld> mp;
    for (lld i = 0; i < k; i++) {
      mp[v[i]]++;
    }
    for (lld i = k; i < n; i++) {
      mp[v[i - k]]--;
      mp[v[i]]++;
      if (v[i] > v[i - k]) {
        cout << "Yes\\n";
      } else {
        cout << "No\\n";
      }
    }
  }
}


Error: TLE

Fixed submission:

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

int main() {
  std::ios::sync_with_stdio(false);
  lld tc = 1;
  // cin >> tc;
  while (tc--) {
    lld n, k;
    cin >> n >> k;
    vector<lld> v(n);
    for (lld i = 0; i < n; i++) {
      cin >> v[i];
    }
    map<lld, lld> mp;
    for (lld i = 0; i < k; i++) {
      mp[v[i]]++;
    }
    for (lld i = k; i < n; i++) {
      map<lld, lld> pre = mp;
      mp[v[i - k]]--;
      mp[v[i]]++;
      if (v[i] > v[i - k]) {
        cout << "Yes\\n";
      } else {
        cout << "No\\n";
      }
    }
  }
}