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

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long n, k;
  scanf("%ld %ld", &n, &k);
  long ten[k];
  long hasZero = -1;
  for (long i = 0; i < k; i++) {
    scanf("%ld", &ten[i]);
    if (ten[i] == 0) {
      hasZero = i;
    }
  }

  long pos = 0;
  for (long i = k; i < n; i++) {
    long new_ten = 0;
    scanf("%ld", &new_ten);
    if (hasZero == pos) {
      hasZero = -1;
    }
    if (hasZero == -1 && ten[pos] < new_ten) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    if (new_ten == 0) {
      hasZero = pos;
    }

    ten[pos] = new_ten;
    pos = (pos + 1) % k;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long n, k;
  scanf("%ld %ld", &n, &k);
  long ten[k];
  for (long i = 0; i < k; i++) {
    scanf("%ld", &ten[i]);
  }

  long pos = 0;
  for (long i = k; i < n; i++) {
    long new_ten = 0;
    scanf("%ld", &new_ten);

    bool hasZero = false;
    for (int j = 0; j < k; j++) {
      if (j == pos) {
        continue;
      }
      if (ten[j] == 0) {
        // cout << "hasZero ";
        hasZero = true;
        break;
      }
    }

    if (!hasZero && ten[pos] < new_ten) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    ten[pos] = new_ten;
    pos = (pos + 1) % k;
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

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

#define fi first
#define se second
#define pb push_back
#define mod(n, k) ((((n) % (k)) + (k)) % (k))
#define forn(i, a, b) for (int i = a; i < b; i++)
#define forr(i, a, b) for (int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define si cout << "Yes\\n";
#define no cout << "No\\n";

ld get(int l, int r, vector<ld> &ac) {
  ld res = ac[r];
  if (l - 1 >= 0)
    res -= ac[l - 1];
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  vector<ld> ac(N);
  forn(i, 0, N) {
    ld x;
    cin >> x;
    ac[i] = x;
    if (i)
      ac[i] += ac[i - 1];
  }
  vector<ld> res;
  forn(i, 0, N) {
    if (i - K + 1 >= 0) {
      res.pb(get(i - K + 1, i, ac));
    }
  }
  forn(i, 1, (int)res.size()) {
    if (res[i] > res[i - 1]) {
      si;
      continue;
    }
    no;
  }
  return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


Error: 0

Fixed submission:

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

#define fi first
#define se second
#define pb push_back
#define mod(n, k) ((((n) % (k)) + (k)) % (k))
#define forn(i, a, b) for (int i = a; i < b; i++)
#define forr(i, a, b) for (int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define si cout << "Yes\\n";
#define no cout << "No\\n";

ll get(int l, int r, vector<ll> &ac) {
  ll res = ac[r];
  if (l - 1 >= 0)
    res /= ac[l - 1];
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  vector<ll> ac(N);
  forn(i, 0, N) {
    ll x;
    cin >> x;
    ac[i] = x;
    if (i)
      ac[i] *= ac[i - 1];
  }
  vector<ll> res;
  forn(i, 0, N) {
    if (i - K + 1 >= 0) {
      res.pb(get(i - K + 1, i, ac));
    }
  }
  forn(i, 1, (int)res.size()) {
    if (res[i] > res[i - 1]) {
      si;
      continue;
    }
    no;
  }
  return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/
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;

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: -6
double free or corruption (out)


Fixed submission:

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<long long int> a(n);
  vector<long long int> ss(n);             // 累積積の配列
  vector<long long int> ans(n - k + 1, 1); // すべての要素を1に初期化

  ss[0] = 1;

  rep(i, n) {
    int a_tmp;
    cin >> a_tmp;
    a[i] = a_tmp;

    ss[i + 1] = ss[i] * a[i];
  }

  // for(int i = 1 ; i < n-1 ; i++){
  //   for(int j = 0 ; j < k ; j++){
  //     ans[i-1] *= a[i-1+j];
  //   }
  // }

  for (int i = 0; i < n - k + 1; i++) { // 累積積のあぷろーち
    // printf("ss[%d] %d\\n", k+i, ss[k+i]);
    ans[i] = ss[k + i] / ss[i];
  }

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

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

#include <bits/stdc++.h>

using namespace std;

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

#define fi first
#define se second

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

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

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

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

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

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

#define fi first
#define se second

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

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

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

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

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

#include <bits/stdc++.h>
#define int long long int
#define endl "\\n"
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int t = 1;
  // cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int a[n], count = 1;
    vector<int> v;
    int i;
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
      if (i + k < n) {
        if (a[i] < a[i + k]) {
          cout << "Yes" << endl;
        } else {
          cout << "No" << endl;
        }
      }
    }
  }
  return 0;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
#define int long long int
#define endl "\\n"
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int t = 1;
  // cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int a[n], count = 1;
    vector<int> v;
    int i;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      // if(i>=k){
      //     count=count/a[i-k];
      //     v.push_back(count);
      //     cout<<count<<endl;
      // }
      // count*=a[i];
    }
    // v.push_back(count/a[i-k]);
    // cout<<count/a[i-k]<<endl;
    for (int i = 0; i < n; i++) {
      count = 1;
      for (int j = i; j < i + k; j++) {
        count *= a[j];
      }
      v.push_back(count);
    }
    for (auto i = 1; i <= n - k; i++) {
      if (v[i - 1] < v[i]) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = k; i < n; i++) {
    if (arr[i] > arr[i - k]) {
      cout << "Yes"
           << "\\n";
    } else {
      cout << "No"
           << "\\n";
    }
  }
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
typedef unsigned long long int ll;
using namespace std;
#define M 1000000000

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  ll arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 1; i < n; i++) {
    arr[i] *= arr[i - 1] % M;
  }
  int a = 0;
  for (int i = k; i < n; i++) {
    arr[i] /= arr[a];
    a++;
  }
  for (int i = k; i < n; i++) {
    if (arr[i] > arr[i - 1]) {
      cout << "Yes"
           << "\\n";
    } else {
      cout << "No"
           << "\\n";
    }
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <vector>

using namespace std;

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

  for (int i = K + 1; i <= N; i++) {
    if (A[i - 1 - K] < A[i - 1]) {
      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 <iostream>
#include <vector>

using namespace std;

int main() {
  int N;
  int K;
  vector<int> 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 - 1 - K] < A[i - 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;
typedef long long int ll;
typedef long double ld;

int main(void) {
  int n, k, f;
  cin >> n >> k;
  vector<ll> a(n, 0);
  queue<ll> que;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < k; i++)
    que.push(a[i]);
  for (int i = k; i < n; i++) {
    f = que.front();
    que.pop();
    // cout << f << " " << a[i] << endl;
    if (f < a[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    que.push(a[i]);
  }
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;

int main(void) {
  int n, k;
  cin >> n >> k;
  vector<ll> a(n + 1, 0);
  queue<ll> que;
  for (int i = 1; i <= n; i++)
    cin >> a[i];
  for (int i = 1; i < k; i++)
    que.push(a[i]);
  for (int i = k + 1; i <= n; i++) {
    if (que.front() < a[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    que.pop();
    que.push(a[i]);
  }
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() {
  int N, K;

  cin >> N >> K;

  vector<ll> P;

  for (int i = 0; i < N; i++) {
    ll in;

    cin >> in;

    P.push_back(in);
  }

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

  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() {
  int N, K;

  cin >> N >> K;

  vector<ll> Psum;

  Psum.push_back(1);

  for (int i = 0; i < N; i++) {
    ll in;

    cin >> in;

    Psum.push_back(Psum[i] * in);
  }

  for (int i = N; i >= K; i--) {
    Psum[i] /= Psum[i - K];
  }

  Psum.erase(Psum.begin());

  for (int i = K; i < N; i++) {
    if (Psum[i] > Psum[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 i, j, k, n;
  cin >> n >> k;
  long long a[n + 1];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  i = 0;
  j = k;
  while (j < n) {
    if (a[j] > a[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    i++;
    j++;
  }
}


Error: TLE

Fixed submission:

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

#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
const int INF32 = 1 << 30;
const ll INF64 = 1LL << 60;

void solve() {
  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 + k] > a[i])
      cout << "Yes\\n";
    else
      cout << "No\\n";
  }
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
const int INF32 = 1 << 30;
const ll INF64 = 1LL << 60;

void solve() {
  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 + k] > a[i])
      cout << "Yes\\n";
    else
      cout << "No\\n";
  }
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--)
    solve();
  return 0;
}
Problem p02602 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <iostream>
#define int unsigned long long int
#define vi vector<int>
#define vvi vector<vector<int>>
using namespace std;

int32_t main() {
  // your code goes here
  int t, x = 1;

  // cout<<"Case #"<<x++<<":\\n";
  int n, i, j, k;
  cin >> n >> k;
  vi a(n + 1), prod(n + 1, 1);
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int res = 1;
  for (i = k + 1; i <= n; i++) {
    if (a[i] > a[i - k])
      cout << "Yes\\n";
    else
      cout << "No\\n";
  }

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
#define int unsigned long long int
#define vi vector<int>
#define vvi vector<vector<int>>
using namespace std;

int32_t main() {
  // your code goes here
  int t, x = 1;

  // cout<<"Case #"<<x++<<":\\n";
  int n, i, j, k;
  cin >> n >> k;
  vi a(n + 1), prod(n + 1, 1);
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    prod[i] = prod[i - 1] * a[i];
  }
  int res = 1;
  for (i = k + 1; i <= n; i++) {
    if ((prod[i] / prod[i - k]) > (prod[i - 1] / prod[i - k - 1]))
      cout << "Yes\\n";
    else
      cout << "No\\n";
  }

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

#include <algorithm>
#include <array>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <unordered_map>
#include <utility>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[]) {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  vector<ll> v(n + 1, 1);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    v[i + 1] = v[i] + a[i];
  }

  ll t1;
  ll t2 = v[k];

  for (ll i = k + 1; i <= n; i++) {
    t1 = t2;
    t2 -= a[i - k - 1];
    t2 += a[i - 1];
    ;

    if (t1 < t2) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}

Error: 0

Fixed submission:

#include <algorithm>
#include <array>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <unordered_map>
#include <utility>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[]) {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  vector<ll> v(n + 1, 1);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    v[i + 1] = v[i] * a[i];
  }

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

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\\n"
#define se second
#define ll long long
#define inf 0x3f3f3f3f
#define fast                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
const int N = 3e5 + 5;
const ll mod = 1e9 + 7;

int main() {
  fast ll n, k;
  cin >> n >> k;
  ll arr[n + 1];
  for (ll i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (ll i = k; i < n; i++) {

    if (arr[i] > arr[i - k]) {
      cout << "Yes\\n";
    } else {
      cout << "No\\n";
    }
  }
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\\n"
#define se second
#define ll long long
#define inf 0x3f3f3f3f
#define fast                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
const int N = 3e5 + 5;
const ll mod = 1e9 + 7;

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

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

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

Error: TLE

Fixed submission:

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

signed main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  int L = 1;
  rep(i, N) {
    int test;
    if (i == K - 1) {
      test = 0;
      rep(i, K) test += A[i];
    }
    if (i > K - 1) {
      int now = 0;
      rep(i, K) now += A[i + L];
      if (now > test)
        cout << "Yes" << endl;
      else
        cout << "No" << endl;
      test = now;
      L += 1;
    }
  }
  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 a[n + 1];
  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" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;

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

#include <algorithm>
#include <cmath>
#include <iostream>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
#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;
  int A[N + 10];
  for (int i = 1; i <= N; ++i) {
    cin >> A[i];
  }

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

  return 0;
}


Error: WA

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iostream>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {

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

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

  return 0;
}