Editorial for Back From Summer '19 P1: Winnie's Orphans
Submitting an official solution before solving the problem yourself is a bannable offence.
We can loop through each orphanage, keeping a running minimum of which orphanage as the least number of children with a cuteness value of ~1~ or ~10~. If the current orphanage has less such children than the running minimum, we update the best solution to the current orphanage's index. Otherwise, we move to the next orphanage.
Time Complexity: ~\mathcal O(NM)~