buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
/* @uthor: Amit Kumar user: CodeChef: dr_virus_ ; Codeforces,Hackerearth,Hakerrank: dr_virus; */ #include <bits/stdc++.h> using namespace std; //#include <boost/multiprecision/cpp_int.hpp> // namespace mp = boost::multiprecision; //#define ln mp::cpp_int; #define ll long long #define ld double #define pp pair<l...
/* @uthor: Amit Kumar user: CodeChef: dr_virus_ ; Codeforces,Hackerearth,Hakerrank: dr_virus; */ #include <bits/stdc++.h> using namespace std; //#include <boost/multiprecision/cpp_int.hpp> // namespace mp = boost::multiprecision; //#define ln mp::cpp_int; #define ll long long #define ld double #define pp pair<l...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
172
#include <iostream> using namespace std; int main() { int n, i; cin >> n; int arr[n - 1], freq[n] = {0}; for (i = 2; i <= n; i++) { cin >> arr[i]; freq[arr[i]]++; } for (i = 1; i <= n; i++) cout << freq[i] << endl; return 0; }
#include <iostream> using namespace std; int main() { int n, i; cin >> n; int arr[n - 1], freq[n] = {0}; for (i = 1; i < n; i++) { cin >> arr[i]; freq[arr[i] - 1]++; } for (i = 0; i < n; i++) cout << freq[i] << endl; return 0; }
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
94
#include <bits/stdc++.h> using namespace std; int main() { int n, x; cin >> n; vector<vector<int>> v(n + 1); for (int i = 1; i <= n; i++) { cin >> x; v[x].push_back(i + 1); } for (int i = 1; i <= n; i++) { cout << v[i].size() << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int n, x; cin >> n; vector<vector<int>> v(n + 1); for (int i = 1; i < n; i++) { cin >> x; v[x].push_back(i + 1); } for (int i = 1; i <= n; i++) { cout << v[i].size() << endl; } }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
96
#include <bits/stdc++.h> using namespace std; int main() { long int N; cin >> N; long int A[N - 1]; for (long int i = 0; i < N - 1; i++) { cin >> A[i]; } sort(A, A + N - 1); long int j = 1, k = 0; for (long int i = 0; i < N - 1; i++) { if (A[i] != j) { cout << i - k << endl; k = i; ...
#include <bits/stdc++.h> using namespace std; int main() { long int N; cin >> N; long int A[N - 1]; for (long int i = 0; i < N - 1; i++) { cin >> A[i]; } sort(A, A + N - 1); long int j = 1, k = 0; for (long int i = 0; i < N - 1; i++) { if (A[i] != j) { cout << i - k << endl; k = i; ...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
203
#include <stdio.h> #include <stdlib.h> int main(void) { int N = 0; scanf("%d", &N); int A[N]; int B[N]; for (int i = 0; i < N; i++) { A[i] = 0; B[i] = 0; } for (int i = 1; i < N; i++) { scanf("%d", &A[i]); if (A[i] > 0) B[A[i] - 1] = B[A[i] - 1] + 1; } for (int i = 0; i < N; i++...
#include <stdio.h> #include <stdlib.h> int main(void) { int N = 0; scanf("%d", &N); int A[N], B[N]; for (int i = 0; i < N; i++) { A[i] = 0; B[i] = 0; } for (int i = 1; i < N; i++) { scanf("%d", &A[i]); if (A[i] > 0) B[A[i] - 1] = B[A[i] - 1] + 1; } for (int i = 0; i < N; i++) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
159
n = int(input()) a = list(int(i) for i in input().split()) lst = [0] * (n + 1) for i in a: lst[i] += 1 for i in range(1, n): print(lst[i])
n = int(input()) a = list(int(i) for i in input().split()) lst = [0] * (n + 1) for i in a: lst[i] += 1 for i in range(1, n + 1): print(lst[i])
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
66
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i; cin >> n; long long int a[n], freq[n + 1]; for (i = 0; i < n - 1; i++) { cin >> a[i]; } for (i = 0; i <= n + 1; i++) { freq[i] = 0; } for (i = 0; i < n - 1; i++) { freq[a[i]]++; } for (i = 1; i <= n; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i; cin >> n; long long int a[n], freq[n + 1]; for (i = 0; i < n - 1; i++) { cin >> a[i]; } for (i = 0; i < n + 1; i++) { freq[i] = 0; } for (i = 0; i < n - 1; i++) { freq[a[i]]++; } for (i = 1; i <= n; i++) { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
141
#include <bits/stdc++.h> using namespace std; int a, c; int main() { cin >> a; vector<int> b(a); for (int i = 0; i < a - 1; i++) cin >> c; b[c - 1]++; for (int i = 0; i < a; i++) cout << b[i] << endl; }
#include <bits/stdc++.h> using namespace std; int a, c; int main() { cin >> a; vector<int> b(a); for (int i = 0; i < a - 1; i++) { cin >> c; b[c - 1]++; } for (int i = 0; i < a; i++) cout << b[i] << endl; }
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
81
n = int(input()) a = [0 for _ in range(n)] m = list(map(int, input().split())) for i in m: a[i-1] += 1 print(a)
n = int(input()) a = [0 for _ in range(n)] m = list(map(int, input().split())) for i in m: a[i-1] += 1 for v in a: print(v)
[["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 102], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
54
from collections import Counter N = int(input()) A = list(map(int, input().split())) c = Counter(A) print(c) for i in range(1, N + 1): print(c[i])
from collections import Counter N = int(input()) A = list(map(int, input().split())) c = Counter(A) for i in range(1, N + 1): print(c[i])
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
58
N = int(input()) A = input().split() c = collections.Counter(A) import collections for i in range(1,N+1): print(c[str(i)])
N = int(input()) A = input().split() import collections c = collections.Counter(A) for i in range(1,N+1): print(c[str(i)])
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
49
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int a[N]; vector<int> b(N); for (int i = 0; i < N - 1; i++) { cin >> a[i]; b[a[i]]++; } for (int i = 0; i < N; i++) { cout << b[i + 1] << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int a[N]; vector<int> b(N + 1); for (int i = 0; i < N - 1; i++) { cin >> a[i]; b[a[i]]++; } for (int i = 0; i < N; i++) { cout << b[i + 1] << endl; } }
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
95
from collections import deafualtdict n=int(input()) ar=list(map(int,input().split())) d=defaultdict(int) for i in ar: d[i]+=1 for i in range (1,n+1): if i in d.keys(): print(d[i]) else: print(0)
from collections import defaultdict n=int(input()) ar=list(map(int,input().split())) d=defaultdict(int) for i in ar: d[i]+=1 for i in range (1,n+1): if i in d.keys(): print(d[i]) else: print(0)
[["-", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]]
5
80
#include <algorithm> #include <cmath> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> #define ll long long #define rep(i, n) for (ll i = 0; i < (ll)n; i++) using namespace std; int main() { ll N, count = 1; cin >> N; vector<ll...
#include <algorithm> #include <cmath> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> #define ll long long #define rep(i, n) for (ll i = 0; i < (ll)n; i++) using namespace std; int main() { ll N, count = 1; cin >> N; vector<ll...
[["+", 0, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 28, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35], ["+", 0, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
165
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> a(n, 0); vector<int> b(n, 0); for (int i = 1; i < n; i++) { cin >> a.at(i); b.at(a.at(i))++; } for (int i = 0; i...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> a(n, 0); vector<int> b(n, 0); for (int i = 1; i < n; i++) { cin >> a.at(i); b.at(a.at(i) - 1)++; } for (int i = ...
[["+", 0, 27, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 27, 28, 2, 3, 4, 0, 16, 12, 13]]
1
133
n = int(input()) a_list = list(map(int, input().split(" "))) i = 0 for target_val in range(1, n + 1): cnt = 0 while target_val == a_list[min(i, len(a_list) - 1)] and i < len(a_list): i += 1 cnt += 1 print(cnt)
n = int(input()) a_list = sorted(list(map(int, input().split(" ")))) i = 0 for target_val in range(1, n + 1): cnt = 0 while target_val == a_list[min(i, len(a_list) - 1)] and i < len(a_list): i += 1 cnt += 1 print(cnt)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
81
n = int(input()) a = map(int, input().split(" ")) d = [0 for i in range(n)] for i in a: d[i] += 1 for i in range(1, n): print(d[i])
n = int(input()) a = map(int, input().split(" ")) d = [0 for i in range(n)] for i in a: d[i - 1] += 1 for i in range(n): print(d[i])
[["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
65
#include <bits/stdc++.h> using namespace std; 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, 0); 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); } cout << ...
#include <bits/stdc++.h> using namespace std; 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, 0); 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; } }
[["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
130
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n], b[n]; a[0] = 1; for (int i(1); i < n; i++) { cin >> a[i]; b[i] = 0; } for (int i(1); i < n; i++) { b[a[i] - 1]++; } for (int i(0); i < n; i++) cout << b[i] << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n], b[n]; a[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]++; } for (int i(0); i < n; i++) cout << b[i] << endl; }
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 1, 0, 11, 12, 11, 31, 69, 28, 22], ["+", 0, 11, 12, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 11, 12, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 11, 12, 11, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 12, 13]]
1
120
import numpy as np N = int(input()) A = list(map(int, input().split())) L = np.zeros(N) for x in A: L[x-1] =+ 1 for y in L: print(int(y))
import numpy as np N = int(input()) A = list(map(int, input().split())) L = np.zeros(N) for x in A: L[x-1] += 1 for y in L: print(int(y))
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 8, 196, 0, 1, 0, 662, 12, 664, 17, 72], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107]]
5
63
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define FOR(i) for (cin >> i; i > 0; i--) #define elif else if #define pb push_back #define ll long long #define mp make_pair #define all(x) x.begin(), x.end() #define re(x) ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define FOR(i) for (cin >> i; i > 0; i--) #define elif else if #define pb push_back #define ll long long #define mp make_pair #define all(x) x.begin(), x.end() #define re(x) ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
125
n = int(input()) a = list(map(int, input().split())) sub = [] for i in range(0, n): sub.append(0) for j in a : sub[j - 1] += 1 print(sub)
n = int(input()) a = list(map(int, input().split())) sub = [] for i in range(0, n): sub.append(0) for j in a : sub[j - 1] += 1 for i in sub: print(i)
[["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 102], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
62
N = int(input()) A = list(map(int, input().split())) L = [] for i in range(N-1): L.append(0) for i in range(N-1): L[A[i]-1] += 1 for j in range(N-1): print(L[j])
N = int(input()) A = list(map(int, input().split())) L = [] for i in range(N): L.append(0) for i in range(N-1): L[A[i]-1] += 1 for j in range(N): print(L[j])
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
83
#include <stdio.h> int main() { int N; int A[1000000]; int Sub[1000000] = {}; scanf("%d", &N); for (int i = 1; i <= N; i++) { scanf("%d", A[i]); Sub[A[i]]++; } for (int j = 1; j <= N; j++) { printf("%d\n", Sub[j]); } }
#include <stdio.h> int main() { int N; int A[1000000]; int Sub[1000000] = {}; scanf("%d", &N); for (int i = 1; i <= N; i++) { scanf("%d", &A[i]); Sub[A[i]]++; } for (int j = 1; j <= N; j++) { printf("%d\n", Sub[j]); } }
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
0
102
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<vector<int>> Z(N); for (int i = 1; i < N; i++) { int x; cin >> x; Z.at(x).push_back(i + 1); } for (int i = 0; i < N; i++) cout << Z.at(i).size() << endl; }
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<vector<int>> Z(N); for (int i = 1; i < N; i++) { int x; cin >> x; Z.at(x - 1).push_back(i + 1); } for (int i = 0; i < N; i++) cout << Z.at(i).size() << endl; }
[["+", 63, 118, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 63, 118, 28, 2, 3, 4, 0, 16, 12, 13]]
1
99
#include <bits/stdc++.h> using namespace std; // long long using ll = long long; // pair<int, int> using PII = pair<int, int>; //最大値、mod const int MOD = 1000000007; const int mod = 1000000007; const int INF = 1000000000; const long long LINF = 1e18; const int MAX = 510000; //出力系 #define print(x) cout << x << endl #...
#include <bits/stdc++.h> using namespace std; // long long using ll = long long; // pair<int, int> using PII = pair<int, int>; //最大値、mod const int MOD = 1000000007; const int mod = 1000000007; const int INF = 1000000000; const long long LINF = 1e18; const int MAX = 510000; //出力系 #define print(x) cout << x << endl #...
[["+", 8, 9, 0, 9, 0, 1, 0, 27, 28, 22], ["+", 8, 9, 0, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 14, 8, 9, 0, 9, 0, 1, 0, 35]]
1
1,620
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; map<int, int> A; for (int i = 0; i < N; i++) { A[i] = 0; } int a; for (int i = 0; i < N; i++) { cin >> a; a--; A[a]++; } for (int i = 0; i < N; i++) { cout << A.at(i) << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; map<int, int> A; for (int i = 0; i < N; i++) { A[i] = 0; } int a; for (int i = 1; i < N; i++) { cin >> a; a--; A[a]++; } for (int i = 0; i < N; i++) { cout << A.at(i) << endl; } }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
109
N=int(input()) A = list(map(int, input().split())) from collections import Counter S=Counter(A) a=[0]*N for x, v in S.items(): a[x] += v for ans in a: print(ans)
import numpy as np N=int(input()) A = list(map(int, input().split())) from collections import Counter S=Counter(A) #print(S) a=[0]*N for x, v in S.items(): a[x-1] += v for ans in a: print(ans)
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 0, 656, 0, 596, 141, 704, 141, 673, 0, 22], ["+", 36, 36, 0, 656, 0, 596, 141, 704, 0, 272], ["+", 36, 36, 0, 656, 0, 596, 141, 704, 705, 22], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
68
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np def main(): N, *A = map(int, read().split()) ans = [0] * (N + 1) print(ans) for a in A: ans[a] += 1 ans = list(map(str, ans)) print('\n'.join(ans[1:])) ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np def main(): N, *A = map(int, read().split()) ans = [0] * (N + 1) for a in A: ans[a] += 1 ans = list(map(str, ans)) print('\n'.join(ans[1:])) return if ...
[["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
118
n=int(input()) a=list(map(int,input().split())) j=0 c=0 import sys for i in range(1,n+1): while 1: if j==n-1: break if i!=a[j]: break else: c+=1 j+=1 print(c) c=0
n=int(input()) a=list(map(int,input().split())) j=0 c=0 import sys a.sort() for i in range(1,n+1): while 1: if j==n-1: break if i!=a[j]: break else: c+=1 j+=1 print(c) c=0
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
80
n = gets.strip.to_i a = gets.strip.split.map(&:to_i) h = Array.new(n-1, 0) a.each do |ai| h[ai] += 1 end h.each do |ha| p ha end
n = gets.strip.to_i a = gets.strip.split.map(&:to_i) h = Array.new(n, 0) a.each do |ai| h[ai-1] += 1 end h.each do |ha| p ha end
[["-", 0, 662, 12, 652, 3, 4, 0, 738, 17, 33], ["-", 0, 662, 12, 652, 3, 4, 0, 738, 12, 612], ["+", 8, 736, 0, 755, 31, 742, 0, 738, 17, 33], ["+", 8, 736, 0, 755, 31, 742, 0, 738, 12, 612]]
4
56
N = int(input()) numbers = input().strip().split(' ') boss_dict = [0] * N for i in range(N - 1): boss_num = int(numbers[i]) boss_dict[boss_num] += 1 for boss in boss_dict: print(boss)
N = int(input()) numbers = input().strip().split(' ') boss_dict = [0] * N for i in range(N - 1): boss_num = int(numbers[i]) boss_dict[boss_num - 1] += 1 for boss in boss_dict: print(boss)
[["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
65
#include <stdio.h> int main(void) { int n; scanf("%d", &n); int a[n]; int ans[n]; for (int i = 0; i < n; i++) { ans[i] = 0; } for (int i = 0; i < n; i++) { scanf("%d", &a[i]); ans[a[i] - 1]++; } for (int i = 0; i < n; i++) { printf("%d\n", ans[i]); } return 0; }
#include <stdio.h> int main(void) { int n; scanf("%d", &n); int a[n]; int ans[n]; for (int i = 0; i < n; i++) { ans[i] = 0; } for (int i = 0; i < n - 1; i++) { scanf("%d", &a[i]); ans[a[i] - 1]++; } for (int i = 0; i < n; i++) { printf("%d\n", ans[i]); } return 0; }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
129
import sys input = sys.stdin.readline import itertools def print_ans(N, ar): """Test Case >>> print_ans(5, [1, 1, 2, 2]) 2 2 0 0 0 >>> print_ans(10, [1,1,1,1,1,1,1,1,1]) 9 0 0 0 0 0 0 0 0 0 >>> print_ans(7, [1,2,3,4,5,6]) 1 1 1 ...
import sys input = sys.stdin.readline import itertools def print_ans(N, ar): """Test Case >>> print_ans(5, [1, 1, 2, 2]) 2 2 0 0 0 >>> print_ans(10, [1,1,1,1,1,1,1,1,1]) 9 0 0 0 0 0 0 0 0 0 >>> print_ans(7, [1,2,3,4,5,6]) 1 1 1 ...
[["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
115
#include <stdio.h> #include <stdlib.h> int main() { long N, i, Ai; long *B; scanf("%ld", &N); B = malloc(N * sizeof(long)); for (i = 0; i < N; i++) { scanf("%ld", &Ai); B[Ai]++; } for (i = 0; i < N; i++) { printf("%ld\n", B[i]); } return 0; }
#include <stdio.h> #include <stdlib.h> int main() { long N, i, Ai; long *B; scanf("%ld", &N); B = malloc(N * sizeof(long)); for (i = 0; i < N - 1; i++) { scanf("%ld", &Ai); B[Ai - 1]++; } for (i = 0; i < N; i++) { printf("%ld\n", B[i]); } return 0; }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 27, 28, 69, 71, 16, 17, 33], ["+", 0, 1, 0, 27, 28, 69, 71, 16, 12, 13]]
0
105
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { long long int n; cin >> n; ll A[n - 1]; for (ll i = 0; i < n - 1; i++) cin >> A[i]; ll B[n] = {0}; for (ll i = 0; i < n - 1; i++) { B[A[i]]++; } for (ll i = 0; i < n; i++) { cout << B[i] << endl; } return...
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { long long int n; cin >> n; ll A[n - 1]; for (ll i = 0; i < n - 1; i++) cin >> A[i]; ll B[n] = {0}; for (ll i = 0; i < n - 1; i++) { B[A[i] - 1]++; } for (ll i = 0; i < n; i++) { cout << B[i] << endl; } re...
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
120
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <vector> using namespace std; int main() { int n; cin >> n; map<int, int> mp; for (int i = 0; i < n; i++) { int a; cin >> a; mp[a]++; } for (int i = 1; i <= n; i++) { cout << mp[i] << "\n"; ...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <vector> using namespace std; int main() { int n; cin >> n; map<int, int> mp; for (int i = 0; i < n - 1; i++) { int a; cin >> a; mp[a]++; } for (int i = 1; i <= n; i++) { cout << mp[i] << "\n"...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
93
#include <bits/stdc++.h> using namespace std; int n, a[200001] = {}; int main() { scanf("%d", &n); int aa; for (int i = 2; i <= n; i++) { scanf("%d", &aa); a[aa]++; } for (int i = 2; i <= n; i++) printf("%d\n", a[i]); }
#include <bits/stdc++.h> using namespace std; int n, a[200001] = {}; int main() { scanf("%d", &n); int aa; for (int i = 2; i <= n; i++) { scanf("%d", &aa); a[aa]++; } for (int i = 1; i <= n; i++) printf("%d\n", a[i]); }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
95
#include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int A[n], H[n + 1]; for (int i = 0; i <= n + 1; i++) { H[i] = 0; } for (int i = 1; i < n; i++) { cin >> A[i]; H[A[i]]++; } for (int i = 1; i <= n + 1; i++) { cout...
#include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int A[n], H[n + 1]; for (int i = 0; i <= n + 1; i++) { H[i] = 0; } for (int i = 1; i < n; i++) { cin >> A[i]; H[A[i]]++; } for (int i = 1; i <= n; i++) { cout << ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
135
#include <bits/stdc++.h> #define ll long long #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); using namespace ...
#include <bits/stdc++.h> #define ll long long #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); using namespace ...
[["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22]]
1
154
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rrep(i, n) for (int i = n - 1; i >= 0; --i) #define fi first #define se second using namespace std; using lint = long long; using uint = unsigned int; using ulint = unsigned long long; using ldouble = long double; using pii = pair<int, int>;...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rrep(i, n) for (int i = n - 1; i >= 0; --i) #define fi first #define se second using namespace std; using lint = long long; using uint = unsigned int; using ulint = unsigned long long; using ldouble = long double; using pii = pair<int, int>;...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
322
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n - 1; i++) { a[sc.nextInt() - 1]++; } for (int i = 0; i < n - 1; i++) { System.out.println(a[i]); ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n - 1; i++) { a[sc.nextInt() - 1]++; } for (int i = 0; i < n; i++) { System.out.println(a[i]); }...
[["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
115
N = int(input('')) #input()で入力を受け取ってint()で数字型に変換します。 A = list(map(int,input().split())) A.insert(0,0) A.insert(0,0) subordinate = [0] * (N+1) #subordinate[N-1] = 0 # print(subordinate) # print(A) for index in range(N, 1, -1): subordinate[A[index]] = subordinate[A[index]] + 1 for index in range(1, N, 1): ...
N = int(input('')) #input()で入力を受け取ってint()で数字型に変換します。 A = list(map(int,input().split())) A.insert(0,0) A.insert(0,0) subordinate = [0] * (N+1) #subordinate[N-1] = 0 # print(subordinate) # print(A) for index in range(N, 1, -1): subordinate[A[index]] = subordinate[A[index]] + 1 for index in range(1, N+1, 1): ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
107
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> a(N, 0); for (int i = 0; i < N; i++) { int A; cin >> A; a.at(A - 1)++; } for (int i = 0; i < N; i++) { cout << a.at(i) << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> a(N, 0); for (int i = 1; i < N; i++) { int A; cin >> A; a.at(A - 1)++; } for (int i = 0; i < N; i++) { cout << a.at(i) << endl; } }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
90
#include <bits/stdc++.h> using namespace std; long long n, m, ans, temp; int a[111111]; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> temp; a[temp]++; } for (int i = 1; i <= n; i++) { cout << a[i] << endl; } }
#include <bits/stdc++.h> using namespace std; long long n, m, ans, temp; int a[11111111]; int main() { cin >> n; for (int i = 1; i < n; i++) { cin >> temp; a[temp]++; } for (int i = 1; i <= n; i++) { cout << a[i] << endl; } }
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
83
#include <bits/stdc++.h> #include <iostream> using namespace std; // Compiler version g++ 6.3.0 int main() { int n; cin >> n; int c[1000000]; memset(c, 0, sizeof(c)); for (int i = 0; i < n; i++) { int x; cin >> x; c[x]++; } for (int i = 1; i <= n + 1; i++) { cout << c[i] << "\n"; } r...
#include <bits/stdc++.h> #include <iostream> using namespace std; // Compiler version g++ 6.3.0 int main() { int n; cin >> n; int c[1000000]; memset(c, 0, sizeof(c)); for (int i = 1; i < n; i++) { int x; cin >> x; c[x]++; } for (int i = 1; i <= n; i++) { cout << c[i] << "\n"; } retur...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
101
#include <iostream> #include <queue> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll n; cin >> n; vector<ll> a(n - 1); rep(i, n - 1) cin >> a[i]; vector<ll> b(n); rep(i, n - 1) b[a[i]]++; rep(i, n) { co...
#include <iostream> #include <queue> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll n; cin >> n; vector<ll> a(n - 1); rep(i, n - 1) cin >> a[i]; vector<ll> b(n + 5); rep(i, n - 1) b[a[i]]++; rep(i, n) ...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
122
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int mgm[n + 1]; map<int, int> sCount; for (int i = 1; i <= n - 1; i++) { sCount[i] = 0; } for (int i = 2; i <= n; i++) { cin >> mgm[i]; sCount[mgm[i]]++; } for (auto...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int mgm[n + 1]; map<int, int> sCount; for (int i = 1; i <= n; i++) { sCount[i] = 0; } for (int i = 2; i <= n; i++) { cin >> mgm[i]; sCount[mgm[i]]++; } for (auto it ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
142
# -*- coding: utf-8 -*- def main(): N = int(input()) A = [int(i) for i in input().split()] ans = [] for _ in range(N): ans.append(0) for i in A: ans[A[i]-1]+=1 for j in ans: print(j) if __name__ == '__main__': main()
# -*- coding: utf-8 -*- def main(): N = int(input()) A = [int(i) for i in input().split()] ans = [] for _ in range(N): ans.append(0) for i in A: ans[i-1]+=1 for j in ans: print(j) if __name__ == '__main__': main()
[["-", 0, 677, 31, 206, 206, 657, 31, 206, 51, 22], ["-", 0, 677, 31, 206, 206, 657, 31, 206, 0, 70], ["-", 0, 677, 31, 206, 206, 657, 31, 206, 0, 73]]
5
85
import collections N = int(input()) A =[int(a) for a in input().split()] def f(): d = collections.defaultdict(int) for i, e in enumerate(A): d[e] += 1 for key in range(1, N+1): print(d[key])
import collections N = int(input()) A =[int(a) for a in input().split()] def f(): d = collections.defaultdict(int) for i, e in enumerate(A): d[e] += 1 for key in range(1, N+1): print(d[key]) f()
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
76
import collections N = int(input()) A = deque(map(int, input().split())) C = collections.Counter(A) for i in range(1, N+1): if i in C.keys(): print(C[i]) else: print(0)
import collections N = int(input()) A = list(map(int, input().split())) C = collections.Counter(A) for i in range(1, N+1): if i in C.keys(): print(C[i]) else: print(0)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
69
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int number = scan.nextInt(); int[] people = new int[number]; for (int i = 1; i < number; i++) { int no = scan.nextInt(); people[no]++; } for (int i = 0; i...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int number = scan.nextInt(); int[] people = new int[number]; for (int i = 0; i < number - 1; i++) { int no = scan.nextInt(); people[no - 1]++; } for (int ...
[["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499], ["+", 0, 1, 0, 27, 0, 504, 71, 16, 17, 33], ["+", 0, 1, 0, 27, 0, 504, 71, 16, 12, 499]]
3
114
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N - 1); 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(0) - 1)++; } for (int i = 0; i < N; i++) { cout << B.at(i) << endl; } ...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N - 1); 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)++; } for (int i = 0; i < N; i++) { cout << B.at(i) << endl; } ...
[["-", 3, 4, 0, 16, 31, 2, 3, 4, 0, 13], ["+", 3, 4, 0, 16, 31, 2, 3, 4, 0, 22]]
1
129
#include <iostream> using namespace std; int main(void) { long long int N; cin >> N; long long int A[N] = {0}, d; for (int i = 1; i < N; i++) { cin >> d; A[d]++; } for (int i = 0; i < N; i++) { cout << A[i] << endl; } return 0; }
#include <iostream> using namespace std; int main(void) { long long int N; cin >> N; long long int A[N] = {0}, d; for (int i = 1; i < N; i++) { cin >> d; A[d - 1]++; } for (int i = 0; i < N; i++) cout << A[i] << endl; return 0; }
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
90
#include <bits/stdc++.h> using namespace std; int main() { int n; int a; cin >> n; vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> a; vec.at(a - 1) += 1; } for (int i = 0; i < n; i++) { cout << vec.at(i) << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int n; int a; cin >> n; vector<int> vec(n); for (int i = 1; i < n; i++) { cin >> a; vec.at(a - 1) += 1; } for (int i = 0; i < n; i++) { cout << vec.at(i) << endl; } }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
89
n = int(input()) a = list(map(int, input().split())) b = dict() for i in range(n): b[i+1] = 0 for i in range(n): b[a[i]] += 1 for i in range(n): print(b[i+1])
n = int(input()) a = list(map(int, input().split())) b = dict() for i in range(n): b[i+1] = 0 for i in range(n-1): b[a[i]] += 1 for i in range(n): print(b[i+1])
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
80
#include <bits/stdc++.h> using namespace std; int main() { long long int N; cin >> N; long long int A[N]; for (long long int i = 1; i < N; i++) { cin >> A[i]; } long long int B[N]; for (long long int i = 0; i < N; i++) { B[i] = 0; } long long int v; for (long long int i = 1; i < N; i++...
#include <bits/stdc++.h> using namespace std; int main() { long long int N; cin >> N; long long int A[N]; for (long long int i = 1; i < N; i++) { cin >> A[i]; } long long int B[N]; for (long long int i = 0; i < N; i++) { B[i] = 0; } long long int v; for (long long int i = 1; i < N; i++...
[["-", 0, 1, 0, 11, 12, 16, 12, 69, 28, 22], ["-", 0, 11, 12, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 11, 12, 16, 12, 69, 341, 342, 0, 22], ["-", 0, 11, 12, 16, 12, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
166
#include <stdio.h> int main() { int res; int N; res = scanf("%d", &N); int A[N + 1]; int subordinate[N + 1]; for (int i = 0; i < N - 1; i++) { A[i] = 0; subordinate[i] = 0; } for (int i = 2; i <= N; i++) { res = scanf("%d", &A[i]); } for (int i = 2; i <= N; i++) { subordinate[A[i]] ...
#include <stdio.h> int main() { int res; int N; res = scanf("%d", &N); int A[N + 1]; int subordinate[N + 1]; for (int i = 0; i < N + 1; i++) { A[i] = 0; subordinate[i] = 0; } for (int i = 2; i <= N; i++) { res = scanf("%d", &A[i]); } for (int i = 2; i <= N; i++) { subordinate[A[i]] ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72]]
0
163
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define rep(i, a, n) for (ll i = a; i < n; i++) #define PI 3.141592653 int main() { ll arr[20001] = {0}; ll n; cin >> n; rep(i, 1, n) { ll ch; cin >> ch; arr[ch] += 1; } rep(i, 1, n) cout << arr[i] << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define rep(i, a, n) for (ll i = a; i < n; i++) #define PI 3.141592653 int main() { ll arr[200002] = {0}; ll n; cin >> n; rep(i, 1, n) { ll ch; cin >> ch; arr[ch] += 1; } rep(i, 1, n + 1) cout << arr[i] << "\n"; return 0; ...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 31, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["+", 31, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
95
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[n]; int c[n]; for (int i = 0; i < n; i++) { c[i] = 0; } for (int i = 0; i < n; i++) { cin >> a[i]; c[a[i] - 1] += 1; } for (int i = 0; i < n; i++) { cout << c[i] << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[n - 1]; int c[n]; for (int i = 0; i < n; i++) { c[i] = 0; } for (int i = 0; i < n - 1; i++) { cin >> a[i]; c[a[i] - 1] += 1; } for (int i = 0; i < n; i++) { cout << c[i] << endl; } return 0; }
[["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
117
#include <bits/stdc++.h> using namespace std; int main() { int n = 0; cin >> n; vector<int> v(n, 0); for (int i = 2; i <= n; i++) { int t = 0; cin >> t; v[t] += 1; } for (int i = 1; i <= n; i++) { cout << v[i] << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int n = 0; cin >> n; vector<int> v(n + 1, 0); for (int i = 2; i <= n; i++) { int t = 0; cin >> t; v[t] += 1; } for (int i = 1; i <= n; i++) { cout << v[i] << endl; } }
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
89
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int n; cin >> n; vector<int> vec(n); for (int i = 2; i <= n; i++) cin >> vec[i]; vector<int> buka(n); for (int i = 2; i <= n; i++) { buka[vec[i] - 1]++; } for (int i = 0; i < n; i++) { cout << buka[i] << end...
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int n; cin >> n; vector<int> vec(n); for (int i = 2; i <= n; i++) cin >> vec[i - 1]; vector<int> buka(n); for (int i = 2; i <= n; i++) { buka[vec[i - 1] - 1]++; } for (int i = 0; i < n; i++) { cout << buka[i...
[["+", 0, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
116
#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() int main() { int n; cin >> n; ...
#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() int main() { int n; cin >> n; ...
[["-", 8, 9, 0, 43, 49, 80, 81, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["-", 31, 69, 28, 2, 3, 4, 0, 16, 17, 33], ["-", 31, 69, 28, 2, 3, 4, 0, 16, 12, 13], ["-", 31, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["-", 31, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
100
n = gets.to_i as = gets.split("\s").map(&:to_i) hash = {} as.each do |a| hash[a] += 1 end (1..n).each do |i| puts hash[i] end
n = gets.to_i as = gets.split("\s").map(&:to_i) hash = Hash.new(0) as.each do |a| hash[a] += 1 end (1..n).each do |i| puts hash[i] end
[["-", 36, 36, 0, 493, 0, 662, 12, 767, 0, 45], ["-", 36, 36, 0, 493, 0, 662, 12, 767, 0, 46], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 486, 743], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["+", 0, 493, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 493, 0, 662, 12, 652, 3...
4
56
import bisect man_count = int(input()) infos = [int(i) for i in input().split()] infos.sort() next_num = 0 end = 0 for i in range(len(infos)+1): if i != next_num: print(0) continue # 速度を上げるために添え字を吹き飛ばそう。 start = bisect.bisect_right(infos, i+1, end) # iが始まる添え字を得る。 print(start - end) ...
import bisect man_count = int(input()) infos = [int(i) for i in input().split()] infos.sort() next_num = 0 end = 0 for i in range(len(infos)+1): if i != next_num: print(0) continue # 速度を上げるために添え字を吹き飛ばそう。 start = bisect.bisect_right(infos, i+1, end) # iが始まる添え字を得る。 print(start - end) ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 79], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["-", 0, 1, 0, 662, 12, 206, 206, 657, 17, 72], ["+", 0, 662, 12, 657, 31, 206, 206, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 31, ...
5
116
people = int(input()) - 1 boss = input().split(' ') boss = list(map(int,boss)) dict_boss = {} for i in range(people): if boss[i]-1 not in dict_boss: dict_boss[boss[i]-1] = 1 else: dict_boss[boss[i]-1] += 1 boss = [0] * people for key in dict_boss: boss[key] = dict_boss[key] for i in boss: print(i)
people = int(input()) - 1 boss = input().split(' ') boss = list(map(int,boss)) dict_boss = {} for i in range(people): if boss[i]-1 not in dict_boss: dict_boss[boss[i]-1] = 1 else: dict_boss[boss[i]-1] += 1 boss = [0] * (people + 1) for key in dict_boss: boss[key] = dict_boss[key] for i in boss: print(i)
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]]
5
110
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> jousi(n); vector<int> b(n, 0); for (int i = 0; i < n - 1; i++) { cin >> jousi.at(i); } for (int j = 0; j < n - 1; j++) { b.at(jousi.at(j))++; } for (int k = 0; k < n; k++) { cout << b.at(k) << endl...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> jousi(n - 1); vector<int> b(n, 0); for (int i = 0; i < n - 1; i++) { cin >> jousi.at(i); } for (int j = 0; j < n - 1; j++) { b.at(jousi.at(j) - 1)++; } for (int k = 0; k < n; k++) { cout << b.at(k)...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 0, 27, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 27, 28, 2, 3, 4, 0, 16, 12, 13]]
1
124
N = int(input()) A = np.array(list(map(int, input().split()))) ans = np.zeros(N) for a in A: ans[a-1] += 1 for o in ans: print(int(o))
import numpy as np N = int(input()) A = np.array(list(map(int, input().split()))) ans = np.zeros(N) for a in A: ans[a-1] += 1 for o in ans: print(int(o))
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 0, 656, 0, 596, 141, 704, 141, 673, 0, 22], ["+", 36, 36, 0, 656, 0, 596, 141, 704, 0, 272], ["+", 36, 36, 0, 656, 0, 596, 141, 704, 705, 22]]
5
63
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N]; for (int i = 0; i < A.length; i++) { A[i] = 0; } for (int i = 0; i < A.length; i++) { A[sc.nextInt() - 1]++; ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N]; for (int i = 0; i < A.length; i++) { A[i] = 0; } for (int i = 0; i < A.length - 1; i++) { A[sc.nextInt() - 1]++;...
[["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
140
#include <iostream> using namespace std; int main() { int n, a, c = 1, t = 0, cnt = 0; cin >> n; int ans[200000]; for (int i = 0; i < n; i++) { ans[i] = 0; } for (int i = 0; i < n - 1; i++) { cin >> a; if (a != c) { t++; c = a; } ans[t] += 1; } for (int i = 0; i < n...
#include <iostream> using namespace std; int main() { int n, a, c = 1, t = 0, cnt = 0; cin >> n; int ans[200000]; for (int i = 0; i < n; i++) { ans[i] = 0; } for (int i = 0; i < n - 1; i++) { cin >> a; if (a != c) { t = a - 1; c = a; } ans[t] += 1; } for (int i = 0;...
[["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
131
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; i++) #define all(n) n.begin(), n.end() int main() { int n; cin >> n; vector<int> a(n - 1), cnt(n + 2); rep(i, n) { cin >> a[i]; cnt[a[i]]++; } rep(i, n - 1) cout << cnt[a[i] + 1] << endl; r...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; i++) #define all(n) n.begin(), n.end() int main() { int n; cin >> n; vector<int> a(n - 1), cnt(n + 2); rep(i, n) { cin >> a[i]; cnt[a[i]]++; } rep(i, n) cout << cnt[i + 1] << endl; return 0...
[["-", 31, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["-", 31, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["-", 12, 69, 341, 342, 0, 16, 31, 69, 28, 22], ["-", 341, 342, 0, 16, 31, 69, 341, 342, 0, 70], ["-", 341, 342, 0, 16, 31, 69, 341, 342, 0, 73]]
1
106
#include <cstdint> #include <iostream> int32_t childlen[200000]; void CallMyFunc(std::istream &input_stream) { input_stream.tie(0); std::ios::sync_with_stdio(false); try { int32_t N; input_stream >> N; for (int32_t i = 0; i < N; ++i) { childlen[i] = 0; } for (int32_t i = 0; i < N - 1; ...
#include <cstdint> #include <iostream> int32_t childlen[200000]; void CallMyFunc(std::istream &input_stream) { input_stream.tie(0); std::ios::sync_with_stdio(false); try { int32_t N; input_stream >> N; for (int32_t i = 0; i < N; ++i) { childlen[i] = 0; } for (int32_t i = 0; i < N - 1; ...
[["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73]]
1
167
N = int(input()) syain = [] for i in range(N): syain.append(0) x =(input()).split(" ") xid = [int(s) for s in x] for t in xid: syain[t-1]+=1 print(syain)
N = int(input()) syain = [] for i in range(N): syain.append(0) x =(input()).split(" ") xid = [int(s) for s in x] for t in xid: syain[t-1]+=1 for m in syain: print(m)
[["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 102], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
69
// include //------------------------------------------ #include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list...
// include //------------------------------------------ #include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
417
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int N, x; cin >> N; int arr[N]; for (int i = 0; i < N; i++) arr[i] = 0; while (N--) { cin >> x; arr[x - 1] += 1; } for (int y : arr) cout << y << "\n"; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int N, x; cin >> N; int arr[N]; for (int i = 0; i < N; i++) arr[i] = 0; N--; while (N--) { cin >> x; arr[x - 1] += 1; } for (int y : arr) cout << y << "\n"; }
[["+", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
97
n=int(input()) a=list(map(int,input().split())) c=Counter(a) ck=list(Counter(a).keys()) for i in range(1,n+1): if i in ck: print(c[i]) else: print(0)
from collections import Counter n=int(input()) a=list(map(int,input().split())) c=Counter(a) ck=set(Counter(a).keys()) for i in range(1,n+1): if i in ck: print(c[i]) else: print(0)
[["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
74
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int n; cin >> n; int arr[n] = {0}; int temp; for (int i = 0; i < n; i++) { cin >> temp; arr[temp]++; } for (int i = 0; i < n; i++) { cout << arr[i] << "\n"; } return 0; }
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int n; cin >> n; int arr[n] = {0}; int temp; for (int i = 0; i < n - 1; i++) { cin >> temp; arr[temp - 1]++; } for (int i = 0; i < n; i++) { cout << arr[i] << "\n"; } return 0; }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
90
#include <bits/stdc++.h> using namespace std; int main() { int n, a; cin >> n; int k[n + 1] = {0}; for (int i = 0; i < n - 1; i++) { cin >> a; k[a]++; } for (int i = 1; i < n; i++) cout << k[i] << "\n"; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a; cin >> n; int k[n + 1] = {0}; for (int i = 0; i < n - 1; i++) { cin >> a; k[a]++; } for (int i = 1; i <= n; i++) cout << k[i] << "\n"; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
86
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ar[n + 1] = {0}; for (int i = i; i < n; i++) { int x; cin >> x; ar[x]++; } for (int i = 1; i <= n; i++) cout << ar[i] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ar[n + 1] = {0}; for (int i = 1; i < n; i++) { int x; cin >> x; ar[x]++; } for (int i = 1; i <= n; i++) cout << ar[i] << endl; return 0; }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
86
#include <stdio.h> #include <string.h> #include <math.h> int main() { long long b, m; scanf("%lld ", &m); long long a[m], c[m]; for (b = 0; b < m; b++) { c[b] = 0; } long long d; for (b = 0; b < m; b++) { scanf("%ld", &a[b]); d = a[b] - 1; c[d]++; } for (b = 0; b < m; b++) pri...
#include <stdio.h> #include <string.h> #include <math.h> int main() { long long b, m; scanf("%lld ", &m); long long a[m], c[m]; for (b = 0; b < m; b++) { c[b] = 0; } long long d; for (b = 1; b < m; b++) { scanf("%lld", &a[b]); d = a[b] - 1; c[d]++; } for (b = 0; b < m; b+...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
138
#include <stdio.h> int main() { int N; scanf("%d", &N); int a[N], b[N]; for (int i = 0; i < N; ++i) { b[i] = 0; } for (int i = 1; i < N; ++i) { scanf("%d", &a[i]); b[a[i]]++; } for (int i = 0; i < N; ++i) { printf("%d", &b[i]); } return 0; }
#include <stdio.h> int main() { int N; scanf("%d", &N); int a[N], b[N]; for (int i = 0; i < N; ++i) { b[i] = 0; } for (int i = 1; i < N; ++i) { scanf("%d", &a[i]); b[a[i] - 1]++; } for (int i = 0; i < N; ++i) { printf("%d\n", b[i]); } return 0; }
[["+", 0, 1, 0, 27, 28, 69, 71, 16, 17, 33], ["+", 0, 1, 0, 27, 28, 69, 71, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
0
125
#coding:utf-8 n = int(input()) a = input().split() lis = [0 for i in range(n)] count = 0 for i in a: lis[int(i - 1)] += 1 for i in lis: print("{}".format(i))
#coding:utf-8 n = int(input()) a = input().split() lis = [0 for i in range(n)] for i in a: lis[int(i) - 1] += 1 for i in lis: print("{}".format(i))
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 31, 206, 206, 657, 31, 652, 3, 4, 0, 25], ["-", 0, 677, 31, 206, 206, 652, 3, 4, 0, 25]]
5
65
import collections as c n=int(input()) a=list(map(int,input().split())) b=c.Counter(a) for i in range(1,N+1): print(b[i])
import collections as c n=int(input()) a=list(map(int,input().split())) b=c.Counter(a) for i in range(1,n+1): print(b[i])
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
56
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N); A.at(0) = 0; for (int i = 1; i < N; i++) { cin >> A.at(i); } vector<int> result(N); for (int i = 0; i < N; i++) { result.at(A.at(i) - 1)++; } for (int i = 0; i < N; i++) { cout << result.at(i);...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N); A.at(0) = 0; for (int i = 1; i < N; i++) { cin >> A.at(i); } vector<int> result(N); for (int i = 1; i < N; i++) { result.at(A.at(i) - 1)++; } for (int i = 0; i < N; i++) { cout << result.at(i) ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
131
#include <assert.h> /*確認*/ #include <ctype.h> /*文字操作*/ #include <limits.h> /*限界*/ #include <math.h> /*計算*/ #include <stdbool.h>/*bool型*/ #include <stdio.h> /*入出力*/ #include <stdlib.h> /*標準ライブラリ*/ #include <string.h> /*文字列*/ //--------------------------------------------------- #define rep(i, n) for (int i = 0; i < ...
#include <assert.h> /*確認*/ #include <ctype.h> /*文字操作*/ #include <limits.h> /*限界*/ #include <math.h> /*計算*/ #include <stdbool.h>/*bool型*/ #include <stdio.h> /*入出力*/ #include <stdlib.h> /*標準ライブラリ*/ #include <string.h> /*文字列*/ //--------------------------------------------------- #define rep(i, n) for (int i = 0; i < ...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
184
import collections n = int(input()) l = list(map(int, input().split())) c = collections.Counter(l) print(c[1]) for i in l: print(c[i+1])
import collections n = int(input()) l = list(map(int, input().split())) c = collections.Counter(l) print(c[1]) for i,value in enumerate(l): print(c[i+2])
[["+", 36, 36, 0, 656, 0, 7, 31, 684, 0, 21], ["+", 36, 36, 0, 656, 0, 7, 31, 684, 0, 22], ["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25], ["-", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]]
5
56
#include <bits/stdc++.h> using namespace std; main() { int n; cin >> n; int a[n]; int count[n + 1] = {0}; for (int i = 0; i < n; i++) { cin >> a[i]; count[a[i]]++; } for (int i = 1; i < n + 1; i++) cout << count[i] << "\n"; }
#include <bits/stdc++.h> using namespace std; main() { int n; cin >> n; int a[n]; int count[n + 1] = {0}; for (int i = 0; i < n - 1; i++) { cin >> a[i]; count[a[i]]++; } for (int i = 1; i < n + 1; i++) cout << count[i] << "\n"; }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
95
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<int, int> m; for (int i = 0; i < n; i++) { int x; cin >> x; x--; m[x]++; } for (int i = 0; i < n; i++) cout << m[i] << "\n"; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<int, int> m; for (int i = 0; i < n - 1; i++) { int x; cin >> x; x--; m[x]++; } for (int i = 0; i < n; i++) cout << m[i] << "\n"; }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
84
#include <bits/stdc++.h> using namespace std; int main(int argc, const char *argv[]) { cin.tie(0); ios::sync_with_stdio(false); ///////////////////// // Write code below / ///////////////////// int n, a, ans[200000], i; for (i = 0; i < 200000; i++) { ans[i] = 0; } cin >> n; for (i = 0; i < ...
#include <bits/stdc++.h> using namespace std; int main(int argc, const char *argv[]) { cin.tie(0); ios::sync_with_stdio(false); ///////////////////// // Write code below / ///////////////////// int n, a, ans[200000], i; for (i = 0; i < 200000; i++) { ans[i] = 0; } cin >> n; for (i = 0; i < ...
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
130
N = int(input()) A = [int(i) for i in input().split()] S = [0] * N for i in A: S[i] += 1 for s in S[1:]: print(s)
N = int(input()) A = [int(i) for i in input().split()] S = [0] * (N+1) for i in A: S[i] += 1 for s in S[1:]: print(s)
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]]
5
57
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) int main() { int N; cin >> N; int64_t ans = 0; int now = 0; vector<int> vec(N); for (int i = 0; i < N - 1; i++) { cin >> now; vec.at(now - 1)++; } rep(i, N - 1) { cout << vec.at(i) << endl; } }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) int main() { int N; cin >> N; int64_t ans = 0; int now = 0; vector<int> vec(N); for (int i = 0; i < N - 1; i++) { cin >> now; vec.at(now - 1)++; } rep(i, N) { cout << vec.at(i) << endl; } }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
100
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; class Main { static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static final PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) throws IOException { ...
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; class Main { static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static final PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) throws IOException { ...
[["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
238
package main import ( "fmt" ) func main() { var n int fmt.Scan(&n) ans := make([]int, n) var p int m := 1 for i := 1; i < n; i++ { fmt.Scan(&p) if p == m { ans[m-1]++ } else { m++ ans[m-1]++ } } for i := 0; i < n; i++ { fmt.Println(ans[i]) } }
package main import ( "fmt" ) func main() { var n int fmt.Scan(&n) ans := make([]int, n) var p int m := 1 for i := 1; i < n; i++ { fmt.Scan(&p) if p == m { ans[m-1]++ } else { m = p ans[m-1]++ } } for i := 0; i < n; i++ { fmt.Println(ans[i]) } }
[["-", 8, 196, 0, 57, 75, 196, 0, 463, 0, 29], ["+", 8, 196, 0, 57, 75, 196, 0, 436, 17, 32], ["+", 0, 57, 75, 196, 0, 436, 12, 432, 0, 22], ["+", 36, 36, 36, 36, 36, 36, 0, 434, 0, 165]]
7
123
from collections import Counter n = int(input()) As = list(map(int, input().split())) ct = Counter(As) for i in range(n): if i in ct.keys(): print(ct[i]) else: print('0')
from collections import Counter n = int(input()) As = list(map(int, input().split())) ct = Counter(As) for i in range(1,n+1): if i in ct.keys(): print(ct[i]) else: print('0')
[["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
67
#include <stdio.h> int main() { unsigned long N; scanf("%lu", &N); unsigned long A[N], B[N]; int i; for (i = 0; i < N - 1; i++) { scanf("%lu", &A[i]); B[i] = 0; } B[N] = 0; unsigned long j; for (i = 0; i < N - 1; i++) { j = A[i]; B[j - 1] = B[j - 1] + 1; } for (i = 0; i < N; i++) {...
#include <stdio.h> int main() { unsigned long N; scanf("%lu", &N); unsigned long A[N], B[N]; int i; for (i = 0; i < N - 1; i++) { scanf("%lu", &A[i]); B[i] = 0; } B[N - 1] = 0; unsigned long j; for (i = 0; i < N - 1; i++) { j = A[i]; B[j - 1] = B[j - 1] + 1; } for (i = 0; i < N; i+...
[["+", 0, 1, 0, 11, 31, 69, 71, 16, 17, 33], ["+", 0, 1, 0, 11, 31, 69, 71, 16, 12, 13]]
0
156
int main(void) { int n, b, a[20000] = {0}; int i; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &b); a[b - 1]++; } for (i = 0; i < n; i++) { printf("%d\n", a[i]); } }
int main(void) { int n, b, a[200000] = {0}; int i; scanf("%d", &n); for (i = 0; i < n - 1; i++) { scanf("%d", &b); a[b - 1]++; } for (i = 0; i < n; i++) { printf("%d\n", a[i]); } }
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
95
#include <bits/stdc++.h> using namespace std; int main() { int i, n; cin >> n; vector<int> ans(n); int arr[n - 1]; for (i = 0; i < n - 1; i++) { cin >> arr[i]; ans[arr[i] - 1]++; } for (auto x : ans) cout << x; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int i, n; cin >> n; vector<int> ans(n); int arr[n - 1]; for (i = 0; i < n - 1; i++) { cin >> arr[i]; ans[arr[i] - 1]++; } for (auto x : ans) cout << x << endl; return 0; }
[["+", 8, 9, 0, 338, 8, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 338, 8, 1, 0, 16, 12, 22]]
1
87
s = input().split() n = int(s[0]) s = input().split() d = [0]*n print(d) for i in s: d[int(i)-1]+=1 for i in range(n): print(d[i])
s = input().split() n = int(s[0]) s = input().split() d = [0]*n for i in s: d[int(i)-1]+=1 for i in range(n): print(d[i])
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
69
/*starting with the name of almighty ALLAH*/ /*solved by RAKIB JOY*/ #include <bits/stdc++.h> #define ll long long int #define pb push_back #define vc vector #define vi vc<int> #define vl vc<ll> #define dbg(x) cout << x << endl; #define mp(x, y) make_pair(x, y) #define yes dbg("YES") #define no dbg("NO") #define tst ...
/*starting with the name of almighty ALLAH*/ /*solved by RAKIB JOY*/ #include <bits/stdc++.h> #define ll long long int #define pb push_back #define vc vector #define vi vc<int> #define vl vc<ll> #define dbg(x) cout << x << endl; #define mp(x, y) make_pair(x, y) #define yes dbg("YES") #define no dbg("NO") #define tst ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
155
#include <iostream> #include <string> using namespace std; #define pi 3.141592 int main() { int n, x, a[200000] = {}; cin >> n; for (int i = 0; i < n; i++) { cin >> x; a[x]++; } for (int i = 0; i < n; i++) { cout << a[x] << endl; } }
#include <iostream> #include <string> using namespace std; #define pi 3.141592 int main() { int n, x, a[200001] = {}; cin >> n; for (int i = 0; i < n - 1; i++) { cin >> x; a[x]++; } for (int i = 1; i <= n; i++) { cout << a[i] << endl; } }
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9...
1
85