fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int numProd, cantMin, i, cod;
  6. cin >> numProd >> cantMin;
  7. int prod[numProd+1] = {0};
  8. for (i=1; i<=numProd; i++){
  9. cin >> cod;
  10. prod[cod]++;
  11. }
  12. for (i=0; i<=numProd; i++){
  13. if (prod[i] >= cantMin) cout << i << ' ' << prod[i] << endl;
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0.01s 5272KB
stdin
9 3
5
9
1
9
1
9
1
1
0
stdout
1 4
9 3