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

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

static const int MOD = 998244353;

long long Inv(long long a) {
  long long res = 1;
  long long n = MOD - 2;
  while (n > 0) {
    if (n & 1)
      res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}
const int N = 505050;
long long fact[N];
long long invfact[N];
void init() {
  fact[0] = 1;
  for (int i = 1; i < N; i++)
    fact[i] = (fact[i - 1] * i) % MOD;
  invfact[N - 1] = Inv(fact[N - 1]);
  for (int i = N - 2; i >= 0; i--)
    invfact[i] = (invfact[i + 1] * (i + 1)) % MOD;
}
long long C(long long n, long long r) {
  if (n < 0 || r < 0 || n < r)
    return 0;
  return fact[n] * invfact[n - r] % MOD * invfact[r] % MOD;
}

int main() {
  init();
  int n, m;
  scanf("%d%d", &n, &m);
  if (n < m)
    swap(n, m);
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    long long mul = C(2 * i, i) % MOD;
    mul = mul * C(n + m - 2 * i, n - i) % MOD;
    ans = (ans + mul) % MOD;
  }
  ans = ans * Inv(2 * C(n + m, n)) % MOD;
  ans = (ans + n) % MOD;
  printf("%lld\n", ans);
  return 0;
}


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

static const int MOD = 998244353;

long long Inv(long long a) {
  long long res = 1;
  long long n = MOD - 2;
  while (n > 0) {
    if (n & 1)
      res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}
const int N = 1010101;
long long fact[N];
long long invfact[N];
void init() {
  fact[0] = 1;
  for (int i = 1; i < N; i++)
    fact[i] = (fact[i - 1] * i) % MOD;
  invfact[N - 1] = Inv(fact[N - 1]);
  for (int i = N - 2; i >= 0; i--)
    invfact[i] = (invfact[i + 1] * (i + 1)) % MOD;
}
long long C(long long n, long long r) {
  if (n < 0 || r < 0 || n < r)
    return 0;
  return fact[n] * invfact[n - r] % MOD * invfact[r] % MOD;
}

int main() {
  init();
  int n, m;
  scanf("%d%d", &n, &m);
  if (n < m)
    swap(n, m);
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    long long mul = C(2 * i, i) % MOD;
    mul = mul * C(n + m - 2 * i, n - i) % MOD;
    ans = (ans + mul) % MOD;
  }
  ans = ans * Inv(2 * C(n + m, n)) % MOD;
  ans = (ans + n) % MOD;
  printf("%lld\n", ans);
  return 0;
}
Problem p03622 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
int n, m;
const int md = 998244353, MX = 500011;
typedef long long LL;

int fac[MX], inv[MX], facinv[MX];
inline int Inv(int x) {
  return x <= 1 ? x : (LL)(md - md / x) * Inv(md % x) % md;
}
int main() {
  scanf("%d%d", &n, &m);
  if (n < m)
    swap(n, m);
  fac[0] = facinv[0] = 1;
  for (int i = 1; i <= n << 1; i++)
    fac[i] = (LL)fac[i - 1] * i % md;
  inv[1] = 1;
  for (int i = 2; i <= n << 1; i++)
    inv[i] = (LL)(md - md / i) * inv[md % i] % md;
  for (int i = 1; i <= n << 1; i++)
    facinv[i] = (LL)facinv[i - 1] * inv[i] % md;
#define C(x, y) ((LL)fac[x] * facinv[y] % md * facinv[(x) - (y)] % md)
  int ans = n, s = 0;
  for (int i = 1; i <= m; i++)
    s = ((LL)s + (LL)C(2 * i, i) * C(n + m - 2 * i, n - i) % md) % md;
  ans = ((LL)ans + (LL)s * Inv(C(n + m, n) * 2 % md) % md) % md;
  printf("%d\n", ans);
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
int n, m;
const int md = 998244353, MX = 1000011;
typedef long long LL;

int fac[MX], inv[MX], facinv[MX];
inline int Inv(int x) {
  return x <= 1 ? x : (LL)(md - md / x) * Inv(md % x) % md;
}
int main() {
  scanf("%d%d", &n, &m);
  if (n < m)
    swap(n, m);
  fac[0] = facinv[0] = 1;
  for (int i = 1; i <= n << 1; i++)
    fac[i] = (LL)fac[i - 1] * i % md;
  inv[1] = 1;
  for (int i = 2; i <= n << 1; i++)
    inv[i] = (LL)(md - md / i) * inv[md % i] % md;
  for (int i = 1; i <= n << 1; i++)
    facinv[i] = (LL)facinv[i - 1] * inv[i] % md;
#define C(x, y) ((LL)fac[x] * facinv[y] % md * facinv[(x) - (y)] % md)
  int ans = n, s = 0;
  for (int i = 1; i <= m; i++)
    s = ((LL)s + (LL)C(2 * i, i) * C(n + m - 2 * i, n - i) % md) % md;
  ans = ((LL)ans + (LL)s * Inv(C(n + m, n) * 2 % md) % md) % md;
  printf("%d\n", ans);
  return 0;
}
Problem p03622 (C++)

Buggy submission (status: Runtime Error):
// Written By NewbieChd
#include <algorithm>
#include <cstdio>
using namespace std;

const int maxN = 2000003, mod = 998244353, inv2 = 499122177;
int fac[maxN], invFac[maxN];
inline int power(int x, int y) {
  int o = 1;
  while (y) {
    if (y & 1)
      o = 1ll * o * x % mod;
    x = 1ll * x * x % mod, y >>= 1;
  }
  return o;
}
inline int binom(int n, int m) {
  return 1ll * fac[n + m] * invFac[n] % mod * invFac[m] % mod;
}

int main() {
  int n, m, lim, i, ans = 0;
  scanf("%d%d%d", &i, &n, &m), lim = n + m;
  if (n < m)
    swap(n, m);

  fac[0] = 1;
  for (i = 1; i <= lim; ++i)
    fac[i] = 1ll * fac[i - 1] * i % mod;
  invFac[lim] = power(fac[lim], mod - 2);
  for (i = lim; i; --i)
    invFac[i - 1] = 1ll * invFac[i] * i % mod;

  for (i = 1; i <= m; ++i)
    ans = (1ll * binom(n - i, m - i) * binom(i, i) % mod + ans) % mod;
  ans = (1ll * inv2 * power(binom(n, m), mod - 2) % mod * ans + n) % mod;

  printf("%d\n", ans);
  return 0;
}


Fixed submission:
// Written By NewbieChd
#include <algorithm>
#include <cstdio>
using namespace std;

const int maxN = 2000003, mod = 998244353, inv2 = 499122177;
int fac[maxN], invFac[maxN];
inline int power(int x, int y) {
  int o = 1;
  while (y) {
    if (y & 1)
      o = 1ll * o * x % mod;
    x = 1ll * x * x % mod, y >>= 1;
  }
  return o;
}
inline int binom(int n, int m) {
  return 1ll * fac[n + m] * invFac[n] % mod * invFac[m] % mod;
}

int main() {
  int n, m, lim, i, ans = 0;
  scanf("%d%d", &n, &m), lim = n + m;
  if (n < m)
    swap(n, m);

  fac[0] = 1;
  for (i = 1; i <= lim; ++i)
    fac[i] = 1ll * fac[i - 1] * i % mod;
  invFac[lim] = power(fac[lim], mod - 2);
  for (i = lim; i; --i)
    invFac[i - 1] = 1ll * invFac[i] * i % mod;

  for (i = 1; i <= m; ++i)
    ans = (1ll * binom(n - i, m - i) * binom(i, i) % mod + ans) % mod;
  ans = (1ll * inv2 * power(binom(n, m), mod - 2) % mod * ans + n) % mod;

  printf("%d\n", ans);
  return 0;
}
Problem p03622 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>
typedef long long LL;
const int N = 5e5 + 5, md = 998244353, iv2 = (md + 1) / 2;
int fac[N], iv[N], n, m, ans;
inline int pow(int a, int b) {
  int ret = 1;
  for (; b; b >>= 1, a = (LL)a * a % md)
    if (b & 1)
      ret = (LL)ret * a % md;
  return ret;
}
inline int C(int n, int m) { return (LL)fac[n] * iv[m] % md * iv[n - m] % md; }
inline int iC(int n, int m) {
  return (LL)iv[n] * fac[m] % md * fac[n - m] % md;
}
int main() {
  scanf("%d%d", &n, &m);
  if (n < m)
    n ^= m ^= n ^= m;
  for (int i = *fac = 1; i <= n + m; ++i)
    fac[i] = (LL)fac[i - 1] * i % md;
  iv[n + m] = pow(fac[n + m], md - 2);
  for (int i = n + m - 1; ~i; --i)
    iv[i] = (i + 1LL) * iv[i + 1] % md;
  for (int i = 1; i <= m; ++i)
    ans = (ans + (LL)C(i + i, i) * C(n + m - 2 * i, n - i)) % md;
  ans = (ans * (LL)iv2 % md * iC(n + m, n) + n) % md;
  printf("%d\n", ans);
  return 0;
}

Fixed submission:
#include <cstdio>
typedef long long LL;
const int N = 1e6 + 5, md = 998244353, iv2 = (md + 1) / 2;
int fac[N], iv[N], n, m, ans;
inline int pow(int a, int b) {
  int ret = 1;
  for (; b; b >>= 1, a = (LL)a * a % md)
    if (b & 1)
      ret = (LL)ret * a % md;
  return ret;
}
inline int C(int n, int m) { return (LL)fac[n] * iv[m] % md * iv[n - m] % md; }
inline int iC(int n, int m) {
  return (LL)iv[n] * fac[m] % md * fac[n - m] % md;
}
int main() {
  scanf("%d%d", &n, &m);
  if (n < m)
    n ^= m ^= n ^= m;
  for (int i = *fac = 1; i <= n + m; ++i)
    fac[i] = (LL)fac[i - 1] * i % md;
  iv[n + m] = pow(fac[n + m], md - 2);
  for (int i = n + m - 1; ~i; --i)
    iv[i] = (i + 1LL) * iv[i + 1] % md;
  for (int i = 1; i <= m; ++i)
    ans = (ans + (LL)C(i + i, i) * C(n + m - 2 * i, n - i)) % md;
  ans = (ans * (LL)iv2 % md * iC(n + m, n) + n) % md;
  printf("%d\n", ans);
  return 0;
}
Problem p03622 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>
#include <cstring>

using namespace std;

const int mo = 998244353, N = 500005;

typedef long long LL;

int n, m, ans, Fac[N], Inv[N], FInv[N];

int C(int n, int m) { return (LL)Fac[n] * FInv[m] % mo * FInv[n - m] % mo; }

int main() {
  scanf("%d%d", &n, &m);
  if (n > m)
    swap(n, m);
  Fac[0] = FInv[0] = Fac[1] = Inv[1] = FInv[1] = 1;
  for (int i = 2; i <= m + n; i++) {
    Fac[i] = (LL)Fac[i - 1] * i % mo;
    Inv[i] = (LL)Inv[mo % i] * (mo - mo / i) % mo;
    FInv[i] = (LL)FInv[i - 1] * Inv[i] % mo;
  }
  for (int i = 1; i <= n; i++)
    ans = (ans + (LL)C(i + i, i) % mo * C(n + m - i - i, n - i)) % mo;
  ans = (LL)ans * Inv[2] % mo * Fac[n] % mo * Fac[m] % mo * FInv[n + m] % mo;
  ans = (ans + m) % mo;
  printf("%d\n", ans);
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cstdio>
#include <cstring>

using namespace std;

const int mo = 998244353, N = 1000005;

typedef long long LL;

int n, m, ans, Fac[N], Inv[N], FInv[N];

int C(int n, int m) { return (LL)Fac[n] * FInv[m] % mo * FInv[n - m] % mo; }

int main() {
  scanf("%d%d", &n, &m);
  if (n > m)
    swap(n, m);
  Fac[0] = FInv[0] = Fac[1] = Inv[1] = FInv[1] = 1;
  for (int i = 2; i <= m + n; i++) {
    Fac[i] = (LL)Fac[i - 1] * i % mo;
    Inv[i] = (LL)Inv[mo % i] * (mo - mo / i) % mo;
    FInv[i] = (LL)FInv[i - 1] * Inv[i] % mo;
  }
  for (int i = 1; i <= n; i++)
    ans = (ans + (LL)C(i + i, i) % mo * C(n + m - i - i, n - i)) % mo;
  ans = (LL)ans * Inv[2] % mo * Fac[n] % mo * Fac[m] % mo * FInv[n + m] % mo;
  ans = (ans + m) % mo;
  printf("%d\n", ans);
  return 0;
}
Problem p03622 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
ll n, m, ny[510000], jc[510000];
ll c(ll n, ll m) { return (ll)jc[n] * ny[m] % mod * ny[n - m] % mod; }

int main() {
  cin >> n >> m;
  if (n <= m)
    swap(n, m);
  jc[0] = jc[1] = ny[0] = ny[1] = 1;
  for (int i = 2; i <= n + m; i++)
    jc[i] = (ll)jc[i - 1] * i % mod,
    ny[i] = (ll)(mod - mod / i) * ny[mod % i] % mod;
  for (int i = 2; i <= n + m; i++)
    ny[i] = (ll)ny[i - 1] * ny[i] % mod;
  ll ans = 0;
  for (int i = 1; i <= m; i++) {
    ans += (ll)c(n + m - i * 2, n - i) % mod * c(i * 2, i) % mod;
    ans %= mod;
  }
  ans = (ll)ans * ny[n + m] % mod * jc[n] % mod * jc[m] % mod * ny[2] % mod;
  ans += n;
  ans %= mod;

  cout << ans << endl;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
ll n, m, ny[1100000], jc[1100000];
ll c(ll n, ll m) { return (ll)jc[n] * ny[m] % mod * ny[n - m] % mod; }

int main() {
  cin >> n >> m;
  if (n <= m)
    swap(n, m);
  jc[0] = jc[1] = ny[0] = ny[1] = 1;
  for (int i = 2; i <= n + m; i++)
    jc[i] = (ll)jc[i - 1] * i % mod,
    ny[i] = (ll)(mod - mod / i) * ny[mod % i] % mod;
  for (int i = 2; i <= n + m; i++)
    ny[i] = (ll)ny[i - 1] * ny[i] % mod;
  ll ans = 0;
  for (int i = 1; i <= m; i++) {
    ans += (ll)c(n + m - i * 2, n - i) % mod * c(i * 2, i) % mod;
    ans %= mod;
  }
  ans = (ll)ans * ny[n + m] % mod * jc[n] % mod * jc[m] % mod * ny[2] % mod;
  ans += n;
  ans %= mod;

  cout << ans << endl;
}
Problem p03622 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>

#define fo(i, j, l) for (int i = j; i <= l; ++i)
#define fd(i, j, l) for (int i = j; i >= l; --i)

using namespace std;
typedef long long ll;
const ll N = 22e4, mo = 998244353;

ll jc[N], ny[N];
int n, m, k;

inline ll ksm(ll o, ll t) {
  ll y = 1;
  for (; t; t >>= 1, o = o * o % mo)
    if (t & 1)
      y = y * o % mo;
  return y;
}

inline ll C(ll a, ll b) { return jc[a] * ny[b] % mo * ny[a - b] % mo; }

int main() {
  cin >> n >> m;
  if (n < m)
    swap(n, m);
  k = n << 1;
  jc[0] = ny[0] = 1;
  fo(i, 1, k) jc[i] = jc[i - 1] * i % mo;
  ny[k] = ksm(jc[k], mo - 2);
  fd(i, k - 1, 1) ny[i] = ny[i + 1] * (i + 1) % mo;
  ll ans = 0;
  for (int h = 0, z = n - m; h < m; ++h, ++z)
    ans = (ans + C(h + z, z) * C(n + m - h - z, m - h)) % mo;
  ans = ans * ny[2] % mo;
  ll zg = C(n + m, m);
  ans = ans * ksm(zg, mo - 2) % mo;
  ans = (ans + n) % mo;
  cout << ans;
}

Fixed submission:
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>

#define fo(i, j, l) for (int i = j; i <= l; ++i)
#define fd(i, j, l) for (int i = j; i >= l; --i)

using namespace std;
typedef long long ll;
const ll N = 12e5, mo = 998244353;

ll jc[N], ny[N];
int n, m, k;

inline ll ksm(ll o, ll t) {
  ll y = 1;
  for (; t; t >>= 1, o = o * o % mo)
    if (t & 1)
      y = y * o % mo;
  return y;
}

inline ll C(ll a, ll b) { return jc[a] * ny[b] % mo * ny[a - b] % mo; }

int main() {
  cin >> n >> m;
  if (n < m)
    swap(n, m);
  k = n << 1;
  jc[0] = ny[0] = 1;
  fo(i, 1, k) jc[i] = jc[i - 1] * i % mo;
  ny[k] = ksm(jc[k], mo - 2);
  fd(i, k - 1, 1) ny[i] = ny[i + 1] * (i + 1) % mo;
  ll ans = 0;
  for (int h = 0, z = n - m; h < m; ++h, ++z)
    ans = (ans + C(h + z, z) * C(n + m - h - z, m - h)) % mo;
  ans = ans * ny[2] % mo;
  ll zg = C(n + m, m);
  ans = ans * ksm(zg, mo - 2) % mo;
  ans = (ans + n) % mo;
  cout << ans;
}
Problem p03622 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>
typedef long long int64;
using namespace std;
inline int read(int f = 1, int x = 0, char ch = ' ') {
  while (!isdigit(ch = getchar()))
    if (ch == '-')
      f = -1;
  while (isdigit(ch))
    x = x * 10 + ch - '0', ch = getchar();
  return f * x;
}
const int N = 2e5 + 5, P = 998244353;
int n, m;
int64 fac[N], ifac[N], ans;
int64 inv(int i) { return i == 1 ? 1 : P - (P / i) * inv(P % i) % P; }
int64 C(int n, int m) { return fac[n] * ifac[m] % P * ifac[n - m] % P; }
int main() {
  n = read(), m = read(), fac[0] = 1;
  for (int i = 1; i <= n + m; ++i)
    fac[i] = fac[i - 1] * i % P;
  ifac[n + m] = inv(fac[n + m]);
  for (int i = n + m; i; --i)
    ifac[i - 1] = ifac[i] * i % P;
  for (int i = min(n, m); i; --i)
    ans = (ans + C(n + m - (i << 1), n - i) * C(i << 1, i) % P) % P;
  ans = (ans * inv(C(n + m, n)) % P * inv(2) % P + max(n, m)) % P;
  printf("%lld\n", ans);
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>
typedef long long int64;
using namespace std;
inline int read(int f = 1, int x = 0, char ch = ' ') {
  while (!isdigit(ch = getchar()))
    if (ch == '-')
      f = -1;
  while (isdigit(ch))
    x = x * 10 + ch - '0', ch = getchar();
  return f * x;
}
const int N = 1e6 + 5, P = 998244353;
int n, m;
int64 fac[N], ifac[N], ans;
int64 inv(int i) { return i == 1 ? 1 : P - (P / i) * inv(P % i) % P; }
int64 C(int n, int m) { return fac[n] * ifac[m] % P * ifac[n - m] % P; }
int main() {
  n = read(), m = read(), fac[0] = 1;
  for (int i = 1; i <= n + m; ++i)
    fac[i] = fac[i - 1] * i % P;
  ifac[n + m] = inv(fac[n + m]);
  for (int i = n + m; i; --i)
    ifac[i - 1] = ifac[i] * i % P;
  for (int i = min(n, m); i; --i)
    ans = (ans + C(n + m - (i << 1), n - i) * C(i << 1, i) % P) % P;
  ans = (ans * inv(C(n + m, n)) % P * inv(2) % P + max(n, m)) % P;
  printf("%lld\n", ans);
  return 0;
}
Problem p03623 (C++)

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

int main(void) {
  string s;
  cin >> s;
  vector<bool> bucket(26, false);

  for (int i = 0; i < s.size(); i++) {
    bucket.at((int)(s.at(i) - 'a')) = true;
  }

  for (int i = 0; i < bucket.size(); i++) {
    if (!bucket.at(i)) {
      cout << (char)('a' + i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}

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

int main(void) {
  int x, a, b;
  cin >> x >> a >> b;
  if (abs(x - a) < abs(x - b))
    cout << 'A' << endl;
  else
    cout << 'B' << endl;
}
Problem p03623 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <strstream>
using namespace std;
int main() {
  int x, a, b;
  scanf("%d%d%d,&x,&a,&b");
  a = fabs(a - x);
  b = fabs(b - x);
  if (a > b)
    printf("B\n");
  else
    printf("A\n");
}

Fixed submission:
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <strstream>
using namespace std;
int main() {
  int x, a, b;
  scanf("%d%d%d", &x, &a, &b);
  a = fabs(a - x);
  b = fabs(b - x);
  if (a > b)
    printf("B\n");
  else
    printf("A\n");
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {

  char str[0xFFFF];
  bool exist[26];

  scanf("%s", str);
  int length = strlen(str);
  for (int L10 = 0; L10 < 26; L10++) {
    exist[L10] = false;
  }

  for (int L10 = 0; L10 < length; L10++) {
    exist[(str[L10] - 'a')] = true;
  }

  for (int L10 = 0; L10 < 26; L10++) {
    if (exist[L10])
      continue;
    char result[2];
    result[0] = L10 + 'a';
    result[1] = '\0';

    printf(result);
    return 0;
  }
  printf("None");
  return 0;
}

Fixed submission:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {

  char str[100001];
  bool exist[26];

  scanf("%s", str);
  int length = strlen(str);
  for (int L10 = 0; L10 < 26; L10++) {
    exist[L10] = false;
  }

  for (int L10 = 0; L10 < length; L10++) {
    exist[(str[L10] - 'a')] = true;
  }

  for (int L10 = 0; L10 < 26; L10++) {
    if (exist[L10])
      continue;
    char result[2];
    result[0] = L10 + 'a';
    result[1] = '\0';

    printf(result);
    return 0;
  }
  printf("None");
  return 0;
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int N = S.size();
  char ans = 'A';
  for (char i = 'a'; i <= 'z'; i++) {
    bool x = true;
    for (int j = 0; i < N; j++) {
      if (i == S.at(j)) {
        x = false;
        break;
      }
    }
    if (x) {
      ans = i;
      break;
    }
  }
  if (ans == 'A')
    cout << "None" << endl;
  else
    cout << ans << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int N = S.size();
  char ans = 'A';
  for (char i = 'a'; i <= 'z'; i++) {
    bool x = true;
    for (int j = 0; j < N; j++) {
      if (i == S.at(j)) {
        x = false;
        break;
      }
    }
    if (x) {
      ans = i;
      break;
    }
  }
  if (ans == 'A')
    cout << "None" << endl;
  else
    cout << ans << endl;
  return 0;
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main() {
  char s[101000];
  cin >> s;
  bool a[26] = {false};
  for (int i = 0; s[i] != '\n'; i++)
    a[s[i] - 'a'] = true;
  for (int i = 0; i < 26; i++) {
    if (!a[i]) {
      cout << (char)(i + 'a') << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main() {
  char s[101000];
  cin >> s;
  bool a[26] = {false};
  for (int i = 0; s[i] != '\0'; i++)
    a[s[i] - 'a'] = true;
  for (int i = 0; i < 26; i++) {
    if (!a[i]) {
      cout << (char)(i + 'a') << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}
Problem p03624 (C++)

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

using namespace std;

int main() {
  char str[1000];

  int flag[27] = {0};

  cin >> str;

  int len = strlen(str);

  for (int i = 0; i < len; i++) {
    flag[str[i] - 'a'] = 1;
  }
  int n = 0;
  for (int i = 0; i < 26; i++) {
    if (flag[i] == 0) {
      n = 1;
      printf("%c\n", i + 'a');
      return 0;
    }
  }
  if (n == 0) {
    cout << "None" << endl;
  }
  return 0;
}


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

using namespace std;

int main() {
  char str[100005];

  int flag[27] = {0};

  cin >> str;

  int len = strlen(str);

  for (int i = 0; i < len; i++) {
    flag[str[i] - 'a'] = 1;
  }
  int n = 0;
  for (int i = 0; i < 26; i++) {
    if (flag[i] == 0) {
      n = 1;
      printf("%c\n", i + 'a');
      return 0;
    }
  }
  if (n == 0) {
    cout << "None" << endl;
  }
  return 0;
}
Problem p03624 (C++)

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

int main(void) {
  string s;
  cin >> s;
  vector<bool> bucket(26, false);

  for (int i = 0; i < s.size(); i++) {
    bucket.at((int)(s.at(i) - 'a')) = true;
  }

  for (int i = 0; i < s.size(); i++) {
    if (!bucket.at(i)) {
      cout << (char)('a' + i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}

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

int main(void) {
  string s;
  cin >> s;
  vector<bool> bucket(26, false);

  for (int i = 0; i < s.size(); i++) {
    bucket.at((int)(s.at(i) - 'a')) = true;
  }

  for (int i = 0; i < bucket.size(); i++) {
    if (!bucket.at(i)) {
      cout << (char)('a' + i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}
Problem p03624 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int maxn = 1e5 + 10;
int flag[maxn];
char s[maxn];
char a[maxn] = "abcdefghijklmnopqrstuvwxyz";
int main() {
  scanf("%s", &s);
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j <= strlen(s); j++) {
      if (a[i] == s[j]) {
        flag[i] = 1;
        break;
      }
    }
  }
  for (int i = 0; i < 26; i++) {
    if (flag[i] == 0) {
      printf("%c\n", a[i]);
      return 0;
    }
    if (i == 25)
      cout << "None" << endl;
  }
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int maxn = 1e5 + 10;
int flag[maxn];
char s[maxn];
char a[maxn] = "abcdefghijklmnopqrstuvwxyz";
int main() {
  scanf("%s", &s);
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < strlen(s); j++) {
      if (a[i] == s[j]) {
        flag[i] = 1;
        break;
      }
    }
  }
  for (int i = 0; i < 26; i++) {
    if (flag[i] == 0) {
      printf("%c\n", a[i]);
      return 0;
    }
    if (i == 25)
      cout << "None" << endl;
  }
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <vector>
using namespace std;

int main() {
  string S;
  cin >> S;
  vector<int> alphabet(26);
  for (int i = 0; i < (int)S.size(); i++) {
    alphabet.at(S.at(i) - 'a')++;
  }

  for (int i = 0; i < (int)S.size(); i++) {
    if (alphabet.at(i) == 0) {
      cout << (char)('a' + i) << endl;
      return 0;
    }
  }

  cout << "None" << endl;
}


Fixed submission:
#include <iostream>
#include <vector>
using namespace std;

int main() {
  string S;
  cin >> S;
  vector<int> alphabet(26);
  for (int i = 0; i < (int)S.size(); i++) {
    alphabet.at(S.at(i) - 'a')++;
  }

  for (int i = 0; i < 26; i++) {
    if (alphabet.at(i) == 0) {
      cout << (char)('a' + i) << endl;
      return 0;
    }
  }

  cout << "None" << endl;
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>
#include <string.h>
char s[10086];
bool a[30];
int main() {
  scanf("%s", &s);
  for (int i = 0; i < strlen(s); i++)
    a[s[i] - 'a'] = 1;
  for (int i = 0; i < 26; i++)
    if (!a[i]) {
      printf("%c\n", i + 'a');
      return 0;
    }
  puts("None");
}

Fixed submission:
#include <cstdio>
#include <string.h>
char s[100860];
bool a[30];
int main() {
  scanf("%s", &s);
  for (int i = 0; i < strlen(s); i++)
    a[s[i] - 'a'] = 1;
  for (int i = 0; i < 26; i++)
    if (!a[i]) {
      printf("%c\n", i + 'a');
      return 0;
    }
  puts("None");
}
Problem p03624 (C++)

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

int main() {
  char buf[9];
  char *str;
  int length = 8;

  fgets(buf, 9, stdin);
  str = (char *)malloc(sizeof(char) * length);
  memcpy(str, buf, 8);
  int cpypos = 0;
  while (strlen(buf) >= 8) {
    fgets(buf, 9, stdin);
    cpypos += 8;
    if (cpypos + 8 > length) {
      length *= 2;
      str = (char *)realloc(str, sizeof(char) * length);
    }
    memcpy((str + cpypos), buf, 8);
  }

  int flag;
  char test = 'a';
  int i;
  for (i = 0; i < 26; i++) {
    flag = 0;
    int j;
    for (j = 0; j < length; j++) {
      char chr = str[j];
      if (chr == 0x0d || chr == 0x0a || chr == 0x1a || chr == 0xff ||
          chr == 0x00)
        break;
      // printf("0x%02X ", str[j] & 0x000000ff);
      if (chr == test) {
        flag = 1;
      }
    }
    if (flag == 0) {
      putchar(test);
      break;
    }
    test++;
  }
  if (flag != 0)
    printf("None");
  /*
  for(i=0;i<length;i++) {
    putchar(str[i]);
  }
  printf("\nlength=%d\n", length);
  */
  free(str);
  return 0;
}


Fixed submission:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
  char buf[9];
  char *str;
  int length = 8;

  fgets(buf, 9, stdin);
  str = (char *)malloc(sizeof(char) * length);
  memcpy(str, buf, 8);
  int cpypos = 0;
  // printf("0x%02x\n", buf[7] & 0x000000FF);
  while (strlen(buf) >= 8 && (buf[7] != 0x0d && buf[7] != 0x0a)) {
    fgets(buf, 9, stdin);
    cpypos += 8;
    if (cpypos + 8 > length) {
      length *= 2;
      str = (char *)realloc(str, sizeof(char) * length);
    }
    memcpy((str + cpypos), buf, 8);
  }

  int flag;
  char test = 'a';
  int i;
  for (i = 0; i < 26; i++) {
    flag = 0;
    int j;
    for (j = 0; j < length; j++) {
      char chr = str[j];
      if (chr == 0x0d || chr == 0x0a || chr == 0x1a || chr == 0xff ||
          chr == 0x00)
        break;
      // printf("0x%02X ", str[j] & 0x000000ff);
      if (chr == test) {
        flag = 1;
      }
    }
    if (flag == 0) {
      putchar(test);
      break;
    }
    test++;
  }
  if (flag != 0)
    printf("None");
  /*
  for(i=0;i<length;i++) {
    putchar(str[i]);
  }
  printf("\nlength=%d\n", length);
  */
  free(str);
  return 0;
}
Problem p03624 (C++)

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

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

  vector<bool> a(26);
  for (int i = 0; i < s.size(); i++) {
    a.at(s.at(i) - 'a') = true;
  }

  for (int i = 0; i < s.size(); i++) {
    if (!a.at(i)) {
      char ans = i + 'a';
      cout << ans << endl;
      return 0;
    }
  }

  cout << "None" << endl;
}


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

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

  vector<bool> a(26);
  for (int i = 0; i < s.size(); i++) {
    a.at(s.at(i) - 'a') = true;
  }

  for (int i = 0; i < 26; i++) {
    if (!a.at(i)) {
      char ans = i + 'a';
      cout << ans << endl;
      return 0;
    }
  }

  cout << "None" << endl;
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;

#define _SI(arr) (sizeof(arr)/sizeof(arr[0])

int main() {
  string s;
  cin >> s;
  int a[27] = {0};
  for (ll i = 0; i < s.size(); i++) {
    a[s[i] - 'a']++;
  }
  for (const auto &x : a) {
    if (a[x] == 0) {
      char p = 'a' + x;
      cout << p << endl;
      exit(0);
    }
  }

  cout << "None" << endl;
}

Fixed submission:
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;

#define _SI(arr) (sizeof(arr)/sizeof(arr[0])

int main() {
  string s;
  cin >> s;
  int a[27] = {0};
  for (ll i = 0; i < s.size(); i++) {
    a[s[i] - 'a']++;
  }
  for (ll i = 0; i < 26; i++) {
    if (a[i] == 0) {
      char p = 'a' + i;
      cout << p << endl;
      exit(0);
    }
  }

  cout << "None" << endl;
}
Problem p03624 (C++)

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

int main() {
  string s;
  cin >> s;
  set<char> st;
  for (int i = 0; i < 26; i++) {
    st.insert(s.at(i));
  }
  for (int i = 0; i < 26; i++) {
    if (st.count('a' + i) == 0) {
      cout << (char)('a' + i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}

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

int main() {
  string s;
  cin >> s;
  set<char> st;
  for (int i = 0; i < s.length(); i++) {
    st.insert(s.at(i));
  }
  for (int i = 0; i < 26; i++) {
    if (st.count('a' + i) == 0) {
      cout << (char)('a' + i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  vector<char> az(26);
  for (int i = 0; i < 26; i++) {
    int x = (int)'a' + i;
    az.at(i) = (char)x;
  }
  for (int i = 0; i < S.size(); i++) {
    if (S.find(az.at(i)) == string::npos) {
      cout << az.at(i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  vector<char> az(26);
  for (int i = 0; i < 26; i++) {
    int x = (int)'a' + i;
    az.at(i) = (char)x;
  }
  for (int i = 0; i < az.size(); i++) {
    if (S.find(az.at(i)) == string::npos) {
      cout << az.at(i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
bool binaryserch(char S[], char str, int l) {
  int left = 0, right = l - 1;
  if (S[right] == str)
    return false;
  while (left < right) {
    int mid = (left + right) / 2;
    if (S[mid] == str)
      return false;
    else if (S[mid] < str)
      left = mid + 1;
    else if (S[mid] > str)
      right = mid;
  }
  return true;
}
int main() {
  char S[10001];
  scanf("%s", &S);
  int l = strlen(S);
  sort(S, S + l);
  char str = 'a';
  for (; str <= 'z'; str++) {
    if (binaryserch(S, str, l)) {
      printf("%c\n", str);
      break;
    }
  }
  if (str == 'z' + 1)
    printf("None\n");
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
bool binaryserch(char S[], char str, int l) {
  int left = 0, right = l - 1;
  if (S[right] == str)
    return false;
  while (left < right) {
    int mid = (left + right) / 2;
    if (S[mid] == str)
      return false;
    else if (S[mid] < str)
      left = mid + 1;
    else if (S[mid] > str)
      right = mid;
  }
  return true;
}
int main() {
  char S[100005];
  scanf("%s", &S);
  int l = strlen(S);
  sort(S, S + l);
  char str = 'a';
  for (; str <= 'z'; str++) {
    if (binaryserch(S, str, l)) {
      printf("%c\n", str);
      break;
    }
  }
  if (str == 'z' + 1)
    printf("None\n");
  return 0;
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++)
typedef long long ll;

int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());

  string t = "abcdefghijklmnopqrstuvwxyz";
  int cnt = 0;
  string u;
  u += s.at(0);
  rep(i, s.size() - 1) {
    if (s.at(i) == s.at(i + 1))
      continue;
    else
      u += s.at(i + 1);
  }

  // cout << u << endl;

  if (u == t) {
    cout << "None" << endl;
    return 0;
  }

  for (int i = 0; i < t.size(); i++) {
    if (t.at(i) == u.at(i))
      continue;
    else {
      cout << t.at(i) << endl;
      return 0;
    }
  }

  cout << t.at(u.size()) << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++)
typedef long long ll;

int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());

  string t = "abcdefghijklmnopqrstuvwxyz";
  int cnt = 0;
  string u;
  u += s.at(0);
  rep(i, s.size() - 1) {
    if (s.at(i) == s.at(i + 1))
      continue;
    else
      u += s.at(i + 1);
  }

  // cout << u << endl;

  if (u == t) {
    cout << "None" << endl;
    return 0;
  }

  for (int i = 0; i < u.size(); i++) {
    if (t.at(i) == u.at(i))
      continue;
    else {
      cout << t.at(i) << endl;
      return 0;
    }
  }

  cout << t.at(u.size()) << endl;
}
Problem p03624 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iterator>
#include <limits>
#include <math.h>
#include <numeric>
#include <stdio.h>
using namespace std;

int main() {
  string s;
  cin >> s;
  vector<char> c;
  for (int i = 0; i < s.length(); i++) {
    for (int j = 97; j <= 122; j++) {
      if (count(s.begin(), s.end(), (char)j) == 0)
        c.push_back((char)j);
    }
  }
  sort(c.begin(), c.end());
  if (c.size() == 0)
    cout << "None" << endl;
  else
    cout << c[0] << endl;
}


Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iterator>
#include <limits>
#include <math.h>
#include <numeric>
#include <stdio.h>
using namespace std;

int main() {
  string s;
  cin >> s;
  vector<char> c;
  for (int j = 97; j <= 122; j++) {
    if (count(s.begin(), s.end(), (char)j) == 0)
      c.push_back((char)j);
  }
  sort(c.begin(), c.end());
  if (c.size() == 0)
    cout << "None" << endl;
  else
    cout << c[0] << endl;
}
Problem p03624 (C++)

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

int main() {
  string s;
  cin >> s;
  bool check[26] = {false};
  for (int i = 0; i < s.length(); i++) {
    check['a' - s[i]] = true;
  }
  for (int i = 0; i < 26; i++) {
    if (check[i] == false) {
      char ans = 'a' + i;
      cout << ans << endl;
      return 0;
    }
  }

  cout << "None" << endl;

  return 0;
}


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

int main() {
  string s;
  cin >> s;
  bool check[26] = {false};
  for (int i = 0; i < s.length(); i++) {
    check[s[i] - 'a'] = true;
  }
  for (int i = 0; i < 26; i++) {
    if (check[i] == false) {
      char ans = 'a' + i;
      cout << ans << endl;
      return 0;
    }
  }

  cout << "None" << endl;

  return 0;
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int main() {
  string s;
  cin >> s;
  vector<bool> c(26, false);
  rep(i, 26) { c[s[i] - 'a'] = true; }
  rep(i, 26) {
    if (c[i] == false) {
      cout << (char)(i + 'a') << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int main() {
  string s;
  cin >> s;
  vector<bool> c(26, false);
  rep(i, s.size()) { c[s[i] - 'a'] = true; }
  rep(i, 26) {
    if (c[i] == false) {
      cout << (char)(i + 'a') << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}
Problem p03624 (C++)

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, a) for (int i = 0; i < (a); ++i)

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int UI;

using namespace std;

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

  string s;
  cin >> s;

  sort(s.begin(), s.end());

  s.erase(unique(s.begin(), s.end()));

  char x = 'a';

  for (const char &item : s) {
    if (x != item) {
      cout << x << endl;
      return 0;
    }
    if (item == 'z') {
      cout << "None" << endl;
      return 0;
    }
    ++x;
  }

  cout << x << endl;

  return 0;
}

Fixed submission:
#include "bits/stdc++.h"

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, a) for (int i = 0; i < (a); ++i)

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int UI;

using namespace std;

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

  string s;
  cin >> s;

  sort(s.begin(), s.end());

  s.erase(unique(s.begin(), s.end()), s.end());

  char x = 'a';

  for (const char &item : s) {
    if (x != item) {
      cout << x << endl;
      return 0;
    }
    if (item == 'z') {
      cout << "None" << endl;
      return 0;
    }
    ++x;
  }

  cout << x << endl;

  return 0;
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <stdio.h>
using namespace std;
char q[1000];
bool k;
int main() {
  cin >> q;
  for (int i = 97; i < 123; i++) {
    k = 0;
    for (int j = 0; j < strlen(q); j++)
      if (q[j] == char(i))
        k = 1;
    if (k == 0) {

      cout << char(i) << endl;
      return 0;
    }
  }
  if (k)
    cout << "None" << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <stdio.h>
using namespace std;
char q[100000];
bool k;
int main() {
  cin >> q;
  for (int i = 97; i < 123; i++) {
    k = 0;
    for (int j = 0; j < strlen(q); j++)
      if (q[j] == char(i))
        k = 1;
    if (k == 0) {

      cout << char(i) << endl;
      return 0;
    }
  }
  if (k)
    cout << "None" << endl;
  return 0;
}
Problem p03624 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

using namespace std;

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

int main() {

  char ans;
  int flag = 0;
  string s;
  cin >> s;
  sort(s.begin(), s.end());

  rep(i, s.size()) {
    for (char c = 'a'; c <= 'z'; ++c) {
      if (s.find(c) == string::npos) {
        ans = c;
        flag = 1;
        break;
      }
    }
  }

  if (flag == 0)
    cout << "None" << endl;
  if (flag == 1)
    cout << ans << endl;

  return 0;
}

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

using namespace std;

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

int main() {

  char ans;
  int flag = 0;
  string s;
  cin >> s;
  sort(s.begin(), s.end());

  for (char c = 'a'; c <= 'z'; ++c) {
    if (s.find(c) == string::npos) {
      ans = c;
      flag = 1;
      break;
    }
  }

  if (flag == 0)
    cout << "None" << endl;
  if (flag == 1)
    cout << ans << endl;

  return 0;
}
Problem p03624 (C++)

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

int main() {
  char s[10010];
  cin >> s;
  bool v[26];

  for (int i = 0; i < 26; i++) {
    v[i] = false;
  }
  for (int i = 0; s[i] != '\0'; i++) {
    v[s[i] - 'a'] = true;
  }

  for (int i = 0; i < 26; i++) {
    if (v[i] == false) {
      char ans = 'a' + i;
      cout << ans << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}

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

int main() {
  char s[100010];
  cin >> s;
  bool v[26];

  for (int i = 0; i < 26; i++) {
    v[i] = false;
  }
  for (int i = 0; s[i] != '\0'; i++) {
    v[s[i] - 'a'] = true;
  }

  for (int i = 0; i < 26; i++) {
    if (v[i] == false) {
      char ans = 'a' + i;
      cout << ans << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}
Problem p03624 (Python)

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

found = False
for chr in s:
    del alpha[alpha.index(chr)]

if len(alpha) == 0:
    print("None")
else:
    print(alpha[0])


Fixed submission:
alpha = list("abcdefghijklmnopqrstuvwxyz")
s = input()

found = False
for chr in s:
    if chr in alpha:
        del alpha[alpha.index(chr)]

if len(alpha) == 0:
    print("None")
else:
    print(alpha[0])
Problem p03624 (Python)

Buggy submission (status: Runtime Error):
import string

s = list(set(list(input())))
s.sort()
comp = string.ascii_lowercase
if len(s) == len(comp):
    ans = "None"
else:
    for i in range(len(s)):
        if s[i] != comp[i]:
            ans = comp[i]
            break
print(ans)


Fixed submission:
import string

s = set(list(input()))
ans = "None"
for c in string.ascii_lowercase:
    if not c in s:
        ans = c
        break

print(ans)
Problem p03624 (Python)

Buggy submission (status: Runtime Error):
s = input().strip()
chars = list(set(s))
chars.sort()
dic = {
    "a": 0,
    "b": 1,
    "c": 2,
    "d": 3,
    "e": 4,
    "f": 5,
    "g": 6,
    "h": 7,
    "i": 8,
    "j": 9,
    "k": 10,
    "l": 11,
    "m": 12,
    "n": 13,
    "o": 14,
    "p": 15,
    "q": 16,
    "r": 17,
    "s": 18,
    "t": 19,
    "u": 20,
    "v": 21,
    "w": 22,
    "x": 23,
    "y": 24,
    "z": 25,
}
swap = {v: k for k, v in dic.items()}
ans = "None"
count = 0
for c in chars:
    if dic[c] != count:
        ans = swap[count]
        break
    count += 1
if count != 25:
    print(swap[count])
else:
    print(ans)


Fixed submission:
s = input().strip()
chars = list(set(s))
chars.sort()
dic = {
    "a": 0,
    "b": 1,
    "c": 2,
    "d": 3,
    "e": 4,
    "f": 5,
    "g": 6,
    "h": 7,
    "i": 8,
    "j": 9,
    "k": 10,
    "l": 11,
    "m": 12,
    "n": 13,
    "o": 14,
    "p": 15,
    "q": 16,
    "r": 17,
    "s": 18,
    "t": 19,
    "u": 20,
    "v": 21,
    "w": 22,
    "x": 23,
    "y": 24,
    "z": 25,
}
swap = {v: k for k, v in dic.items()}
ans = "None"
count = 0
for c in chars:
    if dic[c] != count:
        ans = swap[count]
        break
    count += 1
if count <= 25:
    print(swap[count])
else:
    print(ans)
Problem p03624 (C++)

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

int main() {
  string s;
  cin >> s;
  int out[10010];
  int num[26];
  for (int i = 0; i < s.size(); i++) {
    out[i] = int(s[i] - 97);
  }

  for (int k = 0; k < s.size(); k++) {
    num[out[k]]++;
  }
  bool flag = false;

  for (int j = 0; j < 26; j++) {
    if (num[j] == 0) {
      cout << (char)(j + 97) << endl;
      flag = true;
      break;
    }
  }
  if (flag == false)
    cout << "None" << endl;
}

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

int main() {
  string s;
  cin >> s;
  int out[100010];
  int num[26];
  for (int i = 0; i < s.size(); i++) {
    out[i] = int(s[i] - 97);
  }

  for (int k = 0; k < s.size(); k++) {
    num[out[k]]++;
  }
  bool flag = false;

  for (int j = 0; j < 26; j++) {
    if (num[j] == 0) {
      cout << (char)(j + 97) << endl;
      flag = true;
      break;
    }
  }
  if (flag == false)
    cout << "None" << endl;
}
Problem p03624 (C++)

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

int main() {
  string s;
  cin >> s;
  int a = 0;
  char b = '1';
  string sample = "abcdefghijklmnopqrstuvwxyz";
  sort(s.begin(), s.end());
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == b) {
      continue;
    } else {
      if (s.at(i) != sample.at(a)) {
        break;
      } else {
        if (s.at(i) == 'z') {
          a++;
          break;
        }
        a++;
        b = s.at(i);
      }
    }
  }
  if (a != 27)
    cout << sample.at(a) << endl;
  else
    cout << "None" << endl;
}

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

int main() {
  string s;
  cin >> s;
  int a = 0;
  char b = '1';
  string sample = "abcdefghijklmnopqrstuvwxyz";
  sort(s.begin(), s.end());
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == b) {
      continue;
    } else {
      if (s.at(i) != sample.at(a)) {
        break;
      } else {
        if (s.at(i) == 'z') {
          a++;
          break;
        }
        a++;
        b = s.at(i);
      }
    }
  }
  if (a < 26)
    cout << sample.at(a) << endl;
  else
    cout << "None" << endl;
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
  char u[1000], b;
  int i[26], a, len;
  for (a = 0; a < 26; a++) {
    i[a] = 0;
  }
  cin >> u;
  len = strlen(u);
  for (len--; len >= 0; len--) {
    i[u[len] - 97] = 1;
  }
  for (a = 0; a < 26; a++) {
    if (i[a] == 0) {
      b = a + 97;
      cout << b;
      return 0;
    }
  }
  cout << "None";
  return 0;
}

Fixed submission:
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
  char u[10000000], b;
  int i[26], a, len;
  for (a = 0; a < 26; a++) {
    i[a] = 0;
  }
  cin >> u;
  len = strlen(u);
  for (len--; len >= 0; len--) {
    i[u[len] - 97] = 1;
  }
  for (a = 0; a < 26; a++) {
    if (i[a] == 0) {
      b = a + 97;
      cout << b;
      return 0;
    }
  }
  cout << "None";
  return 0;
}
Problem p03624 (C++)

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

int main(void) {

  int i, j, h, f, g;

  int a[27] = {0};

  char k[27] = "abcdefghijklmnopqrstuvwxyz";

  char s[100001] = "";

  char t[2] = "";

  scanf("%s", s);

  for (i = 0; i < strlen(s); i = i + 1) {

    for (j = i + 1; j < strlen(s); j = j + 1) {

      if (s[i] > s[j]) {

        t[0] = s[j];

        s[j] = s[i];

        s[i] = t[0];
      }
    }
  }

  for (h = 0; h < strlen(s); h = h + 1) {

    for (f = 0; f < strlen(k); f = f + 1) {

      if (strncmp(s + h, k + f, 1) == 0) {

        a[f] += 1;
      }
    }
  }

  for (g = 0; g < strlen(k); g = g + 1) {

    if (a[g] == 0) {

      printf("%c\n", k[g]);

      return 0;
    }
  }

  printf("None\n");

  return 0;
}

Fixed submission:
#include <stdio.h>
#include <string.h>

int main(void) {

  int i, j, h, f, g;

  int a[27] = {0};

  char k[27] = "abcdefghijklmnopqrstuvwxyz";

  char s[100001] = "";

  char t[2] = "";

  scanf("%s", s);

  for (h = 0; h < strlen(s); h = h + 1) {

    for (f = 0; f < strlen(k); f = f + 1) {

      if (strncmp(s + h, k + f, 1) == 0) {

        a[f] += 1;
      }
    }
  }

  for (g = 0; g < strlen(k); g = g + 1) {

    if (a[g] == 0) {

      printf("%c\n", k[g]);

      return 0;
    }
  }

  printf("None\n");

  return 0;
}
Problem p03624 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>
#include <cstring>

char s[1000], ap[30] = {"abcdefghijklmnopqrstuvwxyz"};
int ap2[30];
int main() {
  scanf("%s", &s);
  for (int i = 0; i < strlen(s); i++) {
    for (int j = 0; j < 26; j++)
      if (s[i] == ap[j])
        ap2[j] = 1;
  }
  for (int i = 0; i < 26; i++)
    if (ap2[i] == 0) {
      printf("%c", ap[i]);
      return 0;
    }
  printf("None");
}


Fixed submission:
#include <cstdio>
#include <cstring>

char s[200000], ap[30] = {"abcdefghijklmnopqrstuvwxyz"};
int ap2[30];
int main() {
  scanf("%s", &s);
  for (int i = 0; i < strlen(s); i++) {
    for (int j = 0; j < 26; j++)
      if (s[i] == ap[j])
        ap2[j] = 1;
  }
  for (int i = 0; i < 26; i++)
    if (ap2[i] == 0) {
      printf("%c", ap[i]);
      return 0;
    }
  printf("None");
}
Problem p03624 (C++)

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

int main() {
  string s;
  cin >> s;
  vector<int> ad(26);
  for (int i = 0; i < 26; i++) {
    ad[26] = 0;
  }
  for (int i = 0; i < s.size(); i++) {
    ad[s[i] - 'a']++;
  }
  for (int i = 0; i < 26; i++) {
    if (ad[i] == 0) {
      cout << char('a' + i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}


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

int main() {
  string s;
  cin >> s;
  vector<int> ad(26);
  for (int i = 0; i < 26; i++) {
    ad[i] = 0;
  }
  for (int i = 0; i < s.size(); i++) {
    ad[s[i] - 'a']++;
  }
  for (int i = 0; i < 26; i++) {
    if (ad[i] == 0) {
      cout << char('a' + i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}