qyliang/CodeNanoFix huggingface dataset:
Buggy code:
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))

rate = defaultdict(int)

for a in A:
    if 1 <= a <= 399:
        rate[1] += 1
    if 499 <= a <= 799:
        rate[2] += 1
    if 800 <= a <= 1199:
        rate[3] += 1
    if 1200 <= a <= 1599:
        rate[4] += 1
    if 1600 <= a <= 1999:
        rate[5] += 1
    if 2000 <= a <= 2399:
        rate[6] += 1
    if 2400 <= a <= 2799:
        rate[7] += 1
    if 2800 <= a <= 3199:
        rate[8] += 1
    if a >= 3200:
        rate[9] += 1

v = len(rate.keys())

red = rate[9]

if red:
    if v == 1:
        print(v, v)
    else:
        print(v, min(v + red - 1, 9))
else:
    print(v, v)


Fixed code:
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))

rate = defaultdict(int)

for a in A:
    if 1 <= a <= 399:
        rate[1] += 1
    if 400 <= a <= 799:
        rate[2] += 1
    if 800 <= a <= 1199:
        rate[3] += 1
    if 1200 <= a <= 1599:
        rate[4] += 1
    if 1600 <= a <= 1999:
        rate[5] += 1
    if 2000 <= a <= 2399:
        rate[6] += 1
    if 2400 <= a <= 2799:
        rate[7] += 1
    if 2800 <= a <= 3199:
        rate[8] += 1
    if a >= 3200:
        rate[9] += 1

valiable = len(rate.keys())
topcoder = rate[9]

if topcoder:
    if valiable == 1:
        print(1, min(topcoder, 9))
    else:
        print(valiable - 1, valiable + topcoder - 1)
else:
    print(valiable, valiable)
Buggy code:
import collections

n = int(input())
a = [int(i) for i in input().split()]

d = collections.defaultdict(int)

for i in a:
    i_ = i // 400
    d[i_] += 1

if 8 in d:
    min_ = min(len(d) - 1, 1)
    max_ = min(len(d) + d[8] - 1, 8)

else:
    min_ = len(d)
    max_ = len(d)

print(min_, max_)

Fixed code:
import collections

n = int(input())
a = [int(i) for i in input().split()]

d = collections.defaultdict(int)

for i in a:
    i_ = i // 400
    if i_ >= 8:
        i_ = 8
    d[i_] += 1

if 8 in d:
    min_ = max(len(d) - 1, 1)
    max_ = len(d) + d[8] - 1

else:
    min_ = len(d)
    max_ = len(d)

print(min_, max_)
Buggy code:
n = int(input())
a = list(int(i) for i in input().split())

hai = 0
tya = 0
midori = 0
mizu = 0
ao = 0
ki = 0
daigai = 0
aka = 0

niji = 0

mincolor = 0
maxcolor = 0

for i in range(n):
    if 1 <= a[i] and a[i] <=399:
        hai = 1
    elif 400 <= a[i] and a[i] <= 799:
        tya = 1
    elif 800 <= a[i] and a[i] <= 1199:
        midori
    elif 1200 <= a[i] and a[i] <=1599:
        mizu = 1
    elif 1600 <= a[i] and a[i] <= 1999:
        ao = 1
    elif 2000 <= a[i] and a[i] <= 2399:
        ki = 1
    elif 2400 <= a[i] and a[i] <=2799:
        daidai = 1
    elif 2800 <= a[i] and a[i] <= 3199:
        aka = 1
    elif 3200 <= a[i]:
        niji += 1

mincolor = hai + tya + midori + mizu + ao + ki + daidai + aka
maxcolor = mincolor

for i in range(niji):
    maxcolor += 1

if maxcolor >= 9:
    maxcolor = 8

print(mincolor, maxcolor)


Fixed code:
n = int(input())
a = list(int(i) for i in input().split())

hai = 0
tya = 0
midori = 0
mizu = 0
ao = 0
ki = 0
daidai = 0
aka = 0

niji = 0

for i in range(n):
    if 1 <= a[i] and a[i] <=399:
        hai = 1
    elif 400 <= a[i] and a[i] <= 799:
        tya = 1
    elif 800 <= a[i] and a[i] <= 1199:
        midori = 1
    elif 1200 <= a[i] and a[i] <=1599:
        mizu = 1
    elif 1600 <= a[i] and a[i] <= 1999:
        ao = 1
    elif 2000 <= a[i] and a[i] <= 2399:
        ki = 1
    elif 2400 <= a[i] and a[i] <=2799:
        daidai = 1
    elif 2800 <= a[i] and a[i] <= 3199:
        aka = 1
    elif 3200 <= a[i]:
        niji += 1

mincolor = hai + tya + midori + mizu + ao + ki + daidai + aka

if mincolor == 0:
    mincolor += 1
    niji -= 1

maxcolor = mincolor + niji

#if maxcolor >= 9:
#    maxcolor = 8

print(mincolor, maxcolor)
Buggy code:
N = int(input())
a = list(map(int,input().split()))
R = [0]*9
for r in a:
  rr = r//400
  if rr < 8:
    R[rr] = 1
  else:
    R[8] += 1
s2 = sum(R)
s1 = min(1,s2-R[8])
print(s1,s2)

Fixed code:
N = int(input())
a = list(map(int,input().split()))
R = [0]*9
for r in a:
  rr = r//400
  if rr < 8:
    R[rr] = 1
  else:
    R[8] += 1
s2 = sum(R)
s1 = max(1,s2-R[8])
print(s1,s2)
Buggy code:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    A = string_to_int(inputs[0])
    rate = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
    rate_num = len(rate)

    counter_overs = 0
    rate_set = set()
    for a in A:
        if a >= 3200:
            counter_overs += 1
        else:
            hit = None
            for i, r in enumerate(reversed(rate)):
                if a <= r:
                    hit = i
            rate_set.add(hit)
    print(rate_set)
    if len(rate_set) == 0:
        max_num = counter_overs if counter_overs <= rate_num else rate_num
        min_num = 1
    else:
        sum_all = len(rate_set) + counter_overs
        max_num = sum_all if sum_all <= rate_num else rate_num
        min_num = len(rate_set)
    return "{} {}".format(min_num, max_num)


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)


Fixed code:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    A = string_to_int(inputs[0])
    rate = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
    rate_num = len(rate)

    counter_overs = 0
    rate_set = set()
    for a in A:
        if a >= 3200:
            counter_overs += 1
        else:
            hit = None
            for i, r in enumerate(reversed(rate)):
                if a <= r:
                    hit = i
            rate_set.add(hit)
    if len(rate_set) == 0:
        # max_num = counter_overs if counter_overs <= rate_num else rate_num
        max_num = counter_overs
        min_num = 1
    else:
        sum_all = len(rate_set) + counter_overs
        # max_num = sum_all if sum_all <= rate_num else rate_num
        max_num = sum_all
        min_num = len(rate_set)
    return "{} {}".format(min_num, max_num)


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)
Buggy code:
N = int(input())

a = list(map(int, input().split()))

lst = [0] * 9

for i in range(N):
    lst[min(a[i]//400, 8)] += 1

count = lst[:8].count(0)

kind_max = min(8-count+lst[8])
kind_min = max(8-count,1)

print (kind_min, kind_max)

Fixed code:
N = int(input())

a = list(map(int, input().split()))

lst = [0] * 9

for i in range(N):
    lst[min(a[i]//400, 8)] += 1

count = lst[:8].count(0)

kind_max = min(8-count+lst[8], 100)
kind_min = max(8-count,1)

print (kind_min, kind_max)
Buggy code:
def main():
    N = int(input())
    a = [0] + [int(ele) for ele in input().split()]
    a.sort()
    ans_min = 0
    ans_min += 1 if len(list(filter(lambda x: 1 <= x <= 399, a ))) > 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 400 <= x <= 799, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 800 <= x <= 1200, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 1200 <= x <= 1599, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 1600 <= x <= 1999, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 2000 <= x <= 2399, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 2400 <= x <= 2799, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 2800 <= x <= 3199, a )))> 0 else 0
    over = list(filter(lambda x: 3200 < x, a ))

    ans_max =  ans_min + len(over)
    ans_min += 1 if len(over)> 0 else 0
    print(ans_min, ans_max)

    
    

if __name__=="__main__":
    main()

Fixed code:
def main():
    N = int(input())
    a = [0] + [int(ele) for ele in input().split()]
    a.sort()
    ans_min = 0
    ans_min += 1 if len(list(filter(lambda x: 1 <= x <= 399, a ))) > 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 400 <= x <= 799, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 800 <= x <= 1200, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 1200 <= x <= 1599, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 1600 <= x <= 1999, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 2000 <= x <= 2399, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 2400 <= x <= 2799, a )))> 0 else 0
    ans_min += 1 if len(list(filter(lambda x: 2800 <= x <= 3199, a )))> 0 else 0
    over = list(filter(lambda x: 3200 <= x, a ))

    ans_max = ans_min + len(over)

    if ans_min == 0 and len(over) > 0:
        ans_min = 1 

    print(ans_min, ans_max)


if __name__=="__main__":
    main()
Buggy code:
n = int(input())
a = sorted(map(int,  v input().split()))
cnt = 0

for k in range(1, 9):
    b = list(filter(lambda x: x < 400*k, a))
    if b:
        cnt += 1
    a = a[len(b):]
if cnt:
    print(cnt, cnt+len(a))
else:
    print(1, len(a))


Fixed code:
n = int(input())
a = sorted(map(int, input().split()))
cnt = 0

for k in range(1, 9):
    b = list(filter(lambda x: x < 400*k, a))
    if b:
        cnt += 1
    a = a[len(b):]
if cnt:
    print(cnt, cnt+len(a))
else:
    print(1, len(a))
Buggy code:
N = int(input())
a = list(map(lambda x: int(x) // 400, input().split()))
s_a = []
b_a = []

for i in range(N):
    if a[i] <= 7:
        s_a.append(a[i])
    else:
        b_a.append(a[i])

if len(s_a) == 0:
    min = 1
else:
    min = len(set(s_a))

if len(set(s_a)) + len(b_a) <= :
    max = len(set(s_a)) + len(b_a)
else:
    max = 7

print(min, max)

Fixed code:
N = int(input())
a = list(map(lambda x: int(x) // 400, input().split()))
s_a = []
b_a = []

for i in range(N):
    if a[i] <= 7:
        s_a.append(a[i])
    else:
        b_a.append(a[i])

if len(s_a) == 0:
    min = 1
else:
    min = len(set(s_a))


max = len(set(s_a)) + len(b_a)


print(min, max)
Buggy code:
n = int(input())
a = list(map(int, input().split()))

def color(point):
  if point < 3200:
    return point // 400
  else:
    return 8

vals = {}
for i in a:
  cl = color(i)
  vals.setdefault(cl, 0)
  vals[cl] += 1

print(vals)
  
if 8 not in vals.keys():
  print(len(vals), len(vals))
else:
  if len(vals) == 1:
    print(1, max(2, vals[8]))
  else:
    print(len(vals) - 1, min(8, len(vals) + 1))

Fixed code:
n = int(input())
a = list(map(int, input().split()))

def color(point):
  if point < 3200:
    return point // 400
  else:
    return 8

vals = {}
for i in a:
  cl = color(i)
  vals.setdefault(cl, 0)
  vals[cl] += 1

# print(vals)
  
if 8 not in vals.keys():
  print(len(vals), len(vals))
else:
  print(max(1, len(vals) - 1), len(vals) + vals[8] - 1)
Buggy code:
n=int(input())
pr=list(map(int,input().split()))
rate_color=[]
suge=0
for i in range(n):
    if pr[i]>=3200:
        suge+=1
def cl(x):
    if x<=399:
        return [0]
    elif 400<=x<=799:
        return [1]
    elif 800 <=x<=1199:
        return [2]
    elif 1200 <=x<=1599:
        return [3]
    elif 1600<=x<= 1999:
        return [4]
    elif 2000 <=x<=2399:
        return [5]
    elif 2400 <=x<=2799:
        return [6]
    elif 2800 <=x<=3199:
        return [7]

for i in range(n):
    x=pr[i]
    rate_color+=cl(x)
color=list(set(rate_color))
color_num=len(color)


max_num=color_num+suge
if color_num==0:
    mini_num=1
else:
    mini_num=color_num
print(mini_num,max_num)

Fixed code:
n=int(input())
pr=list(map(int,input().split()))
rate_color=[]
suge=0
for i in range(n):
    if pr[i]>=3200:
        suge+=1
pr=[x for x in pr if x<=3199]

def cl(x):
    if x<=399:
        return [0]
    elif 400<=x<=799:
        return [1]
    elif 800 <=x<=1199:
        return [2]
    elif 1200 <=x<=1599:
        return [3]
    elif 1600<=x<= 1999:
        return [4]
    elif 2000 <=x<=2399:
        return [5]
    elif 2400 <=x<=2799:
        return [6]
    elif 2800 <=x<=3199:
        return [7]

for i in range(len(pr)):
    x=pr[i]
    rate_color+=cl(x)
color=list(set(rate_color))
color_num=len(color)


max_num=color_num+suge
if color_num==0:
    mini_num=1
else:
    mini_num=color_num
print(mini_num,max_num)
Buggy code:
N = int(input())
A = list(map(int, input().split()))

free = 0
colors = {}

for a in A:
    if a < 3200:
        ai = a // 400
        colors[ai] = True

    else:
        free += 1

lc = len(colors)

print(min(1, lc), lc + free)


Fixed code:
N = int(input())
A = list(map(int, input().split()))

free = 0
colors = {}

for a in A:
    if a < 3200:
        ai = a // 400
        colors[ai] = True

    else:
        free += 1

lc = len(colors)

print(max(1, lc), lc + free)
Buggy code:
N = int(input())
a = list(map(int,input().split()))

color = [0]*9

for rate in a:
    if rate >= 3200:
        color[8] += 1
    else:
        color[rate//400] += 1
    
ans = 0

for i in range(8):
        if color[i] > 0:
            ans += 1
    print(max(ans,1),ans + c[8])

Fixed code:
N = int(input())
a = list(map(int,input().split()))

color = [0]*9

for rate in a:
    if rate >= 3200:
        color[8] += 1
    else:
        color[rate//400] += 1
    
ans = 0

for i in range(8):
        if color[i] > 0:
            ans += 1
print(max(ans,1),ans + color[8])
Buggy code:
N,*A=map(int,open(0).read().split());l=[0]*9
for a in A:l[min(8,a//400)]+=1
m=sum([0<l[i]for i in range(8)]);print(min(m,1),m+l[8])

Fixed code:
N,*A=map(int,open(0).read().split());l=[0]*9
for a in A:l[min(8,a//400)]+=1
m=sum([0<l[i]for i in range(8)]);print(max(m,1),m+l[8])
Buggy code:
n=int(input())
a=list(map(int,input().split()))
temp=[0,0,0,0,0,0,0,0]
r=0
for i in range(n):
  if a[i]>=3200:
    r=r+1
  elif a[i]>=2800:
    temp[7]=1
  elif a[i]>=2400:
    temp[6]=1
  elif a[i]>=2000:
    temp[5]=1
  elif a[i]>=1600:
    temp[4]=1
  elif a[i]>=1200:
    temp[3]=1
  elif a[i]>=800:
    temp[2]=1
  elif a[i]>=400:
    temp[1]=1
  else:
    temp[0]=1
print(sum(temp),temp(sum)+r)  

Fixed code:
n=int(input())
a=list(map(int,input().split()))
temp=[0,0,0,0,0,0,0,0]
r=0
for i in range(n):
  if a[i]>=3200:
    r=r+1
  elif a[i]>=2800:
    temp[7]=1
  elif a[i]>=2400:
    temp[6]=1
  elif a[i]>=2000:
    temp[5]=1
  elif a[i]>=1600:
    temp[4]=1
  elif a[i]>=1200:
    temp[3]=1
  elif a[i]>=800:
    temp[2]=1
  elif a[i]>=400:
    temp[1]=1
  else:
    temp[0]=1
if sum(temp)==0:
  print(1,r)
else:
  print(sum(temp),sum(temp)+r)
Buggy code:
from collections import Counter
n = int(input())
x = list(map(int,input().strip().split()))

rate = []
over = 0
for i in range(n):
  if x[i]//400 >=7:
    over += 1
  else:
    rate.append(x[i]//400)
elem = len(set(rate))

_min = elem
_max = elem +over
if elem  == 0:
  _min = 1
if elem + over >=8:
  _max = 8 

print(str(_min),str(_max))

Fixed code:
from collections import Counter
n = int(input())
x = list(map(int,input().strip().split()))

rate = []
over = 0
for i in range(n):
  if x[i]//400 >=8:
    over += 1
  else:
    rate.append(x[i]//400)
elem = len(set(rate))

_min = elem
_max = elem +over
if elem  == 0:
  _min = 1
#if elem + over >=8:
#  _max = 8 

print(str(_min),str(_max))
Buggy code:
N=int(input())
A=list(map(int, input().split()))

  
def judge(n):
  return n//400

rate=[0]*8
masters=0
for a in A:
  if judge(a)<8:
    rate[judge(a)]+=1
  else:
    masters+=1
  
count=0
for r in rate:
  if r!=0:
    count+=1
MAX=min(count+masters)


print(max(1,count),MAX)




Fixed code:
N=int(input())
A=list(map(int, input().split()))

  
def judge(n):
  return n//400

rate=[0]*8
masters=0
for a in A:
  if judge(a)<8:
    rate[judge(a)]+=1
  else:
    masters+=1
  
count=0
for r in rate:
  if r!=0:
    count+=1
MAX=count+masters


print(max(1,count),MAX)
Buggy code:
N=int(input())
a=list(map(int,input().split()))
mi=0
ma=0
l=[]
count=0
for i in range(N):
 if a[i]<3200:
  l.append(a[i]//400)
 else:
  count=count+1

print(len(set(l))+min(1,count),len(set(l))+max(0,count))

Fixed code:
N=int(input())
a=list(map(int,input().split()))
mi=0
ma=0
l=[]
count=0
for i in range(N):
 if a[i]<3200:
  l.append(a[i]//400)
 else:
  count=count+1

print(max(1,len(set(l))),max(1,len(set(l))+count))
Buggy code:
from collections import Counter as C
n=int(input())
A=sorted(C(list(map(lambda x:min(x//400,8),list(map(int,input().split()))))+[8]).most_common())
print(len(A)+A[-1][1]-2)
print(len(A)-1 if A[0][0]!=8 else 1,len(A)+A[-1][1]-2)

Fixed code:
from collections import Counter as C
n=int(input())
A=sorted(C(list(map(lambda x:min(x//400,8),list(map(int,input().split()))))+[8]).most_common())
print(len(A)-1 if A[0][0]!=8 else 1,len(A)+A[-1][1]-2)
Buggy code:
N=int(input())
a=[int(i) for i in input().split()]
b,c,d,e,f,g,h,j,k=0,0,0,0,0,0,0,0,0
for i in range(N):
 if (a[i]<400):
  b=1
 elif (400<=a[i]<800):
  c=1
 elif (800<=a[i]<1200):
  d=1
 elif (1200<=a[i]<1600):
  e=1
 elif (1600<=a[i]<2000):
  f=1
 elif (2000<=a[i]<2400):
  g=1
 elif (2400<=a[i]<2800):
  h=1
 elif (2800<=a[i]<3200):
  j=1
 else:
  k=1
print (b+c+d+e+f+g+h+j,b+c+d+e+f+g+h+j+k)



Fixed code:
N=int(input())
a=[int(i) for i in input().split()]
b,c,d,e,f,g,h,j,k=0,0,0,0,0,0,0,0,0
for i in range(N):
 if (a[i]<400):
  b=1
 elif (400<=a[i]<800):
  c=1
 elif (800<=a[i]<1200):
  d=1
 elif (1200<=a[i]<1600):
  e=1
 elif (1600<=a[i]<2000):
  f=1
 elif (2000<=a[i]<2400):
  g=1
 elif (2400<=a[i]<2800):
  h=1
 elif (2800<=a[i]<3200):
  j=1
 else:
  k += 1
min=b+c+d+e+f+g+h+j
max=min+k
if min==0:
 min=1
print (min,max)
Buggy code:
N = int(input())
A = list(map(int, input().split()))

cnt = [0]*8
c = 0
for a in A:
    if a <= 399:
        cnt[0] += 1
    elif a >= 400 and a <= 799:
        cnt[1] += 1
    elif a >= 800 and a <= 1199:
        cnt[2] += 1
    elif a >= 1200 and a <= 1599:
        cnt[3] += 1
    elif a >= 1600 and a <= 1999:
        cnt[4] += 1
    elif a >= 2000 and a <= 2399:
        cnt[5] += 1
    elif a >= 2400 and a <= 2799:
        cnt[6] += 1
    elif a >= 2800 and a <= 3199:
        cnt[7] += 1
    else:
        c += 1
        
Min = len([i for i in cnt if i != 0]), 0
if c == 0:
    print(Min, Min)
else:
    Max = min(8, Min+c)
    if Min == 0:
        print(1, Max)
    else:
        print(Min, Max)

Fixed code:
N = int(input())
A = list(map(int, input().split()))

cnt = [0]*8
c = 0
for a in A:
    if a <= 399:
        cnt[0] += 1
    elif a >= 400 and a <= 799:
        cnt[1] += 1
    elif a >= 800 and a <= 1199:
        cnt[2] += 1
    elif a >= 1200 and a <= 1599:
        cnt[3] += 1
    elif a >= 1600 and a <= 1999:
        cnt[4] += 1
    elif a >= 2000 and a <= 2399:
        cnt[5] += 1
    elif a >= 2400 and a <= 2799:
        cnt[6] += 1
    elif a >= 2800 and a <= 3199:
        cnt[7] += 1
    else:
        c += 1
        
Min = len([i for i in cnt if i != 0])
if c == 0:
    print(Min, Min)
else:
    Max = Min+c
    if Min == 0:
        print(1, Max)
    else:
        print(Min, Max)
Buggy code:
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n = int(input())
    a =list(map(int, input().split()))
    rate = [0]*8
    cnt = 0
    for x in a:
        r = x//400
        if r > 7:
            cnt += 1
        if not rate[r]:
            rate[r] = 1
    s = sum(rate)
    mins = s+max(0, cnt-s)
    maxs = s+cnt
    print(mins, maxs)        
        
            



if __name__ == '__main__':
    main()

Fixed code:
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n = int(input())
    a = list(map(int, input().split()))
    rate = [0]*8
    cnt = 0
    for x in a:
        r = x//400
        if r > 7:
            cnt += 1
        elif not rate[r]:
            rate[r] = 1
    s = sum(rate)
    mins = s
    if cnt > 0:
        mins += 1
        if s > 0:
            mins -=1
    maxs = s+cnt
    print(mins, maxs)        
        
            



if __name__ == '__main__':
    main()
Buggy code:
# ABC064
# C
# Colorful Leaderboard

n = int(input())
a_list = list(map(int, input().split()))

color_list = [0]*8
over = 0
for i in range(n):
    _ = a_list[i] // 400
    if _ < 8:
        color_list[i] = 1
    else:
        over += 1

_tmp = sum(color_list)
print("%d %d"%(_tmp, _tmp+over))

Fixed code:
# ABC064
# C
# Colorful Leaderboard

n = int(input())
a_list = list(map(int, input().split()))

color_list = [0]*8
over = 0
for i in range(n):
    _ = a_list[i] // 400
    if _ < 8:
        color_list[_] = 1
    else:
        over += 1

_tmp = sum(color_list)
if _tmp == 0:
    print("1 %d"%over)
else:
    print("%d %d"%(_tmp, _tmp+over))
Buggy code:
N = int(input())
list = list(map(int, input().split()))

huriwake = [0, 0, 0, 0, 0, 0, 0, 0]
rea = 0
count = 0

for i in list:
    if i < 400:
        huriwake[0] = 1
    elif i < 800:
        huriwake[1] = 1
    elif i < 1200:
        huriwake[2] = 1
    elif i < 1600:
        huriwake[3] = 1
    elif i < 2000:
        huriwake[4] = 1
    elif i < 2400:
        huriwake[5] = 1
    elif i < 2800:
        huriwake[6] = 1
    elif i < 3200:
        huriwake[7] = 1
    else:
        rea += 1

for h in huriwake:
    if h == 1:
        count += 1

if count == 0 && rea > 0:
    count += 1

min = count

if rea > 0:
    count += rea
    if count > 8: count = 8

max = count

print("{0} {1}".format(min, max))


Fixed code:
N = int(input())
list = list(map(int, input().split()))

huriwake = [0, 0, 0, 0, 0, 0, 0, 0]
rea = 0
count = 0

for i in list:
    if i < 400:
        huriwake[0] = 1
    elif i < 800:
        huriwake[1] = 1
    elif i < 1200:
        huriwake[2] = 1
    elif i < 1600:
        huriwake[3] = 1
    elif i < 2000:
        huriwake[4] = 1
    elif i < 2400:
        huriwake[5] = 1
    elif i < 2800:
        huriwake[6] = 1
    elif i < 3200:
        huriwake[7] = 1
    else:
        rea += 1

for h in huriwake:
    if h == 1:
        count += 1

if count == 0 and rea > 0:
    count += 1
    rea -= 1

min = count

if rea > 0:
    count += rea

max = count

print("{0} {1}".format(min, max))
Buggy code:
n = input()
d = [0 for _ in range(9)]
seq = [int(x) for x in input().split()]
for val in seq:
    val = min(val, 3300)
    d[(val // 400)] += 1
a = sum(1 for val in d[:-1] if val > 0)
print(min(1,a), min(8,a + d[-1]))

Fixed code:
n = input()
d = [0 for _ in range(9)]
seq = [int(x) for x in input().split()]
for val in seq:
    val = min(val, 3300)
    d[(val // 400)] += 1
a = sum(1 for val in d[:-1] if val > 0)
print(max(1,a), a + d[-1])
Buggy code:
import bisect
N = int(input())
a = sorted(list(map(int, input().split())))
color = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
border = []
for i in color:
    border.append(bisect.bisect_left(a, i))
border = [0] + border
num = []
for i in range(len(color)):
    num.append(border[i+1] - border[i])
num.append(N - sum(num))
colornum = sum(x>0 for x in num[:-1])
print(str(colornum) + " " + str(max(colornum + num[-1], 8)))

Fixed code:
import bisect
N = int(input())
a = sorted(list(map(int, input().split())))
color = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
border = []
for i in color:
    border.append(bisect.bisect_left(a, i))
border = [0] + border
num = []
for i in range(len(color)):
    num.append(border[i+1] - border[i])
num.append(N - sum(num))
colornum = sum(x>0 for x in num[:-1])
print(str(max(1, colornum)) + " " + str(colornum + num[-1]))