import math

students = [("여", 1), ("여", 1), ("남", 1), ("남", 2), ("여", 2)]
K = 2
count = 0
result = {}

for x in students:
    result[x] = result.get(x,0)+1

for v in result.values():
    count += (v+K-1)//K
    
print(count)
print(result)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: