Buggy python submission (verdict: Time Limit Exceeded):
import collections
N, K = map(int, raw_input().split())
P_list = list()
for i in range(N):
    P_list.append(raw_input()[0])
    C_list = collections.Counter(P_list).values()
 
# clean
C_list = [c for c in C_list if c > 0]
C_list.sort(reverse=True)
 
res = 0
while True:
    if len(C_list) >= K:
        for i in range(K):
            C_list[i] -= 1
        res += 1
        C_list = [c for c in C_list if c > 0]
        C_list.sort(reverse=True)
    else:
        break
print res

Fixed submission:
import numpy as np
C_vec = np.zeros(26)
N, K = map(int, raw_input().split())

for i in range(N):
    C_vec[ord((raw_input()[0])) - ord('A')] += 1


while True:
    m = int(C_vec.sum() / K)
    C_vec = np.minimum(C_vec, m)
    m_next = int(C_vec.sum() / K)
    if m_next == m:
        break
    else:
        m = m_next

print m

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import collections
N, K = map(int, raw_input().split())
P_list = list()
for i in range(N):
    P_list.append(raw_input()[0])
    C_list = collections.Counter(P_list).values()

# clean
C_vec = np.array(C_list)

while True:
    m = int(C_vec.sum() / K)
    C_vec = np.minimum(C_vec, m)
    m_next = int(C_vec.sum() / K)
    if m_next == m:
        break
    else:
        m = m_next

print m

Fixed submission:
import numpy as np
C_vec = np.zeros(26)
N, K = map(int, raw_input().split())

for i in range(N):
    C_vec[ord((raw_input()[0])) - ord('A')] += 1


while True:
    m = int(C_vec.sum() / K)
    C_vec = np.minimum(C_vec, m)
    m_next = int(C_vec.sum() / K)
    if m_next == m:
        break
    else:
        m = m_next

print m

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import collections
N, K = map(int, raw_input().split())
P_list = list()
for i in range(N):
    P_list.append(raw_input()[0])
    C_list = collections.Counter(P_list).values()

# clean
C_vec = np.array(C_list)
C_vec.sort()
C_vec = C_vec[::-1]

res = 0
while True:
    if len(C_list) >= K:
        d = C_vec[K-1]
        C_vec[0:K] -= d
        res += d
        C_vec = C_vec[C_vec > 0]
        C_vec.sort()
        C_vec = C_vec[::-1]
    else:
        break
print res

Fixed submission:
import numpy as np
C_vec = np.zeros(26)
N, K = map(int, raw_input().split())

for i in range(N):
    C_vec[ord((raw_input()[0])) - ord('A')] += 1


while True:
    m = int(C_vec.sum() / K)
    C_vec = np.minimum(C_vec, m)
    m_next = int(C_vec.sum() / K)
    if m_next == m:
        break
    else:
        m = m_next

print m

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N, K = map(int, raw_input().split())
P_list = list()
for i in range(N):
    P_list.append(raw_input()[0])
    C_list = collections.Counter(P_list).values()

# clean
C_list = [c for c in C_list if c > 0]
C_list.sort(reverse=True)

res = 0
while True:
    if len(C_list) >= K:
        d = C_list[K-1]
        for i in range(K):
            C_list[i] -= d
        res += d
        C_list = [c for c in C_list if c > 0]
        C_list.sort(reverse=True)
    else:
        break
print res

Fixed submission:
import numpy as np
C_vec = np.zeros(26)
N, K = map(int, raw_input().split())

for i in range(N):
    C_vec[ord((raw_input()[0])) - ord('A')] += 1


while True:
    m = int(C_vec.sum() / K)
    C_vec = np.minimum(C_vec, m)
    m_next = int(C_vec.sum() / K)
    if m_next == m:
        break
    else:
        m = m_next

print m

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N, K = map(int, raw_input().split())
P_list = list()
for i in range(N):
    P_list.append(raw_input()[0])
    C_list = collections.Counter(P_list).values()

# clean
C_list = [c for c in C_list if c > 0]
C_list.sort(reverse=True)

res = 0
while True:
    if len(C_list) >= K:
        for i in range(K):
            C_list[i] -= 1
        res += 1
        C_list = [c for c in C_list if c > 0]
        C_list.sort(reverse=True)
    else:
        break
print res

Fixed submission:
import numpy as np
C_vec = np.zeros(26)
N, K = map(int, raw_input().split())

for i in range(N):
    C_vec[ord((raw_input()[0])) - ord('A')] += 1


while True:
    m = int(C_vec.sum() / K)
    C_vec = np.minimum(C_vec, m)
    m_next = int(C_vec.sum() / K)
    if m_next == m:
        break
    else:
        m = m_next

print m