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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <queue>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long int ll;

using namespace std;

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

  int i, j, k;
  long n, m, tmp;
  int a[10000];
  int num = 0;
  string s[200000];

  cin >> n >> k;
  rep(i, n) cin >> a[i];
  rep(i, n) {
    if (a[i] >= k) {
      num++;
    }
  }

  cout << num << endl;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <queue>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long int ll;

using namespace std;

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

  int i, j, k;
  long n, m, tmp;
  int a[100000];
  int num = 0;
  string s[200000];

  cin >> n >> k;
  rep(i, n) cin >> a[i];
  rep(i, n) {
    if (a[i] >= k) {
      num++;
    }
  }

  cout << num << endl;

  return 0;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <iomanip>
#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 <iomanip>
#include <iostream>
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  int h[100002];
  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 <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main(void) {
  int N, K;
  scanf("%d %d", &N, &K);

  vector<int> H(510);
  for (int i = 0; i < N; i++) {
    scanf("%d", &H[i]);
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (K <= H[i]) {
      ans++;
    }
  }

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

Fixed submission:
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main(void) {
  int N, K;
  scanf("%d %d", &N, &K);

  vector<int> H(N + 10);
  for (int i = 0; i < N; i++) {
    scanf("%d", &H[i]);
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (K <= H[i]) {
      ans++;
    }
  }

  printf("%d\n", ans);
}
Problem p02898 (C++)

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


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

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

int main() {
  int N = 0;
  int K = 0;
  int A = 0;
  cin >> N >> K;
  vector<int> H(K);

  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
  }

  for (int j = 0; j < N; j++) {
    if (H.at(j) >= K) {
      A += 1;
    }
  }

  cout << A << endl;
}


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

int main() {
  int N = 0;
  int K = 0;
  int A = 0;
  cin >> N >> K;
  vector<int> H(N);

  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
  }

  for (int j = 0; j < N; j++) {
    if (H.at(j) >= K) {
      A += 1;
    }
  }

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

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define for_p(i, a, b) for (int i = a; i < b; i++)
#define for_m(i, a, b) for (int i = a - 1; i >= b; i--)

// a = s1.size();
// vector<string> s1;
// string s2 = accumulate( s1.begin(), s1.end(), string() );

using namespace std;

int main() {
  int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
  int i = 0, j = 0;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  int a1[256], a2[512], a3[1024];
  char s1[200000], s2[200000], s3[200000];

  cin >> a >> b;

  for (i = 0; i < a; i++) {
    cin >> a1[i];
    if (b <= a1[i]) {
      c++;
    }
  }
  cout << c << endl;
}


Fixed submission:
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define for_p(i, a, b) for (int i = a; i < b; i++)
#define for_m(i, a, b) for (int i = a - 1; i >= b; i--)

// a = s1.size();
// vector<string> s1;
// string s2 = accumulate( s1.begin(), s1.end(), string() );

using namespace std;

int main() {
  int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
  int i = 0, j = 0;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  int a1[100000], a2[512], a3[1024];
  char s1[200000], s2[200000], s3[200000];

  cin >> a >> b;

  for (i = 0; i < a; i++) {
    cin >> a1[i];
    if (b <= a1[i]) {
      c++;
    }
  }
  cout << c << endl;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int a[505];
int main() {
  int n, m, cnt = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    cin >> a[i];
  for (int i = 1; i <= n; i++) {
    if (a[i] >= m)
      cnt++;
  }
  cout << cnt;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int a[100005];
int main() {
  int n, m, cnt = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    cin >> a[i];
  for (int i = 1; i <= n; i++) {
    if (a[i] >= m)
      cnt++;
  }
  cout << cnt;
  return 0;
}
Problem p02898 (C++)

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

int main() {
  int N, K;
  int h[500];
  cin >> N >> K;
  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;
}

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

int main() {
  int N, K;
  int h[(int)1e+5];
  cin >> N >> K;
  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;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define for0(i, N) for (int i = 0; i < (N); ++i)
#define for1n(i, N) for (int i = 1; i <= (N); ++i)
#define for1(i, N) for (int i = 1; i < (N); ++i)
#define forn(i, N) for (int i = 0; i <= (N); ++i)
#define forx(i, N, x) for (int i = (x); i < (N); ++i)
#define forl(i, N, x, a)                                                       \
  for (int i = (x), a = 0; a < (N); i = (i + 1) % (N), ++a)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;

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

  int N, K, result = 0;
  cin >> N >> K;

  int h[500] = {};

  for0(i, N) {
    cin >> h[i];
    if (h[i] >= K)
      ++result;
  }

  cout << result;

  return 0;
}


Fixed submission:
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define for0(i, N) for (int i = 0; i < (N); ++i)
#define for1n(i, N) for (int i = 1; i <= (N); ++i)
#define for1(i, N) for (int i = 1; i < (N); ++i)
#define forn(i, N) for (int i = 0; i <= (N); ++i)
#define forx(i, N, x) for (int i = (x); i < (N); ++i)
#define forl(i, N, x, a)                                                       \
  for (int i = (x), a = 0; a < (N); i = (i + 1) % (N), ++a)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;

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

  int N, K, result = 0;
  cin >> N >> K;

  int h[100000] = {};

  for0(i, N) {
    cin >> h[i];
    if (h[i] >= K)
      ++result;
  }

  cout << result;

  return 0;
}
Problem p02898 (C++)

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

int main() {
  long n;
  int k, a, cc;
  cin >> n >> k;
  vector<long> data(500);
  for (long i = 0; i < n; i++) {
    cin >> a;
    data.at(i) = a;
  }

  cc = 0;
  for (long i = 0; i < n; i++) {
    if (data.at(i) >= k) {
      cc++;
    }
  }
  cout << cc << endl;
}


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

int main() {
  long n;
  int k, a, cc;
  cin >> n >> k;
  vector<long> data(1000000);
  for (long i = 0; i < n; i++) {
    cin >> a;
    data.at(i) = a;
  }

  cc = 0;
  for (long i = 0; i < n; i++) {
    if (data.at(i) >= k) {
      cc++;
    }
  }
  cout << cc << endl;
}
Problem p02898 (C++)

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

int main() {
  int N, K;
  vector<int> h(N);
  for (int i = 0; i < N; i++) {
    cin >> h.at(i);
  }
  sort(h.begin(), h.end());
  reverse(h.begin(), h.end());
  int i = 0;
  while (h.at(i) >= K) {
    i++;
    if (i == N) {
      break;
    }
  }
  cout << i << endl;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  for (int i = 0; i < N; i++) {
    cin >> h.at(i);
  }
  sort(h.begin(), h.end());
  reverse(h.begin(), h.end());
  int i = 0;
  while (h.at(i) >= K) {
    i++;
    if (i == N) {
      break;
    }
  }
  cout << i << endl;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
// #include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  int N, K;
  int sum = 0;
  cin >> N >> K;
  vector<int> vi(K);
  for (int i = 0; i < N; i++) {
    cin >> vi[i];
  }
  for (int i = 0; i < N; i++) {
    if (vi[i] >= K) {
      sum++;
    }
  }
  cout << sum << endl;
}

Fixed submission:
// #include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  int N, K;
  int sum = 0;
  cin >> N >> K;
  vector<int> vi(N);
  for (int i = 0; i < N; i++) {
    cin >> vi[i];
  }
  for (int i = 0; i < N; i++) {
    if (vi[i] >= K) {
      sum++;
    }
  }
  cout << sum << endl;
}
Problem p02898 (C++)

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

  cout << count << endl;
}

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

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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int odd(int n, int A[], int k) {
  int i, j = 0;
  for (i = 0; i < n; i++) {
    if (A[i] >= k) {
      j++;
    }
  }

  return j;
}
int main() {
  int p, u;
  int c, B[1000], b;
  cin >> p >> c;
  for (u = 0; u < p; u++) {
    cin >> B[u];
  }
  b = odd(p, B, c);
  cout << b << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int odd(int n, int A[], int k) {
  int i, j = 0;
  for (i = 0; i < n; i++) {
    if (A[i] >= k) {
      j++;
    }
  }

  return j;
}
int main() {
  int p, u;
  int c, B[100005], b;
  cin >> p >> c;
  for (u = 0; u < p; u++) {
    cin >> B[u];
  }
  b = odd(p, B, c);
  cout << b << endl;
  return 0;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int h[1000] = {};
int main() {
  int N, K;
  cin >> N >> K;
  int cnt = 0;
  rep(i, N) {
    cin >> h[i];
    if (h[i] >= K) {
      cnt++;
    }
  }

  cout << cnt << endl;
}


Fixed submission:
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int h[100010] = {};
int main() {
  int N, K;
  cin >> N >> K;
  int cnt = 0;
  rep(i, N) {
    cin >> h[i];
    if (h[i] >= K) {
      cnt++;
    }
  }

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

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace ::std;
int N, K;
int main() {

  int h[505] = {0};
  int ans = 0;
  cin >> N >> K;
  for (int i = 1; i <= N; ++i) {
    cin >> h[i];
    if (h[i] >= K) {
      ++ans;
    }
  }
  cout << ans;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace ::std;
int N, K;
int main() {

  int h[100000] = {0};
  int ans = 0;
  cin >> N >> K;
  for (int i = 1; i <= N; ++i) {
    cin >> h[i];
    if (h[i] >= K) {
      ++ans;
    }
  }
  cout << ans;
  return 0;
}
Problem p02898 (C++)

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

using namespace std;

int main() {
  int n, k;
  int arr[50];

  cin >> n >> k;
  for (int i = 0; i < n; i++)
    cin >> arr[i];

  int count = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] >= k)
      count++;
  }

  cout << count;
  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

int main() {
  int n, k;
  int arr[100000];

  cin >> n >> k;
  for (int i = 0; i < n; i++)
    cin >> arr[i];

  int count = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] >= k)
      count++;
  }

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

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

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


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

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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <cctype>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
std::string line;
typedef long long ll;

int main() {
  int n, k;
  cin >> n >> k;
  int h[10010] = {0};
  rep(i, n) cin >> h[i];

  sort(h, h + n, greater<int>());

  int cnt = 0;
  rep(i, n) {
    if (k <= h[i])
      cnt++;
  }

  cout << cnt << endl;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#include <cctype>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
std::string line;
typedef long long ll;

int main() {
  int n, k;
  cin >> n >> k;
  int h[100010] = {0};
  rep(i, n) cin >> h[i];

  sort(h, h + n, greater<int>());

  int cnt = 0;
  rep(i, n) {
    if (k <= h[i])
      cnt++;
  }

  cout << cnt << endl;

  return 0;
}
Problem p02898 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

int main(void) {
  int n = 0, k = 0, a = 0;
  scanf("%d", &n);
  scanf("%d", &k);
  int h[n + 1];

  for (int i = 1; i = n; i++) {
    scanf("%d", &h[i]);
    if (h[i] >= k) {
      a++;
    }
  }
  printf("%d\n", a);
}

Fixed submission:
#include <iostream>

int main(void) {
  int n = 0, k = 0, a = 0;
  scanf("%d", &n);
  scanf("%d", &k);
  int h[n + 1];

  for (int i = 1; i <= n; i++) {
    scanf("%d", &h[i]);
    if (h[i] >= k) {
      a++;
    }
  }
  printf("%d\n", a);
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// #include <tr1/unordered_map>
#include <iostream>
#define maxn 10005
#define M 1000000007
using namespace std;
// using namespace tr1;
int main() {
  int n, k, num = 0;
  scanf("%d%d", &n, &k);
  int a[maxn];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] >= k)
      num++;
  }
  printf("%d", num);
  return 0;
}


Fixed submission:
#include <algorithm>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// #include <tr1/unordered_map>
#include <iostream>
#define maxn 100005
#define M 1000000007
using namespace std;
// using namespace tr1;
int main() {
  int n, k, num = 0;
  scanf("%d%d", &n, &k);
  int a[maxn];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] >= k)
      num++;
  }
  printf("%d", num);
  return 0;
}
Problem p02898 (C++)

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


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int cnt = 0;
int a[100005];
int main() {
  int n, h;
  cin >> n >> h;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (h <= a[i]) {
      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 = 0, k = 0;
  cin >> n >> k;
  assert(n > 0 && 10000 >= n);
  assert(k > 0 && 500 >= k);

  int answer = 0;
  for (int i = 0; i < n; i++) {
    int h = 0;
    cin >> h;
    assert(h > 0 && h <= 500);
    if (h >= k)
      answer++;
  }

  cout << answer << endl;

  return 0;
}


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

using namespace std;

int main() {
  int n = 0, k = 0;
  cin >> n >> k;
  assert(n > 0 && 100000 >= n);
  assert(k > 0 && 500 >= k);

  int answer = 0;
  for (int i = 0; i < n; i++) {
    int h = 0;
    cin >> h;
    assert(h > 0 && h <= 500);
    if (h >= k)
      answer++;
  }

  cout << answer << endl;

  return 0;
}
Problem p02898 (C++)

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

int main() {
  int n, k;
  int h[11000];

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

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

  cout << count << endl;
}

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

int main() {
  int n, k;
  int h[110000];

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

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

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

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

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int n, o, p, k, i, x = 0, y;
  cin >> n >> k;
  o = n;
  p = n;
  int h[100000];
  for (i = 0; i < o; i++) {
    cin >> h[i];
  }
  for (y = 0; y < p; y++) {
    if (h[y] >= k) {
      x++;
    }
  }
  cout << x << endl;
}
Problem p02898 (C++)

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

int main() {
  int n, k;
  int h[550];
  int cot = 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)
      ++cot;
  }
  cout << cot;
}

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

int main() {
  int n, k;
  int h[1000000];
  int cot = 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)
      ++cot;
  }
  cout << cot;
}
Problem p02898 (C++)

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

int A[1000];

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  rep(i, n) scanf("%d", &A[i]);
  int sum = 0;
  rep(i, n) if (A[i] >= k) sum++;
  printf("%d", sum);
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define m0(x) memset(x, 0, sizeof(x))

int A[100000];

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  rep(i, n) scanf("%d", &A[i]);
  int sum = 0;
  rep(i, n) if (A[i] >= k) sum++;
  printf("%d", sum);
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> h(501);
  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 += 1;
  }
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<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 += 1;
  }
  cout << ans << endl;
}
Problem p02898 (C++)

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

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

  vector<int> h(10010);
  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;

  vector<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>
#include <string>
using namespace std;

int main() {
  int N, K, h[10100], ans = 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) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int N, K, h[102000], ans = 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) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02898 (C++)

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

int main() {
  int N, K;
  int h[501];
  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 << endl;
}

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

int main() {
  int N, K;
  int h[100001];
  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 << endl;
}
Problem p02898 (C++)

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

int main() {
  int N, K, h[1000];
  cin >> N >> K;

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

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

  cout << count << endl;
}

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

int main() {
  int N, K, h[1000000];
  cin >> N >> K;

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

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

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

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int n, k;
  int h[10000];

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

  int count = 0;

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

  cout << count << endl;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int n, k;
  int h[100000];

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

  int count = 0;

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

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

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

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

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

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

Buggy submission (status: Runtime Error):
#include <stdio.h>
int main(void) {
  int N, K, A = 0;

  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; i++) {
    int h;
    scanf("%d", h);
    if (h >= K) {
      A++;
    }
  }
  printf("%d", A);
  return 0;
}

Fixed submission:
#include <stdio.h>
int main(void) {
  int N, K, A = 0;

  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; i++) {
    int h;
    scanf("%d", &h);
    if (h >= K) {
      A++;
    }
  }
  printf("%d", A);
  return 0;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main() {
  int n;
  cin >> n;
  int k;
  cin >> k;
  int a[505];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] >= k)
      ans++;
  }
  cout << ans;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main() {
  int n;
  cin >> n;
  int k;
  cin >> k;
  int a[100005];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] >= k)
      ans++;
  }
  cout << ans;
}
Problem p02898 (C++)

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

using namespace std;

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

Fixed submission:
#include <iostream>

using namespace std;

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

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main(void) {
  // Your code here!
  int N, K, ans = 0;
  int h[505];
  scanf("%d%d", &N, &K);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &h[i]);
  }
  for (int i = 1; i <= N; i++) {
    if (h[i] >= K)
      ans++;
  }
  printf("%d", ans);
}


Fixed submission:
#include <iostream>
using namespace std;
int main(void) {
  // Your code here!
  int N, K, ans = 0;
  int h[100005];
  scanf("%d%d", &N, &K);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &h[i]);
  }
  for (int i = 1; i <= N; i++) {
    if (h[i] >= K)
      ans++;
  }
  printf("%d", ans);
}
Problem p02898 (C++)

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

int main() {
  int n;
  int k;
  int i;
  int a;
  int h[500];
  cin >> n;
  cin >> k;
  a = n;
  for (i = 0; i < n; i++) {
    cin >> h[i];
    if (h[i] < k) {
      a = a - 1;
    }
  }
  cout << a << endl;

  return 0;
}


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

int main() {
  int n;
  int k;
  int i;
  int a;
  int h[100000];
  cin >> n;
  cin >> k;
  a = n;
  for (i = 0; i < n; i++) {
    cin >> h[i];
    if (h[i] < k) {
      a = a - 1;
    }
  }
  cout << a << endl;

  return 0;
}
Problem p02898 (C++)

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

Fixed submission:
#include <iostream>
using namespace std;
int main(void) {
  int a[100000], n, k, i, cnt = 0;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (k <= a[i])
      cnt += 1;
  }
  cout << cnt << endl;
  return 0;
}
Problem p02898 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
#define MAX_NUM 10 ^ 5

int main() {
  int N, K, h[MAX_NUM], can_ride = 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)
      can_ride++;
  }
  cout << can_ride << endl;
  return 0;
}

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

int main() {
  int N, K, h[MAX_NUM], can_ride = 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)
      can_ride++;
  }
  cout << can_ride << endl;
  return 0;
}
Problem p02899 (C++)

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

int main() {
  int N, i, n, a[10001] = {0}, b[10001] = {0}, t;
  cin >> N;
  for (i = 1; i <= N; i++) {
    cin >> n;
    a[i] = n;
  }

  for (i = 1; i <= N; i++) {
    t = a[i];    // t=2
    b[a[t]] = t; // b[a[2]]=2
    // cout<<a[i]<<endl;
  }

  for (i = 1; i <= N; i++) {
    cout << b[i] << " ";
  }
}


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

int main() {
  int N, i, n, a[100001] = {0}, b[100001] = {0}, t;
  cin >> N;
  for (i = 1; i <= N; i++) {
    cin >> n;
    a[i] = n;
  }

  for (i = 1; i <= N; i++) {
    t = a[i];    // t=2
    b[a[t]] = t; // b[a[2]]=2
    // cout<<a[i]<<endl;
  }

  for (i = 1; i <= N; i++) {
    cout << b[i] << " ";
  }
}
Problem p02899 (C++)

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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> vec(N, vector<int>(N));
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i).at(0);
    vec.at(i).at(1) = i + 1;
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < N; i++) {
    cout << vec.at(i).at(1);
    if (i == N - 1) {
      cout << endl;
    } else {
      cout << " ";
    }
  }
}

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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> vec(N, vector<int>(2));
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i).at(0);
    vec.at(i).at(1) = i + 1;
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < N; i++) {
    cout << vec.at(i).at(1);
    if (i == N - 1) {
      cout << endl;
    } else {
      cout << " ";
    }
  }
}
Problem p02899 (C++)

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

#define LINF 1e18
#define INF 1e9

using namespace std;

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

  for (int i = 1; i <= N; i++) {
    cout << attend[i] << " ";
  }
  cout << endl;
}

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

#define LINF 1e18
#define INF 1e9

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> attend(N + 5);
  for (int i = 1; i <= N; i++) {
    int A;
    cin >> A;
    attend[A] = i;
  }

  for (int i = 1; i <= N; i++) {
    cout << attend[i] << " ";
  }
  cout << endl;
}
Problem p02899 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i <= end; i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> auto MAX(const T &a) {
  return *max_element(a.begin(), a.end());
}
template <class T> auto MIN(const T &a) {
  return *min_element(a.begin(), a.end());
}
template <class T, class U> U SUM(const T &a, const U &v) {
  return accumulate(a.begin(), a.end(), v);
}
template <class T, class U> U COUNT(const T &a, const U &v) {
  return count(a.begin(), a.end(), v);
}
template <class T, class U> int LOWER(const T &a, const U &v) {
  return lower_bound(a.begin(), a.end(), v) - a.begin();
}
template <class T, class U> int UPPER(const T &a, const U &v) {
  return upper_bound(a.begin(), a.end(), v) - a.begin();
}
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }
int LCM(int a, int b) {
  int g = GCD(a, b);
  return a / g * b;
}

int main(void) {
  // Your code here!
  int n;
  cin >> n;
  vector<int> a(n + 1);
  rep(i, n) cin >> a[i + 1];
  rep(i, n) {
    vector<int>::iterator itr;
    int wanted = i + 1;
    itr = find(a.begin(), a.end(), wanted);
    size_t index = distance(a.begin(), itr);
    cout << index << " ";
  }
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i <= end; i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> auto MAX(const T &a) {
  return *max_element(a.begin(), a.end());
}
template <class T> auto MIN(const T &a) {
  return *min_element(a.begin(), a.end());
}
template <class T, class U> U SUM(const T &a, const U &v) {
  return accumulate(a.begin(), a.end(), v);
}
template <class T, class U> U COUNT(const T &a, const U &v) {
  return count(a.begin(), a.end(), v);
}
template <class T, class U> int LOWER(const T &a, const U &v) {
  return lower_bound(a.begin(), a.end(), v) - a.begin();
}
template <class T, class U> int UPPER(const T &a, const U &v) {
  return upper_bound(a.begin(), a.end(), v) - a.begin();
}
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }
int LCM(int a, int b) {
  int g = GCD(a, b);
  return a / g * b;
}

int main(void) {
  // Your code here!
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> rev(n);
  rep(i, n) { rev[a[i] - 1] = i + 1; }
  rep(i, n) cout << rev[i] << " ";
}
Problem p02899 (Python)

Buggy submission (status: Time Limit Exceeded):
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = list(map(int, input().split()))
    print(*[S.index(i + 1) + 1 for i in range(N)])


if __name__ == "__main__":
    main()


Fixed submission:
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))

    result = []
    for i, a in enumerate(A, start=1):
        result.append([i, a])
    result = sorted(result, key=lambda x: x[1])

    print(*[i for i, a in result])


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

Buggy submission (status: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

for i in range(1, N + 1):
    print(A.index(i) + 1, end=" ")


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

import numpy as np

A = np.array(A)
print(" ".join([str(i + 1) for i in A.argsort()]))
Problem p02899 (C++)

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

int main() {
  int n, val, arr[10001];
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> val;
    arr[val] = i;
  }

  for (int i = 1; i <= n; i++)
    cout << arr[i] << " ";

  return 0;
}

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

int main() {
  int n, val, arr[100001];
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> val;
    arr[val] = i;
  }

  for (int i = 1; i <= n; i++)
    cout << arr[i] << " ";

  return 0;
}
Problem p02899 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  int n, a[50001], A;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> A;
    a[A] = i;
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int n, a[100001], A;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> A;
    a[A] = i;
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
Problem p02899 (C++)

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

int main() {
  int a[10000];
  int i, j, n;

  cin >> n;

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

  for (i = 0; i < n; i++) {
    cout << a[i] << " ";
  }

  cout << "\n";

  return 0;
}

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

int main() {
  int a[100000];
  int i, j, n;

  cin >> n;

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

  for (i = 0; i < n; i++) {
    cout << a[i] << " ";
  }

  cout << "\n";

  return 0;
}
Problem p02899 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10010;
int N;
int li[MAXN];
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    int x;
    cin >> x;
    li[x] = i;
  }
  for (int i = 1; i <= N; i++) {
    cout << li[i] << " ";
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int N;
int li[MAXN];
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    int x;
    cin >> x;
    li[x] = i;
  }
  for (int i = 1; i <= N; i++) {
    cout << li[i] << " ";
  }
  return 0;
}
Problem p02899 (C++)

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i, n; i++) {
    cin >> a[i];
  }

  vector<int> reverse(n);
  for (int j = 0; j < n; j++) {
    reverse[a[j] - 1] = j + 1;
  }
  for (int i = 0; i < n; i++) {
    cout << reverse[i] << endl;
  }
}

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

using namespace std;

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

  vector<int> reverse(n);
  for (int j = 0; j < n; j++) {
    reverse[a[j] - 1] = j + 1;
  }
  for (int i = 0; i < n; i++) {
    cout << reverse[i] << endl;
  }
}
Problem p02899 (C++)

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a.at(j) == i + 1) {
        b.at(i) = j + 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << b.at(i) << " ";
    if (i == n - 1) {
      cout << endl;
    }
  }
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < n; i++) {
    b.at(a.at(i) - 1) = i + 1;
  }
  for (int i = 0; i < n; i++) {
    cout << b.at(i) << " ";
    if (i == n - 1) {
      cout << endl;
    }
  }
}
Problem p02899 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main(void) {
  // Your code here!
  int N;
  cin >> N;
  int a[N], b[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    for (int k = 1; k <= N; k++) {
      if (a[i] == k) {
        b[k - 1] = i + 1;
      }
    }
  }
  for (int i = 0; i < N - 1; i++) {
    cout << b[i] << " ";
  }
  cout << b[N - 1] << endl;
}


Fixed submission:
#include <iostream>
using namespace std;
int main(void) {
  // Your code here!
  int N;
  cin >> N;
  int a[N], b[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    b[a[i] - 1] = i + 1;
  }
  for (int i = 0; i < N - 1; i++) {
    cout << b[i] << " ";
  }
  cout << b[N - 1] << endl;
}
Problem p02899 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <vector>

using namespace std;

int main() {
  // 人数入力
  int num;
  cin >> num;

  // 教室にいた人数を保存
  vector<int> vecNum(num);
  for (int i = 0; i < num; i++) {
    cin >> vecNum.at(i);
  }

  // 順番を探索
  vector<int> vecAns;
  for (int i = 1; i <= num; i++) {
    for (int j = 0; j < num; j++) {
      if (vecNum[j] == i) {
        vecAns.push_back(j + 1);
      }
    }
  }

  // 出力
  for (int i = 0; i < num; i++) {
    cout << vecAns[i] << " ";

    if (i == num - 1) {
      cout << endl;
    }
  }

  return 0;
}

Fixed submission:
#include <iostream>
#include <vector>

using namespace std;

int main() {
  // 人数入力
  int num;
  cin >> num;

  // 教室にいた人数を保存
  vector<int> vecNum(num);
  for (int i = 0; i < num; i++) {
    cin >> vecNum.at(i);
  }

  // 順番を探索
  vector<int> vecAns(num);
  for (int i = 0; i < num; i++) {
    vecAns.at(vecNum[i] - 1) = i + 1;
  }

  // 出力
  for (int i = 0; i < num; i++) {
    cout << vecAns[i] << " ";

    if (i == num - 1) {
      cout << endl;
    }
  }

  return 0;
}
Problem p02899 (C++)

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

int main() {
  long long N;

  pair<int, int> p[10007];

  cin >> N;

  for (int i = 1; i <= N; i++) {
    cin >> p[i - 1].first;
    p[i - 1].second = i;
  }

  sort(p, p + N);

  for (int i = 1; i <= N; i++) {
    cout << p[i - 1].second << " ";
  }

  cout << endl;
}

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

int main() {
  long long N;

  pair<int, int> p[100007];

  cin >> N;

  for (int i = 1; i <= N; i++) {
    cin >> p[i - 1].first;
    p[i - 1].second = i;
  }

  sort(p, p + N);

  for (int i = 1; i <= N; i++) {
    cout << p[i - 1].second << " ";
  }

  cout << endl;
}
Problem p02899 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> b(n);
  rep(i, n + 1) {
    rep(j, n) {
      if (a[j] == i)
        b[i - 1] = j + 1;
    }
  }
  rep(i, n) cout << b[i] << " ";
  cout << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> b(n);
  rep(i, n) { b[a[i] - 1] = i + 1; }
  rep(i, n) cout << b[i] << " ";
  cout << endl;
}
Problem p02899 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int arr[1000000];
int main() {
  int n, temp;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    arr[temp - 1] = i + 1;
  }
  for (int i = 0; i < n; i++)
    cout << arr[i] << " ";
  cout << "\n";

  return 1;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int arr[1000000];
int main() {
  int n, temp;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    arr[temp - 1] = i + 1;
  }
  for (int i = 0; i < n; i++)
    cout << arr[i] << " ";
  cout << "\n";

  return 0;
}
Problem p02899 (C++)

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

using namespace std;

int main(void) {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    p[A[i]] = i;
  }
  for (int i = 1; i <= N; i++) {
    cout << p[i] + 1 << " ";
  }
  cout << endl;
  return 0;
}

Fixed submission:
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> p(N + 1);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    p[A[i]] = i;
  }
  for (int i = 1; i <= N; i++) {
    cout << p[i] + 1 << " ";
  }
  cout << endl;
  return 0;
}
Problem p02899 (C++)

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

int main(void) {
  int N;
  int A[10001];

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

  return 0;
}

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

int main(void) {
  int N;
  int A[100001];

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

  return 0;
}