prithivMLmods/Coder-Stat huggingface dataset:
Problem p02992 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
int n, k;
ll dp[56666][111];
vector<int> v;
int main() {
  scanf("%d%d", &n, &k);
  int l = 1, r = 1;
  while (r + 1 <= n) {
    v.push_back(r);
    l = r + 1;
    r = n / (n / l);
  }
  v.push_back(r);
  sort(v.begin(), v.end());
  dp[0][1] = v[0];
  for (int i = 1; i < v.size(); i++)
    dp[i][1] = v[i] - v[i - 1];
  ll ans = 0;
  for (int i = 2; i <= k; i++) {
    int r = v.size() - 1;
    ll now = 0;
    for (int j = 0; j < v.size(); j++) {
      now = (now + dp[j][i - 1]) % mod;
      while (v[r] >= n / v[j] && r >= 0) {
        dp[r][i] = now * (r == 0 ? v[r] : v[r] - v[r - 1]) % mod;
        r--;
      }
    }
  }
  for (int i = 0; i < v.size(); i++)
    ans += dp[i][k];
  printf("%lld\n", ans % mod);
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
int n, k;
ll dp[66666][111];
vector<int> v;
int main() {
  scanf("%d%d", &n, &k);
  int l = 1, r = 1;
  while (r + 1 <= n) {
    v.push_back(r);
    l = r + 1;
    r = n / (n / l);
  }
  v.push_back(r);
  sort(v.begin(), v.end());
  dp[0][1] = v[0];
  for (int i = 1; i < v.size(); i++)
    dp[i][1] = v[i] - v[i - 1];
  ll ans = 0;
  for (int i = 2; i <= k; i++) {
    int r = v.size() - 1;
    ll now = 0;
    for (int j = 0; j < v.size(); j++) {
      now = (now + dp[j][i - 1]) % mod;
      while (v[r] >= n / v[j] && r >= 0) {
        dp[r][i] = now * (r == 0 ? v[r] : v[r] - v[r - 1]) % mod;
        r--;
      }
    }
  }
  for (int i = 0; i < v.size(); i++)
    ans += dp[i][k];
  printf("%lld\n", ans % mod);
}
Problem p02992 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
ll dp[100][100000];
ll arr[100000];
const ll mod = 1e9 + 7;
int main() {
  ll n, k;
  cin >> n >> k;
  ll sqrt_n = sqrt(n);
  for (ll i = 1, sum = 0; i <= 2 * sqrt_n; i++) {
    if (i <= sqrt_n) {
      arr[i]++;
      sum++;
    } else {
      arr[i] += n / (2 * sqrt_n - i + 1) - sum;
      sum += arr[i];
    }
    dp[0][i] = sum;
  }
  for (ll i = 1; i <= k; i++)
    for (ll j = 0; j < 2 * sqrt_n; j++)
      dp[i][j + 1] = (dp[i - 1][sqrt_n * 2 - j] * arr[j + 1] + dp[i][j]) % mod;
  cout << dp[k - 1][sqrt_n * 2] << endl;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
ll dp[105][200000];
ll arr[100000];
const ll mod = 1e9 + 7;
int main() {
  ll n, k;
  cin >> n >> k;
  ll sqrt_n = sqrt(n);
  for (ll i = 1, sum = 0; i <= 2 * sqrt_n; i++) {
    if (i <= sqrt_n) {
      arr[i]++;
      sum++;
    } else {
      arr[i] += n / (2 * sqrt_n - i + 1) - sum;
      sum += arr[i];
    }
    dp[0][i] = sum;
  }
  for (ll i = 1; i <= k; i++)
    for (ll j = 0; j < 2 * sqrt_n; j++)
      dp[i][j + 1] = (dp[i - 1][sqrt_n * 2 - j] * arr[j + 1] + dp[i][j]) % mod;
  cout << dp[k - 1][sqrt_n * 2] << endl;
}
Problem p02992 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10, mod = 1e9 + 7;
int a, b, f[maxn], k;
map<int, int, greater<int>> dp, dp2;
unordered_map<int, int> fre;
void plusle(int &a, int b) {
  a += b;
  if (a >= mod)
    a -= mod;
  return;
}
void minun(int &a, int b) {
  a -= b;
  if (a < 0)
    a += mod;
  return;
}
int add(int a, int b) {
  a += b;
  if (a >= mod)
    a -= mod;
  return a;
}
int mul(int a, int b) { return (int)(((long long)a * b) % mod); }

int main() {
  int n;
  scanf("%d%d", &n, &k);
  fre.reserve(1 << 17);
  fre.max_load_factor(0.25);
  int cc = n, pt = 1;
  while (cc) {
    //  cout<<cc<<'\n';
    int x = n / cc;
    dp[x] = (n / x - n / (x + 1));
    fre[x] = dp[x];
    cc = (n / (x + 1));
  }
  int sum = 0;
  //  for(auto i:dp)
  // printf("%d %d\n",i.first,i.second);
  while (k--) {
    // cout<<'g'<<'\n';
    int last = -1;
    // dp2.clear();
    for (auto &it : dp) {
      dp2[it.first] = (last == -1) ? it.second : add(last, it.second);
      last = dp2[it.first];
    }
    for (auto &it : dp) {
      dp[it.first] = mul(fre[it.first], dp2[n / (it.first)]);
    }
  }
  printf("%d\n", dp[n]);
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10, mod = 1e9 + 7;
int a, b, f[maxn], k;
map<int, int, greater<int>> dp, dp2;
unordered_map<int, int> fre;
void plusle(int &a, int b) {
  a += b;
  if (a >= mod)
    a -= mod;
  return;
}
void minun(int &a, int b) {
  a -= b;
  if (a < 0)
    a += mod;
  return;
}
int add(int a, int b) {
  a += b;
  if (a >= mod)
    a -= mod;
  return a;
}
int mul(int a, int b) { return (int)(((long long)a * b) % mod); }

int main() {
  int n;
  scanf("%d%d", &n, &k);
  fre.reserve(1 << 17);
  fre.max_load_factor(0.25);
  int cc = n, pt = 1;
  while (cc) {
    //  cout<<cc<<'\n';
    int x = n / cc;
    dp[x] = (n / x - n / (x + 1));
    fre[x] = dp[x];
    cc = (n / (x + 1));
  }
  int sum = 0;
  //  for(auto i:dp)
  // printf("%d %d\n",i.first,i.second);
  while (k--) {
    // cout<<'g'<<'\n';
    int last = -1;
    // dp2.clear();
    for (auto &it : dp) {
      dp2[it.first] = (last == -1) ? it.second : add(last, it.second);
      last = dp2[it.first];
    }
    for (auto &it : dp) {
      it.second = mul(fre[it.first], dp2[n / (it.first)]);
    }
  }
  printf("%d\n", dp[n]);
}
Problem p02992 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>
#include <iostream>
#include <vector>
#define N 40000
using namespace std;
typedef long long ll;

ll n, k, en, M = 1e9 + 7, d[N], s[N];
vector<int> c;
int main() {
  ll i, t;
  cin >> n >> k;
  c.push_back(0);
  for (i = 1; i <= n;) {
    t = n / (n / i);
    c.push_back(t);
    i = t + 1;
  }
  en = c.size() - 1;
  for (i = en; i; i--) {
    c[i] -= c[i - 1];
    s[i] = 1;
  }
  while (k--) {
    for (i = 1; i <= en; i++)
      d[i] = s[en - i + 1] * c[i] % M;
    for (i = 1; i <= en; i++)
      s[i] = (s[i - 1] + d[i]) % M;
  }
  cout << s[en];
  return 0;
}

Fixed submission:
#include <cstdio>
#include <iostream>
#include <vector>
#define N 100000
using namespace std;
typedef long long ll;

ll n, k, en, M = 1e9 + 7, d[N], s[N];
vector<int> c;
int main() {
  ll i, t;
  cin >> n >> k;
  c.push_back(0);
  for (i = 1; i <= n;) {
    t = n / (n / i);
    c.push_back(t);
    i = t + 1;
  }
  en = c.size() - 1;
  for (i = en; i; i--) {
    c[i] -= c[i - 1];
    s[i] = 1;
  }
  while (k--) {
    for (i = 1; i <= en; i++)
      d[i] = s[en - i + 1] * c[i] % M;
    for (i = 1; i <= en; i++)
      s[i] = (s[i - 1] + d[i]) % M;
  }
  cout << s[en];
  return 0;
}
Problem p02992 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  int N, K;
  cin >> N >> K;
  unordered_map<int, int> mp;
  int l = 1, r = 2, count = 0;
  mp[0] = 1;
  while (r <= N) {
    count++;
    l = r;
    r = N / (N / l) + 1;
    mp[count] = r - l;
  }
  long long dp[120][1000000];
  for (int i = 0; i < K; i++) {
    long long sum = 0;
    for (int j = count; j >= 0; j--) {
      if (i == 0) {
        dp[0][j] = mp[j];
        continue;
      }
      long long a = mp[j];
      sum += dp[i - 1][count - j];
      sum %= MOD;
      dp[i][j] = sum * a;
      dp[i][j] %= MOD;
    }
  }
  long long answer = 0;
  for (int i = 0; i <= count; i++) {
    answer += dp[K - 1][i];
    answer %= MOD;
  }
  cout << answer << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  int N, K;
  cin >> N >> K;
  unordered_map<int, int> mp;
  int l = 1, r = 2, count = 0;
  mp[0] = 1;
  while (r <= N) {
    count++;
    l = r;
    r = N / (N / l) + 1;
    mp[count] = r - l;
  }
  long long dp[120][100000];
  for (int i = 0; i < K; i++) {
    long long sum = 0;
    for (int j = count; j >= 0; j--) {
      if (i == 0) {
        dp[0][j] = mp[j];
        continue;
      }
      long long a = mp[j];
      sum += dp[i - 1][count - j];
      sum %= MOD;
      dp[i][j] = sum * a;
      dp[i][j] %= MOD;
    }
  }
  long long answer = 0;
  for (int i = 0; i <= count; i++) {
    answer += dp[K - 1][i];
    answer %= MOD;
  }
  cout << answer << endl;
}
Problem p02992 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;
const int mod = 1e9 + 7;
vector<pair<int, int>> fa;
long long dp[101][40000];
int main() {
  // cout<<sqrt(1000000000)<<endl;
  long long n, k;
  cin >> n >> k;
  for (int i = 1; i * i <= n; i++) {
    fa.push_back({i, 0});
    fa.push_back({n / i, 0});
  }
  sort(fa.begin(), fa.end());
  fa.erase(unique(fa.begin(), fa.end()), fa.end());
  map<long long, long long> pos;
  int m = (int)fa.size();
  // cout<<m<<endl;
  for (int i = 0; i < m - 1; i++) {
    long long l = n / (fa[i + 1].first);
    long long r = n / (fa[i].first);
    fa[i].second = r - l;
  }
  fa.back().second = 1;
  for (int i = 0; i < m; i++)
    pos[fa[i].first] = i;
  dp[0][pos[n]] = 1;
  for (int i = 0; i < k; i++) {
    for (int j = m - 2; j >= 0; j--)
      dp[i][j] = (dp[i][j] % mod + dp[i][j + 1] % mod) % mod;
    for (int j = 0; j < m; j++) {
      int nj = pos[n / fa[j].first];
      dp[i + 1][j] =
          (dp[i + 1][j] % mod + (dp[i][nj] % mod * fa[j].second % mod) % mod) %
          mod;
    }
  }
  long long ans = 0;
  for (int i = 0; i < m; i++)
    ans = (ans % mod + dp[k][i] % mod) % mod;
  cout << ans % mod << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;
const int mod = 1e9 + 7;
vector<pair<int, int>> fa;
long long dp[101][100000];
int main() {
  // cout<<sqrt(1000000000)<<endl;
  long long n, k;
  cin >> n >> k;
  for (int i = 1; i * i <= n; i++) {
    fa.push_back({i, 0});
    fa.push_back({n / i, 0});
  }
  sort(fa.begin(), fa.end());
  fa.erase(unique(fa.begin(), fa.end()), fa.end());
  map<long long, long long> pos;
  int m = (int)fa.size();
  // cout<<m<<endl;
  for (int i = 0; i < m - 1; i++) {
    long long l = n / (fa[i + 1].first);
    long long r = n / (fa[i].first);
    fa[i].second = r - l;
  }
  fa.back().second = 1;
  for (int i = 0; i < m; i++)
    pos[fa[i].first] = i;
  dp[0][pos[n]] = 1;
  for (int i = 0; i < k; i++) {
    for (int j = m - 2; j >= 0; j--)
      dp[i][j] = (dp[i][j] % mod + dp[i][j + 1] % mod) % mod;
    for (int j = 0; j < m; j++) {
      int nj = pos[n / fa[j].first];
      dp[i + 1][j] =
          (dp[i + 1][j] % mod + (dp[i][nj] % mod * fa[j].second % mod) % mod) %
          mod;
    }
  }
  long long ans = 0;
  for (int i = 0; i < m; i++)
    ans = (ans % mod + dp[k][i] % mod) % mod;
  cout << ans % mod << endl;
  return 0;
}
Problem p02992 (C++)

Buggy submission (status: Runtime Error):
#include <cmath>
#include <iostream>
#include <numeric>
using namespace std;
constexpr int M = 1000000007;

int main() {
  int N, K;
  cin >> N >> K;
  const int b = int(sqrt(N)) + 2;
  long long dps[2][b], dpl[2][b];
  int cur = 0, prev = 1;
  dps[0][0] = dps[1][0] = dpl[0][0] = dpl[1][0] = 0;
  for (int i = 1; i < b; i++) {
    dps[prev][i] = i;
    dpl[prev][i] = N / i;
  }
  while (--K) {
    for (int i = 1; i < b; i++) {
      dps[cur][i] =
          (dps[cur][i - 1] + (N / i < b ? dps[prev][N / i] : dpl[prev][i])) % M;
    }
    for (int i = b - 1; i > 0; i--) {
      dpl[cur][i] =
          ((i == b - 1 ? dps[cur][N / b] : dpl[cur][i + 1]) +
           (N / (N / i) < b ? dps[prev][N / (N / i)] : dpl[prev][N / i]) *
               (N / i - N / (i + 1))) %
          M;
    }
    swap(prev, cur);
  }
  cout << dpl[prev][1] << endl;
}


Fixed submission:
#include <cmath>
#include <iostream>
#include <numeric>
using namespace std;
constexpr int M = 1000000007;

int main() {
  int N, K;
  cin >> N >> K;
  if (N == 1) {
    cout << 1 << endl;
    return 0;
  }
  const int b = int(sqrt(N)) + 2;
  long long dps[2][b], dpl[2][b];
  int cur = 0, prev = 1;
  dps[0][0] = dps[1][0] = dpl[0][0] = dpl[1][0] = 0;
  for (int i = 1; i < b; i++) {
    dps[prev][i] = i;
    dpl[prev][i] = N / i;
  }
  while (--K) {
    for (int i = 1; i < b; i++) {
      dps[cur][i] =
          (dps[cur][i - 1] + (N / i < b ? dps[prev][N / i] : dpl[prev][i])) % M;
    }
    for (int i = b - 1; i > 0; i--) {
      dpl[cur][i] =
          ((i == b - 1 ? dps[cur][N / b] : dpl[cur][i + 1]) +
           (N / (N / i) < b ? dps[prev][N / (N / i)] : dpl[prev][N / i]) *
               (N / i - N / (i + 1))) %
          M;
    }
    swap(prev, cur);
  }
  cout << dpl[prev][1] << endl;
}
Problem p02992 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
vector<pair<long long, pair<long long, long long>>>
quotient_ranges(long long N) {
  vector<pair<long long, pair<long long, long long>>> ans;
  for (long long i = 1; i * i <= N; i++) {
    ans.push_back(make_pair(N / i, make_pair(i, i)));
  }
  for (long long i = N / ((long long)sqrt(N) + 1); i >= 1; i--) {
    ans.push_back(make_pair(i, make_pair(N / (i + 1) + 1, N / i)));
  }
  return ans;
}
int main() {
  long long N;
  int K;
  cin >> N >> K;
  vector<pair<long long, pair<long long, long long>>> A = quotient_ranges(N);
  int cnt = A.size();
  vector<vector<long long>> dp(K, vector<long long>(cnt, 0));
  for (int i = 0; i < cnt - 1; i++) {
    dp[0][i] = A[i].first - A[i + 1].first;
  }
  dp[0][cnt - 1] = 1;
  for (int i = 0; i < K - 1; i++) {
    for (int j = cnt - 1; j >= 0; j--) {
      int k = cnt - 1;
      long long sum = 0;
      if (k >= 0) {
        while ((long long)A[j].first * A[k].first <= N) {
          sum += dp[i][k];
          sum %= MOD;
          k--;
          if (k < 0) {
            break;
          }
        }
      }
      dp[i + 1][j] += sum * dp[0][j];
      dp[i + 1][j] %= MOD;
    }
  }
  long long ans = 0;
  for (int i = 0; i < cnt; i++) {
    ans += dp[K - 1][i];
  }
  ans %= MOD;
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
vector<pair<long long, pair<long long, long long>>>
quotient_ranges(long long N) {
  vector<pair<long long, pair<long long, long long>>> ans;
  for (long long i = 1; i * i <= N; i++) {
    ans.push_back(make_pair(N / i, make_pair(i, i)));
  }
  for (long long i = N / ((long long)sqrt(N) + 1); i >= 1; i--) {
    ans.push_back(make_pair(i, make_pair(N / (i + 1) + 1, N / i)));
  }
  return ans;
}
int main() {
  long long N;
  int K;
  cin >> N >> K;
  vector<pair<long long, pair<long long, long long>>> A = quotient_ranges(N);
  int cnt = A.size();
  vector<vector<long long>> dp(K, vector<long long>(cnt, 0));
  for (int i = 0; i < cnt - 1; i++) {
    dp[0][i] = A[i].first - A[i + 1].first;
  }
  dp[0][cnt - 1] = 1;
  for (int i = 0; i < K - 1; i++) {
    int k = cnt - 1;
    long long sum = 0;
    for (int j = 0; j < cnt; j++) {
      if (k >= 0) {
        while ((long long)A[j].first * A[k].first <= N) {
          sum += dp[i][k];
          sum %= MOD;
          k--;
          if (k < 0) {
            break;
          }
        }
      }
      dp[i + 1][j] += sum * dp[0][j];
      dp[i + 1][j] %= MOD;
    }
  }
  long long ans = 0;
  for (int i = 0; i < cnt; i++) {
    ans += dp[K - 1][i];
  }
  ans %= MOD;
  cout << ans << endl;
}
Problem p02992 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll mod = 1e9 + 7, dp[100][100000];
int main() {
  ll n, k;
  cin >> n >> k;
  fill(dp[0], dp[0] + 2 * ll(sqrt(n)) + 1, 0);
  dp[0][1] = 1;
  ll count = 0;
  for (int i = 1; n / i > sqrt(n); i++)
    count++;
  count += ll(sqrt(n));
  rep(i, k + 1) {
    ll a = 1, sum = 0, b = count;
    for (; n / a > sqrt(n); a++)
      (sum += dp[i][a]) %= mod, dp[i + 1][b] = sum, b--;
    for (int j = sqrt(n); j >= 1; j--) {
      ll x = n / j - n / (j + 1);
      (sum += dp[i][a] * x) %= mod;
      dp[i + 1][b] = sum, b--;
      a++;
    }
  }
  cout << dp[k + 1][1] << "\n";
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll mod = 1e9 + 7, dp[110][200000];
int main() {
  ll n, k;
  cin >> n >> k;
  fill(dp[0], dp[0] + 2 * ll(sqrt(n)) + 1, 0);
  dp[0][1] = 1;
  ll count = 0;
  for (int i = 1; n / i > sqrt(n); i++)
    count++;
  count += ll(sqrt(n));
  rep(i, k + 1) {
    ll a = 1, sum = 0, b = count;
    for (; n / a > sqrt(n); a++)
      (sum += dp[i][a]) %= mod, dp[i + 1][b] = sum, b--;
    for (int j = sqrt(n); j >= 1; j--) {
      ll x = n / j - n / (j + 1);
      (sum += dp[i][a] * x) %= mod;
      dp[i + 1][b] = sum, b--;
      a++;
    }
  }
  cout << dp[k + 1][1] << "\n";
}
Problem p02992 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
constexpr Int MOD = 1e9 + 7;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A, C;
  {
    int t = 1;
    while (t < N) {
      A.push_back(N / t);
      C.push_back(N / (N / t));
      t = N / (N / t) + 1;
    }
  }
  int M = A.size();
  vector<Int> dp(M, 1), dp2(M), sum(M);
  for (int i = 1; i < K; i++) {
    sum[0] = C[0] * dp[0] % MOD;
    for (int j = 1; j < M; j++) {
      sum[j] = (sum[j - 1] + (C[j] - C[j - 1]) * dp[j]) % MOD;
    }
    for (int j = 0; j < M; j++) {
      int t = upper_bound(begin(C), end(C), A[j]) - begin(C) - 1;
      dp2[j] = (sum[t] + (A[j] == C[t] ? 0 : (A[j] - C[t]) * dp[t + 1])) % MOD;
    }
    swap(dp2, dp);
  }
  Int ans = C[0] * dp[0];
  for (int i = 1; i < M; i++) {
    ans = (ans + (C[i] - C[i - 1]) * dp[i]) % MOD;
  }
  cout << ans << '\n';
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
constexpr Int MOD = 1e9 + 7;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A, C;
  {
    int t = 1;
    while (t <= N) {
      A.push_back(N / t);
      C.push_back(N / (N / t));
      t = N / (N / t) + 1;
    }
  }
  int M = A.size();
  vector<Int> dp(M, 1), dp2(M), sum(M);
  for (int i = 1; i < K; i++) {
    sum[0] = C[0] * dp[0] % MOD;
    for (int j = 1; j < M; j++) {
      sum[j] = (sum[j - 1] + (C[j] - C[j - 1]) * dp[j]) % MOD;
    }
    for (int j = 0; j < M; j++) {
      int t = upper_bound(begin(C), end(C), A[j]) - begin(C) - 1;
      dp2[j] = (sum[t] + (A[j] == C[t] ? 0 : (A[j] - C[t]) * dp[t + 1])) % MOD;
    }
    swap(dp2, dp);
  }
  Int ans = C[0] * dp[0];
  for (int i = 1; i < M; i++) {
    ans = (ans + (C[i] - C[i - 1]) * dp[i]) % MOD;
  }
  cout << ans << '\n';
  return 0;
}
Problem p02992 (C++)

Buggy submission (status: Runtime Error):
/*
[abc132] F - Small Products
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

const int MAX_R = 1e5;
const int MAX_K = 100;
const int MOD = 1e9 + 7;

class gf {
public:
  int n;
  gf() : n(0) {}
  gf(int n) : n(n % MOD) {}
  gf operator+(const gf x) const { return gf((n + x.n) % MOD); }
  gf operator*(const gf x) const { return gf((1LL * n * x.n) % MOD); }
};

int N, K;
gf dp[MAX_K][MAX_R];
vector<int> t;

ll solve() {
  for (int i = 1; i * i <= N; i++) {
    t.push_back(i);
    if (N / i != i) {
      t.push_back(N / i);
    }
  }
  sort(t.begin(), t.end(), greater<int>());
  int T = t.size();
  t.push_back(0);

  for (int i = 1; i <= T; i++) {
    dp[0][i] = 1;
  }
  for (int k = 1; k <= K; k++) {
    for (int i = 1; i <= T; i++) {
      dp[k][i] =
          dp[k][i - 1] + dp[k - 1][T - i + 1] * (t[T - i] - t[T - i + 1]);
    }
  }

  return dp[K][T].n;
}

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

  cout << solve() << endl;

  return 0;
}


Fixed submission:
/*
[abc132] F - Small Products
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

const int MAX_R = 1e5;
const int MAX_K = 100;
const int MOD = 1e9 + 7;

class gf {
public:
  int n;
  gf() : n(0) {}
  gf(int n) : n(n % MOD) {}
  gf operator+(const gf x) const { return gf((n + x.n) % MOD); }
  gf operator*(const gf x) const { return gf((1LL * n * x.n) % MOD); }
};

int N, K;
gf dp[MAX_K + 1][MAX_R];
vector<int> t;

ll solve() {
  for (int i = 1; i * i <= N; i++) {
    t.push_back(i);
    if (N / i != i) {
      t.push_back(N / i);
    }
  }
  sort(t.begin(), t.end(), greater<int>());
  int T = t.size();
  t.push_back(0);

  for (int i = 1; i <= T; i++) {
    dp[0][i] = 1;
  }
  for (int k = 1; k <= K; k++) {
    for (int i = 1; i <= T; i++) {
      dp[k][i] =
          dp[k][i - 1] + dp[k - 1][T - i + 1] * (t[T - i] - t[T - i + 1]);
    }
  }

  return dp[K][T].n;
}

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

  cout << solve() << endl;

  return 0;
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  string s;
  cin >> s;
  if (s.at(1) == s.at(2) || s.at(2) == s.at(3) || s.at(3) == s.at(4)) {
    cout << "Bad" << endl;
  } else
    cout << "Good" << endl;
}


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

int main() {
  string s;
  cin >> s;
  if (s.at(0) == s.at(1) || s.at(1) == s.at(2) || s.at(2) == s.at(3)) {
    cout << "Bad" << endl;
  } else
    cout << "Good" << endl;
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {

  string s;
  cin >> s;

  if (s.at(0) == s.at(1) || s.at(1) == s.at(2) || s.at(2) == s.at(23))
    cout << "Bad" << endl;
  else
    cout << "Good" << endl;
}

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

int main() {

  string s;
  cin >> s;

  if (s.at(0) == s.at(1) || s.at(1) == s.at(2) || s.at(2) == s.at(3))
    cout << "Bad" << endl;
  else
    cout << "Good" << endl;
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
  string s;
  cin >> s;
  rep(i, 3) {
    if (s[i - 1] == s[i]) {
      cout << "Bad";
      return 0;
    }
  }
  cout << "Good";
}


Fixed submission:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
  string s;
  cin >> s;
  rep(i, 3) {
    if (s[i] == s[i + 1]) {
      cout << "Bad";
      return 0;
    }
  }
  cout << "Good";
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  string S;
  if (S.at(0) == S.at(1) || S.at(1) == S.at(2) || S.at(2) == S.at(3)) {
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }
}

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

int main() {
  string S;
  cin >> S;
  if (S.at(0) == S.at(1) || S.at(1) == S.at(2) || S.at(2) == S.at(3)) {
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()

int main() {

  string s;
  cin >> s;

  string prev = "A";

  for (int i = 0; i < 4; i++) {
    if (prev[0] == s[i]) {
      cout << "Bad" << endl;
      return 0;
    }
    prev[0] = s[i];
  }

  cout << "Good" << endl;
  return 1;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()

int main() {

  string s;
  cin >> s;

  string prev = "A";

  for (int i = 0; i < 4; i++) {
    if (prev[0] == s[i]) {
      cout << "Bad" << endl;
      return 0;
    }
    prev[0] = s[i];
  }

  cout << "Good" << endl;
  return 0;
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  string S;
  cin >> S;

  if (S.at(0) == S.at(1)) {
    cout << "Bad" << endl;
  }

  else if (S.at(1) == S.at(2)) {
    cout << "Bad" << endl;
  }

  else if (S.at(2) == S.at(3)) {
    cout << "Bad" << endl;
  }

  else if (S.at(3) == S.at(4)) {
    cout << "Bad" << endl;
  }

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

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

int main() {
  string S;
  cin >> S;

  if (S.at(0) == S.at(1)) {
    cout << "Bad" << endl;
  }

  else if (S.at(1) == S.at(2)) {
    cout << "Bad" << endl;
  }

  else if (S.at(2) == S.at(3)) {
    cout << "Bad" << endl;
  }

  else {
    cout << "Good" << endl;
  }
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
/*;

THE BEST IS YET TO COME
*/
#include <bits/stdc++.h>
using namespace std;
#define r(i, s, l) for (int i = s; i < l; i++)
#define rr(i, s, l) for (int i = s; i >= l; i--)
#define mod 1000000007
#define int long long
#define INT_BITS 32
#define ld long double
#define pp pair<int, int>
#define ss second
#define ff first
#define INF 1e18
#define N 2000005
#define all(a) a.begin(), a.end()
#define pb push_back
#define endl "\n"
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}

signed main() {

  int n;
  cin >> n;

  vector<int> c;
  while (n > 0) {
    c.pb(n % 10);
    n = n / 10;
  }

  r(i, 0, c.size() - 1) if (c[i] == c[i + 1]) {
    cout << "Bad";
    return 0;
  }

  cout << "Good";

  return 0;
}


Fixed submission:
/*;

THE BEST IS YET TO COME
*/
#include <bits/stdc++.h>
using namespace std;
#define r(i, s, l) for (int i = s; i < l; i++)
#define rr(i, s, l) for (int i = s; i >= l; i--)
#define mod 1000000007
#define int long long
#define INT_BITS 32
#define ld long double
#define pp pair<int, int>
#define ss second
#define ff first
#define INF 1e18
#define N 2000005
#define all(a) a.begin(), a.end()
#define pb push_back
#define endl "\n"
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}

signed main() {

  string s;
  cin >> s;
  r(i, 0, s.length() - 1) if (s[i] == s[i + 1]) {
    cout << "Bad";
    return 0;
  }

  cout << "Good";

  return 0;
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  string S;
  cin >> S;
  bool A = false;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == S.at(i + 1))
      A = true;
  }
  if (A == true)
    cout << "Bad" << endl;
  else if (A == false)
    cout << "Good" << endl;
}

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

int main() {
  string S;
  cin >> S;
  bool A = false;
  for (int i = 0; i < S.size() - 1; i++) {
    if (S.at(i) == S.at(i + 1))
      A = true;
  }
  if (A == true)
    cout << "Bad" << endl;
  else if (A == false)
    cout << "Good" << endl;
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  string s, answer = "Good";
  cin >> s;
  for (int i = 0; i < 4; ++i) {
    if (s.at(i) == s.at(i + 1)) {
      answer = "Bad";
      break;
    }
  }
  cout << answer << endl;
}


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

int main() {
  string s, answer = "Good";
  cin >> s;
  for (int i = 0; i < 4; ++i) {
    if (s[i] == s[i + 1]) {
      answer = "Bad";
      break;
    }
  }
  cout << answer << endl;
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {

  int num;
  cin >> num;
  if ((num / 10000) > 0)
    return 0;
  string s = to_string(num);
  if (s.at(0) == s.at(1) || s.at(1) == s.at(2) || s.at(2) == s.at(3))
    cout << "Bad" << endl;
  else
    cout << "Good" << endl;
}

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

int main() {

  string s;
  cin >> s;

  if (s.at(0) == s.at(1) || s.at(1) == s.at(2) || s.at(2) == s.at(3))
    cout << "Bad" << endl;
  else
    cout << "Good" << endl;
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  bool a = true;
  for (int i = 0; i < 3; i++) {
    if (s.at(i) == s.at(i + 1)) {
      a = false;
      break;
    }
  }
  if (a) {
    cout << "Good" << endl;
  } else {
    cout << "Bad" << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  bool a = true;
  for (int i = 0; i < 3; i++) {
    if (s.at(i) == s.at(i + 1)) {
      a = false;
      break;
    }
  }
  if (a) {
    cout << "Good" << endl;
  } else {
    cout << "Bad" << endl;
  }
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  string S;
  cin >> S;
  if (S.at(0) != S.at(1) && S.at(1) != S.at(2) && S.at(2) != S.at(3) &&
      S.at(3) != S.at(4)) {
    cout << "Good" << endl;
  } else {
    cout << "Bad" << endl;
  }
}

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

int main() {
  string S;
  cin >> S;
  if (S.at(0) != S.at(1) && S.at(1) != S.at(2) && S.at(2) != S.at(3)) {
    cout << "Good" << endl;
  } else {
    cout << "Bad" << endl;
  }
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm> // sort(ALL())
#include <iomanip>
#include <iostream>
#include <map> // 連想配列 map<string, int>
#include <math.h>
#include <queue> // push(), front(), pop() 先入れ先出し
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, n) for (int i = 1; i <= (n); i++)
#define pb push_back
#define mp make_pair
#define scan(argument) cin >> argument
#define prin(argument) cout << argument << endl
#define kaigyo cout << endl
#define EPS 1e-7
#define ALL(obj) (obj).begin(), (obj).end()
using ul = unsigned long;
using ll = long long;
using ld = long double;
using vint = vector<int>;
using vll = vector<ll>;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using vpint = vector<pint>;
using vpll = vector<pll>;
const int INF = (int)1e9 + 1;
const int MOD = (int)1e9 + 7;
#define INT(argu) (int)(argu + eps)

int x;

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

  string s;
  scan(s);
  //  int n = s.size();
  REP(i, 3) {
    if (s[i] == s[i + 1]) {
      cout << "Bad" << endl;
      exit(1);
    }
  }
  //  vint s(n);
  //  REP(i, n) scan(s[i]);

  cout << "Good" << endl;

  return 0;
}


Fixed submission:
#include <algorithm> // sort(ALL())
#include <iomanip>
#include <iostream>
#include <map> // 連想配列 map<string, int>
#include <math.h>
#include <queue> // push(), front(), pop() 先入れ先出し
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, n) for (int i = 1; i <= (n); i++)
#define pb push_back
#define mp make_pair
#define scan(argument) cin >> argument
#define prin(argument) cout << argument << endl
#define kaigyo cout << endl
#define EPS 1e-7
#define ALL(obj) (obj).begin(), (obj).end()
using ul = unsigned long;
using ll = long long;
using ld = long double;
using vint = vector<int>;
using vll = vector<ll>;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using vpint = vector<pint>;
using vpll = vector<pll>;
const int INF = (int)1e9 + 1;
const int MOD = (int)1e9 + 7;
#define INT(argu) (int)(argu + eps)

int x;

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

  string s;
  scan(s);
  //  int n = s.size();
  REP(i, 3) {
    if (s[i] == s[i + 1]) {
      cout << "Bad" << endl;
      return 0;
    }
  }
  //  vint s(n);
  //  REP(i, n) scan(s[i]);

  cout << "Good" << endl;

  return 0;
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc __builtin_popcountl
#define m_p make_pair
#define inf 200000000000000
#define MAXN 1000001
#define eps 0.0000000001
#define fastio                                                                 \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);
string char_to_str(char c) {
  string tem(1, c);
  return tem;
}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long

/////////////

signed main() {
  fastio;
#ifndef ONLINE_JUDGE
  freopen("inputf.in", "r", stdin);
  freopen("outputf.in", "w", stdout);
#endif
  string s;
  cin >> s;
  if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])

    cout << "Bad";
  else {
    cout << "Good";
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc __builtin_popcountl
#define m_p make_pair
#define inf 200000000000000
#define MAXN 1000001
#define eps 0.0000000001
#define fastio                                                                 \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);
string char_to_str(char c) {
  string tem(1, c);
  return tem;
}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long

/////////////

signed main() {
  fastio;
  string s;
  cin >> s;
  if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])

    cout << "Bad";
  else {
    cout << "Good";
  }
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < 4; i++) {
    if (s.at(i) == s.at(i + 1)) {
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
  return 0;
}


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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < 4; i++) {
    if (s[i] == s[i + 1]) {
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
  return 0;
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  string S;
  cin >> S;
  bool a = true;
  for (int i = 0; i < 4; i++) {
    if (S.at(i) == S.at(i + 1)) {
      a = false;
    }
  }
  if (a) {
    cout << "Good" << endl;
  } else {
    cout << "Bad" << endl;
  }
}

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

int main() {
  string S;
  cin >> S;
  bool a = true;
  for (int i = 0; i < 3; i++) {
    if (S.at(i) == S.at(i + 1)) {
      a = false;
    }
  }
  if (a) {
    cout << "Good" << endl;
  } else {
    cout << "Bad" << endl;
  }
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {

  string s;
  cin >> s;
  int i, c = 0;
  int l = s.size();
  for (i = 0; i < l; i++) {
    if (s.at(i) == s.at(i + 1)) {
      c++;
    }
  }
  if (c == 0) {
    cout << "Good" << endl;
  } else {
    cout << "Bad" << endl;
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {

  string s;
  cin >> s;
  int i, c = 0;
  int l = s.size();
  for (i = 0; i < l - 1; i++) {
    if (s.at(i) == s.at(i + 1)) {
      c++;
    }
  }
  if (c == 0) {
    cout << "Good" << endl;
  } else {
    cout << "Bad" << endl;
  }
}
Problem p02993 (Python)

Buggy submission (status: Runtime Error):
import sys


def input():
    return sys.stdin.readline()[:-1]


def main():
    n = input()
    if n[1] == n[2] or n[2] == n[3] or n[3] == n[4]:
        print("Bad")

    else:
        print("Good")


if __name__ == "__main__":
    main()


Fixed submission:
import sys


def input():
    return sys.stdin.readline()[:-1]


def main():
    n = input()
    if n[1] == n[2] or n[2] == n[3] or n[1] == n[0]:
        print("Bad")

    else:
        print("Good")


if __name__ == "__main__":
    main()
Problem p02993 (Python)

Buggy submission (status: Runtime Error):
s = list(map(int, input().split()))
if s[0] != s[1] and s[1] != s[2] and s[2] != s[3]:
    print("Good")
else:
    print("Bad")


Fixed submission:
s = list(input())
if s[0] != s[1] and s[1] != s[2] and s[2] != s[3]:
    print("Good")
else:
    print("Bad")
Problem p02993 (Python)

Buggy submission (status: Runtime Error):
S = input()
if S[1] == S[2] or S[2] == S[3] or S[3] == S[4]:
    print("Bad")
else:
    print("Good")


Fixed submission:
S = input()
if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print("Bad")
else:
    print("Good")
Problem p02993 (Python)

Buggy submission (status: Runtime Error):
import sys

fin = sys.stdin.readline
num = str(int(fin()))

readable = True
prev_num = num[0]
for i in range(1, 4):
    cur_num = num[i]
    if prev_num == cur_num:
        readable = False
    prev_num = cur_num

if readable:
    print("Good")
else:
    print("Bad")


Fixed submission:
import sys

fin = sys.stdin.readline
num = str(fin()).split()[0]

readable = True
prev_num = num[0]
for i in range(1, 4):
    cur_num = num[i]
    if prev_num == cur_num:
        readable = False
    prev_num = cur_num

if readable:
    print("Good")
else:
    print("Bad")
Problem p02993 (Python)

Buggy submission (status: Runtime Error):
s = int(input())

ans = "Good"

s_temp = 99

for num in s:
    if int(num) == s_temp:
        ans = "Bad"
        break
    else:
        s_temp = int(num)

print(ans)


Fixed submission:
s = input()

ans = "Good"

s_temp = 99

for num in s:
    if int(num) == s_temp:
        ans = "Bad"
        break
    else:
        s_temp = int(num)

print(ans)
Problem p02993 (Python)

Buggy submission (status: Runtime Error):
cord = list(input())
cord_len = len(cord)
for i in range(cord - 1):
    if cord[i] == cord[i + 1]:
        print("Bad")
        break
else:
    print("Good")


Fixed submission:
cord = list(input())
cord_len = len(cord)
for i in range(cord_len - 1):
    if cord[i] == cord[i + 1]:
        print("Bad")
        break
else:
    print("Good")
Problem p02993 (Python)

Buggy submission (status: Runtime Error):
s = list(input())

if s[0] == s[1] or s[1] == s[2] or s[2] == s[3] or s[3] == s[4]:
    print("Bad")
else:
    print("Good")


Fixed submission:
s = list(input())

if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print("Bad")
else:
    print("Good")
Problem p02993 (Python)

Buggy submission (status: Runtime Error):
s = str(int(input()))
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print("Bad")
else:
    print("Good")


Fixed submission:
s = str(input())
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print("Bad")
else:
    print("Good")
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  string A;
  cin >> A;

  bool flag = true;
  for (int i = 0; i < 4; i++) {
    if (A.at(i) == A.at(i + 1)) {
      cout << "Bad" << endl;
      flag = false;
      break;
    }
  }
  if (flag)
    cout << "Good" << endl;
}

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

int main() {
  string A;
  cin >> A;

  bool flag = true;
  for (int i = 0; i < 3; i++) {
    if (A.at(i) == A.at(i + 1)) {
      cout << "Bad" << endl;
      flag = false;
      break;
    }
  }
  if (flag)
    cout << "Good" << endl;
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  vector<char> a(4);
  for (int i = 0; i < 4; i++)
    cin >> a.at(i);

  if (a.at(0) == a.at(1))
    cout << "Bad";
  else if (a.at(1) == a.at(2))
    cout << "Bad";
  else if (a.at(2) == a.at(3))
    cout << "Bad";
  else if (a.at(3) == a.at(4))
    cout << "Bad";
  else
    cout << "Good";
}

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

int main() {
  vector<char> a(4);
  for (int i = 0; i < 4; i++)
    cin >> a.at(i);

  if (a.at(0) == a.at(1))
    cout << "Bad";
  else if (a.at(1) == a.at(2))
    cout << "Bad";
  else if (a.at(2) == a.at(3))
    cout << "Bad";
  else
    cout << "Good";
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  //
  string str;

  if (str.at(0) == str.at(1))
    cout << "Bad";
  else if (str.at(1) == str.at(2))
    cout << "Bad";
  else if (str.at(2) == str.at(3))
    cout << "Bad";
  else
    cout << "Good";
  //
}


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

int main() {
  //
  string str;
  cin >> str;
  if (str.at(0) == str.at(1))
    cout << "Bad";
  else if (str.at(1) == str.at(2))
    cout << "Bad";
  else if (str.at(2) == str.at(3))
    cout << "Bad";
  else
    cout << "Good";
  //
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
#include <string>
using namespace std;

#define Fp(I, STAT, END) for (int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for (int I = STAT; I > END; I--)

int main() {
  string S;
  cin >> S;
  Fp(i, 0, 3) {
    if (S[i] == S[i + 1]) {
      cout << "Bad" << endl;
      return 1;
    }
  }
  cout << "Good" << endl;
}


Fixed submission:
#include <iostream>
#include <stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
#include <string>
using namespace std;

#define Fp(I, STAT, END) for (int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for (int I = STAT; I > END; I--)

int main() {
  string S;
  cin >> S;
  Fp(i, 0, 3) {
    if (S[i] == S[i + 1]) {
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unrolled-loops")

using namespace std;

#define inp "TestCode.inp"
#define out "TestCode.out"
#define FAST                                                                   \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define FileInOut                                                              \
  freopen(inp, "r", stdin);                                                    \
  freopen(out, "w", stdout);
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define pi acos(-1)
#define pii pair<int, int>
#define ppiii pair<pair<int, int>, int>
#define INF 1000000
#define endl '\n'
#define ll long long
#define pq priority_queue
const int mod = 1e9 + 7;
int test = 1;
/*-----------------------------------------------*/
void nathan_on_osu(){FAST
#ifndef ONLINE_JUDGE
                         FileInOut
#endif // ONLINE_JUDGE
} /*-----------------------------------------------*/

string s;

int main() {
  nathan_on_osu();
  cin >> s;
  for (int i = 0; i <= 2; i++) {
    if (s[i] == s[i + 1]) {
      cout << "Bad";
      return 0;
    }
  }
  cout << "Good";
}


Fixed submission:
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unrolled-loops")

using namespace std;

#define inp "TestCode.inp"
#define out "TestCode.out"
#define FAST                                                                   \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define FileInOut                                                              \
  freopen(inp, "r", stdin);                                                    \
  freopen(out, "w", stdout);
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define pi acos(-1)
#define pii pair<int, int>
#define ppiii pair<pair<int, int>, int>
#define INF 1000000
#define endl '\n'
#define ll long long
#define pq priority_queue
const int mod = 1e9 + 7;
int test = 1;
/*-----------------------------------------------*/
void nathan_on_osu(){FAST
#ifndef ONLINE_JUDGE
// FileInOut
#endif // ONLINE_JUDGE
} /*-----------------------------------------------*/

string s;

int main() {
  nathan_on_osu();
  cin >> s;
  for (int i = 0; i <= 2; i++) {
    if (s[i] == s[i + 1]) {
      cout << "Bad";
      return 0;
    }
  }
  cout << "Good";
}
Problem p02993 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  string s;
  cin >> s;
  if (s.at(1) == s.at(2)) {
    cout << "Bad" << endl;
  } else if (s.at(2) == s.at(3)) {
    cout << "Bad" << endl;
  } else if (s.at(3) == s.at(4)) {
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }
}

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

int main() {
  string s;
  cin >> s;
  if (s.at(1) == s.at(2)) {
    cout << "Bad" << endl;
  } else if (s.at(2) == s.at(3)) {
    cout << "Bad" << endl;
  } else if (s.at(0) == s.at(1)) {
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }
}
Problem p02993 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>

int main() {
  int S = 0;
  while (S < 1000 || S > 9999)
    scanf("%d", &S);

  if (S / 1000 % 10 == S / 100 % 10 || S / 100 % 10 == S / 10 % 10 ||
      S / 10 % 10 == S % 10)
    printf("Bad");
  else
    printf("Good");

  return 0;
}

Fixed submission:
#include <stdio.h>

int main() {
  int S = 0;
  for (;;)
    if (S < 10000 || S > 999)
      break;
  scanf("%d", &S);

  if (S / 1000 % 10 == S / 100 % 10 || S / 100 % 10 == S / 10 % 10 ||
      S / 10 % 10 == S % 10)
    printf("Bad");
  else
    printf("Good");

  return 0;
}
Problem p02993 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define pans cout << ans << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
  string s;
  cin >> s;
  bool flag = false;
  for (int i = 0; i < 3; i++) {
    if (s[i] == s[i + 1]) {
      flag = true;
    }
  }
  int a = 0;
  for (int i = 0; i < 10000000000; i++) {
    a += 1;
  }
  if (flag) {
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define pans cout << ans << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
  string s;
  cin >> s;
  bool flag = false;
  for (int i = 0; i < 3; i++) {
    if (s[i] == s[i + 1]) {
      flag = true;
    }
  }
  int a = 0;
  for (int i = 0; i < 1000000000; i++) {
    a += 1;
  }
  if (flag) {
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }

  return 0;
}