fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. // The GOAT ^_^
  5. int main() {
  6. int n, m;
  7. cin >> n >> m;
  8. int arr[n];
  9.  
  10. for (int i = 0; i < n; i++) {
  11. cin >> arr[i];
  12. }
  13.  
  14. for (int i = 1; i <= m; i++) {
  15. int cnt = 0;
  16. for (int j = 0; j < n; j++) {
  17. if (arr[j] == i)
  18. cnt++;
  19. }
  20. cout << cnt << endl;
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 5320KB
stdin
10 5
1 2 3 4 5 3 2 1 5 3
stdout
2
2
3
1
2