alexjercan/bugnet huggingface dataset:
Problem p02602 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(), a.end()
#define rrng(a) a.end(), a.begin()
#define endl "\\n"

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

  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 << "No" << endl;
    else
      cout << "Yes" << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(), a.end()
#define rrng(a) a.end(), a.begin()
#define endl "\\n"

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

  int N, K;
  cin >> N >> K;
  vector<Bint> A(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];
  vector<Bint> sum(N + 1);
  sum[0] = 1;
  for (int i = 0; i < N; i++)
    sum[i + 1] = sum[i] * A[i];
  Bint memo = sum[K];
  for (int i = K + 1; i <= N; i++) {
    if (memo >= sum[i] / sum[i - K])
      cout << "No" << endl;
    else
      cout << "Yes" << endl;
    memo = sum[i] / sum[i - K];
  }
  return 0;
}
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 rep1(i, n) for (int i = 1; i <= n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define repr1(i, n) for (int i = n; i >= 1; i--)
#define all(v) v.begin(), v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1);
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;
}

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

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


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define repr1(i, n) for (int i = n; i >= 1; i--)
#define all(v) v.begin(), v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1);
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;
}

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

  for (int i = 1; i <= n; 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" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  int n, k;
  int a[200000];
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int x, b;
  for (int j = 0; j < n - k; j++) {

    if (a[j] < a[j + k]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int n, k;
  int a[2000];
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int x[2000];
  for (int s = 0; s < n - k; s++) {
    x[s] = 1;
  }
  for (int j = k; j < n - k; j++) {

    for (int l = j - k; l < j; l++) {
      x[j] *= a[l];
    }
    if (j != k) {
      if (x[j] > x[j - 1]) {
        cout << "Yes";
      } else {
        cout << "No";
      }
    }
  }
  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;
typedef long long ll;
using P = pair<ll, ll>;

signed main(void) {
  int n, k;
  cin >> n >> k;
  ll a[n];
  rep(i, n) cin >> a[i];
  ll tmp = a[0];
  for (int i = k; i < n; i++) {
    if (tmp < a[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    tmp = a[i - k + 1];
  }
  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;
using P = pair<ll, ll>;

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

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

Error: 0

Fixed submission:

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

#include <bits/stdc++.h>
#define repp(i, l, r) for (long long i = (l); i < (r); i++)
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define per(i, n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647; // int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int, int>;
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<long double> a(n + 5, 1);
  rep(i, n) cin >> a[i];
  vector<long double> rui(n + 1, 1);
  repp(i, 1, n + 1) {
    long double f = log10(rui[i - 1]);
    long double b = log10(a[i - 1]);
    rui[i] = rui[i - 1] + b;
  }
  for (ll i = k + 1; i <= n; i++) {
    long double th = rui[i] - rui[i - k];
    long double be = rui[i - 1] - rui[i - 1 - k];
    if (th > be)
      cout << "Yes\\n";
    else
      cout << "No\\n";
  }
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define repp(i, l, r) for (long long i = (l); i < (r); i++)
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define per(i, n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647; // int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int, int>;
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 + 5, 1);
  rep(i, n) cin >> a[i];
  vector<ll> rui(n + 1, 1);
  repp(i, 1, n + 1) rui[i] = rui[i - 1] * a[i - 1];
  for (ll i = k + 1; i <= n; i++) {
    ll th = rui[i] / rui[i - k];
    ll be = rui[i - 1] / rui[i - 1 - k];
    if (th > be)
      cout << "Yes\\n";
    else
      cout << "No\\n";
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);

int main() {

  ll n, k;
  cin >> n >> k;
  ll a[n + 1];

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

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

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);

int main() {

  ll n, k;
  cin >> n >> k;
  ll a[n + 1];
  ll prefix[n + 1];

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

  for (int i = 2; i <= n; ++i) {
    prefix[i] = prefix[i] * prefix[i - 1];
  }

  for (int i = k + 1; i <= n; ++i) {
    ll x;
    if (i == k + 1)
      x = prefix[i - 1];
    else
      x = prefix[i - 1] / prefix[i - 1 - k];

    ll y = prefix[i] / prefix[i - k];
    if (y > x)
      cout << "Yes";
    else
      cout << "No";
    cout << endl;
  }

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

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

// ABCテンプレート

#define rep(i, n) for (int i = 0; i < (n); i++)
#define in(n) cin >> (n)
#define out(ans) cout << (ans) << endl;
#define keta(n) cout << fixed << setprecision((n));
using ll = int64_t;
using v = vector<int>;

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


Error: 0

Fixed submission:

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

// ABCテンプレート

#define rep(i, n) for (int i = 0; i < (n); i++)
#define in(n) cin >> (n)
#define out(ans) cout << (ans) << endl;
#define keta(n) cout << fixed << setprecision((n));
using ll = int64_t;
using v = vector<int>;

int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> alist(N);
  vector<ll> aklist(N, 1);
  rep(i, N) {
    ll A;
    cin >> A;
    alist.at(i) = A;
    if (i == 0) {
      aklist.at(i) = A;
    } else {
      aklist.at(i) = A * aklist.at(i - 1);
    }
  }
  /*
  for(int i=K-1; i<N; i++) {
    if(i==K-1) continue;
    else aklist.at(i) = aklist.at(i)/aklist.at(i-K);
  }
  */
  for (int i = K; i < N; i++) {
    ll before, after;
    if (i == K)
      before = aklist.at(i - 1);
    else
      before = aklist.at(i - 1) / aklist.at(i - 1 - K);
    after = aklist.at(i) / aklist.at(i - K);
    if (after > before) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
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[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 <bits/stdc++.h>
using namespace std;

int main() {
  /*
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n+1);
  vector<long long> b(n+1, 0);
  a[0] = 0;
  for (int i = 1; i < n+1; ++i) {
      cin >> a[i];
  }
  long long tmp = 1;
  for (int i = 1; i < n+1; ++i) {
      tmp *= a[i];
      if (i >= k) {
          b[i] = tmp;
          tmp /= a[i-k+1];
      }
  }

  for (int i = k+1; i < n+1; ++i) {
      cout << (b[i-1] < b[i] ? "Yes" : "No") << endl;
  }
  */
  long long int n, k;
  cin >> n >> k;
  vector<long long int> a(n), b(n + 1);
  b[0] = 1;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    b[i + 1] = b[i] * a[i];
  }

  for (int i = k + 1; i < n + 1; ++i) {
    const auto s = b[i] / b[i - k];
    const auto ss = b[i - 1] / b[i - k - 1];
    cout << (s > ss ? "Yes" : "No") << endl;
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

#define ll long long
int MAX = 2e6;

int main() {
  // #ifndef ONLINE_JUGDE
  //	freopen("input.txt", "r", stdin);
  //	freopen("output.txt", "w", stdout);
  // #endif

  ios::sync_with_stdio(0);
  cin.tie(0);

  int n, k;
  int a[MAX];
  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 << "Yes\\n";
    else
      cout << "No\\n";
  }
  return 0;
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
  // #ifndef ONLINE_JUGDE
  //	freopen("input.txt", "r", stdin);
  //	freopen("output.txt", "w", stdout);
  // #endif

  ios::sync_with_stdio(0);
  cin.tie(0);

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

Error: -11

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, k + i < n) {
    if (A[k + i] > A[i]) {
      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 int LL;
// Compiler version g++ 6.3.0
int fact(LL n) {
  if (n == 1 || n == 0) {
    return 1;
  } else {
    return fact(n - 1) * n;
  }
}
int main() {
  LL n, k;
  cin >> n >> k;
  LL a[n + 1], b[n + 1];
  for (LL i = 1; i < n + 1; i++) {
    cin >> a[i];
  }
  b[0] = 1;
  LL j = 1;
  for (LL i = 1; i <= n; i++) {
    b[i] = b[i - 1] * a[i];
  }
  // cout<<b[k]<<endl;
  for (LL i = k + 1; i < n + 1; i++) {

    //    cout<<b[i]<<endl;
    if (a[i] > a[j]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    j++;
  }
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
// Compiler version g++ 6.3.0
int fact(LL n) {
  if (n == 1 || n == 0) {
    return 1;
  } else {
    return fact(n - 1) * n;
  }
}
int main() {
  LL n, k;
  cin >> n >> k;
  LL a[n + 1], b[n + 1];
  for (LL i = 1; i < n + 1; i++) {
    cin >> a[i];
  }
  b[0] = 1;
  for (LL i = 1; i <= n; i++) {
    b[i] = b[i - 1] * a[i];
  }
  // cout<<b[k]<<endl;
  for (LL i = k + 1; i < n + 1; i++) {
    b[i] = b[i] / b[i - k];
    //    cout<<b[i]<<endl;
    if (b[i] > b[i - 1]) {
      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;
int main() {
  int n, k;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < n - k; i++) {
    if (arr[k + i] > arr[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  long long int val = 1;
  cin >> n >> k;
  long long int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int i = 0;
  while (i < k) {
    val = val * arr[i];
  }
  arr[k - 1] = val;
  for (int j = k; j < n; i++) {
    arr[j] = arr[j - 1] * arr[j];
  }
  for (int i = k; i < n; i++) {
    if (arr[i] > arr[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 < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  REP(i, N) cin >> a[i];
  for (int r = K; r < N; r++) {
    int l = r - K;
    if (a[l] < a[r])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

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

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> score(N);
  REP(i, N)
  cin >> score[i];

  vector<int> gakkiScore(K);
  for (int i = 0; i < K; i++) {
    int calc = score[K - 1 + i];
    for (int j = 1; j < K; j++) {
      calc *= score[K - 1 - j];
    }
    gakkiScore[i] = calc;
  }

  for (int i = 1; i < K; i++) {
    if (gakkiScore[i - 1] < gakkiScore[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
Problem p02602 (C++) — buggy submission, verdict: 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) {
  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;
}


Error: -6
malloc(): corrupted top size


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) {
  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;
}
Problem p02602 (C++) — buggy submission, verdict: 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);
  }
  for (int i = 0; i < N - K; i++) {
    if (A.at(i) < A.at(i + K)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}

Error: 0

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

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

ll N, K, A[1 << 18];

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

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


Fixed submission:

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

int main() {
  int N, K;
  vector<ll> A(N);
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = K + 1; i <= N; i++) {
    if (A[i - K] < A[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>
int main() {
  int a, b;

  scanf("%d %d", &a, &b);
  int nilai[a];
  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;
}


Error: 0

Fixed submission:

#include <stdio.h>

int main() {
  int a, b;

  scanf("%d %d", &a, &b);

  int c[255];

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

    scanf("%d", &c[i]);
  }

  for (int i = b; i < a; i++) {
    if (c[i] > c[i - b]) {
      printf("Yes\\n");
    } else {
      printf("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;

  long long a[200001];

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

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

Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {

  int N, K;

  cin >> N >> K;

  long long a[200001];

  long long ans[200001];

  ans[0] = 1;

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

    ans[i] = a[i] * ans[i - 1];
  }

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

    if (ans[i + K] / ans[i] > ans[i + K - 1] / ans[i - 1]) {
      cout << "Yes" << endl;

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