alexjercan/bugnet huggingface dataset:
Problem p02707 (C++) — buggy submission, verdict: Runtime Error

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

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

  int n;
  cin >> n;
  vector<int> a(n - 1), b(n, 0);
  rep(i, n - 1) {
    cin >> a.at(i);
    b.at(a.at(i) - 1)++;
  }
  rep(i, n) cout << b.at(i) << endl;

  return 0;
}

Error: WA

Fixed submission:

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

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

  int n;
  cin >> n;
  vector<int> a(n - 1), b(n, 0);
  FOR(i, 0, n - 1) { cin >> a.at(i); }
  FOR(i, 0, n - 1) {
    int j = i;
    while (a.at(j) == i + 1) {
      ++b.at(i);
      ++j;
    }
    cout << b.at(i) << endl;
  }
  cout << 0 << endl;

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

#include <iostream>

using namespace std;

int main() {
  int n, j, a[200000], count[200000];

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

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

  for (int i = 0; i < n; i++) {
    cout << count[i] << endl;
  }
}

Error: 0

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int n, j, a[20000], count[20000];

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

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

  for (int i = 0; i < n; i++) {
    cout << count[i] << endl;
  }
}
Problem p02707 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  // Your code here

  int N, count = -1, x;
  cin >> N;
  vector<int> num(N);
  for (int i = 1; i < N; i++) {
    cin >> x;
    num.at(x - 1)++;
  }

  for (int i = 0; i < N; i++) {
    cout << num.at(i) << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  // Your code here

  int N, count = -1;
  cin >> N;
  vector<int> num(N);
  num.at(0) = 1;
  for (int i = 1; i < N; i++) {
    cin >> num.at(i);
  }

  for (int i = 1; i <= N; i++) {
    for (int j = 0; j < N; j++) {
      if (num.at(j) == i)
        count++;
    }
    cout << count << endl;
    count = 0;
  }
}
Problem p02707 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  A.at(0) = 1;
  for (ll i = 0; i < N - 1; i++) {
    cin >> A.at(i + 1);
  }

  vector<ll> B(N);
  for (ll i = 0; i < N; i++) {
    B.at(A.at(i) - 1)++;
  }
  B.at(0)--;

  for (ll i = 0; i < N; i++) {
    cout << B.at(i) << endl;
  }
}

Error: TLE

Fixed submission:

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

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  A.at(0) = 1;
  for (ll i = 0; i < N - 1; i++) {
    cin >> A.at(i + 1);
  }

  vector<ll> B(N);
  for (ll i = 0; i < N; i++) {
    ll count = 0;
    for (ll j = i + 1; j < N; j++) {
      if (A.at(j) == i + 1) {
        count++;
      }
    }
    B.at(i) = count;
  }

  for (ll i = 0; i < N; i++) {
    cout << B.at(i) << endl;
  }
}
Problem p02707 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n - 1], ans[n];
  for (int i = 0; i < n; i++)
    ans[i] = 0;
  for (int i = 0; i < n - 1; i++) {
    cin >> a[i];
    ans[a[i] - 1]++;
  }
  for (int i = 0; i < n; i++)
    cout << ans[i] << endl;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n - 1], ans[n];
  for (int i = 0; i < n; i++)
    ans[i] = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ans[a[i] - 1]++;
  }
  for (int i = 0; i < n; i++)
    cout << ans[i] << endl;
}
Problem p02707 (C++) — buggy submission, verdict: Time Limit Exceeded

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

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

  vector<int> A(N);
  vector<int> B(N);

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

  for (int i = 0; i < N - 1; i++) {
    B.at(A.at(i) - 1) += 1;
  }

  for (int i = 0; i < N - 1; i++) {
    cout << B.at(i) << endl;
  }
  cout << 0 << endl;
}


Error: TLE

Fixed submission:

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

int main() {
  long N;
  cin >> N;
  long M = N - 1;

  vector<long> num(M);
  vector<long> count(N);

  for (long i = 0; i < M; i++) {
    cin >> num.at(i);
  }

  for (long i = 0; i < M; i++) {
    count.at(i) = std::count(num.begin(), num.end(), i + 1);
  }

  for (long i = 0; i < M; i++) {
    cout << count.at(i) << endl;
  }
  cout << 0 << endl;
}
Problem p02707 (C++) — buggy submission, verdict: Runtime Error

// #include "pch.h"
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <ctype.h>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <tuple>
#include <vector>
using namespace std;
// #define int long long
#define rep(i, s, n) for (int i = s; i < n; i++)
#define repe(i, s, n) for (int i = s; i <= n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a, b) a = min((a), (b))
#define chmax(a, b) a = max((a), (b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i, j) ((i < 0 && j < 0) || (i > 0 && j > 0)) ? true : false
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

vector<int> list(200005, 0);

signed main() {
  int N;

  cin >> N;

  for (int i = 1; i < N; i++) {
    int num;
    cin >> num;
    list[num]++;
  }

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

  return 0;
}

Error: 0

Fixed submission:

// #include "pch.h"
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <ctype.h>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <tuple>
#include <vector>
using namespace std;
// #define int long long
#define rep(i, s, n) for (int i = s; i < n; i++)
#define repe(i, s, n) for (int i = s; i <= n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a, b) a = min((a), (b))
#define chmax(a, b) a = max((a), (b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i, j) ((i < 0 && j < 0) || (i > 0 && j > 0)) ? true : false
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

vector<int> list(100005, 0);

signed main() {
  int N;

  cin >> N;

  for (int i = 1; i < N; i++) {
    int num;
    cin >> num;
    list[num]++;
  }

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

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

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

#define pi 3.14159265358979323846
#define ll long long
#define N 200001

int main() {
  ll n;
  cin >> n;
  ll ara[n - 1];
  for (int i = 0; i < n - 1; i++)
    cin >> ara[i];
  ll x;
  ll p[N] = {0};

  for (int i = 0; i < n - 1; i++) {

    x = ara[i];
    p[x]++;
  }
  for (int i = 1; i <= n; i++)
    cout << p[i] << endl;
}


Error: 0

Fixed submission:

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

#define pi 3.14159265358979323846
#define ll long long
#define N 100001

int main() {
  ll n;
  cin >> n;
  ll ara[n - 1];
  for (int i = 0; i < n - 1; i++)
    cin >> ara[i];
  ll x;
  ll p[N] = {0};

  for (int i = 0; i < n - 1; i++) {

    x = ara[i];
    p[x]++;
  }
  for (int i = 1; i <= n; i++)
    cout << p[i] << endl;
}
Problem p02707 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> count(200000, 0);
  for (int i = 0; i < n - 1; i++) {
    int a;
    cin >> a;
    count[a - 1]++;
  }
  for (int i = 0; i < n; i++) {
    cout << count[i] << endl;
  }
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> count(100000, 0);
  for (int i = 0; i < n - 1; i++) {
    int a;
    cin >> a;
    count[a - 1]++;
  }
  for (int i = 0; i < n; i++) {
    cout << count[i] << endl;
  }
  return 0;
}
Problem p02707 (C++) — buggy submission, verdict: Runtime Error

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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 <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  fill((T *)array, (T *)(array + N), val);
}
template <class T1, class T2, class Pred = std::less<T2>>
struct sort_pair_second {
  bool operator()(const std::pair<T1, T2> &left,
                  const std::pair<T1, T2> &right) {
    Pred p;
    return p(left.second, right.second);
  }
};

int a[200010];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;
  rep(i, N - 1) {
    int A;
    cin >> A;
    a[A - 1]++;
  }
  rep(i, N) cout << a[i] << endl;
  return 0;
}

Error: 0

Fixed submission:

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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 <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  fill((T *)array, (T *)(array + N), val);
}
template <class T1, class T2, class Pred = std::less<T2>>
struct sort_pair_second {
  bool operator()(const std::pair<T1, T2> &left,
                  const std::pair<T1, T2> &right) {
    Pred p;
    return p(left.second, right.second);
  }
};

int a[100010];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;
  rep(i, N - 1) {
    int A;
    cin >> A;
    a[A - 1]++;
  }
  rep(i, N) cout << a[i] << endl;
  return 0;
}
Problem p02707 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define repi(i, a, n) for (int i = (int)a; i < (int)(n); i++)
#define ll long long

int main(void) {
  int n;
  std::cin >> n;
  std::vector<int> num(1000005, 0);

  rep(i, n - 1) {
    int t;
    std::cin >> t;
    num[t]++;
  }
  repi(i, 1, n + 1) { std::cout << num[i] << std::endl; }
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define repi(i, a, n) for (int i = (int)a; i < (int)(n); i++)
#define ll long long

int main(void) {
  int n;
  std::cin >> n;
  std::vector<int> num(100005, 0);

  rep(i, n - 1) {
    int t;
    std::cin >> t;
    num[t]++;
  }
  repi(i, 1, n + 1) { std::cout << num[i] << std::endl; }
}
Problem p02707 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
static const int MAX = 1000000;

int main() {
  long long int N;
  long long int A[MAX];
  long long int B[MAX];

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

  for (int i = 1; i < N; i++) {
    B[A[i]] += 1;
  }

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

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int N;
  int A[200000];
  int B[200000];

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

  for (int i = 1; i < N; i++) {
    for (int j = 1; j < N; j++) {
      if (A[j] == i) {
        B[i] = B[i] + 1;
      }
    }
  }

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

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

#include <algorithm>
#include <climits>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main() {
#ifdef RUN_LOCAL
  ifstream in("../input.txt");
  cin.rdbuf(in.rdbuf());
#endif

  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);

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

  for (int i = 0; i < n; ++i) {
    cout << b[i] << endl;
  }

  return 0;
}


Error: -6
double free or corruption (out)


Fixed submission:

#include <algorithm>
#include <climits>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main() {
#ifdef RUN_LOCAL
  ifstream in("../input.txt");
  cin.rdbuf(in.rdbuf());
#endif

  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);

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

  for (int i = 0; i < n; ++i) {
    cout << b[i] << endl;
  }

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



#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {

  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);

  A[0] = 0;
  B[0] = 0;

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

  for (int i = 1; i < N; i++) {
    B[A[i] - 1] += 1;
  }

  for (int i = 0; i < N; i++) {
    cout << B[i] << endl;
  }

  return 0;
}


Error: -6
double free or corruption (out)


Fixed submission:



#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {

  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);

  A[0] = 0;
  B[0] = 0;

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

  for (int i = 0; i < N; i++) {
    B[A[i] - 1] += 1;
  }

  for (int i = 0; i < N; i++) {
    cout << B[i] << endl;
  }

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

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

int main() {
  int N, sum = 0;
  int a[1000000], b[1000000] = {};
  int i = 0;
  cin >> N;

  for (int i = 0; i < N - 1; i++) {
    cin >> a[i];
    b[a[i] - 1]++;
  }
  for (int i = 0; i < N; i++) {
    cout << b[i] << endl;
  }
}


Error: 0

Fixed submission:

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

int main() {
  int N, sum = 0;
  int a[10000], b[10000] = {};
  int i = 0;
  cin >> N;

  for (int i = 0; i < N - 1; i++) {
    cin >> a[i];
    b[a[i] - 1]++;
  }
  for (int i = 0; i < N; i++) {
    cout << b[i] << endl;
  }
}
Problem p02707 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> boss_num(n - 1);
  vector<int> buka_num(n + 1); // 初期化

  rep(i, n - 1) cin >> boss_num.at(i);
  rep(i, n - 1) { buka_num.at(boss_num.at(i))++; }

  for (int i = 1; i < n + 1; ++i) {
    cout << buka_num.at(i) << endl;
  }
  // TLE
  //  rep(i, n){
  //    cout << count(all(boss_num), i+1) << endl;
  //  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> boss_num(n - 1);

  rep(i, n - 1) cin >> boss_num.at(i);

  rep(i, n) { cout << count(all(boss_num), i + 1) << endl; }
}
Problem p02707 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <vector>
using namespace std;

int main() {
  int n, i;
  cin >> n;
  vector<int> ans(n);
  for (i = 1; i < n; i++) {
    int a; // いちいち初期化//
    cin >> a;
    ans[a - 1]++;
  }
  for (i = 0; i < n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
#include <vector>
using namespace std;

int main() {
  int n, i;
  cin >> n;
  vector<int> a(n - 1), ans(n);
  for (i = 2; i <= n; i++)
    cin >> a[i];
  for (i = 2; i <= n; i++)
    ans[a[i]]++;
  for (i = 1; i <= n; i++)
    cout << ans[i] << endl;
  return 0;
}
Problem p02707 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main(void) {
  // Your code here!

  int human_number;
  int __report[2560000], __sums[2560000] = {0};

  cin >> human_number;

  for (int index = 1; index < human_number; index++) {
    cin >> __report[index];
    __sums[__report[index]]++;
  }

  for (int index = 1; index <= human_number; index++) {
    cout << __sums[index] << endl;
  }
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {
  // Your code here!

  int human_number;
  int __report[160000], __sums[160000] = {0};

  cin >> human_number;

  for (int index = 1; index < human_number; index++) {
    cin >> __report[index];
    __sums[__report[index]]++;
  }

  for (int index = 1; index <= human_number; index++) {
    cout << __sums[index] << endl;
  }
}
Problem p02707 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define ll long long
using namespace std;
int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
const double PI = 3.14159265358979323846;
int main() {
  int N;
  cin >> N;
  vector<int> a(N - 1);
  for (int i = 0; i < N - 1; i++) {
    cin >> a.at(i);
  }
  vector<int> b(N);
  for (int i = 0; i < N - 1; i++) {
    b.at(a.at(i) - 1)++;
  }
  for (int i = 0; i < N; i++) {
    cout << b.at(i) << endl;
  }
  return 0;
}

// g++ lo.cpp
// ./a.exe
// g++ -o つくりたいふぁいるめい　もとのふぁいる.cpp
/*
for (int i = 0; i < n - 2; i++) {
  for (int j = i + 1; j < n - 1; j++) {
    int k = 2 * j - i;*/

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long
using namespace std;
int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
const double PI = 3.14159265358979323846;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 1; i <= n; i++) {
    int b = 0;
    for (int j = 0; j < n; j++) {
      cin >> a[j];
      if (a[j] == i) {
        b++;
      }
    }
    cout << b << endl;
  }
  return 0;
}

// g++ lo.cpp
// ./a.exe
// g++ -o つくりたいふぁいるめい　もとのふぁいる.cpp
/*
for (int i = 0; i < n - 2; i++) {
  for (int j = i + 1; j < n - 1; j++) {
    int k = 2 * j - i;*/
Problem p02707 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
using namespace std;

int main() {
  int N;
  int A[220000];

  cin >> N;
  A[1] = 1;
  for (int i = 2; i <= N; ++i)
    cin >> A[i];

  int B[N];
  for (int i = 1; i <= N; ++i) {
    B[i] = 0;
  }
  for (int i = 1; i <= N; ++i) {
    if (i != A[i])
      B[A[i]] += 1;
  }
  for (int i = 1; i <= N; ++i) {
    cout << B[i] << endl;
  }
}

Error: 0

Fixed submission:

#include <iostream>
#include <string>
using namespace std;

int main() {
  int N;
  int A[21000];

  cin >> N;
  A[1] = 1;
  for (int i = 2; i <= N; ++i)
    cin >> A[i];

  int B[N];
  for (int i = 1; i <= N; ++i) {
    B[i] = 0;
  }
  for (int i = 1; i <= N; ++i) {
    if (i != A[i])
      B[A[i]] += 1;
  }
  for (int i = 1; i <= N; ++i) {
    cout << B[i] << endl;
  }
}
Problem p02707 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n, arr[1000000], p = 0;
  memset(arr, 0, sizeof(arr));
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    arr[x]++;
  }
  for (int i = 1; i <= n; i++) {
    cout << arr[i] << "\\n";
  }
  return 0;
}


Error: 0

Fixed submission:

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

int main() {
  int n, arr[10000], p = 0;
  memset(arr, 0, sizeof(arr));
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    arr[x]++;
  }
  for (int i = 1; i <= n; i++) {
    cout << arr[i] << "\\n";
  }
  return 0;
}
Problem p02707 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t N, A, b[200001] = {};
  int64_t i, j, k;

  cin >> N;
  for (i = 2; i <= N; i++) {
    cin >> A;
    b[A]++;
  }
  for (i = 1; i <= N; i++) {
    cout << b[i] << endl;
  }
  return 0;
}


Error: 0

Fixed submission:

// Tariquzzaman Faisal
//_Faisal101_
// IUT_CSE'19
// 190041101

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <stdio.h>
#include <vector>
#define mp make_pair
#define pb push_back
#define pb push_back
#define fileOut freopen("out.txt", "w", stdout)
#define fileIn freopen("in.txt", "r", stdout)
#define testcases                                                              \\
  ll tc, t;                                                                    \\
  cin >> tc;                                                                   \\
  for (t = 1; t <= tc; t++)
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL)
#define pi acos(-1.0)
#define ll long long

using namespace std;

ll ara[100010];

int main() {

  ll n, temp;
  cin >> n;
  for (ll i = 0; i < n - 1; i++) {
    cin >> temp;
    ara[temp]++;
  }
  for (ll i = 1; i <= n; i++) {
    cout << ara[i] << endl;
  }

  return 0;
}