qyliang/CodeNanoFix huggingface dataset:
Buggy code:

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

def get_color(point):
    color = ''
    if 400 > point:
        color = 'grey'
    elif 800 > point:
        color = 'brown'
    elif 1200 > point:
        color = 'green'
    elif 1600 > point:
        color = 'light blue'
    elif 2000 > point:
        color = 'blue'
    elif 2400 > point:
        color = 'yellow'
    elif 2800 > point:
        color = 'orange'
    elif 3200 > point:
        color = 'red'
    else:
        color = 'free'
    return color
dict = {}
for i in range(N):
    color = get_color(a[i])
    if color not in dict.keys():
        dict[color] = 1
    else:
        dict[color] += 1

min_cnt = 0
max_cnt = 0
if 'free' not in dict.keys():
    min_cnt = max_cnt = len(dict.keys())
else:
    min_cnt = len(dict.keys())-1
    max_cnt = min(8, min_cnt + len(dict['free']))

print(min_cnt, max_cnt)


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

def get_color(point):
    color = ''
    if 400 > point:
        color = 'grey'
    elif 800 > point:
        color = 'brown'
    elif 1200 > point:
        color = 'green'
    elif 1600 > point:
        color = 'light blue'
    elif 2000 > point:
        color = 'blue'
    elif 2400 > point:
        color = 'yellow'
    elif 2800 > point:
        color = 'orange'
    elif 3200 > point:
        color = 'red'
    else:
        color = 'free'
    return color
dict = {}
for i in range(N):
    color = get_color(a[i])
    if color not in dict.keys():
        dict[color] = 1
    else:
        dict[color] += 1

min_cnt = 0
max_cnt = 0
if 'free' not in dict.keys():
    min_cnt = max_cnt = len(dict.keys())
else:
    min_cnt = max(1, len(dict.keys())-1)
    max_cnt = len(dict.keys())-1 + dict['free']

print(min_cnt, max_cnt)
Buggy code:
N = int(input())


c = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]

i = 0
cnt = 0
ansOne = 0
ansAny = 0
for ai in sorted(map(int, input())):
  while i < len(c):
    if ai <= c[i]:
      cnt += 1
      break
    elif cnt > 0:
      ansOne += 1
      cnt = 0
    
  else:
    ansAny += 1
    continue

print("{} {}".format(max(ansOne, 1), min(len(c), ansOne + ansAny))
  




Fixed code:
N = int(input())


c = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]

i = 0
cnt = 0
ansOne = 0
ansAny = 0
for ai in sorted(map(int, input().split())):
  while i < len(c):
    if ai <= c[i]:
      cnt += 1
      break
    else:
      if cnt > 0:
        ansOne += 1
        cnt = 0
      i+=1
    
  else:
    ansAny += 1

if ansAny <= 0:
  ansOne += 1
print("{} {}".format(max(ansOne, 1), ansOne + ansAny))
Buggy code:
import numpy as np
N = int(input())
a = [int(_) for _ in input().split()]
a = np.array(a)
a = np.sort(a)
min = 0
max = 0
m = 0

for i in range(8):
    set_1 = set(np.where(i*400<=a)[0])
    set_2 = set(np.where(a<(i+1)*400)[0])
    match = list(set_1 & set_2)
    if len(match)>0:
        min+=1
if min=0:
    min=1
    if N>8:
	max = 8
    else:
	max = N
else:
    if len(np.where(a>=3200)[0])==0:
        max = min
    else:
        max = min + len(np.where(a>=3200)[0])
    	if max>8:
            max = 8
print (min, max)


Fixed code:
import numpy as np
N = int(input())
a = [int(_) for _ in input().split()]
a = np.array(a)
a = np.sort(a)
min = 0
max = 100

for i in range(8):
    set_1 = set(np.where(i*400<=a)[0])
    set_2 = set(np.where(a<(i+1)*400)[0])
    match = list(set_1 & set_2)
    if len(match)>0:
        min+=1
if min==0:
    min=1
    max = N
else:
    if len(np.where(a>=3200)[0])==0:
        max = min
    else:
        max = min + len(np.where(a>=3200)[0])
print (min, max)
Buggy code:
n=int(input())
rates=list(map(int,input().split()))
over3200=sum(1 for i in rates if i>=3200)
fixed=set()
for i in rates:
  if i//<=7:
    fixed.add(i)
f=len(fixed)
if f==0:
  print(1,over3200)
else:
  print(f,f+over3200)

Fixed code:
n=int(input())
rates=list(map(int,input().split()))
over3200=sum(1 for i in rates if i>=3200)
fixed=set()
for i in rates:
  if i//400<=7:
    fixed.add(i//400)
f=len(fixed)
if f==0:
  print(1,over3200)
else:
  print(f,f+over3200)
Buggy code:
# -*- coding: utf-8 -*-

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

color = [0,0,0,0,0,0,0,0,0]

for i in range(n):
    if 1 <= a[i] <= 399:
        color[0] += 1
    elif 400 <= a[i] <= 799:
        color[1] += 1
    elif 800 <= a[i] <= 1199:
        color[2] += 1
    elif 1200 <= a[i] <= 1599:
        color[3] += 1
    elif 1600 <= a[i] <= 1999:
        color[4] += 1
    elif 2000 <= a[i] <= 2399:
        color[5] += 1
    elif 2400 <= a[i] <= 2799:
        color[6] += 1
    elif 2800 <= a[i] <= 3199:
        color[7] += 1
    elif 3200 <= a[i]:
        color[8] += 1


min_col = color[:]
min_cnt = 0
del min_col[-1]
for i in range(len(min_col)):
    if min_col[i] != 0:
        min_cnt += 1

max_cnt = min(min_cnt + color[8])
min_cnt = max(1,min_cnt)

print(min_cnt, max_cnt)

Fixed code:
# -*- coding: utf-8 -*-

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

color = [0,0,0,0,0,0,0,0,0]

for i in range(n):
    if 1 <= a[i] <= 399:
        color[0] += 1
    elif 400 <= a[i] <= 799:
        color[1] += 1
    elif 800 <= a[i] <= 1199:
        color[2] += 1
    elif 1200 <= a[i] <= 1599:
        color[3] += 1
    elif 1600 <= a[i] <= 1999:
        color[4] += 1
    elif 2000 <= a[i] <= 2399:
        color[5] += 1
    elif 2400 <= a[i] <= 2799:
        color[6] += 1
    elif 2800 <= a[i] <= 3199:
        color[7] += 1
    elif 3200 <= a[i]:
        color[8] += 1


min_col = color[:]
min_cnt = 0
del min_col[-1]
for i in range(len(min_col)):
    if min_col[i] != 0:
        min_cnt += 1

max_cnt = min_cnt + color[8]
min_cnt = max(1,min_cnt)

print(min_cnt, max_cnt)
Buggy code:
n = int(input())
A = list(map(int,input().split()))
color = []
cnt = 0

for i in range(n):
    c = A[i]//400
    if c<=7:
        color.append(c)
    else:
        cnt += 1

diff = set(color)
minimum = max(len(diff),1)
maximum = min(len(diff)+cnt)

print(minimum, maximum)

Fixed code:
n = int(input())
A = list(map(int,input().split()))
color = []
cnt = 0

for i in range(n):
    c = A[i]//400
    if c<=7:
        color.append(c)
    else:
        cnt += 1

diff = set(color)
minimum = max(len(diff),1)
maximum = len(diff)+cnt

print(minimum, maximum)
Buggy code:
N = int(input())
a = [int(e) for e in input().split()]

su = [0] * 9
for e in a:
    if e >= 3200:
        su[8] += 1
    else:
        su[e//400] += 1
mi = 0
for e in su[:8]:
    print(e)
    if e != 0:
        mi += 1
mi = max(1, mi)
ma = min(8, mi+su[8])
print(mi, ma)

Fixed code:
N = int(input())
a = [int(e) for e in input().split()]

su = [0] * 9
for e in a:
    if e >= 3200:
        su[8] += 1
    else:
        su[e//400] += 1
mi = 0
for e in su[:8]:
    if e != 0:
        mi += 1
ma = mi+su[8]
mi = max(1, mi)
print(mi, ma)
Buggy code:
N = int(input())
a = list(map(int, input().split()))
array1 = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
array2 = [True for _ in range(8)]
result1 = 0
plus = 0

for i in range(N):
    print(i)

    if a[i] >= 3200:
        plus += 1
        continue

    for j in range(len(array1)):
        if a[i] < array1[j]:
            if array2[j]:
                result1 += 1
                array2[j] = False
            break

result2 = result1 + plus
if result2 > 8:
    result2 = 8

print(result1, result2)


Fixed code:
N = int(input())
a = list(map(int, input().split()))
array1 = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
array2 = [True for _ in range(8)]
result1 = 0
plus = 0

for i in range(N):

    if a[i] >= 3200:
        plus += 1
        continue

    for j in range(8):
        if a[i] < array1[j]:
            if array2[j]:
                result1 += 1
                array2[j] = False
            break

result2 = result1 + plus

print(max(result1, 1), result2)
Buggy code:
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
d = defaultdict(int)
for i in a:
    d[i//400] += 1
c = 0
f = 0
print(d)
for key in d.keys():
    if key < 8:
        c += 1
    else:
        f += d[key]
if c == 0:
    print(1,f)
else:
    print(c,c+f)



Fixed code:
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
d = defaultdict(int)
for i in a:
    d[i//400] += 1
c = 0
f = 0
for key in d.keys():
    if key < 8:
        c += 1
    else:
        f += d[key]
if c == 0:
    print(1,f)
else:
    print(c,c+f)
Buggy code:
N = int(input())
x = list(map(int, input().split()))
a=[0]*8
b=0
for i in range(0,N):
    if x[i]>=3200:
        b +=1
for j in range(0,8):
    for i in range(0,N):
        if x[i]<400:
            a[j] +=1
            x[i] = inf
        x[i] -= 400

zerox=0
mincolar=0
 
for i in a:
    if i==0:
        zerox +=1  
    else:
        mincolar +=1

if(zerox<b):
    print(mincolar,mincolar+zerox)
else:
    print(mincolar,mincolar+b)


quit()

Fixed code:
inf=float('inf')
N = int(input())
x = list(map(int, input().split()))
a=[0]*8
b=0
for i in range(0,N):
    if x[i]>=3200:
        b +=1
        x[i]=inf
for j in range(0,8):
    for i in range(0,N):
        if x[i]<400:
            a[j] +=1
            x[i] = inf
        x[i] -= 400
 
 
mincolar=0
for i in a:
    if i!=0:
        mincolar +=1
if mincolar!=0:
    print(mincolar,mincolar+b)
else:
    print(1,b)
quit()
Buggy code:
input();A=map(int,input().split());C=[0]*99;D=0
for a in A:a//=400;D+=a>7;C[a]+=a<8
E=sum(C);print(max(E,1),E+D)


Fixed code:
input();A=map(int,input().split());C=[0]*99;D=0
for a in A:a//=400;D+=a>7;C[a]=a<8
E=sum(C);print(max(E,1),E+D)
Buggy code:
N = int(input())
lst = [0] * 9

for x in [int(x) for x in input().split()]:
    if x <= 399:
        lst[0] = 1
    elif x <= 799:
        lst[1] = 1
    elif x <= 1199:
        lst[2] = 1
    elif x <= 1599:
        lst[3] = 1
    elif x <= 1999:
        lst[4] = 1
    elif x <= 2399:
        lst[5] = 1
    elif x <= 2799:
        lst[6] = 1
    elif x <= 3199:
        lst[7] = 1
    else:
        lst[8] += 1

a = sum(lst[:-1])
b = lst[8]
print(lst)
if 8 - a < b:
    b = 8 - a
print("{0} {1}".format(a, a + b))


Fixed code:
N = int(input())
lst = [0] * 9

for x in [int(x) for x in input().split()]:
    if x <= 399:
        lst[0] = 1
    elif x <= 799:
        lst[1] = 1
    elif x <= 1199:
        lst[2] = 1
    elif x <= 1599:
        lst[3] = 1
    elif x <= 1999:
        lst[4] = 1
    elif x <= 2399:
        lst[5] = 1
    elif x <= 2799:
        lst[6] = 1
    elif x <= 3199:
        lst[7] = 1
    else:
        lst[8] += 1

a = sum(lst[:-1])
b = lst[8]
if a == 0 and b > 0:
    print("1 {0}".format(b))
else:
    print("{0} {1}".format(a, a + b))
Buggy code:
N = int(input())

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

color = [0] * 9

a = 400 
    
for i in range(0,N):
    if rate[i] < a:
        color[0] = 1
    elif a <= rate[i] < 2*a:
        color[1] = 1
    elif 2*a <= rate[i] < 3*a:
        color[2] = 1
    elif 3*a <= rate[i] < 4*a:
        color[3] = 1
    elif 4*a <= rate[i] < 5*a:
        color[4] = 1
    elif 5*a <= rate[i] < 6*a:
        color[5] = 1
    elif 6*a <= rate[i] < 7*a:
        color[6] = 1
    elif 7*a <= rate[i] < 8*a:
        color[7] = 1
    elif 8*a <= rate[i]:
        color[8] += 1
        

min_color = 0
max_color = 0



print( max(color[:8].count(1),1), min_color + color[8])


Fixed code:
N = int(input())

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

color = [0] * 8

a = 400 
free = 0
    
for i in range(0,N):
    if rate[i] < a:
        color[0] = 1
    elif a <= rate[i] < 2*a:
        color[1] = 1
    elif 2*a <= rate[i] < 3*a:
        color[2] = 1
    elif 3*a <= rate[i] < 4*a:
        color[3] = 1
    elif 4*a <= rate[i] < 5*a:
        color[4] = 1
    elif 5*a <= rate[i] < 6*a:
        color[5] = 1
    elif 6*a <= rate[i] < 7*a:
        color[6] = 1
    elif 7*a <= rate[i] < 8*a:
        color[7] = 1
    elif 8*a <= rate[i]:
        free += 1
        

min_color = 0
max_color = 0

min_color = color.count(1)
max_color = min_color + free

print( max(min_color,1), max_color)
Buggy code:
n=int(input())
a=list(map(int,input().split()))
a1=0
a2=0
a3=0
a4=0
a5=0
a6=0
a7=0
a8=0
wild=0
for i in range(n):
    if 0<=a[i]<=399:
        a1+=1
    elif 400<=a[i]<=799:
        a2+=1
    elif 800<=a[i]<=1199:
        a3+=1
    elif 1200<=a[i]<=1599:
        a4+=1
    elif 1600<=a[i]<=1999:
        a5+=1
    elif 2000<=a[i]<=2399:
        a6+=1
    elif 2400<=a[i]<=2799:
        a7+=1
    elif 2800<=a[i]<=3199:
        a8+=1
    else:
        wild+=1
ans=0
r=[]
r.append(a1)
r.append(a2)
r.append(a3)
r.append(a4)
r.append(a5)
r.append(a6)
r.append(a7)
r.append(a8)
for i in range(8):
    if r[i]!=0:
        ans+=1
print(min(ans,1),ans+wild)

Fixed code:
n=int(input())
a=list(map(int,input().split()))
a1=0
a2=0
a3=0
a4=0
a5=0
a6=0
a7=0
a8=0
wild=0
for i in range(n):
    if 0<=a[i]<=399:
        a1+=1
    elif 400<=a[i]<=799:
        a2+=1
    elif 800<=a[i]<=1199:
        a3+=1
    elif 1200<=a[i]<=1599:
        a4+=1
    elif 1600<=a[i]<=1999:
        a5+=1
    elif 2000<=a[i]<=2399:
        a6+=1
    elif 2400<=a[i]<=2799:
        a7+=1
    elif 2800<=a[i]<=3199:
        a8+=1
    else:
        wild+=1
ans=0
r=[]
r.append(a1)
r.append(a2)
r.append(a3)
r.append(a4)
r.append(a5)
r.append(a6)
r.append(a7)
r.append(a8)
for i in range(8):
    if r[i]!=0:
        ans+=1
print(max(ans,1),ans+wild)
Buggy code:
n = int(input())
a = [int(item) for item in input().split()]

rank_num = [0] *  9
for item in a:
    item_rank = -1 
    if item < 400:
        item_rank = 0
    elif item < 800:
        item_rank = 1
    elif item < 1200:
        item_rank = 2
    elif item < 1600:
        item_rank = 3
    elif item < 2000:
        item_rank = 4
    elif item < 2400:
        item_rank = 5
    elif item < 2800:
        item_rank = 6
    elif item < 3200:
        item_rank = 7
    else:
        item_rank = 8
    rank_num[item_rank] += 1
print(rank_num)

ans_min = max(8 - rank_num[:-1].count(0), 1)
ans_max = 8 - rank_num[:-1].count(0) + rank_num[-1]
print(ans_min, ans_max)

Fixed code:
n = int(input())
a = [int(item) for item in input().split()]

rank_num = [0] *  9
for item in a:
    item_rank = -1 
    if item < 400:
        item_rank = 0
    elif item < 800:
        item_rank = 1
    elif item < 1200:
        item_rank = 2
    elif item < 1600:
        item_rank = 3
    elif item < 2000:
        item_rank = 4
    elif item < 2400:
        item_rank = 5
    elif item < 2800:
        item_rank = 6
    elif item < 3200:
        item_rank = 7
    else:
        item_rank = 8
    rank_num[item_rank] += 1

ans_min = max(8 - rank_num[:-1].count(0), 1)
ans_max = 8 - rank_num[:-1].count(0) + rank_num[-1]
print(ans_min, ans_max)
Buggy code:
n = int(input())
l = list(map(int,input().split()))
ll = [0,400,800,1200,1600,2000,2400,2800,3200]
al = [0] * 9

ans = 0
cnt = 0

for i in range(n):
  for j in range(0,8):
    if l[i] >= 3200:
      cnt = +1
      break
    if ll[j] <= l[i] < ll[j+1]:
      al[j] = 1
print(al,cnt)

if sum(al) != 0:
  print(sum(al), sum(al) + cnt)
else:
  print(1,cnt)

Fixed code:
n = int(input())
l = list(map(int,input().split()))
ll = [0,400,800,1200,1600,2000,2400,2800,3200]
al = [0] * 8

ans = 0
cnt = 0

for i in range(n):
  for j in range(0,8):
    if ll[j] <= l[i] < ll[j+1]:
      al[j] = 1
    if l[i] >= 3200:
      cnt += 1
      break
print(sum(al) if sum(al) > 0 else 1, sum(al) + cnt)
Buggy code:
n = int(input())
a = [int(x) for x in input().split()]

agg = [0] * 9
free = 0

for rate in a:
    if rate < 400:
        agg[0] += 1
    elif rate < 800:
        agg[1] += 1
    elif rate < 1200:
        agg[2] += 1
    elif rate < 1600:
        agg[3] += 1
    elif rate < 2000:
        agg[4] += 1
    elif rate < 2400:
        agg[5] += 1
    elif rate < 2800:
        agg[6] += 1
    elif rate < 3200:
        agg[7] += 1
    else:
        agg[8] += 1

minimum = len([x for x in agg if x > 0])
maximum = minimum + max(agg[8]-1, 0)

print(minimum, maximum)

Fixed code:
n = int(input())
a = [int(x) for x in input().split()]

agg = [0] * 9
free = 0

for rate in a:
    if rate < 400:
        agg[0] += 1
    elif rate < 800:
        agg[1] += 1
    elif rate < 1200:
        agg[2] += 1
    elif rate < 1600:
        agg[3] += 1
    elif rate < 2000:
        agg[4] += 1
    elif rate < 2400:
        agg[5] += 1
    elif rate < 2800:
        agg[6] += 1
    elif rate < 3200:
        agg[7] += 1
    else:
        free += 1

minimum = len([x for x in agg if x > 0])
maximum = minimum + free
if minimum == 0:
    minimum = 1

print(minimum, maximum)
Buggy code:
def c():
    n = int(input())
    a = list(map(int, input().split()))
    l = list(map(lambda i: min(8, i//400), a))
    over_rate = l.count(8)
    res = set(l)
    try: res.remove(8)

    mi = max(1, len(res))
    ma = len(res) + over_rate
    print(mi, ma)


Fixed code:
def c():
    n = int(input())
    a = list(map(int, input().split()))
    l = list(map(lambda i: min(8, i//400), a))
    over_rate = l.count(8)
    res = set(l)
    if 8 in res: res.remove(8)

    mi = max(1, len(res))
    ma = len(res) + over_rate
    print(mi, ma)

c()
Buggy code:
maxColorNum = 8
rates = [False] * maxColorNum
overRed = 0
N = int(input())
people = list(map(int, input().split()))
for i in people:
    idx = i // 400
    if idx >= maxColorNum:
        overRed += 1
    else:
        rates[idx] = True
minNum = rates.count(True) if overRed == 0 else rates.count(True)+1
maxNum = rates.count(True) + overRed if rates.count(True) + \
    overRed <= maxColorNum else maxColorNum

print(str(minNum) + " " + str(maxColorNum))


Fixed code:
maxColorNum = 8
rates = [False] * maxColorNum
overRed = 0
N = int(input())
people = list(map(int, input().split()))
for i in people:
    idx = i // 400
    if idx >= maxColorNum:
        overRed += 1
    else:
        rates[idx] = True
minNum = 1 if rates.count(True) == 0 and overRed != 0 else rates.count(True)
maxNum = rates.count(True) + overRed

print(str(minNum) + " " + str(maxNum))
Buggy code:
n = int(input())
A = list(map(int,input().split()))

dic = [False]*7

cnt = 0

for i in range(n):
  tmp = A[i] // 400
  if(tmp >= 8):
    cnt += 1
  else:
    dic[tmp] = True
  
print(str(sum(dic)) + ' ' + str(sum(dic) + cnt))

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

dic = [False]*8

cnt = 0

for i in range(n):
  tmp = A[i] // 400
  if(tmp >= 8):
    cnt += 1
  else:
    dic[tmp] = True
if(sum(dic) == 0 and cnt > 0):
  print('1 ' + str(cnt))
else:
  print(str(sum(dic)) + ' ' + str(sum(dic) + cnt))
Buggy code:
 N = int(input())
 A = [int(i) for i in input().split()]

 colors = [0,0,0,0,0,0,0,0,0]

 for a in A:
   if a < 400:
     colors[0] +=1
   elif 400<=a and a <800:
     colors[1] +=1
   elif 800<=a and a<1200:
     colors[2] +=1
   elif 1200<=a and a<1600:
     colors[3] +=1
   elif 1600<=a and a<2000:
     colors[4] +=1
   elif 2000<=a and a<2400:
     colors[5] +=1
   elif 2400<=a and a<2800:
     colors[6] +=1
   elif 2800<=a and a<3200:
     colors[7] +=1
   else:
     colors[8] +=1

 ans = 0
 for i in range(len(colors)-1):
   if colors[i] !=0:
     ans +=1

 print(str(ans) + " " + str(colors[8] + ans))


Fixed code:
N = int(input())
A = [int(i) for i in input().split()]

colors = [0,0,0,0,0,0,0,0,0]

for a in A:
  if a < 400:
    colors[0] +=1
  elif 400<=a and a <800:
    colors[1] +=1
  elif 800<=a and a<1200:
    colors[2] +=1
  elif 1200<=a and a<1600:
    colors[3] +=1
  elif 1600<=a and a<2000:
    colors[4] +=1
  elif 2000<=a and a<2400:
    colors[5] +=1
  elif 2400<=a and a<2800:
    colors[6] +=1
  elif 2800<=a and a<3200:
    colors[7] +=1
  else:
    colors[8] +=1

ans = 0
for i in range(len(colors)-1):
  if colors[i] !=0 :
    ans +=1

if ans == 0:
  print(str(1) + " " + str(colors[8] + ans))
else:
  print(str(ans) + " " + str(colors[8] + ans))
Buggy code:
N=int(input())
nums=input().split()
r1=0
r2=0
r3=0
r4=0
r5=0
r6=0
r7=0
r8=0
r9=0
for n in range(0,N):
    if 1<=int(nums[n])<=399:
        r1=1
    if 400<=int(nums[n])<=799:
        r2=1
    if 800<=int(nums[n])<=1199:
        r3=1
    if 1200<=int(nums[n])<=1599:
        r4=1
    if 1600<=int(nums[n])<=1999:
        r5=1
    if 2000<=int(nums[n])<=2399:
        r6=1
    if 2400<=int(nums[n])<=2799:
        r7=1
    if 2800<=int(nums[n])<=3199:
        r8=1
    if 3200<=int(nums[n]):
        r9=r9+1

if r1==r2==r3==r4==r5==r6==r7==r8==0 :
    if 1<=r9<=8:
        p1=r9
        p2=1
    else:
        p1=8
        p2=1
else:
    p1=r1+r2+r3+r4+r5+r6+r7+r8+r9
    p2=r1+r2+r3+r4+r5+r6+r7+r8

Fixed code:
N=int(input())
nums=input().split()
r1=0
r2=0
r3=0
r4=0
r5=0
r6=0
r7=0
r8=0
r9=0
for n in range(0,N):
    if 1<=int(nums[n])<=399:
        r1=1
    if 400<=int(nums[n])<=799:
        r2=1
    if 800<=int(nums[n])<=1199:
        r3=1
    if 1200<=int(nums[n])<=1599:
        r4=1
    if 1600<=int(nums[n])<=1999:
        r5=1
    if 2000<=int(nums[n])<=2399:
        r6=1
    if 2400<=int(nums[n])<=2799:
        r7=1
    if 2800<=int(nums[n])<=3199:
        r8=1
    if 3200<=int(nums[n]):
        r9=r9+1

if r1==r2==r3==r4==r5==r6==r7==r8==0 :
    if 1<=r9<=8:
        p1=r9
        p2=1
    else:
        p1=8
        p2=1
else:
    p1=r1+r2+r3+r4+r5+r6+r7+r8+r9
    p2=r1+r2+r3+r4+r5+r6+r7+r8

print(p2,p1)
Buggy code:
# coding: utf-8
def get_ln_int_inputs():
    return list(map(int, input().split()))


def main():
    input()
    rates = get_ln_int_inputs()

    colors = [0] * 8
    free_colors = 0
    for rate in rates:
        if rate >= 3200:
            free_colors += 1
        else:
            colors[rate // 400] = 1
    fixed_colors = sum(colors)

    print(str(fixed_colors) + " " + str(min(fixed_colors + free_colors, 1)))


main()

Fixed code:
# coding: utf-8
def get_ln_int_inputs():
    return list(map(int, input().split()))


def main():
    input()
    rates = get_ln_int_inputs()

    colors = [0] * 8
    free_colors = 0
    for rate in rates:
        if rate >= 3200:
            free_colors += 1
        else:
            colors[rate // 400] = 1
    fixed_colors = sum(colors)

    print(str(max(fixed_colors, 1)) + " " + str(max(fixed_colors + free_colors, 1)))


main()
Buggy code:
n=int(input())
a=list(map(int,input().split()))
map(lambda x:x//400,a)
cnt=0
z=[]
for i in a:
  if i>=8:
    cnt+=1
  else:
    z+=[i]
print(min(8,len(set(z))),min(8,len(set(z))+cnt))

Fixed code:
n=int(input())
a=list(map(int,input().split()))
a=list(map(lambda x:x//400,a))
cnt=0
z=[]
for i in a:
  if i>=8:
    cnt+=1
  else:
    z.append(i)
print(max(1,len(set(z))),len(set(z))+cnt)
Buggy code:
N = int(input())
an = list(map(int, input().split()))
over_cnt = 0
colors = []
for a in an:
    rate = a // 400
    if rate >= 8:
        over_cnt += 1
    elif rate not in colors:
        colors.append(rate)

min = len(colors)
max = min(len(colors) + over_cnt, 8)
print(min, max)


Fixed code:
N = int(input())
an = list(map(int, input().split()))
over_cnt = 0
colors = []
for a in an:
    rate = a // 400
    if rate >= 8:
        over_cnt += 1
    elif rate not in colors:
        colors.append(rate)

print(max(len(colors), 1), len(colors) + over_cnt)