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
#include <algorithm> #include <iostream> #define flush fflush(stdout) using namespace std; typedef long long ll; typedef pair<int, int> P; const int mod = (int)1e9 + 7, INF = (int)1e9; int main(void) { int n, m, i, a, s; scanf("%d%d", &n, &m); s = 0; for (i = 0; i < m; i++) { scanf("%d", &a); s += a; ...
#include <algorithm> #include <iostream> #define flush fflush(stdout) using namespace std; typedef long long ll; typedef pair<int, int> P; const int mod = (int)1e9 + 7, INF = (int)1e9; int main(void) { int n, m, i, a, s; scanf("%d%d", &n, &m); s = 0; for (i = 0; i < m; i++) { scanf("%d", &a); s += a; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
141
#include <stdio.h> #define true 1 int main(void) { int n = 0; int boss[200001] = {}; int bossNum[200001] = {}; scanf("%d", &n); for (int i = 2; i <= n; i++) { scanf("%d", &boss[i]); bossNum[boss[i]] += 1; } for (int i = 1; i <= n; i++) { printf("%d", bossNum[i]); } return 0; }
#include <stdio.h> #define true 1 int main(void) { int n = 0; int boss[200001] = {}; int bossNum[200001] = {}; scanf("%d", &n); for (int i = 2; i <= n; i++) { scanf("%d", &boss[i]); bossNum[boss[i]] += 1; } for (int i = 1; i <= n; i++) { printf("%d\n", bossNum[i]); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
115
#include <iostream> using namespace std; int main() { int n; cin >> n; int sub[200001] = {}; for (int i = 0; i < n; i++) { int a; cin >> a; sub[a]++; } for (int i = 1; i <= n; i++) { cout << sub[i] << endl; } }
#include <iostream> using namespace std; int main() { int n; cin >> n; int sub[200001] = {}; for (int i = 0; i < n - 1; i++) { int a; cin >> a; sub[a]++; } for (int i = 1; i <= n; i++) { cout << sub[i] << endl; } }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
82
#include <bits/stdc++.h> using namespace std; int main() { int a; int K; cin >> a; vector<int> v(a + 1); int tmp; for (int i = 0; i < a; i++) { cin >> tmp; K = v.at(tmp) + 1; v.at(tmp) = K; } for (int i = 0; i < a + 1; i++) { cout << v.at(i) << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int a; int K; cin >> a; vector<int> v(a + 1); int tmp; for (int i = 0; i < a - 1; i++) { cin >> tmp; K = v.at(tmp) + 1; v.at(tmp) = K; } for (int i = 1; i < a + 1; i++) { cout << v.at(i) << endl; } }
[["+", 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]]
1
105
# import math # import statistics a=int(input()) #b,c=int(input()),int(input()) # c=[] # for i in a: # c.append(i) # e1,e2 = map(int,input().split()) f = list(map(int,input().split())) #g = [input() for _ in range(a)] f.sort() count=1 ans=[0 for i in range(len(f))] for i in range(len(f)-1): if f[i]==f[i+1]: ...
# import math # import statistics a=int(input()) #b,c=int(input()),int(input()) # c=[] # for i in a: # c.append(i) # e1,e2 = map(int,input().split()) f = list(map(int,input().split())) #g = [input() for _ in range(a)] f.sort() count=1 ans=[0 for i in range(a)] for i in range(len(f)-1): if f[i]==f[i+1]: ...
[["-", 0, 659, 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, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
127
n = int(input()) a = [int(x) for x in input().split()] ans = [0] * n for i in range(n): ans[a[i]-1] += 1 for i in range(n): print(ans[i])
n = int(input()) a = [int(x) for x in input().split()] ans = [0] * n for i in range(n-1): ans[a[i]-1] += 1 for i in range(n): print(ans[i])
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
67
n = int(input()) lst = list(map(int,input().split())) lst2 = [0 for i in range(n)] for i in range(n): x = lst[i] lst2[x - 1] = lst2[x - 1] + 1 for i in range(n): print(lst2[i])
n = int(input()) lst = list(map(int,input().split())) lst2 = [0 for i in range(n)] for i in range(n - 1): x = lst[i] lst2[x - 1] = lst2[x - 1] + 1 for i in range(n): print(lst2[i])
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
81
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main() { int n; cin >> n; vector<int> v(n); for (int i = 1; i < n; i++) { int a; cin >> a; v[a]++; } for (auto x : v) cout << x << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main() { int n; cin >> n; vector<int> v(n); for (int i = 1; i < n; i++) { int a; cin >> a; v[a - 1]++; } for (auto x : v) cout << x << endl; }
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
83
N = int(input()) rel_list = map(int, input().split()) member_list = [0]*N for rel in rel_list: member_list[rel-1] += 1 print([i for i in member_list])
N = int(input()) rel_list = map(int, input().split()) member_list = [0]*N for rel in rel_list: member_list[rel-1] += 1 [print(i) for i in member_list]
[["+", 36, 36, 0, 656, 0, 1, 0, 658, 0, 70], ["-", 0, 1, 0, 652, 3, 4, 0, 658, 0, 70], ["+", 0, 1, 0, 658, 8, 652, 3, 4, 0, 25], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
52
#include <bits/stdc++.h> using namespace std; int main(void) { int N; cin >> N; vector<int> v(N); vector<int> b(N); for (int i = 1; i < N; i++) { cin >> v[i]; } for (int i = 1; i < N; i++) { b[v[i]]++; } for (int i = 1; i <= N; i++) { cout << b[i] << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main(void) { int N; cin >> N; vector<int> v(N); map<int, int> b; for (int i = 1; i < N; i++) { cin >> v[i]; } for (int i = 1; i < N; i++) { b[v[i]]++; } for (int i = 1; i <= N; i++) { cout << b[i] << endl; } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 21], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25]]
1
114
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> res(N, 0); for (int i = 0; i < N; ++i) { int a; cin >> a; --a; res[a]++; } for (int i = 0; i < N; ++i) cout << res[i] << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> res(N, 0); for (int i = 0; i < N - 1; ++i) { int a; cin >> a; --a; res[a]++; } for (int i = 0; i < N; ++i) cout << res[i] << endl; }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
85
#pragma region header #include <algorithm> #include <assert.h> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip...
#pragma region header #include <algorithm> #include <assert.h> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip...
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
810
#include <bits/stdc++.h> using namespace std; int main() { int ar[1000000] = {0}; int n; cin >> n; for (int i = 0; i < n; i++) { int temp; cin >> temp; ++ar[temp]; } for (int i = 1; i < n; i++) { printf("%d\n", ar[i]); } }
#include <bits/stdc++.h> using namespace std; int main() { int ar[1000000] = {0}; int n; cin >> n; for (int i = 1; i < n; i++) { int temp; cin >> temp; ++ar[temp]; } for (int i = 1; i <= n; i++) { printf("%d\n", ar[i]); } }
[["-", 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, 0, 7, 15, 16, 17, 19]]
1
87
n = int(input()) k =[]*n a = list(map(int, input().split())) for i in range(n-1): k[a[i-1]] += 1 for i in range(k): print(k[i])
n = int(input()) k =[0]*n a = list(map(int, input().split())) for i in range(n-1): k[a[i]-1] += 1 for i in range(len(k)): print(k[i])
[["+", 0, 1, 0, 662, 12, 657, 31, 634, 0, 612], ["+", 0, 677, 31, 206, 206, 657, 31, 206, 0, 73], ["-", 0, 1, 0, 677, 31, 206, 206, 206, 0, 73], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
67
import bisect N = int(input()) A = [int(x) for x in input().split()] index = 0 for i in range(1, N+1): now = bisect.bisect_right(A, i) print(now - index) index = now
import bisect N = int(input()) A = [int(x) for x in input().split()] A=sorted(A) index = 0 for i in range(1, N+1): now = bisect.bisect_right(A, i) print(now - index) index = now
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
62
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(v) v.begin(), v.end() int main() { ll N; cin >> N; vector<ll> vec(N, 0); for (ll i = 0; i < N; i++) { ll A; cin >> A; vec[A - 1]++; } for (ll x : vec) { cout << x << endl; } }
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(v) v.begin(), v.end() int main() { ll N; cin >> N; vector<ll> vec(N, 0); for (ll i = 0; i < N - 1; i++) { ll A; cin >> A; vec[A - 1]++; } for (ll x : vec) { cout << x << endl; } }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
88
from collections import Counter n = int(input()) s = mapt(int, input().split(" ")) data = Counter(s) for i in range(1, n+1): print(data.get(i, 0))
from collections import Counter n = int(input()) s = map(int, input().split(" ")) data = Counter(s) for i in range(1, n+1): print(data.get(i, 0))
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
58
#include <stdio.h> int main() { long int n, a; long int cnt[200001] = {0}; scanf("%ld", &n); for (int i = 1; i < n; i++) { scanf("%ld", &a); cnt[a] = cnt[a] + 1; } for (int i = 1; i <= n; i++) { printf("%ld", cnt[i]); } return 0; }
#include <stdio.h> int main() { long n, a; long cnt[200001] = {0}; scanf("%ld", &n); for (int i = 1; i < n; i++) { scanf("%ld", &a); cnt[a] = cnt[a] + 1; } for (int i = 1; i <= n; i++) { printf("%ld\n", cnt[i]); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
104
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> v(n - 1, 0); int temp; for (int i = 0; i < n - 1; ++i) { cin >> temp; v[temp]++; } for (auto i : v) cout << i << endl; }
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> v(n, 0); int temp; for (int i = 0; i < n - 1; ++i) { cin >> temp; v[--temp]++; } for (auto i : v) cout << i << endl; }
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 0, 27, 28, 69, 341, 342, 0, 27, 17, 68]]
1
78
#include <algorithm> #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n; cin >> n; vector<int> ans(n, 0); for (int i = 0; i < n - 1; i++) { int a; cin >> a; ans.at(a)++; } for (int i = 1; i <= n; i++) { cout << ans.at(i) << end...
#include <algorithm> #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n; cin >> n; vector<int> ans(n, 0); for (int i = 0; i < n - 1; i++) { int a; cin >> a; ans.at(a - 1)++; } for (int i = 0; i < n; i++) { cout << ans.at(i) << ...
[["+", 0, 27, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 27, 28, 2, 3, 4, 0, 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, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
100
#include <bits/stdc++.h> using namespace std; int n, i, temp, a[200100]; int main() { cin >> n; for (i = 1; i <= n; i++) { cin >> temp; a[temp]++; } for (i = 1; i <= n; i++) { cout << a[i] << endl; } }
#include <bits/stdc++.h> using namespace std; int n, i, temp, a[200100]; int main() { cin >> n; for (i = 2; i <= n; i++) { cin >> temp; a[temp]++; } for (i = 1; i <= n; i++) { cout << a[i] << endl; } }
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]]
1
77
#include <bits/stdc++.h> #include <map> #include <queue> #include <set> #include <stack> #include <string.h> #include <vector> #define endl "\n" #define ll long long #define int long long #define fast \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> #include <map> #include <queue> #include <set> #include <stack> #include <string.h> #include <vector> #define endl "\n" #define ll long long #define int long long #define fast \ ios_base::sync_with_stdio(false); ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
258
#include <bits/stdc++.h> #define for0(i, b) for (int i = 0; i < b; i++) #define for1(i, b) for (int i = 1; i <= b; i++) #define reps(i, a, b) for (int i = a; i < b.length(); i++) typedef long long ll; #define MOD 1000000007 using namespace std; int main() { int n, val; cin >> n; std::vector<int> v(n, 0); for...
#include <bits/stdc++.h> #define for0(i, b) for (int i = 0; i < b; i++) #define for1(i, b) for (int i = 1; i <= b; i++) #define reps(i, a, b) for (int i = a; i < b.length(); i++) typedef long long ll; #define MOD 1000000007 using namespace std; int main() { int n, val; cin >> n; std::vector<int> v(n + 1, 0); ...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
120
N=int(input()) *A,=tuple(map(int,input().split())) import bisect for i in range(1,N+1): print(bisect.bisect_right(A,i)-bisect.bisect_left(A,i))
N=int(input()) *A,=sorted(map(int,input().split())) import bisect for i in range(1,N+1): print(bisect.bisect_right(A,i)-bisect.bisect_left(A,i))
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
61
#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; vector<int> x(n); for (int i = 1; i < n; i++) { int a; cin >> a; a--; x[a]++; } for (int i = 0; i < n; i++) cout << x[i] << end...
#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> x(n); for (int i = 1; i < n; i++) { int a; cin >> a; a--; x[a]++; } for (int i = 0; i < n; i++) cout <<...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
106
#include <bits/stdc++.h> using namespace std; typedef vector<int> vint; int a[200010]; int ans[200010]; int main() { int n; cin >> n; for (int i = 2; i <= n; i++) { cin >> a[i]; ans[a[i]]++; } for (int i = 1; i <= n; i++) cout << a[i] << endl; }
#include <bits/stdc++.h> using namespace std; typedef vector<int> vint; int a[200010]; int ans[200010]; int main() { int n; cin >> n; for (int i = 2; i <= n; i++) { cin >> a[i]; ans[a[i]]++; } for (int i = 1; i <= n; i++) cout << ans[i] << endl; }
[["-", 8, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 8, 1, 0, 16, 31, 16, 12, 69, 28, 22]]
1
93
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
[["+", 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
1,615
n = gets.chomp.to_i a = gets.chomp.split(' ').map(&:to_i) ans = Array.new(n){0} a.each do |i| ans[a[i]-1] += 1 end ans.each do |i| puts i end
n = gets.chomp.to_i a = gets.chomp.split(' ').map(&:to_i) ans = Array.new(n){0} a.each do |i| ans[i-1] += 1 end ans.each do |i| puts i end
[["-", 0, 755, 31, 742, 0, 738, 31, 742, 500, 22], ["-", 0, 755, 31, 742, 0, 738, 31, 742, 0, 70], ["-", 0, 755, 31, 742, 0, 738, 31, 742, 0, 73]]
4
65
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cmath> #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iostream> // cou...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cmath> #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iostream> // cou...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
196
#include <stdio.h> int main(void) { int n, m, i; scanf("%d", &n); int a[n]; for (i = 0; i < n; i++) { a[i] = 0; } for (i = 1; i < n; i++) { scanf("%d", &m); a[m - 1] = a[m - 1] + 1; } for (i = 0; i < n; i++) { printf("%d", a[i]); } return 0; }
#include <stdio.h> int main(void) { int n, m, i; scanf("%d", &n); int a[n]; for (i = 0; i < n; i++) { a[i] = 0; } for (i = 1; i < n; i++) { scanf("%d", &m); a[m - 1] = a[m - 1] + 1; } for (i = 0; i < n; i++) { printf("%d\n", a[i]); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
125
#include <stdio.h> int main(void) { int n, i, a; scanf("%d", &n); //社員の数 int s[n]; for (i = 0; i < n; i++) s[i] = 0; for (i = 0; i < n; i++) { scanf("%d", &a); //上司の番号 s[a - 1] += 1; } for (i = 0; i < n; i++) { printf("%d\n", s[i]); } return 0; }
#include <stdio.h> int main(void) { int n, i, a; scanf("%d", &n); //社員の数 int s[n]; for (i = 0; i < n; i++) s[i] = 0; for (i = 0; i < n - 1; i++) { scanf("%d", &a); //上司の番号 s[a - 1] += 1; } for (i = 0; i < n; i++) { printf("%d\n", s[i]); } return 0; }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
119
#include <stdio.h> int main() { int n, i; scanf("%d", &n); int a[n], b[n]; for (i = 0; i < n; i++) { b[i] = 0; } for (i = 0; i < n; i++) { scanf("%d", &a[i]); b[a[i] - 1]++; } for (i = 0; i < n; i++) { printf("%d\n", b[i]); } return 0; }
#include <stdio.h> int main() { int n, i; scanf("%d", &n); int a[n], b[n]; for (i = 0; i < n; i++) { b[i] = 0; } for (i = 0; i < n - 1; i++) { scanf("%d", &a[i]); b[a[i] - 1]++; } for (i = 0; i < n; i++) { printf("%d\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
126
#include <stdio.h> int main(void) { int a, b, i; int c[200000]; scanf("%d", &a); for (i = 0; i < a; i++) { c[i] = 0; } for (i = 0; i < a; i++) { scanf("%d", &b); c[b - 1]++; } for (i = 0; i < a; i++) { printf("%d\n", c[i]); } return 0; }
#include <stdio.h> int main(void) { int a, b, i; int c[200000]; scanf("%d", &a); for (i = 0; i < a; i++) { c[i] = 0; } for (i = 0; i < a - 1; i++) { scanf("%d", &b); c[b - 1]++; } for (i = 0; i < a; i++) { printf("%d\n", c[i]); } return 0; }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
118
#include <stdio.h> #include <stdlib.h> void main(void) { int sum = 0, a, i, b, c[200000] = {0}; scanf("%d", &a); for (i = 0; i < a; i++) { scanf("%d", &b); c[b] += 1; } for (i = 1; i < a; i++) { printf("%d\n", c[i]); } }
#include <stdio.h> #include <stdlib.h> void main(void) { int sum = 0, a, i, b, c[200000] = {0}; scanf("%d", &a); for (i = 1; i < a; i++) { scanf("%d", &b); c[b - 1] += 1; } for (i = 0; i < a; i++) { printf("%d\n", c[i]); } }
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 1, 0, 11, 31, 69, 71, 16, 17, 33], ["+", 0, 1, 0, 11, 31, 69, 71, 16, 12, 13]]
0
101
n = int(input()) a = list(map(int, input().split())) l = [0] * n for i in range(n - 1): if a[i] > 0: l[a[i] - 1] += 1 for i in range(n - 1): print(l[i])
n = int(input()) a = list(map(int, input().split())) l = [0] * n for i in range(n - 1): if a[i] > 0: l[a[i] - 1] += 1 for i in range(n): print(l[i])
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
78
#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); //初期化 rep(i, n - 1) cin >> boss_num.at(i); rep...
#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); ...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
143
import java.util.Scanner; public class Main { public static void main(String args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int a[] = new int[300000]; int ans[] = new int[300000]; for (int i = 2; i <= n; i++) { a[i] = scan.nextInt(); ans[a[i]]++; } f...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int a[] = new int[300000]; int ans[] = new int[300000]; for (int i = 2; i <= n; i++) { a[i] = scan.nextInt(); ans[a[i]]++; } ...
[["+", 54, 495, 0, 496, 39, 224, 497, 497, 0, 70], ["+", 54, 495, 0, 496, 39, 224, 497, 497, 0, 73]]
3
128
n=int(input()) a=list(map(int,input().split())) b=[]*n for i in range(n-1): b[a[i]-1]+=1 for i in b: print(i)
n=int(input()) a=list(map(int,input().split())) b=[0]*n for i in range(n-1): b[a[i]-1]+=1 for i in b: print(i)
[["+", 0, 1, 0, 662, 12, 657, 31, 634, 0, 612]]
5
61
#include <bits/stdc++.h> #define ll long long #define pb push_back long long int mod = (long long int)1000000007; using namespace std; void solve() { ll i, j, k, n; std::cout.precision(10); int yes = 0; cin >> n; int freq[n + 1] = {0}; n--; while (n--) { cin >> i; freq[i]++; } for (i = 1; i <...
#include <bits/stdc++.h> #define ll long long #define pb push_back long long int mod = (long long int)1000000007; using namespace std; void solve() { ll i, j, k, n; std::cout.precision(10); int yes = 0; cin >> n; int freq[n + 1] = {0}; j = n; n--; while (n--) { cin >> i; freq[i]++; } for (i...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
180
N=int(input()) A=list(map(int, input().split())) ans=[0]*N for _i in range(N): ans[A[i]-1]+=1 for x in ans: print(x)
N=int(input()) A=list(map(int, input().split())) ans=[0]*N for i in range(N-1): ans[A[i]-1]+=1 for x in ans: print(x)
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
60
N = int(input()) A = list(map(int, input().split())) result = [0] * N for a in A: result[a - 1] += 1 print('\n'.join(result))
N = int(input()) A = list(map(int, input().split())) result = [0] * N for a in A: result[a - 1] += 1 print('\n'.join(map(str, result))) #print(*result, sep='\n')
[["+", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
56
#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.at(i); vector<int> ans(N); for (int i = 0; i < N; i++) { ans.at(A.at(i) - 1)++; } for (auto a : ans) cout << a << "\n"; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; N--; vector<int> A(N); for (int i = 0; i < N; i++) cin >> A.at(i); vector<int> ans(N + 1); for (int i = 0; i < N; i++) { ans.at(A.at(i) - 1)++; } for (auto a : ans) cout << a << "\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], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
106
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) using namespace std; using ll = long long; using p = pair<int, int>; using Graph = vector<vector<int>>; const double PI = acos(-1); int main() { int N; cin >> N; int v[N] = {}; int a; rep(i, N) { cin >> a; v[a - 1]++; } ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) using namespace std; using ll = long long; using p = pair<int, int>; using Graph = vector<vector<int>>; const double PI = acos(-1); int main() { int N; cin >> N; int v[N] = {}; int a; rep(i, N - 1) { cin >> a; v[a - 1]++; ...
[["+", 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
117
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int A[N]; for (int i = 0; i < N - 1; i++) cin >> A[i]; int ans[N] = {0}; for (int i = 0; i < N - 1; i++) { ans[A[i] - 1]++; } for (int x = 0; x < N; x++) { cout << A[x] << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int A[N]; for (int i = 0; i < N - 1; i++) cin >> A[i]; int ans[N] = {0}; for (int i = 0; i < N - 1; i++) { ans[A[i] - 1]++; } for (int x = 0; x < N; x++) { cout << ans[x] << endl; } }
[["-", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22]]
1
112
n=int(input()) a=list(map(int,input().split())) ans=[0]*n for i in range(n-1): ans[a[i]-1] += 1 for i in range(n-1): print(ans[i])
n=int(input()) a=list(map(int,input().split())) ans=[0]*n for i in range(n-1): ans[a[i]-1] += 1 for i in range(n): print(ans[i])
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
70
<?php $N = intval(trim(fgets(STDIN))); $A_array = array_map('intval',explode(" ",trim(fgets(STDIN)))); $ans = array_fill(0,$N,0); // var_dump($ans); for($i=0;$i<($N-1);$i++){ $ans[$A_array[$i]-1]++; } for($i=0;$i<($N-1);$i++){ echo $ans[$i]."\n"; ...
<?php $N = intval(trim(fgets(STDIN))); $A_array = array_map('intval',explode(" ",trim(fgets(STDIN)))); $ans = array_fill(0,$N,0); // var_dump($ans); for($i=0;$i<($N-1);$i++){ $ans[$A_array[$i]-1]++; } for($i=0;$i<($N);$i++){ echo $ans[$i]."\n"; }...
[["-", 0, 7, 0, 16, 12, 23, 0, 16, 17, 33], ["-", 0, 7, 0, 16, 12, 23, 0, 16, 12, 612]]
6
127
import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; public class Main { private static Map<Integer, Integer> m_mapBossId = new LinkedHashMap<Integer, Integer>(); public static void main(String[] args) throws Exception { Scanner sc = new Scanner(S...
import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; public class Main { private static Map<Integer, Integer> m_mapBossId = new LinkedHashMap<Integer, Integer>(); public static void main(String[] args) throws Exception { Scanner sc = new Scanner(S...
[["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
228
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n - 1); vector<int> vv(n, 0); for (int i = 0; i < n - 1; i++) { cin >> v.at(i); vv.at(v.at(i))++; } for (int j = 0; j < n; j++) cout << vv.at(j) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n - 1); vector<int> vv(n + 1, 0); for (int i = 0; i < n - 1; i++) { cin >> v.at(i); vv.at(v.at(i) - 1)++; } for (int j = 0; j < n; j++) cout << vv.at(j) << endl; }
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 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
106
#include <bits/stdc++.h> using namespace std; #define PI 3.14159265358979323846264338327950L #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main() { int n; cin >> n; int ans[n]; int a[n]; for (int i = 0; i < n; i++) { ans[i] = 0; a[i] = 0; //無理やり0にすればいい } for (int i =...
#include <bits/stdc++.h> using namespace std; #define PI 3.14159265358979323846264338327950L #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main() { int n; cin >> n; int ans[n]; int a[n]; for (int i = 0; i <= n; i++) { ans[i] = 0; a[i] = 0; } for (int i = 0; i < n; i+...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
135
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <vector> using namespace std; using lint = long long; constexpr int MOD = 1000000007, INF = 1010101010; constex...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <vector> using namespace std; using lint = long long; constexpr int MOD = 1000000007, INF = 1010101010; constex...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
190
#include <bits/stdc++.h> using namespace std; using Graph = vector<vector<int>>; int main(void) { int N; cin >> N; Graph G(N); int a; for (int i = 2; i <= N; i++) { cin >> a; G[a].push_back(1); } for (int i = 1; i <= N; i++) { cout << G[i].size() << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; using Graph = vector<vector<int>>; int main(void) { int N; cin >> N; Graph G(N + 1); int a; for (int i = 2; i <= N; i++) { cin >> a; G[a].push_back(1); } for (int i = 1; i <= N; i++) { cout << G[i].size() << endl; } return 0; }
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
102
import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] a = new int[n]; int[] ar = new int[n]; for (int i = 2; i <= n; i++) { a[i] = s.nextInt(); } for (in...
import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] a = new int[200010]; int[] ar = new int[200010]; for (int i = 2; i <= n; i++) { a[i] = s.nextInt(); } ...
[["-", 0, 503, 49, 200, 51, 227, 497, 505, 0, 22], ["+", 0, 503, 49, 200, 51, 227, 497, 505, 0, 499]]
3
147
#include <iostream> using namespace std; int c[200001]; int main() { int n, a, i; cin >> n; for (i = 2; i < n; i++) { cin >> a; c[a]++; } for (i = 1; i <= n; i++) { cout << c[a] << endl; } return 0; }
#include <iostream> using namespace std; int c[200001]; int main() { int n, a, i; cin >> n; for (i = 1; i < n; i++) { cin >> a; c[a]++; } for (i = 1; i <= n; i++) { cout << c[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, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22]]
1
81
N = int(input()) A = list(map(int, input().split())) man=1 cnt=0 man_list=[0]*N A += [0] for a in A: if a != man: man_list[man-1] = cnt man = a cnt=0 cnt+=1 for l in man_list: print(l)
N = int(input()) A = list(map(int, input().split())) man=1 cnt=0 man_list=[0]*N A.sort() A += [0] for a in A: if a != man: man_list[man-1] = cnt man = a cnt=0 cnt+=1 for l in man_list: print(l)
[["+", 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], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 31, 22]]
5
79
def main(): n = int(input()) A = list(map(int, input().split())) num = [0] * n # for i in range(0, n-1): # for k in range(0, len(A)): # if A[k] == i+1: # num[i] += 1 for i in range(0, n-1): num[A[i]] += 1 for k in range(1, n+1): print(num[k]) main()
def main(): n = int(input()) A = list(map(int, input().split())) num = [0] * n + [0] # for i in range(0, n-1): # for k in range(0, len(A)): # if A[k] == i+1: # num[i] += 1 for i in range(0, n-1): num[A[i]] += 1 for k in range(1, n+1): print(num[k]) main()
[["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 1, 0, 662, 12, 657, 12, 634, 0, 70], ["+", 0, 1, 0, 662, 12, 657, 12, 634, 0, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 634, 0, 73]]
5
84
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int N; cin >> N; vector<int> A(N - 1); for (int i = 0; i < N - 1; ++i) { int a; cin >> a; A[a - 1]++; } for (int i = 0; i < N; i++) { cout << A[i] << endl; } return 0; }
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int N; cin >> N; vector<int> A(N); for (int i = 0; i < N - 1; ++i) { int a; cin >> a; A[a - 1]++; } for (int i = 0; i < N; i++) { cout << A[i] << endl; } return 0; }
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
93
n = input() num = list(map(int,input().split())) num.sort() cnt = 0 work = 0 sum = 0 flg = 0 for i in num: if work != i: if work != 0: print(cnt) sum += 1 cnt = 1 mae = work + 1 work = i if mae != work: for i in range(mae,work): print(0) elif work == i: cnt += 1 ...
n = input() num = list(map(int,input().split())) num.sort() cnt = 0 work = 0 sum = 0 flg = 0 for i in num: if work != i: if work != 0: print(cnt) sum += 1 cnt = 1 mae = work + 1 work = i if mae != work: for i in range(mae,work): print(0) sum += 1 elif work == i...
[["+", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 612]]
5
126
def main(): n = int(input()) a = list(map(int, input().split(' '))) buka = [0]*n print(a) for i in a: buka[i-1] += 1 for i in buka: print(i) if __name__ == "__main__": main()
def main(): n = int(input()) a = list(map(int, input().split(' '))) buka = [0]*n for i in a: buka[i-1] += 1 for i in buka: print(i) if __name__ == "__main__": main()
[["-", 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
76
n=int(input()) a=list(map(int,input().split())) mem=[0]*10 for i in a: mem[i-1]+=1 for i in mem: print(i)
n=int(input()) a=list(map(int,input().split())) mem=[0]*n for i in a: mem[i-1]+=1 for i in mem: print(i)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
54
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] emp = new int[n]; for (int i = 0; i < n - 1; i++) { emp[sc.nextInt() - 1]++; } for (int i = 0; i < n; i++) { System.out.print(emp[...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] emp = new int[n]; for (int i = 0; i < n - 1; i++) { emp[sc.nextInt() - 1]++; } for (int i = 0; i < n; i++) { System.out.println(em...
[["-", 0, 7, 8, 196, 0, 1, 0, 492, 141, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 492, 141, 22]]
3
113
#include <bits/stdc++.h> using namespace std; // 小数点以下桁数 // fixed << setprecision(i) int main() { int n, a; vector<int> b(200000, 0); cin >> n; for (int i = 0; i < n; i++) { cin >> a; b[a - 1]++; } for (int i = 0; i < n; i++) cout << b[i] << endl; }
#include <bits/stdc++.h> using namespace std; // 小数点以下桁数 // fixed << setprecision(i) int main() { int n, a; vector<int> b(200000, 0); cin >> n; for (int i = 1; i < n; i++) { cin >> a; b[a - 1]++; } for (int i = 0; i < n; i++) cout << b[i] << endl; }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
85
n = int(input()) a = list(map(int, input().split())) l = [0] * n for i in range(n-1): l[a[i] - 1] += 1 print(l)
n = int(input()) a = list(map(int, input().split())) l = [0] * n for i in range(n-1): l[a[i] - 1] += 1 for j in l: print(j)
[["+", 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
57
N = int(input()) A = list(map(int,input().split())) l = [0]*N for i in A: l[i-1] += 1 print(l,sep="\n")
N = int(input()) A = list(map(int,input().split())) l = [0]*N for i in A: l[i-1] += 1 print(*l,sep="\n")
[["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48]]
5
55
#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> num(n); for (int j = 0; j < n; j++) { num[a[j]]++; } for (int k = 0; k < n; k++) { cout << num[k] << endl; } }
#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> num(n); for (int j = 0; j < n - 1; j++) { num[a[j] - 1]++; } for (int k = 0; k < n; k++) { cout << num[k] << endl; } }
[["+", 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
110
N=int(input()) A=list(map(int, input().split())) ans=[0]*N for a in A: ans[a-1]+=1 print(ans)
N=int(input()) A=list(map(int, input().split())) ans=[0]*N for a in A: ans[a-1]+=1 for n in ans: print(n)
[["+", 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
49
#include <stdio.h> int main(void) { int i, N; scanf("%d", &N); int A[N - 1], B[N]; for (i = 0; i < N; i++) B[i] = 0; for (i = 0; i <= N - 2; i++) { scanf("%d", &A[i]); B[A[i]] += 1; } for (i = 0; i < N; i++) { printf("%d\n", B[i]); } return 0; }
#include <stdio.h> int main(void) { int i, N; scanf("%d", &N); int A[N - 1], B[N]; for (i = 0; i < N; i++) B[i] = 0; for (i = 0; i <= N - 2; i++) { scanf("%d", &A[i]); B[A[i] - 1] += 1; } for (i = 0; i < N; i++) { printf("%d\n", B[i]); } return 0; }
[["+", 0, 1, 0, 11, 31, 69, 71, 16, 17, 33], ["+", 0, 1, 0, 11, 31, 69, 71, 16, 12, 13]]
0
128
#include <stdio.h> int main(void) { int n, i, a; scanf("%d", &n); int buka[n + 1]; for (i = 0; i < n + 1; i++) buka[i] = 0; for (i = 2; i < n + 1; i++) { scanf("%d", &a); buka[a]++; } for (i = 1; i < n; i++) printf("%d\n", buka[i]); return 0; }
#include <stdio.h> int main(void) { int n, i, a; scanf("%d", &n); int buka[n + 1]; for (i = 0; i < n + 1; i++) buka[i] = 0; for (i = 2; i < n + 1; i++) { scanf("%d", &a); buka[a]++; } for (i = 1; i < n + 1; i++) printf("%d\n", buka[i]); return 0; }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
118
#include <stdio.h> int main() { int N; int i; int A; int shain[200000]; scanf("%d", &N); for (i = 1; i < N; i++) { scanf("%d", &A); shain[A - 1] += 1; } for (i = 0; i < N; i++) { printf("%d", shain[i]); } return 0; }
#include <stdio.h> int main() { int N; int i; int A; int shain[200000] = {0}; scanf("%d", &N); for (i = 1; i < N; i++) { scanf("%d", &A); shain[A - 1] += 1; } for (i = 0; i < N; i++) { printf("%d\n", shain[i]); } return 0; }
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
97
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(obj) (obj).begin(), (obj).end() #define bit(n) (1LL << (n)) typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; int sum[n]; rep(i, n) { sum[i] = 0; } r...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(obj) (obj).begin(), (obj).end() #define bit(n) (1LL << (n)) typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; int sum[n]; rep(i, n) { sum[i] = 0; } r...
[["+", 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
123
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iostream> // cout, endl, cin ...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iostream> // cout, endl, cin ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
156
def main(): N = int(input()) A = [int(x) for x in input().split()] B = [0] * N for i in range(N): B[A[N-i-1]] += 1 for i in range(N): print(B[i]) if __name__ == '__main__': main()
def main(): N = int(input()) A = [int(x) for x in input().split()] B = [0] * N for i in range(N-1): B[A[N-i-2]-1] += 1 for i in range(N): print(B[i]) if __name__ == '__main__': main()
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 677, 31, 206, 206, 206, 206, 657, 12, 612], ["+", 31, 206, 206, 657, 31, 206, 206, 657, 12, 612], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
84
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> sub(N + 1); for (int i = 0; i < N; ++i) { int x; cin >> x; ++sub[x]; } for (int i = 1; i <= N; ++i) { cout << sub[i] << endl; } return 0; }
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> sub(N + 1); for (int i = 0; i < N - 1; ++i) { int x; cin >> x; ++sub[x]; } for (int i = 1; i <= N; ++i) { cout << sub[i] << endl; } return 0; }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
89
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n - 1); for (int i = 0; i < n; i++) { a[i] = 0; } for (int i = 0; i < n - 1; i++) { int m; cin >> m; a[m - 1]++; } for (int i = 0; i < n; i++) { cout << a[i] << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { a[i] = 0; } for (int i = 0; i < n - 1; i++) { int m; cin >> m; a[m - 1]++; } for (int i = 0; i < n; i++) { cout << a[i] << endl; } }
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
111
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> cnt(n); for (int i = 0; i < n; i++) { cnt.at(i) = 0; } for (int i = 0; i < n; i++) { int a; cin >> a; cnt.at(a - 1)++; } for (int i = 0; i < n; i++) { cout << cnt.at(i) << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> cnt(n); for (int i = 0; i < n; i++) { cnt.at(i) = 0; } for (int i = 1; i < n; i++) { int a; cin >> a; cnt.at(a - 1)++; } for (int i = 0; i < n; i++) { cout << cnt.at(i) << endl; } }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
113
n = int(input()) s = list(map(int, input().split())) t = [0 for _ in range(n)] for i in range(n-1): t[i] += 1 for i in range(n): print(t[i])
n = int(input()) s = list(map(int, input().split())) t = [0 for _ in range(n)] for i in range(n-1): t[s[i]-1] += 1 for i in range(n): print(t[i])
[["+", 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], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
68
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <numeric> #incl...
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <numeric> #incl...
[["+", 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
1,963
n = int(input()) l = list(map(int,input().split())) k = 0 j = 1 cnt = 0 for i in range(n): if i == n-1: print(cnt) for _ in range(n - j): print(0) elif j == l[i]: cnt += 1 elif l[i] - j >= 1: print(cnt) cnt = 1 a = l[i] - j for _ in rang...
n = int(input()) l = list(map(int,input().split())) l.sort() k = 0 j = 1 cnt = 0 for i in range(n): if i == n-1: print(cnt) for _ in range(n - j): print(0) elif j == l[i]: cnt += 1 elif l[i] - j >= 1: print(cnt) cnt = 1 a = l[i] - j for _ ...
[["+", 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
125
n = int(input()) a = list(map(int, input().split())) c = [] * n for x in a: c[x-1] += 1 for x in c: print(x)
n = int(input()) a = list(map(int, input().split())) c = [0] * n for x in a: c[x-1] += 1 for x in c: print(x)
[["+", 0, 1, 0, 662, 12, 657, 31, 634, 0, 612]]
5
53
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n = int(readline()) a = list(map(int, readline().split())) l = [0]*n for i in a: l[i - 1] += 1 print(l, sep="/n")
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n = int(readline()) a = list(map(int, readline().split())) l = [0]*n for i in a: l[i - 1] += 1 print(*l,sep='\n')
[["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["-", 0, 652, 3, 4, 0, 653, 51, 557, 0, 654], ["-", 0, 652, 3, 4, 0, 653, 51, 557, 0, 6], ["-", 0, 652, 3, 4, 0, 653, 51, 557, 0, 655], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 654], ["+", 3, 4, 0, 653, 51, 557, 0, 6, 0, 44], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 655]]
5
84
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] member = new int[N]; for (int i = 0; i < N - 1; i++) { member[sc.nextInt()]++; } for (int j = 0; j < N; j++) { System.out.println(membe...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] member = new int[N]; for (int i = 0; i < N - 1; i++) { member[sc.nextInt() - 1]++; } for (int j = 0; j < N; j++) { System.out.println(m...
[["+", 0, 1, 0, 27, 0, 504, 71, 16, 17, 33], ["+", 0, 1, 0, 27, 0, 504, 71, 16, 12, 499]]
3
111
n=int(input()) l=list(map(int,input().split(" "))) s=[0]*n for i in range(len(l)): s[l.pop()]+=1 for i in range(n): print(s[i])
n=int(input()) l=list(map(int,input().split(" "))) s=[0]*n for i in range(len(l)): s[l.pop()-1]+=1 for i in range(n): print(s[i])
[["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
71
x = Array.new(200001, 0) n = gets.to_i a = gets.split.map(&:to_i) for i in a x[i] += 1 end 1.upto a.length do |i| puts x[i] end
x = Array.new(200001, 0) n = gets.to_i a = gets.split.map(&:to_i) for i in a x[i] += 1 end 1.upto a.length+1 do |i| puts x[i] end
[["+", 0, 493, 0, 652, 3, 4, 0, 738, 17, 72], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 12, 612]]
4
53
#n, m, q = map(int, input().split()) #List = list(map(int, input().split())) #req = [list(map(int, input().split())) for _ in range(q)] #t = t[:-1] #print(ans[j], end = "") 改行無しで出力 #ans = [0]*n n = int(input()) a = list(map(int, input().split())) print(a) ans = [0]*n for i in a: ans[i-1] += 1 for j in ans: pr...
#n, m, q = map(int, input().split()) #List = list(map(int, input().split())) #req = [list(map(int, input().split())) for _ in range(q)] #t = t[:-1] #print(ans[j], end = "") 改行無しで出力 #ans = [0]*n n = int(input()) a = list(map(int, input().split())) ans = [0]*n for i in a: ans[i-1] += 1 for j in ans: print(j)
[["-", 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
64
N = int(input()) A = list(map(int,input().split())) m = [0]*N #0~N-1 print(m) for i in A: m[i-1] += 1 for i in range(N): print(m[i])
N = int(input()) A = list(map(int,input().split())) m = [0]*N #0~N-1 for i in A: m[i-1] += 1 # print(m) for i in range(N): print(m[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
65
n = int(input()) a = list(map(int, input().split())) ans = [0]*n counter = 0 for i in range(n): ans[a[i-1]] += 1 for i in range(n): print(ans[i])
n = int(input()) a = list(map(int, input().split())) ans = [0]*n counter = 0 for i in range(n-1): ans[a[i]-1] += 1 for i in range(n): print(ans[i])
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 677, 31, 206, 206, 657, 31, 206, 0, 73], ["-", 0, 1, 0, 677, 31, 206, 206, 206, 0, 73]]
5
69
#include <bits/stdc++.h> using namespace std; int main() { int N, A; cin >> N; vector<int> B(210000); for (int i = 0; i < N; i++) { cin >> A; B[A - 1]++; } for (int i = 0; i < N; i++) { cout << B[i] << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int N, A; cin >> N; vector<int> B(210000); for (int i = 0; i < N - 1; i++) { cin >> A; B[A - 1]++; } for (int i = 0; i < N; i++) { cout << B[i] << endl; } }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
83
N=int(input()) A=list(map(int,input().split())) x=A[0]*N for i in A: x[i-1]+=1 for j in x: print(j)
N=int(input()) A=list(map(int,input().split())) x=[0]*N for i in A: x[i-1]+=1 for j in x: print(j)
[["-", 0, 1, 0, 662, 12, 657, 31, 206, 51, 22]]
5
55
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> A(n, 0); for (int i = 0; i < n - 1; i++) { int a; cin >> a; a--; A.at(a); } for (int a : A) cout << a << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> A(n, 0); for (int i = 0; i < n - 1; i++) { int a; cin >> a; a--; A.at(a)++; } for (int a : A) { cout << a << endl; } return 0; }
[["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 338, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 338, 8, 9, 0, 46]]
1
81
N = int(input()) A = [0] B = list(map(int, input().split())) A += B #print(A) sig = [0] * N for i in range(N-1): sig[A[i+1]] += 1 #print(sig) #print(sig) for i in sig: print(i)
N = int(input()) A = [0] B = list(map(int, input().split())) A += B #print(A) sig = [0] * N for i in range(N-1): sig[A[i+1]-1] += 1 #print(sig) #print(sig) for i in sig: print(i)
[["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
73
#include <bits/stdc++.h> using namespace std; #define INF 1000007 #define MOD 1000000007 #define maxn 101 #define maxh 1001 #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) FOR(i, 0, n) const int dx[4] = {0, 1, -1, 0}, dy[4] = {1, 0, 0, -1}; typedef std::pair<int, int> P; template <typename A, s...
#include <bits/stdc++.h> using namespace std; #define INF 1000007 #define MOD 1000000007 #define maxn 101 #define maxh 1001 #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) FOR(i, 0, n) const int dx[4] = {0, 1, -1, 0}, dy[4] = {1, 0, 0, -1}; typedef std::pair<int, int> P; template <typename A, s...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
552
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) a.push_back(0); int b[n - 1]; for (int i = 0; i < n - 1; i++) { cin >> b[i]; a[b[i]]++; } for (int i = 0; i < n; i++) { cout << a[i] << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n + 1; i++) a.push_back(0); int b[n - 1]; for (int i = 0; i < n - 1; i++) { cin >> b[i]; a[b[i]]++; } for (int i = 1; i <= n; i++) { cout << a[i] << endl; } return 0; ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 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, 0, 7, 15, 16, 17, 19]]
1
119
N = int(input()) A = list(map(int,input.split())) ans = [0]*N for i in A: ans[i-1] += 1 for j in ans: print(j)
N = int(input()) A = list(map(int,input().split())) ans = [0]*N for i in A: ans[i-1] += 1 for j in ans: print(j)
[["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25]]
5
52
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> ans(n); for (int i = 0; i > n - 1; i++) { int a; cin >> a; ans[a - 1]++; } for (int i = 0; i < n; i++) { cout << ans[i] << endl; } return 0; }
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> ans(n); for (int i = 0; i < n - 1; i++) { int a; cin >> a; ans[a - 1]++; } for (int i = 0; i < n; i++) { cout << ans[i] << endl; } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
91
#include <iostream> #include <vector> using namespace std; int main() { int n, x; cin >> n; vector<int> fv(n); for (int i = 1; i < n; ++i) { cin >> x; fv[x]++; } for (int i = 1; i <= n; ++i) cout << fv[i] << " \n"; return 0; }
#include <iostream> #include <vector> using namespace std; int main() { int n, x; cin >> n; vector<int> fv(200000); for (int i = 1; i < n; ++i) { cin >> x; fv[x]++; } for (int i = 1; i <= n; ++i) cout << fv[i] << " \n"; return 0; }
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
87
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <time.h> #include <tuple> #include <utility> #include <vector> #define ll ...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <time.h> #include <tuple> #include <utility> #include <vector> #define ll ...
[["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 31, 69, 28, 2, 3, 4, 0, 16, 17, 72], ["+", 31, 69, 28, 2, 3, 4, 0, 16, 12, 13]]
1
301
#include <algorithm> #include <bits/stdc++.h> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> a(n), count(n); for (int i = 1; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { count[i] = 0; } for (int i = 0; i < n;...
#include <algorithm> #include <bits/stdc++.h> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> a(200010), count(200010); for (int i = 2; i <= n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { count[i] = 0; } for (int i =...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 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, 0, 7, 15, 16, 17, 19]]
1
137
n = int(input()) a = list(input().split()) #print(a) employ = {} for i in range(len(a)): if a[i] in employ: employ[a[i]] = employ[a[i]] + 1 else: employ[a[i]] = 1 #print(employ) for i in range(1, n): if str(i) in employ: print(employ[str(i)]) else: print(0)
n = int(input()) a = list(input().split()) #print(a) employ = {} for i in range(len(a)): if a[i] in employ: employ[a[i]] = employ[a[i]] + 1 else: employ[a[i]] = 1 #print(employ) for i in range(1, n+1): if str(i) in employ: print(employ[str(i)]) else: print(0)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
107
N = int(input()) A = list(map(int,input().split())) count = [0]*(N-1) for i in range(N-1): count[A[i]-1] += 1 for i in count: print(i)
N = int(input()) A = list(map(int,input().split())) count = [0]*N for i in range(N-1): count[A[i]-1] += 1 for i in count: print(i)
[["-", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["-", 0, 662, 12, 657, 12, 23, 0, 657, 17, 33], ["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["-", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]]
5
66
#include <iostream> using namespace std; int main() { int a; cin >> a; int s, result[a]; for (int i = 0; i < a; i++) { result[i] = 0; } for (int i = 0; i < a; i++) { cin >> s; result[s - 1] += 1; } for (int i = 0; i < a; i++) { cout << result[s] << endl; } }
#include <iostream> using namespace std; int main() { int a; cin >> a; int s, result[a]; for (int i = 0; i < a; i++) { result[i] = 0; } for (int i = 1; i < a; i++) { cin >> s; result[s - 1] += 1; } for (int i = 0; i < a; i++) { cout << result[i] << endl; } }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22]]
1
104
from sys import stdin, stdout from collections import deque, defaultdict import math as m rl = lambda: stdin.readline() rll = lambda: stdin.readline().split() rli = lambda: map(int, stdin.readline().split()) INF, NINF = float('inf'), float('-inf') def main(): n = int(rl()) A = list(rli()) cnt = defaultdict(lambda...
from sys import stdin, stdout from collections import deque, defaultdict import math as m rl = lambda: stdin.readline() rll = lambda: stdin.readline().split() rli = lambda: map(int, stdin.readline().split()) INF, NINF = float('inf'), float('-inf') def main(): n = int(rl()) A = list(rli()) cnt = defaultdict(lambda...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
150