fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll long long
  5. #define ull unsigned long long
  6. #define ld long double
  7.  
  8. void Free_palestine() {
  9. ios::sync_with_stdio(false);
  10. cin.tie(NULL);
  11. cout.tie(NULL);
  12. }
  13.  
  14. const int N = 2e5 + 5;
  15. const int MOD = 1e9 + 7;
  16.  
  17. signed main(){
  18. Free_palestine();
  19.  
  20. int n, m; cin >> n >> m;
  21. int arr[n];
  22. int freq[100000+1]= {};
  23.  
  24. for(int i = 0; i < n; i++){
  25. cin>>arr[i];
  26. freq[arr[i]]++;
  27. }
  28.  
  29. for(int i = 1; i <= m; i++){
  30. cout<<freq[i]<<"\n";
  31. }
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0.01s 5320KB
stdin
10 5
1 2 3 4 5 3 2 1 5 3
stdout
2
2
3
1
2