Guest User


a guest
Jan 3rd, 2022
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. In Santa's village it is a tradition that after a successful Christmas and the distribution of all gifts to the children of the world, each elf also receives a gift from Santa himself. This year, Santa has thought to give an extra reward to the elves who took particularly few breaks during their work - wrapping the presents - and therefore worked especially hard. Therefore, he has bought a whole bunch of additional gifts and wants to give the elves who took few breaks a second gift for their efforts. Now, of course, he wonders which elves he should give such a second gift to. He has thought of distributing exactly k extra gifts, so that each of the gifted elves has made at most k breaks. Since Santa Claus
  2. is a very nice guy, of course as many elves as possible should receive an additional gift. Can you determine how many elves will receive an extra gift from Santa?
  4. Example Cases :
  6. Input:
  7. 1 1 3 6 10
  8. Output:
  9. 3
  11. Input:
  12. 10 1 5 1 8 6
  13. Output
  14. 2
RAW Paste Data Copied