int a = arr[0]; int cnt1 = 0; for (int i = 0; i < n; i++) { if (arr[i] == a) cnt1++; else { if (cnt1 >= cnt) break; a = arr[i]; cnt1 = 0; } } return a; }
intmain(){ int n; while (!(cin >> n).eof()) { for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); int res = solve(n); cout << res << endl; } return0; }