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

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

using namespace std;

char mp[41][45];
int n;
long long dp[41][41][41][41], dp2[41][41][41][41];

long long calc_dp2(int l, int r, int ll, int rr);
long long calc_dp(int l, int r, int ll, int rr);

long long calc_dp(int l, int r, int ll, int rr) {
  if (dp[l][r][ll][rr] != -1)
    return dp[l][r][ll][rr];
  // do something plz
  dp[l][r][ll][rr] = 0;
  for (int p = l; p <= r; ++p)
    for (int q = ll; q <= rr; ++q)
      dp[l][r][ll][rr] += (mp[p][q] - '0') * calc_dp2(l, p - 1, p + 1, r) *
                          calc_dp2(ll, q - 1, q + 1, rr);
  return dp[l][r][ll][rr];
}

long long calc_dp2(int l, int r, int ll, int rr) {
  if (dp2[l][r][ll][rr] != -1)
    return dp2[l][r][ll][rr];
  // also do something plz
  dp2[l][r][ll][rr] = 0;
  for (int p = l; p <= r; ++p)
    for (int q = ll; q <= rr; ++q)
      dp2[l][r][ll][rr] += calc_dp(l, p, q, rr) * calc_dp2(p + 1, r, ll, q - 1);
  return dp2[l][r][ll][rr];
}

int main() {
  scanf("%d", &n);
  n *= 2;
  for (int i = 1; i <= n; ++i)
    scanf("%s", mp[i] + 1);
  memset(dp, -1, sizeof(dp));
  memset(dp2, -1, sizeof(dp2));
  for (int i = 1; i <= n + 1; ++i)
    for (int j = 1; j <= n + 1; ++j)
      dp[i][i - 1][j][j - 1] = dp2[i][i - 1][j][j - 1] = 1;
  long long as = 0;
  for (int i = 2; i <= n; ++i)
    if (mp[1][i] == '1')
      as += calc_dp2(2, i - 1, i + 1, n);
  printf("%lld\n", as);
}

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

using namespace std;

char mp[41][45];
int n;
long long dp[42][42][42][42], dp2[42][42][42][42];

long long calc_dp2(int l, int r, int ll, int rr);
long long calc_dp(int l, int r, int ll, int rr);

long long calc_dp(int l, int r, int ll, int rr) {
  if (dp[l][r][ll][rr] != -1)
    return dp[l][r][ll][rr];
  // do something plz
  dp[l][r][ll][rr] = 0;
  for (int p = l; p <= r; ++p)
    for (int q = ll; q <= rr; ++q)
      dp[l][r][ll][rr] += (mp[p][q] - '0') * calc_dp2(l, p - 1, p + 1, r) *
                          calc_dp2(ll, q - 1, q + 1, rr);
  return dp[l][r][ll][rr];
}

long long calc_dp2(int l, int r, int ll, int rr) {
  if (dp2[l][r][ll][rr] != -1)
    return dp2[l][r][ll][rr];
  // also do something plz
  dp2[l][r][ll][rr] = 0;
  for (int p = l; p <= r; ++p)
    for (int q = ll; q <= rr; ++q)
      dp2[l][r][ll][rr] += calc_dp(l, p, q, rr) * calc_dp2(p + 1, r, ll, q - 1);
  return dp2[l][r][ll][rr];
}

int main() {
  scanf("%d", &n);
  n *= 2;
  for (int i = 1; i <= n; ++i)
    scanf("%s", mp[i] + 1);
  memset(dp, -1, sizeof(dp));
  memset(dp2, -1, sizeof(dp2));
  for (int i = 1; i <= n + 1; ++i)
    for (int j = 1; j <= n + 1; ++j)
      dp[i][i - 1][j][j - 1] = dp2[i][i - 1][j][j - 1] = 1;
  long long as = 0;
  for (int i = 2; i <= n; ++i)
    if (mp[1][i] == '1')
      as += calc_dp2(2, i - 1, i + 1, n);
  printf("%lld\n", as);
}
Problem p02895 (C++)

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

using namespace std;

typedef long long ll;

const int MAX_N = 25;

ll dp[MAX_N][MAX_N][MAX_N];
ll can[MAX_N][MAX_N];

int main() {
  int n;
  cin >> n;

  n *= 2;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      char c;
      cin >> c;

      can[i][j] = c - '0';
    }
  }

  for (int k = 0; k < n; k += 2) {
    for (int l = 0; l < n; l++) {
      int r = (l + k) % n;
      for (int m = l; true; m = (m + 1) % n) {
        if (m == l || m == r) {
          if (l == r) {
            dp[l][r][m] = 1;
          }
        } else {
          for (int p = l; p != m && (m + 1) % n != p; p = (p + 2) % n) {
            int sq = m;
            if (sq % 2 == l % 2) {
              sq = (sq + 1) % n;
            }
            for (int q = sq; true; q = (q + 2) % n) {
              for (int a = l; true; a = (a + 1) % n) {
                for (int b = (q + 1) % n; true; b = (b + 1) % n) {
                  if (can[a][b]) {
                    dp[l][r][m] += dp[l][p][a] * dp[(p + 1) % n][q][m] *
                                   dp[(q + 1) % n][r][b];
                  }
                  if (b == r)
                    break;
                }
                if (a == p)
                  break;
              }
              if (q == r || (q + 1) % n == r)
                break;
            }
          }
        }

        if (m == r)
          break;
      }
    }
  }

  ll ans = 0;
  for (int m = 1; m < n; m++) {
    if (can[0][m]) {
      ans += dp[1][n - 1][m];
    }
  }
  cout << ans << endl;
}


Fixed submission:
#include <iostream>

using namespace std;

typedef long long ll;

const int MAX_N = 45;

ll dp[MAX_N][MAX_N][MAX_N];
ll can[MAX_N][MAX_N];

int main() {
  int n;
  cin >> n;

  n *= 2;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      char c;
      cin >> c;

      can[i][j] = c - '0';
    }
  }

  for (int k = 0; k < n; k += 2) {
    for (int l = 0; l < n; l++) {
      int r = (l + k) % n;
      for (int m = l; true; m = (m + 1) % n) {
        if (m == l || m == r) {
          if (l == r) {
            dp[l][r][m] = 1;
          }
        } else {
          for (int p = l; p != m && (m + 1) % n != p; p = (p + 2) % n) {
            int sq = m;
            if (sq % 2 == l % 2) {
              sq = (sq + 1) % n;
            }
            for (int q = sq; true; q = (q + 2) % n) {
              for (int a = l; true; a = (a + 1) % n) {
                for (int b = (q + 1) % n; true; b = (b + 1) % n) {
                  if (can[a][b]) {
                    dp[l][r][m] += dp[l][p][a] * dp[(p + 1) % n][q][m] *
                                   dp[(q + 1) % n][r][b];
                  }
                  if (b == r)
                    break;
                }
                if (a == p)
                  break;
              }
              if (q == r || (q + 1) % n == r)
                break;
            }
          }
        }

        if (m == r)
          break;
      }
    }
  }

  ll ans = 0;
  for (int m = 1; m < n; m++) {
    if (can[0][m]) {
      ans += dp[1][n - 1][m];
    }
  }
  cout << ans << endl;
}
Problem p02895 (C++)

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

const int MAXN = 25;
long long dp[MAXN][MAXN][MAXN];
int A[MAXN][MAXN];
char S[MAXN];
int n;
long long ans;

long long getAns(int l, int r, int c) {
  if (dp[l][r][c] != -1)
    return dp[l][r][c];
  if (l == r)
    return dp[l][r][c] = 1;
  if (l == c || r == c)
    return dp[l][r][c] = 0;

  long long &res = dp[l][r][c];
  res = 0;

  for (int limL = l; limL < c; ++limL)
    for (int limR = c + 1; limR <= r; ++limR)
      if (A[limL][limR])
        for (int lP = limL; lP < c; ++lP)
          for (int rP = c + 1; rP <= limR; ++rP)
            res += getAns(l, lP, limL) * getAns(lP + 1, rP - 1, c) *
                   getAns(rP, r, limR);
  //	printf("(%d, %d, %d, %lld)\n", l, r, c, res);
  return res;
}

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

  cin >> n;
  n <<= 1;

  for (int i = 1; i <= n && (cin >> (S + 1)); ++i)
    for (int j = 1; j <= n; ++j)
      A[i][j] = S[j] - '0';

  memset(dp, -1, sizeof dp);

  for (int i = 2; i <= n; ++i)
    if (A[1][i])
      ans += getAns(2, n, i);
  cout << ans << '\n';
  return 0;
}

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

const int MAXN = 55;
long long dp[MAXN][MAXN][MAXN];
int A[MAXN][MAXN];
char S[MAXN];
int n;
long long ans;

long long getAns(int l, int r, int c) {
  if (dp[l][r][c] != -1)
    return dp[l][r][c];
  if (l == r)
    return dp[l][r][c] = 1;
  if (l == c || r == c)
    return dp[l][r][c] = 0;

  long long &res = dp[l][r][c];
  res = 0;

  for (int limL = l; limL < c; ++limL)
    for (int limR = c + 1; limR <= r; ++limR)
      if (A[limL][limR])
        for (int lP = limL; lP < c; ++lP)
          for (int rP = c + 1; rP <= limR; ++rP)
            res += getAns(l, lP, limL) * getAns(lP + 1, rP - 1, c) *
                   getAns(rP, r, limR);
  //	printf("(%d, %d, %d, %lld)\n", l, r, c, res);
  return res;
}

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

  cin >> n;
  n <<= 1;

  for (int i = 1; i <= n && (cin >> (S + 1)); ++i)
    for (int j = 1; j <= n; ++j)
      A[i][j] = S[j] - '0';

  memset(dp, -1, sizeof dp);

  for (int i = 2; i <= n; ++i)
    if (A[1][i])
      ans += getAns(2, n, i);
  cout << ans << '\n';
  return 0;
}
Problem p02897 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define speed                                                                  \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);
void input() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
#endif
}
/*****************************************************************************/

int main() {
  input();
  speed

      int q;
  cin >> q;
  double sum = 0;
  for (int i = 1; i <= q; i++) {
    if (i % 2 == 1)
      sum++;
  }

  double ans = sum / q * 1.0;
  cout << ans;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define speed                                                                  \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);
void input() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
#endif
}
/*****************************************************************************/

int main() {
  // input();
  speed

      int q;
  cin >> q;
  double sum = 0;
  for (int i = 1; i <= q; i++) {
    if (i % 2 == 1)
      sum++;
  }

  double ans = sum / q * 1.0;
  cout << ans;

  return 0;
}
Problem p02897 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1e9 + 7;
ll const maxn = 4e5 + 5;
ll const inf = 1e18;
ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }
ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }
ll powm(ll x, ll n, ll M) {
  ll result = 1;
  while (n > 0) {
    if (n % 2 == 1)
      result = (result * x) % M;
    x = (x * x) % M;
    n = n / 2;
  }
  return result;
}
int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin >> n;
  ll ans = ceil((n * 1.0) / 2);
  long double x = (ans * 1.0) / n;
  cout << fixed << setprecision(10) << x << "\n";
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1e9 + 7;
ll const maxn = 4e5 + 5;
ll const inf = 1e18;
ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }
ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }
ll powm(ll x, ll n, ll M) {
  ll result = 1;
  while (n > 0) {
    if (n % 2 == 1)
      result = (result * x) % M;
    x = (x * x) % M;
    n = n / 2;
  }
  return result;
}
int main() {
  // #ifndef ONLINE_JUDGE
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  // #endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin >> n;
  ll ans = ceil((n * 1.0) / 2);
  long double x = (ans * 1.0) / n;
  cout << fixed << setprecision(10) << x << "\n";
  return 0;
}
Problem p02897 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define FAST                                                                   \
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);                   \
  srand(time(NULL))
int main() {
  ll odd = 0, even = 0;
  ll n;
  cin >> n;
  for (ll i = 1; i <= n; i++) {
    if (i % 2)
      odd++;
    else
      even++;
  }
  ld ans = odd / even;
  cout << fixed << setprecision(12) << ans;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define FAST                                                                   \
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);                   \
  srand(time(NULL))
int main() {
  ll odd = 0, even = 0;
  ll n;
  cin >> n;
  for (ll i = 1; i <= n; i++) {
    if (i % 2)
      odd++;
    else
      even++;
  }
  ld ans = odd / (ld)n;
  cout << fixed << setprecision(12) << ans;
}
Problem p02897 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define EPS 1e-7
#define LLMAX 9223372036854775807
#define INTMAX 2147483647
#define ULLMAX 18446744073709551615
#define precision(n) cout << setprecision(n) << fixed
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define forr(i, t, n) for (int i = t; i < n; ++i)
#define rforr(i, t, n) (int i = n - 1; i >= t; --i)
#define rfor(i, n) for (int i = n - 1; i >= 0; --i)
#define rmod(x, y) (((x % y) + y) % y)
#define pb push_back
#define emp emplace_back
using namespace std;
typedef vector<int>::iterator vit;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int MAXN = 1024;

// STRUCTS

// OPERATORS

// GLOBALS

// FUNCTIONS

// PROBLEM: odds of oddness
// LINK: https://atcoder.jp/contests/abc142/tasks/abc142_a
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifndef ONLINE_JUDGE
  freopen("_input.txt", "r", stdin);
  freopen("_output.txt", "w", stdout);
#endif
  double n;
  cin >> n;
  double ans;
  precision(7);
  if (int(n) % 2) {
    ans = ceil(n / 2);
    ans /= n;
  } else
    ans = 1 / 2.00;
  cout << ans;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define EPS 1e-7
#define LLMAX 9223372036854775807
#define INTMAX 2147483647
#define ULLMAX 18446744073709551615
#define precision(n) cout << setprecision(n) << fixed
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define forr(i, t, n) for (int i = t; i < n; ++i)
#define rforr(i, t, n) (int i = n - 1; i >= t; --i)
#define rfor(i, n) for (int i = n - 1; i >= 0; --i)
#define rmod(x, y) (((x % y) + y) % y)
#define pb push_back
#define emp emplace_back
using namespace std;
typedef vector<int>::iterator vit;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int MAXN = 1024;

// STRUCTS

// OPERATORS

// GLOBALS

// FUNCTIONS

// PROBLEM: odds of oddness
// LINK: https://atcoder.jp/contests/abc142/tasks/abc142_a
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  double n;
  cin >> n;
  double ans;
  precision(7);
  if (int(n) % 2) {
    ans = ceil(n / 2);
    ans /= n;
  } else
    ans = 1 / 2.00;
  cout << ans;

  return 0;
}
Problem p02897 (C++)

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

using namespace std;

int main() {
  size_t n;
  cin >> n;
  double t = 0.0;
  for (size_t i = 1; i <= n; ++i) {
    if (i % 2 == 1)
      t += 1.0;
  }
  auto c = t / double(n);
  cout << c << endl;
  return 1;
}

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

using namespace std;

int main() {
  size_t n;
  cin >> n;
  double t = 0.0;
  for (size_t i = 1; i <= n; ++i) {
    if (i % 2 == 1)
      t += 1.0;
  }
  auto c = t / double(n);
  cout << c << endl;
  return 0;
}
Problem p02897 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define maxim (ll)1000000000000
#define PB push_back
#define MP make_pair
using namespace std;

int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll t = 1;
  // cin>>t;
  while (t--) {
    ll n;
    cin >> n;
    ld ans = (ld)((n / 2) + (n % 2)) / n;
    cout << fixed << setprecision(10) << ans << endl;
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define maxim (ll)1000000000000
#define PB push_back
#define MP make_pair
using namespace std;

int main() {

  ios::sync_with_stdio(0);
  cin.tie(0);
  ll t = 1;
  // cin>>t;
  while (t--) {
    ll n;
    cin >> n;
    ld ans = (ld)((n / 2) + (n % 2)) / n;
    cout << fixed << setprecision(10) << ans << endl;
  }
  return 0;
}
Problem p02897 (Python)

Buggy submission (status: Runtime Error):
N = input()

if N % 2 == 0:
    print((N / 2) / N)

else:
    print(((N + 1) / 2) / N)


Fixed submission:
N = int(input())

if N % 2 == 0:
    print((N / 2) / N)

else:
    print(((N + 1) / 2) / N)
Problem p02897 (C++)

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

int main() {
  int n;
  std::cin >> n;

  return (n - n / 2) / (double)n;
}

Fixed submission:
#include <iostream>

int main() {
  int n;
  std::cin >> n;
  std::cout << (n - n / 2) / (double)n;
}
Problem p02897 (C++)

Buggy submission (status: Runtime Error):
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
// #include"testlib.h"
#define endl "\n"
#define all(v) v.begin(), v.end()
#define allr(s) s.rbegin(), s.rend()
#define RT(s) return cout << s, 0
#define watch(x) cout << (#x) << " = " << x << endl
#define sz(s) (int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> row;
typedef vector<row> matrix;
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
void file() {
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
#else
  // freopen("street.in", "r", stdin);
  // freopen("out.txt", "w", stdout);
#endif
}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}

int main() {
  file();
  fast();
  int n;
  cin >> n;
  cout << fixed << setprecision(6);
  if (n & 1)
    cout << (n / 2 + 1) / (double)n << endl;
  else
    cout << 0.5000000 << endl;
  return 0;
}

Fixed submission:
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
// #include"testlib.h"
#define endl "\n"
#define all(v) v.begin(), v.end()
#define allr(s) s.rbegin(), s.rend()
#define RT(s) return cout << s, 0
#define watch(x) cout << (#x) << " = " << x << endl
#define sz(s) (int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> row;
typedef vector<row> matrix;
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
void file() {
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
#else
  // freopen("street.in", "r", stdin);
  // freopen("out.txt", "w", stdout);
#endif
}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}

int main() {
  // file();
  fast();
  int n;
  cin >> n;
  cout << fixed << setprecision(6);
  if (n & 1)
    cout << (n / 2 + 1) / (double)n << endl;
  else
    cout << 0.5000000 << endl;
  return 0;
}
Problem p02897 (C++)

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

int main() {
  int n;
  std::cin >> n;
  double ans;
  if (n % 2 == 0)
    ans = 0.5;
  else
    ans = (n / 2 + 1) / (n / 2);
  std::cout << ans << std::endl;
  return 0;
}

Fixed submission:
#include <iostream>

int main() {
  int n;
  std::cin >> n;
  double ans;
  if (n % 2 == 0)
    ans = 0.5;
  else
    ans = (double)(n / 2 + 1) / (double)n;
  std::cout << ans << std::endl;
  return 0;
}
Problem p02897 (Python)

Buggy submission (status: Runtime Error):
N = int(input())
nums = filter(lambda x: x % 2 != 0, range(1, N + 1))
print(len(nums) / float(N))


Fixed submission:
N = int(input())
odds = list(filter(lambda x: x % 2 != 0, range(1, N + 1)))
print("{:.10f}".format(len(odds) / float(N)))
Problem p02897 (Python)

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

odd = (n + 1) // 2
ans = odd / n
print(f"{ans:.9f}")


Fixed submission:
n = int(input())

odd = (n + 1) // 2
ans = odd / n
print("{:.9f}".format(ans))
Problem p02897 (C++)

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

#define int long long int
#define pb push_back
#define pii pair<int, int>
#define fi first
#define se second
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define dbg(x)                                                                 \
  { cerr << "> " << #x << ": " << x << endl; }
#define dbg2(x, y)                                                             \
  { cerr << "> " << #x << ": " << x << " , " << #y << ": " << y << endl; }
#define dbg3(x, y, z)                                                          \
  {                                                                            \
    cerr << "> " << #x << ": " << x << " , " << #y << ": " << y << " , " << #z \
         << ": " << z << endl;                                                 \
  }
#define IOS                                                                    \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0);                                                                  \
  cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif

const int inf = INT_MAX;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;

signed main() {
  IOS;
  int n;
  cin >> n;
  cout << fixed << setprecision(10) << (n + 1) / 2 / (n / 2);
  return 0;
}

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

#define int long long int
#define pb push_back
#define pii pair<int, int>
#define fi first
#define se second
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define dbg(x)                                                                 \
  { cerr << "> " << #x << ": " << x << endl; }
#define dbg2(x, y)                                                             \
  { cerr << "> " << #x << ": " << x << " , " << #y << ": " << y << endl; }
#define dbg3(x, y, z)                                                          \
  {                                                                            \
    cerr << "> " << #x << ": " << x << " , " << #y << ": " << y << " , " << #z \
         << ": " << z << endl;                                                 \
  }
#define IOS                                                                    \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0);                                                                  \
  cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif

const int inf = INT_MAX;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;

signed main() {
  IOS;
  int n;
  cin >> n;
  int a = (n + 1) / 2;
  int b = n / 2;
  cout << fixed << setprecision(10) << (double)a / n;
  return 0;
}
Problem p02898 (Python)

Buggy submission (status: Runtime Error):
# -*- coding: utf-8 -*-

n, k = map(int, input().split())
cnt = 0

h = list(map(int, input().split()))

for high in h:
    if h >= k:
        cnt += 1


print(cnt)


Fixed submission:
# -*- coding: utf-8 -*-

n, k = map(int, input().split())
cnt = 0

h = list(map(int, input().split()))

for high in h:
    if high >= k:
        cnt += 1


print(cnt)
Problem p02898 (Python)

Buggy submission (status: Runtime Error):
n, k = map(int, input().split())
H = list(map(int, input().split()))
cnt = 0
for i in n:
    if H[i] >= k:
        cnt += 1
print(cnt)


Fixed submission:
n, k = map(int, input().split())
H = list(map(int, input().split()))
cnt = 0
for i in range(n):
    if H[i] >= k:
        cnt += 1
print(cnt)
Problem p02898 (Python)

Buggy submission (status: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))
print(len(filter(lambda x: x >= k, h)))


Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
print(len(list(filter(lambda x: x >= k, h))))
Problem p02898 (Python)

Buggy submission (status: Runtime Error):
N = int(input())
K = int(input())
h = list(map(int, input().split()))


count = 0
for i in h:
    if i >= K:
        count += 1

print(count)


Fixed submission:
N, K = list(map(int, input().split()))
h = list(map(int, input().split()))


count = 0
for i in h:
    if i >= K:
        count += 1

print(count)
Problem p02898 (C++)

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

using namespace std;

int main() {
  int n, k, cnt = 0;
  int v[501];

  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (v[i] >= k)
      cnt++;
  }

  cout << cnt << endl;

  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

int main() {
  int n, k, cnt = 0;
  int v[1000000];

  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (v[i] >= k)
      cnt++;
  }

  cout << cnt << endl;

  return 0;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <vector>
#define rep(i, n)                                                              \
  for (int i = 0; i < n; i++)                                                  \
    ;
using namespace std;

int main() {
  int N, K;
  vector<int> A(500);
  cin >> N >> K;
  int count = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] > K - 1) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}


Fixed submission:
#include <iostream>
#include <vector>
#define rep(i, n)                                                              \
  for (int i = 0; i < n; i++)                                                  \
    ;
using namespace std;

int main() {
  int N, K;
  vector<int> A(100000);
  cin >> N >> K;
  int count = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] > K - 1) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}
Problem p02898 (Python)

Buggy submission (status: Runtime Error):
N, K = map(int, input().split())
ar = list(map, input().split())

count = 0
for i in range(N):
    if ar[i] >= K:
        count += 1

print(count)


Fixed submission:
N, K = map(int, input().split())
ar = list(map(int, input().split()))

count = 0
for i in range(N):
    if ar[i] >= K:
        count += 1

print(count)
Problem p02898 (C++)

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

using namespace std;

int main(void) {
  int N, K, h[500], count = 0;

  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> h[i];
    if (h[i] >= K) {
      count++;
    }
  }

  printf("%d", count);

  return 0;
}


Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int main(void) {
  int N, K, h[100000], count = 0;

  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> h[i];
    if (h[i] >= K) {
      count++;
    }
  }

  printf("%d", count);

  return 0;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; ++i)
#define RREP(i, n) for (int i = n; 0 <= i; --i)
#define FOR(i, start, end) for (int i = start; i < end; ++i)
#define RFOR(i, start, end) for (int i = start; end <= i; --i)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

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

  ll N, K;
  cin >> N >> K;
  ll h[501];
  REP(i, N) cin >> h[i];

  ll ans = 0;
  REP(i, N) {
    if (h[i] >= K)
      ++ans;
  }
  cout << ans << '\n';
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; ++i)
#define RREP(i, n) for (int i = n; 0 <= i; --i)
#define FOR(i, start, end) for (int i = start; i < end; ++i)
#define RFOR(i, start, end) for (int i = start; end <= i; --i)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

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

  ll N, K;
  cin >> N >> K;
  ll h[100100];
  REP(i, N) cin >> h[i];

  ll ans = 0;
  REP(i, N) {
    if (h[i] >= K)
      ++ans;
  }
  cout << ans << '\n';
  return 0;
}
Problem p02898 (Python)

Buggy submission (status: Runtime Error):
n = int(input())
min_height = int(input())

height = []
for _ in range(n):
    height.append(int(input()))
height.sort(reverse=True)

cnt = 0
for h in height:
    if h < min_height:
        break
    cnt += 1
print(cnt)


Fixed submission:
n, min_height = map(int, input().split())
height = list(map(int, input().split()))
height.sort(reverse=True)

cnt = 0
for h in height:
    if h < min_height:
        break
    cnt += 1
print(cnt)
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int main() {
  int r = 0, i, n, k, h[10010];
  scanf("%d%d", &n, &k);
  for (i = 1; i <= n; i++) {
    scanf("%d", &h[i]);
  }
  for (i = 1; i <= n; i++) {
    if (h[i] >= k) {
      r++;
    }
  }
  printf("%d", r);
  return 0;
}


Fixed submission:
#include <stdio.h>
int main() {
  int r = 0, i, n, k, h[100100];
  scanf("%d%d", &n, &k);
  for (i = 1; i <= n; i++) {
    scanf("%d", &h[i]);
  }
  for (i = 1; i <= n; i++) {
    if (h[i] >= k) {
      r++;
    }
  }
  printf("%d", r);
  return 0;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
// #define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int, int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define OREP(i, n) for (int i = 1; i <= (n); ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define GOODBYE                                                                \
  do {                                                                         \
    cout << "No" << endl;                                                      \
    return 0;                                                                  \
  } while (false)
#define MM << " " <<
#define Endl endl

signed main(void) {
  int N, K, Ans = 0;
  int h[514];
  cin >> N >> K;
  REP(i, N) { cin >> h[i]; }
  REP(i, N) {
    if (h[i] >= K)
      Ans++;
  }
  cout << Ans << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
// #define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int, int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define OREP(i, n) for (int i = 1; i <= (n); ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define GOODBYE                                                                \
  do {                                                                         \
    cout << "No" << endl;                                                      \
    return 0;                                                                  \
  } while (false)
#define MM << " " <<
#define Endl endl

signed main(void) {
  int N, K, Ans = 0;
  int h[114514];
  cin >> N >> K;
  REP(i, N) { cin >> h[i]; }
  REP(i, N) {
    if (h[i] >= K)
      Ans++;
  }
  cout << Ans << endl;
  return 0;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
const int INF = 100100100;
using namespace std;

int main() {
  int N, K;
  int h[510];
  int res = 0;
  cin >> N >> K;

  rep(i, N) cin >> h[i];

  rep(i, N) {
    if (h[i] >= K)
      res++;
  }

  cout << res << endl;
}


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

int main() {
  int N, K;
  int h[110000];
  int res = 0;
  cin >> N >> K;

  rep(i, N) cin >> h[i];

  rep(i, N) {
    if (h[i] >= K)
      res++;
  }

  cout << res << endl;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#define FOR(i, m, M) for (int i = m; i < M; i++)
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  int h[500];
  bool flag = 0;
  FOR(i, 0, N) { cin >> h[i]; }
  sort(h, h + N, greater<int>());
  FOR(j, 0, N) {
    if (h[j] < K) {
      cout << j << endl;
      flag = 1;
      break;
    }
  }
  if (!flag)
    cout << N << endl;
}


Fixed submission:
#include <algorithm>
#include <iostream>
#define FOR(i, m, M) for (int i = m; i < M; i++)
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  int h[100000];
  bool flag = 0;
  FOR(i, 0, N) { cin >> h[i]; }
  sort(h, h + N, greater<int>());
  FOR(j, 0, N) {
    if (h[j] < K) {
      cout << j << endl;
      flag = 1;
      break;
    }
  }
  if (!flag)
    cout << N << endl;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a[1000], count = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] >= k)
      count++;
  }
  cout << count << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a[100005], count = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] >= k)
      count++;
  }
  cout << count << endl;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  int h[1000];
  for (int i = 0; i < n; i++) {
    cin >> h[i];
    if (h[i] >= k) {
      ans++;
    }
  }
  cout << ans << endl;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  int h[n];
  for (int i = 0; i < n; i++) {
    cin >> h[i];
    if (h[i] >= k) {
      ans++;
    }
  }
  cout << ans << endl;
}
Problem p02898 (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() {
  int n, k;
  cin >> n >> k;

  int h[550];
  rep(i, n) { cin >> h[i]; }

  int noreru = 0;

  rep(j, n) {
    if (h[j] >= k) {
      noreru++;
    }
  }

  cout << noreru << 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() {
  int n, k;
  cin >> n >> k;

  int h[n];
  rep(i, n) { cin >> h[i]; }

  int noreru = 0;

  rep(j, n) {
    if (h[j] >= k) {
      noreru++;
    }
  }

  cout << noreru << endl;
}
Problem p02898 (C++)

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

int main() {
  int N, K;
  int h[500];
  int count = 0;
  cin >> N >> K;
  for (int i = 0; i < N; i++)
    cin >> h[i];

  for (int i = 0; i < N; i++) {
    if (h[i] >= K)
      count++;
  }
  cout << count;
}

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

int main() {
  int N, K;
  int h[100000];
  int count = 0;
  cin >> N >> K;
  for (int i = 0; i < N; i++)
    cin >> h[i];

  for (int i = 0; i < N; i++) {
    if (h[i] >= K)
      count++;
  }
  cout << count;
}
Problem p02898 (C++)

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

int main() {

  int n, k;
  cin >> n >> k;
  int a[k];
  for (int i = 0; i < n; i++)
    cin >> a[i];
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] >= k)
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}


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

int main() {

  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++)
    cin >> a[i];
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] >= k)
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}
Problem p02898 (C++)

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

int main() {

  int n, k, c = 0, i;
  int h[500];

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

  for (i = 0; i < n; i++) {
    if (h[i] >= k) {
      c++;
    }
  }

  cout << c << endl;
  return 0;
}


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

int main() {

  int n, k, c = 0, i;
  int h[100000];

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

  for (i = 0; i < n; i++) {
    if (h[i] >= k) {
      c++;
    }
  }

  cout << c << endl;
  return 0;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  int k;
  cin >> k;
  int j = 0;
  int h[500];
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }

  for (int i = 0; i < n; i++) {
    if (k <= h[i]) {
      j++;
    }
  }
  cout << j;

  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  int k;
  cin >> k;
  int j = 0;
  int h[n];
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }

  for (int i = 0; i < n; i++) {
    if (k <= h[i]) {
      j++;
    }
  }
  cout << j;

  return 0;
}
Problem p02898 (C++)

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

using namespace std;

int main() {
  int N, K;
  int array[10000] = {};

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

  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (array[i] >= K) {
      // 乗れる
      cnt++;
    }
  }

  cout << cnt << endl;

  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

int main() {
  int N, K;
  int array[100000] = {};

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

  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (array[i] >= K) {
      // 乗れる
      cnt++;
    }
  }

  cout << cnt << endl;

  return 0;
}
Problem p02898 (C++)

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

using namespace std;

int h[510];

int main() {
  int N, K;
  cin >> N >> K;
  for (int i = 0; i < N; ++i) {
    cin >> h[i];
  }
  int cnt = 0;
  for (int i = 0; i < N; ++i) {
    if (h[i] >= K)
      cnt++;
  }
  cout << cnt << endl;
}


Fixed submission:
#include <iostream>

using namespace std;

int h[100100];

int main() {
  int N, K;
  cin >> N >> K;
  for (int i = 0; i < N; ++i) {
    cin >> h[i];
  }
  int cnt = 0;
  for (int i = 0; i < N; ++i) {
    if (h[i] >= K)
      cnt++;
  }
  cout << cnt << endl;
}
Problem p02898 (C++)

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

int main() {
  int n, k, i, count;
  vector<int> h(500);
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> h.at(i);
  }

  count = 0;
  for (i = 0; i < n; i++) {
    if (h.at(i) >= k)
      count++;
  }
  cout << count << endl;
  return 0;
}

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

int main() {
  int n, k, i, count;
  vector<int> h(100000);
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> h.at(i);
  }

  count = 0;
  for (i = 0; i < n; i++) {
    if (h.at(i) >= k)
      count++;
  }
  cout << count << endl;
  return 0;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  int count = 0;
  vector<int> wtf(K);
  for (int i = 0; i < N; i++) {
    cin >> wtf.at(i);
    if (wtf.at(i) >= K) {
      count++;
    }
  }
  cout << count << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  int count = 0;
  vector<int> wtf(N);
  for (int i = 0; i < N; i++) {
    cin >> wtf.at(i);
    if (wtf.at(i) >= K) {
      count++;
    }
  }
  cout << count << endl;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main(void) {
  int N, K, h[500], a;
  cin >> N >> K;
  for (int i = 1; i <= N; i++) {
    cin >> h[i];
  }
  a = 0;
  for (int i = 1; i <= N; i++) {
    if (h[i] >= K) {
      a = a + 1;
    }
  }
  cout << a << endl;

  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main(void) {
  int N, K, h[100000], a;
  cin >> N >> K;
  for (int i = 1; i <= N; i++) {
    cin >> h[i];
  }
  a = 0;
  for (int i = 1; i <= N; i++) {
    if (h[i] >= K) {
      a = a + 1;
    }
  }
  cout << a << endl;

  return 0;
}
Problem p02898 (C++)

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

int main() {
  int n, k;
  cin >> n >> k;

  int h[k];
  rep(i, n) cin >> h[i];

  int ans = 0;

  rep(i, n) {
    if (h[i] >= k)
      ans++;
  }

  cout << ans << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
typedef long long lint;

int main() {
  int n, k;
  cin >> n >> k;

  int h[n];
  rep(i, n) cin >> h[i];

  int ans = 0;

  rep(i, n) {
    if (h[i] >= k)
      ans++;
  }

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

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

int main() {
  int N, K;
  int height[100];

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

  int count = 0;
  for (int i = 0; i < N; i++) {
    if (height[i] >= K) {
      count++;
    }
  }

  cout << count << endl;

  return 0;
}


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

int main() {
  int N, K;
  int height[100000];

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

  int count = 0;
  for (int i = 0; i < N; i++) {
    if (height[i] >= K) {
      count++;
    }
  }

  cout << count << endl;

  return 0;
}
Problem p02898 (C++)

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

int main() {
  int N, K;
  cin >> N >> K;
  int h[500];
  int result = 0;
  for (int i = 0; i < N; i++) {
    cin >> h[i];
    if (h[i] >= K) {
      result++;
    }
  }

  cout << result << endl;
  return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  int h[100000];
  int result = 0;
  for (int i = 0; i < N; i++) {
    cin >> h[i];
    if (h[i] >= K) {
      result++;
    }
  }

  cout << result << endl;
  return 0;
}
Problem p02898 (C++)

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

int main() {
  int n, k;
  cin >> n >> k;
  int h[510];
  for (int i = 0; i < n; i++)
    cin >> h[i];
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (h[i] >= k)
      cnt++;
  }
  cout << cnt << endl;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  int h[100010];
  for (int i = 0; i < n; i++)
    cin >> h[i];
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (h[i] >= k)
      cnt++;
  }
  cout << cnt << endl;
}
Problem p02898 (C++)

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

using namespace std;

int main() {
  int n;
  cin >> n;
  int k;
  cin >> k;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int h;
    cin >> h;
    if (h >= k)
      ans++;
  }
  return ans;
}


Fixed submission:
#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  int k;
  cin >> k;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int h;
    cin >> h;
    if (h >= k)
      ans++;
  }
  cout << ans << endl;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define maxn (int)(1e5)
#define i64 long long
#define pii pair<i64, i64>
#define all(x) x.begin(), x.end()
#define LB(x, v) lower_bound(all(x), v) - x.begin()
#define fread() freopen("in.txt", "r", stdin);
using namespace std;
int h[110];

int solve(int n, int k) {
  int ans = 0;
  for (int i = 0; i < n; i++)
    if (h[i] >= k)
      ans++;
  return ans;
}

int main() {
  /*BEFORE SUBMIT, CHECK
  sample i/o format
  statements for debugging are removed/comment out
  global values / stl containers are initialized/cleared for each test (if
  needed) all array size are sufficient loop variable or output value doesn't
  cross min/max limit of input
  // */

  int n, k;
  while (scanf("%d %d", &n, &k) == 2) {
    for (int i = 0; i < n; i++)
      scanf("%d", &h[i]);
    printf("%d\n", solve(n, k));
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define maxn (int)(1e5)
#define i64 long long
#define pii pair<i64, i64>
#define all(x) x.begin(), x.end()
#define LB(x, v) lower_bound(all(x), v) - x.begin()
#define fread() freopen("in.txt", "r", stdin);
using namespace std;
int h[maxn + 2];

int solve(int n, int k) {
  int ans = 0;
  for (int i = 0; i < n; i++)
    if (h[i] >= k)
      ans++;
  return ans;
}

int main() {
  /*BEFORE SUBMIT, CHECK
  sample i/o format
  statements for debugging are removed/comment out
  global values / stl containers are initialized/cleared for each test (if
  needed) all array size are sufficient loop variable or output value doesn't
  cross min/max limit of input
  // */

  int n, k;
  while (scanf("%d %d", &n, &k) == 2) {
    for (int i = 0; i < n; i++)
      scanf("%d", &h[i]);
    printf("%d\n", solve(n, k));
  }
  return 0;
}
Problem p02898 (C++)

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

int main() {
  int n, k, i, ara[max], cnt = 0;
  scanf("%d %d", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%d", &ara[i]);
  }
  for (i = 0; i < n; i++) {
    if (ara[i] >= k)
      cnt++;
  }

  printf("%d", cnt);
}


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

int main() {
  int n, k, i, ara[100005], cnt = 0;
  scanf("%d %d", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%d", &ara[i]);
  }
  for (i = 0; i < n; i++) {
    if (ara[i] >= k)
      cnt++;
  }

  printf("%d", cnt);
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int h[1000];
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (h[i] >= k)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int h[200000];
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (h[i] >= k)
      ans++;
  }
  cout << ans << endl;
  return 0;
}