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 <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n - 1], ans[n]; for (int i = 0; i < n; i++) ans[i] = 0; for (int i = 0; i < n; i++) { cin >> a[i]; ans[a[i] - 1]++; } for (int i = 0; i < n; i++) cout << ans[i] << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n - 1], ans[n]; for (int i = 0; i < n; i++) ans[i] = 0; for (int i = 0; i < n - 1; i++) { cin >> a[i]; ans[a[i] - 1]++; } for (int i = 0; i < n; i++) cout << ans[i] << endl; }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
110
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #includ...
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #includ...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
179
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <stack> #include <stdlib.h> #include <string> #include <vector> int main() { long long n; std::cin >> n; std::vector<long long> v(n, 0); for (long l...
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <stack> #include <stdlib.h> #include <string> #include <vector> int main() { long long n; std::cin >> n; std::vector<long long> v(n, 0); for (long l...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
122
import collections n = int(input()) a = collections.Counter(list(map(int, input().split()))) for i in range(1,n): print(a[i+1])
import collections n = int(input()) a = collections.Counter(list(map(int, input().split()))) for i in range(n): print(a[i+1])
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
51
n = int(input()) A = [int(x) for x in input().split()] B = {} for a in A: if a not in B: B[a] = 0 B[a] += 1 for i in range(n): if i in B: print(B[i]) else: print(0)
n = int(input()) A = [int(x) for x in input().split()] B = {} for a in A: if a not in B: B[a] = 0 B[a] += 1 for i in range(1, n + 1): if i in B: print(B[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
79
#include <bits/stdc++.h> #define ll long long #define ld long double #define F first #define S second #define ONLINE_JUDGE 1 using namespace std; const int mod = 1e9 + 7; void solve() { int n; cin >> n; vector<int> c(n + 1); for (int i = 0; i < n; i++) { int x; cin >> x; c[x]++; } for (int ...
#include <bits/stdc++.h> #define ll long long #define ld long double #define F first #define S second #define ONLINE_JUDGE 1 using namespace std; const int mod = 1e9 + 7; void solve() { int n; cin >> n; vector<int> c(n + 1); for (int i = 0; i + 1 < n; i++) { int x; cin >> x; c[x]++; } for (...
[["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 12, 13]]
1
183
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n - 1), b(n, 0); for (int i = 0; i < n - 1; i++) { cin >> a[i]; b[a[i]]++; } for (int i = 0; i < n; i++) { cout << b[i] << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n - 1), b(n, 0); for (int i = 0; i < n - 1; i++) { cin >> a[i]; b[a[i] - 1]++; } for (int i = 0; i < n; i++) cout << b[i] << endl; return 0; }
[["+", 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
99
n = int(input()) a = list(map(int, input().split())) ans = [0]*n for i in range(n-1): ans[a[i]-1] += 1 print(a) [print(i) for i in ans]
n = int(input()) a = list(map(int, input().split())) ans = [0]*n for i in range(n-1): ans[a[i]-1] += 1 [print(i) for i in ans]
[["-", 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
67
#include <iostream> using namespace std; int main() { int count[200001] = {0}; int N; cin >> N; for (int i = 1; i < N - 1; i++) { int A; cin >> A; count[A]++; } for (int i = 1; i <= N; i++) { cout << count[i] << endl; } return 0; }
#include <iostream> using namespace std; int main() { int count[200001] = {0}; int N; cin >> N; for (int i = 1; i <= N - 1; i++) { int A; cin >> A; count[A]++; } for (int i = 1; i <= N; i++) { cout << count[i] << endl; } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
88
#include <bits/stdc++.h> using namespace std; #define ALL(obj) obj.begin(), obj.end() #define SORT(obj) sort(obj.begin(), obj.end()) #define pb(obj) push_back(obj) #define REP(i, N) for (int i = 0; i < N; i++) typedef long long ll; ll const MOD = 1e9 + 7; using ll = long long; int main() { ll n; cin >> n; vector...
#include <bits/stdc++.h> using namespace std; #define ALL(obj) obj.begin(), obj.end() #define SORT(obj) sort(obj.begin(), obj.end()) #define pb(obj) push_back(obj) #define REP(i, N) for (int i = 0; i < N; i++) typedef long long ll; ll const MOD = 1e9 + 7; using ll = long long; int main() { ll n; cin >> n; vector...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
122
from collections import defaultdict n=int(input()) a=list(map(int,input().split())) d=defaultdict(int) for item in a: d[item-1]+=1 print(d) for i in range(n): print(d[i])
from collections import defaultdict n=int(input()) a=list(map(int,input().split())) d=defaultdict(int) for item in a: d[item-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
67
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec(N - 1); for (int i = 0; i < N - 1; i++) { cin >> vec.at(i); } vector<int> count(N - 1); for (int i = 0; i < N - 1; i++) { count.at(vec.at(i))++; } for (int i = 1; i <= N; i++) { cout << count.at(...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec(N - 1); for (int i = 0; i < N - 1; i++) { cin >> vec.at(i); } vector<int> count(N + 1); for (int i = 0; i < N - 1; i++) { count.at(vec.at(i))++; } for (int i = 1; i <= N; i++) { cout << count.at(...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72]]
1
126
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> vec(n - 1); for (int i = 0; i < n - 1; i++) { cin >> vec.at(i); } vector<int> ans(n, 0); for (int i = 0; i < n - 1; i++) { ans.at(vec.at(i) - 1)++; } for (int i = 0; i < n - 2; i++) { cout ...
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> vec(n - 1); for (int i = 0; i < n - 1; i++) { cin >> vec.at(i); } vector<int> ans(n, 0); for (int i = 0; i < n - 1; i++) { ans.at(vec.at(i) - 1)++; } for (int i = 0; i < n - 1; i++) { cout ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
143
N = int(input()) ls = list(map(int, input())) anls = [0]*(N+1) for i in ls: anls[i] += 1 for i in range(1,N+1): print(anls[i])
N = int(input()) ls = list(map(int, input().split())) anls = [0]*(N+1) for i in ls: anls[i] += 1 for i in range(1,N+1): print(anls[i])
[["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
62
N = int(input()) A = [int(i) for i in input().split()] ans = [0]*N for a in A: ans[a-1] += 1 print(*A, sep='\n')
N = int(input()) A = [int(i) for i in input().split()] ans = [0]*N for a in A: ans[a-1] += 1 print(*ans, sep='\n')
[["-", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22]]
5
57
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") //#include<bits/stdc++.h> #include <cstdio> #include <cstring> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (...
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") //#include<bits/stdc++.h> #include <cstdio> #include <cstring> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (...
[["-", 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, 17, 72], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
433
#include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef int itn; const...
#include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef int itn; const...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
531
#include <iostream> #include <map> #include <vector> int main() { int N; std::cin >> N; std::vector<int> question(N); std::map<int, int> m; for (int i = 1; i < N; i++) { int A; std::cin >> A; question[i] = A; m[A]++; } for (int i = 0; i < N; i++) { int count = m[question[i] + 1]; ...
#include <iostream> #include <map> #include <vector> int main() { int N; std::cin >> N; std::vector<int> question(N); std::map<int, int> m; for (int i = 1; i < N; i++) { int A; std::cin >> A; question[i] = A; m[A]++; } for (int i = 0; i < N; i++) { int count = m[i + 1]; std::cout ...
[["-", 51, 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
119
#include <iostream> using namespace std; #define f(i, n) for (int i = 0; i < n; i++) #define int long long signed main() { int n; cin >> n; int m = n - 1; int freq[m]; f(i, m) freq[i] = 0; int dummy; f(i, m) { cin >> dummy; freq[dummy]++; } f(i, m) cout << freq[i] << endl; return 0; }
#include <iostream> using namespace std; #define f(i, n) for (int i = 0; i < n; i++) #define int long long signed main() { int n; cin >> n; int m = n - 1; int freq[n]; f(i, n) freq[i] = 0; int dummy; f(i, m) { cin >> dummy; freq[dummy - 1]++; } f(i, n) cout << freq[i] << endl; return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 16, 31, 16, 31, 2, 3, 4, 0, 22], ["+", 0, 16, ...
1
95
N = int(input()) A = list(map(int, input().split())) ans = [0] * N for i in A: ans[i] += 1 for a in ans[1:]: print(a)
N = int(input()) A = list(map(int, input().split())) ans = [0] * (N+1) for i in A: ans[i] += 1 for a in ans[1:]: print(a)
[["+", 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
56
n = int(input()) a = list(map(int,input().split())) s = [0 for _ in range(n)] for i in range(n): s[a[i]-1] += 1 for t in s:print(t)
n = int(input()) a = list(map(int,input().split())) s = [0 for _ in range(n)] for i in range(n-1): s[a[i]-1] += 1 for t in s:print(t)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
65
n = int(input()) ai = list(map(int, input().split())) ans = [0]*n for i in range(len(ai)): ans[ai[i]] += 1 for i in range(len(ans)): print(ans[i])
n = int(input()) ai = list(map(int, input().split())) ans = [0]*n for i in range(len(ai)): ans[ai[i]-1] += 1 for i in range(len(ans)): print(ans[i])
[["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
70
import collection N = int(input()) A = list(map(int, input().split())) count = collections.Counter(A) for n in range(N): print(count[n + 1])
import collections N = int(input()) A = list(map(int, input().split())) count = collections.Counter(A) for n in range(N): print(count[n+1])
[["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
52
N =int(input()) A =list(map(int,input().split())) l =[0]*N for i in A: l[i-1]+=1 print(l)
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], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["+", 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
49
import collections n = int(input()) a = list(map(int, input().split())) ac = collections.Counter(a) for i in range(1,n+1): print(a[i])
import collections n = int(input()) a = list(map(int, input().split())) ac = collections.Counter(a) for i in range(1,n+1): print(ac[i])
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22]]
5
54
n = int(input()) a = list(map(int, input().split())) ans = [0] * n for i in range(len(a)): ans[a[i]-1] += 1 for i in range(len(a)): print(ans[i])
n = int(input()) a = list(map(int, input().split())) ans = [0] * n for i in range(len(a)): ans[a[i]-1] += 1 for i in range(n): print(ans[i])
[["-", 0, 7, 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], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
72
import java.math.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] sub = new int[n + 1]; for (int i = 0; i < n; i++) sub[in.nextInt()] += 1; for (int i = 1; i <= n; i++) System.out.printl...
import java.math.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] sub = new int[n + 1]; for (int i = 0; i < n - 1; i++) sub[in.nextInt()] += 1; for (int i = 1; i <= n; i++) System.out.pr...
[["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
115
#include <iostream> #include <map> #include <set> #include <stdio.h> #include <string> #include <vector> using namespace std; #define ll long long #define rep(i, n) for (ll i = 1; i < (n + 1); i++) #define req(j, n) for (ll j = 1; j < (n + 1); j++) #define rer(k, n) for (ll k = 1; k < (n + 1); k++) int main() { ll...
#include <iostream> #include <map> #include <set> #include <stdio.h> #include <string> #include <vector> using namespace std; #define ll long long #define rep(i, n) for (ll i = 1; i < (n + 1); i++) #define req(j, n) for (ll j = 1; j < (n + 1); j++) #define rer(k, n) for (ll k = 1; k < (n + 1); k++) int main() { ll...
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
118
n =int(input()) s = list(map(int,input().split())) l =[0]*n while i < n-2 : l[s[i]-1] += 1 i += 1 for _ in range(n): print(l[_])
n =int(input()) s = list(map(int,input().split())) l =[0]*n i = 0 while i < n-1 : l[s[i]-1] += 1 i += 1 for _ in range(n): print(l[_])
[["+", 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], ["-", 0, 656, 0, 52, 15, 666, 0, 657, 12, 612], ["+", 0, 656, 0, 52, 15, 666, 0, 657, 12, 612]]
5
68
n = int(input()) boss_list = map(int, input().split()) employee_list = [0] * (n - 1) for boss in boss_list: employee_list[boss - 1] += 1 for employee in employee_list: print(employee)
n = int(input()) boss_list = map(int, input().split()) employee_list = [0] * n for boss in boss_list: employee_list[boss - 1] += 1 for employee in employee_list: print(employee)
[["-", 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
55
n = int(input()) boss_list = map(int, input().split()) employee_list = [0] * (n - 1) for boss in boss_list: employee_list[boss - 1] += 1 for employee in employee_list: print(employee)
n = int(input()) boss_list = map(int, input().split()) employee_list = [0] * (n) for boss in boss_list: employee_list[boss - 1] += 1 for employee in employee_list: print(employee)
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 17, 33], ["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612]]
5
55
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; N++; vector<int> data(N); vector<int> out(N, 0); N--; for (int i = 1; i < N; i++) { cin >> data[i]; } sort(data.begin(), data.end()); for (int i = 0; i <= N; i++) { out[data[i]...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; N++; vector<int> data(N); vector<int> out(N, 0); N--; for (int i = 1; i < N; i++) { cin >> data[i]; } sort(data.begin(), data.end()); for (int i = 0; i <= N; i++) { out[data[i]...
[["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22]]
1
135
N=int(input()) A=[int(i) for i in input().split()] lis=[0 for i in range(N)] for i in A: lis[i-1]+=1 print(lis)
N=int(input()) A=[int(i) for i in input().split()] lis=[0 for i in range(N)] for i in A: lis[i-1]+=1 for t in lis: print(t)
[["+", 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
55
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; a[0] = 0; int counter[n] = {}; for (int i = 1; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { counter[a[i]]++; } for (int i = 1; i < n; i++) { cout << counter[i] << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; a[0] = 0; int counter[n + 10] = {}; for (int i = 1; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { counter[a[i]]++; } for (int i = 1; i <= n; i++) { cout << counter[i] << endl; } }
[["+", 0, 43, 49, 50, 49, 80, 81, 16, 17, 72], ["+", 0, 43, 49, 50, 49, 80, 81, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
114
#include <algorithm> #include <complex> #include <cstdlib> #include <ctime> #include <iomanip> #include <iostream> #include <limits> #include <locale> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <tim...
#include <algorithm> #include <complex> #include <cstdlib> #include <ctime> #include <iomanip> #include <iostream> #include <limits> #include <locale> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <tim...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
244
#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> ans(n); rep(i, n) { int a; cin >> a; ans[a - 1]++; } for (int x : ans) { cout << x << endl; } return ...
#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> ans(n); rep(i, n - 1) { int a; cin >> a; ans[a - 1]++; } for (int x : ans) { cout << x << endl; } ret...
[["+", 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
93
N = int(input()) A_l = list(map(int, input().split())) ans_l = [0]*N i = 0 while i < N-1: ans_l[A_l[i]-1] += 1 i += 1 i=0 while i < N-1: print(ans_l[i]) i += 1
N = int(input()) A_l = list(map(int, input().split())) ans_l = [0]*N i = 0 while i < N-1: ans_l[A_l[i]-1] += 1 i += 1 i=0 while i < N: print(ans_l[i]) i += 1
[["-", 0, 656, 0, 52, 15, 666, 0, 657, 17, 33], ["-", 0, 656, 0, 52, 15, 666, 0, 657, 12, 612]]
5
76
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> x(n); int a; for (int i = 0; i < n; i++) { cin >> a; x[a - 1]++; } for (int i = 0; i < n; i++) { cout << x[i] << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> x(n); int a; for (int i = 0; i < n - 1; i++) { cin >> a; x[a - 1]++; } for (int i = 0; i < n; i++) { cout << x[i] << endl; } }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
84
N=int(input()) A=[int(x) for x in input().split()] M=[0 for i in range(N)] for i in range(len(A)): M[A[i]-1]+=1 print(M)
N=int(input()) A=[int(x) for x in input().split()] M=[0 for i in range(N)] for i in range(len(A)): M[A[i]-1]+=1 for i in M: 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
64
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #define rep(i, s, g) for (i = s; i < g; i++) using namespace std; using ll = long long; const int inf = 10...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #define rep(i, s, g) for (i = s; i < g; i++) using namespace std; using ll = long long; const int inf = 10...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
138
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <tuple> #include <utility> #include <vector> #define...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <tuple> #include <utility> #include <vector> #define...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
163
#include <bits/stdc++.h> using namespace std; typedef long long int64; int main() { int n; cin >> n; vector<int> A(n + 1); for (int i = 1; i <= n; i++) { int x; cin >> x; A[x]++; } for (int i = 1; i <= n; i++) { cout << A[i] << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int64; int main() { int n; cin >> n; vector<int> A(n + 1); for (int i = 1; i < n; i++) { int x; cin >> x; A[x]++; } for (int i = 1; i <= n; i++) { cout << A[i] << endl; } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
92
n = int(input().strip().split()) arr = [int(i) for i in input().strip().split()] result = {i:0 for i in range(1, n + 1)} for i, j in enumerate(arr, 2): result[j] += 1 for i in result.values(): print(i)
n = int(input().strip()) arr = [int(i) for i in input().strip().split()] result = {i:0 for i in range(1, n + 1)} for i, j in enumerate(arr, 2): result[j] += 1 for i in result.values(): print(i)
[["-", 12, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["-", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
87
N = int(input()) A = [int(s) for s in input().split(" ")] R = [0] * (A + 1) for a in A: R[a - 1] += 1 for a in R: print(a)
N = int(input()) A = [int(s) for s in input().split(" ")] R = [0] * (len(A) + 1) for a in A: R[a - 1] += 1 for a in R: print(a)
[["+", 12, 657, 12, 23, 0, 657, 31, 652, 63, 22], ["+", 12, 23, 0, 657, 31, 652, 3, 4, 0, 24], ["+", 12, 23, 0, 657, 31, 652, 3, 4, 0, 25]]
5
62
n = int(input()) a = list(map(int,input().split())) al = [0 for i in range(n)] for i in a: al[a[i]-1] += 1 for i in range(n): print(al[i])
n = int(input()) a = list(map(int,input().split())) al = [0 for i in range(n)] for i in a: al[i-1] += 1 for i in range(n): print(al[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]]
5
68
n = int(input()) a = list(map(int, input().split())) submap = {} for each in a: try: submap[i] += 1 except: submap[i] = 1 for i in range(1, n+1): try: print(submap[i]) except: print(0)
n = int(input()) a = list(map(int, input().split())) submap = {} for each in a: try: submap[each] += 1 except: submap[each] = 1 for i in range(1, n+1): try: print(submap[i]) except: print(0)
[["-", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22], ["-", 0, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 0, 196, 0, 1, 0, 662, 31, 206, 206, 22]]
5
77
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n; scanf("%d", &n); int i; int a[n]; int b[n]; memset(b, 0, sizeof(b + 1)); for (i = 2; i <= n; i++) { scanf("%d", &a[i]); b[a[i]]++; } for (i = 1; i <= n; i++) printf("%d\n", b[i]); return 0; }
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n; scanf("%d", &n); int i; int a[n + 1]; int b[n + 1]; memset(b, 0, sizeof(b)); for (i = 2; i <= n; i++) { scanf("%d", &a[i]); b[a[i]]++; } for (i = 1; i <= n; i++) printf("%d\n", b[i]); return 0; }
[["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["-", 3, 4, 0, 105, 51, 23, 0, 16, 17, 72], ["-", 3, 4, 0, 105, 51, 23, 0, 16, 12, 13]]
0
121
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> a; for (int i = 0; i < n; i++) { a.push_back(0); } int k; for (int i = 1; i < n; i++) { cin >> k; a[k - 1]++; } for (int i = 0; i < n; i++) { cout << a[k - 1] << endl; } return 0; }
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> a; for (int i = 0; i < n; i++) { a.push_back(0); } int k; for (int i = 1; i < n; i++) { cin >> k; a[k - 1]++; } for (int i = 0; i < n; i++) { cout << a[i] << endl; } return 0; }
[["-", 31, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["-", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22]]
1
111
N = int(input()) liste = list(map(int, input().split())) from collections import Counter countedList = Counter(liste) for i in range(N): if i in countedList: print(countedList[i]) else: print('0')
N = int(input()) liste = list(map(int, input().split())) from collections import Counter countedList = Counter(liste) # print( for i in range(N): if i+1 in countedList: print(countedList[i+1]) else: print('0')
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 72], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]]
5
63
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()]++; } for (int i = 1; i < N; 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 + 1]; for (int i = 0; i < N - 1; i++) { A[sc.nextInt()]++; } for (int i = 1; i <= N; i++) { System.out.println(A[i]); ...
[["+", 49, 200, 51, 227, 497, 505, 0, 16, 17, 72], ["+", 49, 200, 51, 227, 497, 505, 0, 16, 12, 499], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
3
111
#include <iostream> #include <vector> int main(void) { int N; std::cin >> N; std::vector<int> ans(N); for (int i = 0; i < N - 1; i++) { int a; std::cin >> a; ans[a]++; } for (const auto x : ans) { std::cout << x << std::endl; } return 0; }
#include <iostream> #include <vector> int main(void) { int N; std::cin >> N; std::vector<int> ans(N); for (int i = 0; i < N - 1; i++) { int a; std::cin >> a; a--; ans[a]++; } for (const auto x : ans) { std::cout << x << std::endl; } return 0; }
[["+", 0, 7, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
87
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n; int a[200005]; int ans[200005]; scanf("%d", &n); for (int i = 0; i < n - 1; i++) { scanf("%d", &a[i]); } for (int i = 0; i < n - 1; i++) { ans[i] = 0; } for (int i = 0; i < n - 1; i++) { a...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n; int a[200005]; int ans[200005]; scanf("%d", &n); for (int i = 0; i < n - 1; i++) { scanf("%d", &a[i]); } for (int i = 0; i < n; i++) { ans[i] = 0; } for (int i = 0; i < n - 1; i++) { ans[a...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
156
a=[0]*int(input()) for i in input().split(): a[int(i)-1]+=1 for i in range(N): print(f'{a[i]}')
a=[0]*int(input()) for i in input().split(): a[int(i)-1]+=1 for i in range(len(a)): print(f'{a[i]}')
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 7, 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]]
5
53
N = int(input()) A = list(map(int, input().split())) data = [0 for i in range(N-1)] for i in range(N-1): data[A[i]-1] += 1 for j in range(N-1): print(data[j], end = '\n')
N = int(input()) A = list(map(int, input().split())) data = [0 for i in range(N)] for i in range(N-1): data[A[i]-1] += 1 for j in range(N): print(data[j], end = '\n')
[["-", 0, 659, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
83
N=int(input()) A=list(map(int,input().split())) dic={} for i in range(1,N+1): dic[i]=0 for a in A: dic[a]=+1 for i in range(1,N+1): print(dic[i])
n = int(input()) A = list(map(int, input().split())) dic = {} for i in range(1, n+1): dic[i] = 0 for a in A: dic[a] += 1 for i in range(1, n+1): print(dic[i])
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 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
78
#include <bits/stdc++.h> #define ll long long const int N = 200005; using namespace std; int n, a, x[N]; int main() { cin >> n; for (int i = 2; i <= n; i++) cin >> a, x[a]++; for (int i = 1; i <= n; i++) cout << x[i]; return 0; }
#include <bits/stdc++.h> #define ll long long const int N = 200005; using namespace std; int n, a, x[N]; int main() { cin >> n; for (int i = 2; i <= n; i++) cin >> a, x[a]++; for (int i = 1; i <= n; i++) cout << x[i] << endl; return 0; }
[["+", 8, 9, 0, 7, 8, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 7, 8, 1, 0, 16, 12, 22]]
1
83
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a[200010]; ll ans[200010] = {0}; ll n; cin >> n; for (ll i = 2; i <= n; i++) { cin >> a[i]; ans[a[i]]++; } for (ll i = 2; i <= n; i++) { cout << a[i] << "\n"; } }
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a[200010]; ll ans[200010] = {0}; ll n; cin >> n; for (ll i = 2; i <= n; i++) { cin >> a[i]; ans[a[i]]++; } for (ll i = 1; i <= n; i++) { cout << ans[i] << "\n"; } }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22]]
1
97
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int temp = n - 1; int a[n] = {0}; while (temp--) { int x; cin >> x; a[x] = a[x] + 1; } for (int i = 1; i <= n; i++) cout << a[i] << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int temp = n - 1; int a[n + 1] = {0}; while (temp--) { int x; cin >> x; a[x] = a[x] + 1; } for (int i = 1; i <= n; i++) cout << a[i] << endl; }
[["+", 0, 43, 49, 50, 49, 80, 81, 16, 17, 72], ["+", 0, 43, 49, 50, 49, 80, 81, 16, 12, 13]]
1
85
// file creato da gio il 2020-04-20 19:47:11.170774 #include <bits/stdc++.h> #define FAST #ifdef FAST #pragma GCC optimize("Ofast") #pragma GCC target( \ "fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #pragma GCC optimize("unroll-loop...
// file creato da gio il 2020-04-20 19:47:11.170774 #include <bits/stdc++.h> #define FAST #ifdef FAST #pragma GCC optimize("Ofast") #pragma GCC target( \ "fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #pragma GCC optimize("unroll-loop...
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
121
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N + 1]; for (int i = 1; i < N; i++) { int a = sc.nextInt(); A[a]++; } ...
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N + 1]; for (int i = 0; i < N - 1; i++) { int a = sc.nextInt(); A[a]++; ...
[["-", 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, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
3
125
N = int(input()) b = list(map(int,input().split())) c= list() for i in range( N ): c.append(0) for i in b: c[i - 1] += 1 for i in c: print(c[i - 1])
N = int(input()) b = list(map(int,input().split())) c = list() for i in range( N ): c.append(0) for i in b: c[i - 1] += 1 #print(c) for i in range(N): print(c[i])
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 12, 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, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25], ["-", 0, 652, 3, 4, 0, 206, 206, 657, 17, 33], ["-", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]]
5
71
import numpy as np N = int(input()) A = list(map(int,input().split())) boss=[0]*N for x in A: boss[x-1] += 1 for i in boss: print(int(boss[i]))
import numpy as np N = int(input()) A = list(map(int,input().split())) boss=[0]*N for x in A: boss[x-1] += 1 for i in boss: print(i)
[["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 3, 4, 0, 652, 3, 4, 0, 206, 51, 22], ["-", 3, 4, 0, 652, 3, 4, 0, 206, 0, 70], ["-", 3, 4, 0, 652, 3, 4, 0, 206, 0, 73], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
64
from sys import stdin,stdout size = int(stdin.readline()) li = list(map(int,stdin.readline().split())) """ans = [0]*size for i in li: if i not in ans: ans[i-1] = 1 else: ans[i-1] += 1 for i in ans: print(i) """ from collections import Counter c1 = Counter(li) ans2 = [0] * size for i,j in c1....
from sys import stdin,stdout size = int(stdin.readline()) li = list(map(int,stdin.readline().split())) """ans = [0]*size for i in li: if i not in ans: ans[i-1] = 1 else: ans[i-1] += 1 for i in ans: print(i) """ from collections import Counter c1 = Counter(li) ans2 = [0] * size for i,j in c1....
[["+", 0, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 657, 12, 557, 0, 654], ["+", 3, 4, 0, 657, 12, 557, 0, 6, 0, 44], ["+", 0, 652, 3, 4, 0, 657, 12, 557, 0, 655]]
5
85
#include <cstdio> #include <cstring> #include <iostream> #include <string> #include <utility> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> boss(n - 1); for (int i = 0; i < n - 1; i++) { int x; cin >> x; boss.at(x - 1) += 1; } for (int i = 0; i < n - 1; i++) ...
#include <cstdio> #include <cstring> #include <iostream> #include <string> #include <utility> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> boss(n); for (int i = 0; i < n - 1; i++) { int x; cin >> x; boss.at(x - 1) += 1; } for (int i = 0; i < n; i++) { co...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
105
#include <bits/stdc++.h> const int M = 2e5 + 9; const int MOD = 1e9 + 7; const long long MOD2 = 10000004873; const long long N = 1e12 + 7; using namespace std; long long pwr(long long b, int p) { if (p <= 0) return 1; long long sq = pwr(b, p >> 1); sq = (((sq % MOD) * (sq % MOD)) % MOD); if (p & 1) s...
#include <bits/stdc++.h> const int M = 2e5 + 9; const int MOD = 1e9 + 7; const long long MOD2 = 10000004873; const long long N = 1e12 + 7; using namespace std; long long pwr(long long b, int p) { if (p <= 0) return 1; long long sq = pwr(b, p >> 1); sq = (((sq % MOD) * (sq % MOD)) % MOD); if (p & 1) s...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
206
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vec(200010); vector<int> veC(200010); for (int i = 0; i < n - 1; i++) cin >> vec[i]; for (int i = 0; i < n - 1; i++) veC[vec[i]]++; for (int i = 0; i < n; i++) cout << veC[i] << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vec(200010); vector<int> veC(200010); for (int i = 0; i < n - 1; i++) cin >> vec[i]; for (int i = 0; i < n - 1; i++) veC[vec[i] - 1]++; for (int i = 0; i < n; i++) cout << veC[i] << endl; }
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
108
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include ...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
148
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n + 1] = {0}; int ar[n + 1]; for (int i = 2; i <= n; i++) cin >> ar[i]; for (int i = 1; i <= n; i++) ++arr[ar[i]]; for (int i = 1; i <= n; i++) cout << arr[i] << "\n"; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n + 1] = {0}; int ar[n + 1]; for (int i = 2; i <= n; i++) cin >> ar[i]; for (int i = 2; i <= n; i++) ++arr[ar[i]]; for (int i = 1; i <= n; i++) cout << arr[i] << "\n"; }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
108
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> ar(n); // int count =0; for (int i = 1; i < n; ++i) { int temp; cin >> temp; ar[temp] = ar[temp] + 1; } for (int i = 0; i < n; ++i) { cout << ar[i] << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> ar(n); // int count =0; for (int i = 1; i < n; ++i) { int temp; cin >> temp; ar[temp - 1] = ar[temp - 1] + 1; } for (int i = 0; i < n; ++i) { cout << ar[i] << endl; } }
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
89
#include <stdio.h> int main() { int n, i; scanf("%d", &n); int a[n], c[n]; for (i = 0; i < n; i++) { scanf("%d", &a[i]); } for (i = 0; i < n; i++) { c[i] = 0; } for (i = 0; i < n; i++) { c[a[i] - 1]++; } for (i = 0; i < n; i++) { printf("%d\n", c[i]); } return 0; }
#include <stdio.h> int main() { int n, i; scanf("%d", &n); int a[n - 1], c[n]; for (i = 0; i < n - 1; i++) { scanf("%d", &a[i]); } for (i = 0; i < n; i++) { c[i] = 0; } for (i = 0; i < n - 1; i++) { c[a[i] - 1]++; } for (i = 0; i < n; i++) { printf("%d\n", c[i]); } return ...
[["+", 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]]
0
141
import numpy as np N = int(input()) A = np.array(list(map(int, input().split()))) counter = np.bincount(A) print(counter) for i in range(1, N+1): if i < len(counter): print(counter[i]) else: print(0)
import numpy as np N = int(input()) A = np.array(list(map(int, input().split()))) counter = np.bincount(A) for i in range(1, N+1): if i < len(counter): print(counter[i]) else: print(0)
[["-", 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
79
N = int(input()) A = list(map(int,input().split())) B = [0]*N for i in range(N-1): B[A.pop()-1]+=1 for i in B: print(B[i])
N = int(input()) A = list(map(int,input().split())) B = [0]*N for i in range(N-1): B[A.pop()-1]+=1 for i in range(N): print(B[i])
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 12, 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, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25]]
5
66
#include <iostream> #include <vector> #define MAX 200000 using namespace std; int main(void) { int N; cin >> N; int num[MAX] = {}; vector<int> v; for (int i = 0; i < N - 1; i++) { int tmp; cin >> tmp; v.push_back(tmp - 1); } for (int i = 0; i < N; i++) { int ai = v[i]; num[ai] = num[a...
#include <iostream> #include <vector> #define MAX 200000 using namespace std; int main(void) { int N; cin >> N; int num[MAX] = {}; vector<int> v; for (int i = 0; i < N - 1; i++) { int tmp; cin >> tmp; v.push_back(tmp - 1); } for (int i = 0; i < N - 1; i++) { int ai = v[i]; num[ai] = n...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
138
from collections import Counter def main(): N=int(input()) A=list(map(int,input().split())) d=Counter(A) for i in range(1,N+1): if i not in d: print(0) else: print(d[1]) if __name__=='__main__': main()
from collections import Counter def main(): N=int(input()) A=list(map(int,input().split())) d=Counter(A) for i in range(1,N+1): if i not in d: print(0) else: print(d[i]) if __name__=='__main__': main()
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 22]]
5
81
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N); for (int i = 1; i < N; i++) cin >> A.at(i); vector<int> ans(N); for (int i = 1; i < N; i++) { ans.at(A.at(i)) += 1; } for (int i = 0; i < N; i++) { cout << ans.at(i) << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N); for (int i = 1; i < N; i++) cin >> A.at(i); vector<int> ans(N); for (int i = 1; i < N; i++) { ans.at(A.at(i) - 1) += 1; } for (int i = 0; i < N; i++) { cout << ans.at(i) << endl; } }
[["+", 0, 11, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 31, 2, 3, 4, 0, 16, 12, 13]]
1
117
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n + 10] = {0}; int num; for (int i = 1; i <= n; i++) cin >> num, arr[num]++; for (int i = 1; i <= n; i++) cout << arr[i] << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n + 10] = {0}; int num; for (int i = 1; i < n; i++) cin >> num, arr[num]++; for (int i = 1; i <= n; i++) cout << arr[i] << "\n"; return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
86
#include <algorithm> #include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> ans(n); //上司 rep(i, n - 1) { int a; cin >> a; ans[a - 1]++; } for (int ...
#include <algorithm> #include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> ans(n); //上司 rep(i, n - 1) { int a; cin >> a; ans[a - 1]++; } for (int ...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
101
N = int(input()) A=[int(i) for i in input().split()] B = [0 for i in range(len(A))] for i in A: B[i-1] =B[i-1] + 1 for i in B: print(i)
N = int(input()) A=[int(i) for i in input().split()] B = [0 for i in range(N)] for i in A: B[i-1] =B[i-1] + 1 for i in B: print(i)
[["-", 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]]
5
70
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); for (int i = 1; i < n; i++) { int t; cin >> t; ++v[t]; } for (auto &i : v) cout << i << '\n'; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); for (int i = 1; i < n; i++) { int t; cin >> t; ++v[t - 1]; } for (auto &i : v) cout << i << '\n'; }
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
73
def resolve(): n = int(input()) woker = list(map(int, input().split())) woker_count = collections.Counter(woker) for i in range(n): print(woker_count[i + 1]) resolve()
import collections def resolve(): n = int(input()) woker = list(map(int, input().split())) woker_count = collections.Counter(woker) for i in range(n): print(woker_count[i + 1]) resolve()
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
58
N=int(input()) A=list(map(int, input().split())) s=0 for num in range(1, N+1): count = 0 for i in range(s, N-1): if A[i] == num: count += 1 else: break s+=count print(count)
N=int(input()) A=list(map(int, input().split())) A=sorted(A) s=0 for num in range(1, N+1): count = 0 for i in range(s, N-1): if A[i] == num: count += 1 else: break s+=count print(count)
[["+", 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
76
#include <iostream> using namespace std; int main() { int n, temp; cin >> n; int ar[n + 1]; for (int i = 0; i < n - 1; i++) { cin >> temp; ar[temp]++; } for (int i = 1; i <= n; i++) { cout << ar[i] << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n, temp; cin >> n; int ar[n + 1] = {0}; for (int i = 0; i < n - 1; i++) { cin >> temp; ar[temp]++; } for (int i = 1; i <= n; i++) { cout << ar[i] << endl; } 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]]
1
85
#include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); int N; //社員の人数 int c, sum = 0; cin >> N; int A[N - 1]; for (int i = 0; i < N; i++) { A[i] = 0; } for (int i = 0; i < N - 1; i++) { cin >> c; A[c - 1]++; } for (int j = 0...
#include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); int N; //社員の人数 int c, sum = 0; cin >> N; int A[N]; for (int i = 0; i < N; i++) { A[i] = 0; } for (int i = 0; i < N - 1; i++) { cin >> c; A[c - 1]++; } for (int j = 0; j ...
[["-", 8, 9, 0, 43, 49, 80, 81, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13]]
1
131
n = int(input()) a = list(map(int, input().split())) result = [0 for _ in range(n)] for i in range(n - 1): result[a[i]-i] += 1 for v in result: print(v)
n = int(input()) a = list(map(int, input().split())) result = [0 for _ in range(n)] for i in range(n - 1): result[a[i]-1] += 1 for v in result: print(v)
[["-", 0, 1, 0, 677, 31, 206, 206, 657, 12, 22], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
67
#include <stdio.h> int main(void) { int N; scanf("%d", &N); int A[200010]; for (int i = 2; i <= N; i++) { scanf("%d", &A[i]); } int count[200010]; for (int i = 0; i <= N; i++) { count[i] = 0; } for (int i = 2; i <= N; i++) { count[A[i]] += 1; } for (int i = 1; i <= N; i++) { prin...
#include <stdio.h> int main(void) { int N; scanf("%d", &N); int A[200010]; for (int i = 2; i <= N; i++) { scanf("%d", &A[i]); } int count[200010]; for (int i = 1; i <= N; i++) { count[i] = 0; } for (int i = 2; i <= N; i++) { count[A[i]] += 1; } for (int i = 1; i <= N; i++) { prin...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
143
#include <bits/stdc++.h> #define int long long #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) const unsigned...
#include <bits/stdc++.h> #define int long long #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) const unsigned...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
136
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec(N - 1); vector<int> answer(N); for (int i = 0; i < N; i++) { answer.at(i) = 0; } for (int i = 0; i < N - 1; i++) { cin >> vec.at(i); } for (int i = 0; i < N - 1; i++) { int b = vec.at(i); answe...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec(N - 1); vector<int> answer(N); for (int i = 0; i < N; i++) { answer.at(i) = 0; } for (int i = 0; i < N - 1; i++) { cin >> vec.at(i); } for (int i = 0; i < N - 1; i++) { int b = vec.at(i); answe...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
158
N = int(input()) A = list(map(int,input().split())) Clist = [] for count in range(len(A)+1): Clist.append(0) for count in range(len(A)): Clist[A[count]-1] = Clist[A[count]-1] + 1 for count in range(0,len(A)): print(Clist[count])
N = int(input()) A = list(map(int,input().split())) Clist = [] for count in range(len(A)+1): Clist.append(0) for count in range(len(A)): Clist[A[count]-1] = Clist[A[count]-1] + 1 for count in range(0,len(A)+1): print(Clist[count])
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
100
import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Scanner; import java.util.function.Function; import java.util.stream.Collectors; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int numberOfPerson = Integer.parseInt...
import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Scanner; import java.util.function.Function; import java.util.stream.Collectors; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int numberOfPerson = Integer.parseInt...
[["-", 49, 200, 51, 227, 497, 505, 0, 16, 17, 33], ["-", 49, 200, 51, 227, 497, 505, 0, 16, 12, 499], ["+", 0, 1, 0, 27, 0, 504, 71, 16, 17, 33], ["+", 0, 1, 0, 27, 0, 504, 71, 16, 12, 499], ["-", 8, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 492, 3, 4, 0, 22]]
3
150
#include <bits/stdc++.h> using namespace std; int main() { long long int i, n; cin >> n; vector<long long int> subs(n, 0); for (int j = 1; j < n; j++) { cin >> i; subs[i]++; } for (auto s : subs) printf("%lld\n", s); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int i, n; cin >> n; vector<long long int> subs(n, 0); for (int j = 1; j < n; j++) { cin >> i; subs[i - 1]++; } for (auto s : subs) printf("%lld\n", s); return 0; }
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
82
#include <bits/stdc++.h> using namespace std; main() { int n; cin >> n; int a[n + 1]; a[0] = 0; a[1] = 0; vector<int> v(n + 1, 0); for (int i = 2; i < n; i++) { cin >> a[i]; v[a[i]]++; } for (int i = 1; i <= n; i++) { cout << v[i] << "\n"; } }
#include <bits/stdc++.h> using namespace std; main() { int n; cin >> n; int a[n + 1]; a[0] = 0; a[1] = 0; vector<int> v(n + 1, 0); for (int i = 2; i <= n; i++) { cin >> a[i]; v[a[i]]++; } for (int i = 1; i <= n; i++) { cout << v[i] << "\n"; } }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
112
#include <bits/stdc++.h> #define int long long int #define endl '\n' using namespace std; int a[200010], ans[200010]; void solve() { int n; cin >> n; for (int i = 2; i <= n; ++i) cin >> a[i]; for (int i = 2; i <= n; ++i) ans[a[i]]++; for (int i = 2; i <= n; ++i) cout << ans[i] << endl; } signed...
#include <bits/stdc++.h> #define int long long int #define endl '\n' using namespace std; int a[200010], ans[200010]; void solve() { int n; cin >> n; for (int i = 2; i <= n; ++i) cin >> a[i]; for (int i = 2; i <= n; ++i) ans[a[i]]++; for (int i = 1; i <= n; ++i) cout << ans[i] << endl; } signed...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
137
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; memset(a, 0, sizeof(a)); for (int i = 1; i < n; i++) { int b; cin >> b; a[b] += 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; int a[n + 1]; memset(a, 0, sizeof(a)); for (int i = 1; i < n; i++) { int b; cin >> b; a[b] += 1; } for (int i = 1; i <= n; i++) cout << a[i] << endl; }
[["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 80, 81, 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
90
#define _USE_MATH_DEFINES #include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> using namespace std; #define MAX(x, y) (x > y ? x : y) #define MIN(x, y) (x < y ? x : y) #define ABS(x) (x > 0 ? x : -(x)) #define INF 214...
#define _USE_MATH_DEFINES #include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> using namespace std; #define MAX(x, y) (x > y ? x : y) #define MIN(x, y) (x < y ? x : y) #define ABS(x) (x > 0 ? x : -(x)) #define INF 214...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
576
#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++) cin >> a[i]; vector<int> ans(n); for (int i = 0; i < n - 1; i++) ans[a[i]]++; for (int i = 1; i <= n; i++) cout << ans[i] << endl; }
#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++) cin >> a[i]; vector<int> ans(n + 1); for (int i = 0; i < n - 1; i++) ans[a[i]]++; for (int i = 1; i <= n; i++) cout << ans[i] << endl; }
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
108
N = int(input()) A = list(map(int, input().split())) B = [0] * N for i in A: B[i-1] = int(B[i-1]) + 1 print(B)
N = int(input()) A = list(map(int, input().split())) B = [0] * N for i in A: B[i-1] = int(B[i-1]) + 1 for j in B: 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
59
#include <bits/stdc++.h> using namespace std; int a[100000]; int ans[100000]; int main() { int n; cin >> n; for (int i = 2; i < n; i++) cin >> a[i]; for (int i = 2; i <= n; i++) ans[a[i]]++; for (int i = 1; i <= n; i++) cout << ans[i] << endl; }
#include <bits/stdc++.h> using namespace std; int a[200010]; int ans[200010]; int main() { int n; cin >> n; for (int i = 2; i <= n; i++) cin >> a[i]; for (int i = 2; i <= n; i++) ans[a[i]]++; for (int i = 1; i <= n; i++) cout << ans[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, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
98
#include <iostream> using namespace std; int main() { int n; int sub[200001]; cin >> n; for (int i = 1; i <= n; i++) { sub[i] = 0; } for (int j = 0; j < n; j++) { int x; cin >> x; sub[x]++; } for (int k = 1; k <= n; k++) { cout << sub[k] << endl; } }
#include <iostream> using namespace std; int main() { int n; int sub[200001]; cin >> n; for (int i = 1; i <= n; i++) { sub[i] = 0; } for (int j = 2; j <= n; j++) { int x; cin >> x; sub[x]++; } for (int k = 1; k <= n; k++) { cout << sub[k] << endl; } }
[["-", 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
102
#include <inttypes.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> int main(void) { uint32_t n; scanf("%" PRIu32, &n); uint32_t *d; do { d = calloc(n, sizeof(uint32_t)); } while (!d); for (uint32_t i = 0; i < n; i++) { uint32_t a; scanf("%" PRIu32, &a); d[a - 1]++; } for (u...
#include <inttypes.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> int main(void) { uint32_t n; scanf("%" PRIu32, &n); uint32_t *d; do { d = calloc(n, sizeof(uint32_t)); } while (!d); for (uint32_t i = 1; i < n; i++) { uint32_t a; scanf("%" PRIu32, &a); d[a - 1]++; } for (u...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 2, 3, 4, 0, 42, 0, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 42, 0, 5, 0, 6]]
0
133
import collections N = int(input()) A_list = list(map(int, input().split())) ans = collections.Counter(A_list) for i in range(N): print(ans[i])
import collections N = int(input()) A_list = list(map(int, input().split())) ans = collections.Counter(A_list) for i in range(1, N+1): print(ans[i])
[["+", 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
50