qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys

d = sys.stdin.readline()
while d:
    a,b,c,d,e,f = map(int,d.split())
    inv = 1/(a*e - b*d)
    iA = [[e,-b],[-d,a]]
    B = [c,f]
    sol = list()
    for i in range(2):
        tmp = 0
        for j in range(2):
            tmp += iA[i][j] * B[j]
        sol.append(tmp*inv)
    print("%.3f %.3f"%(sol[0],sol[1]))

    d = sys.stdin.readline()

Fixed code:
import sys

d = sys.stdin.readline()
while d:
    a,b,c,d,e,f = map(int,d.split())
    inv = 1/(a*e - b*d)
    iA = [[e,-b],[-d,a]]
    B = [c,f]
    sol = list()
    for i in range(2):
        tmp = 0
        for j in range(2):
            tmp += inv*iA[i][j] * B[j]
        sol.append(tmp)
    print("%.3f %.3f"%(sol[0],sol[1]))

    d = sys.stdin.readline()
Buggy code:
t = 0
while t == 0:	
	try:
		a,b,e,c,d,f = [int(i) for i in input().split()]
	except:
		break
	else:
		x = (d*e - b*f) / (a*d - b*c) + 0
		y = (a*f - c*e) / (a*d - b*c) + 0
		print("{0:.3f}".format(x) + "  " + "{0:.3f}".format(y))

Fixed code:
t = 0
while t == 0:	
	try:
		a,b,e,c,d,f = [int(i) for i in input().split()]
	except:
		break
	else:
		x = (d*e - b*f) / (a*d - b*c) + 0
		y = (a*f - c*e) / (a*d - b*c) + 0
		print("{0:.3f}".format(x) + " " + "{0:.3f}".format(y))
Buggy code:
x = []
y = []
while True:
    try:
        a, b, p, c, d, q = map(int, input().split())
        x.append((d*p-b*q)/(a*d-b*c))
        y.append((a*q-c*p)/(a*d-b*c))
    except EOFError:
        break

for i in range(len(x)):
    print("{:.3f} {:.3f}".format(x[i], y[i]))

Fixed code:
x = []
y = []
while True:
    try:
        a, b, p, c, d, q = map(int, input().split())
        x.append((d*p-b*q)/(a*d-b*c))
        y.append((a*q-c*p)/(a*d-b*c))
    except EOFError:
        break

for i in range(len(x)):
    print("{:.3f} {:.3f}".format(x[i]+0, y[i]+0))
Buggy code:
import sys
from decimal import Decimal
from fractions import Fraction

def main():

    #input_strings = sys.stdin.readlines()
    for matrix_string in input_strings:
        matrix = list(map(Fraction, list(matrix_string.split())))
        if matrix[0] == 0:
            matrix = matrix[3:] + matrix[:3]
        matrix = list(map(lambda x: x / matrix[0], matrix[:3])) + matrix[3:]
        matrix = matrix[:3] + list(map(lambda x: x[1] - matrix[3] * x[0], zip(matrix[:3], matrix[3:])))
        matrix = matrix[:3] + list(map(lambda x: x / matrix[4], matrix[3:]))
        matrix = list(map(lambda x: x[0] - matrix[1] * x[1], zip(matrix[:3], matrix[3:]))) + matrix[3:]
        matrix = list(map(float, matrix))
        matrix = list(map(Decimal, matrix))
        matrix = list(map(lambda x: x.quantize(Decimal('.001'), rounding='ROUND_HALF_UP'), matrix))
        matrix = list(map(lambda x: x + 0, matrix))

        print('%.3f %.3f' % (matrix[2], matrix[5]))
main()

Fixed code:
import sys
from decimal import Decimal
from fractions import Fraction

def main():

    input_strings = sys.stdin.readlines()
    for matrix_string in input_strings:
        matrix = list(map(Fraction, list(matrix_string.split())))
        if matrix[0] == 0:
            matrix = matrix[3:] + matrix[:3]
        matrix = list(map(lambda x: x / matrix[0], matrix[:3])) + matrix[3:]
        matrix = matrix[:3] + list(map(lambda x: x[1] - matrix[3] * x[0], zip(matrix[:3], matrix[3:])))
        matrix = matrix[:3] + list(map(lambda x: x / matrix[4], matrix[3:]))
        matrix = list(map(lambda x: x[0] - matrix[1] * x[1], zip(matrix[:3], matrix[3:]))) + matrix[3:]
        matrix = list(map(float, matrix))
        matrix = list(map(Decimal, matrix))
        matrix = list(map(lambda x: x.quantize(Decimal('.001'), rounding='ROUND_HALF_UP'), matrix))

        print('%.3f %.3f' % (matrix[2], matrix[5]))
main()
Buggy code:
import sys
import math
def simeq(a,b,c,d,e,f):
    return ((c*e-b*f)/(a*e-b*d),((a*f-c*d)/(a*e-b*d)))

if __name__ == '__main__':
    for line in sys.stdin:
        (a,b,c,d,e,f) = map(int,line.split())
        (x,y) = simeq(a,b,c,d,e,f)
        print("{:.3f} {:.3f}".format(round(x,3),round(y,3)))

Fixed code:
import sys
import math
def simeq(a,b,c,d,e,f):
    return ((c*e-b*f)/(a*e-b*d)+0,((a*f-c*d)/(a*e-b*d))+0)

if __name__ == '__main__':
    for line in sys.stdin:
        (a,b,c,d,e,f) = map(float,line.split())
        (x,y) = simeq(a,b,c,d,e,f)
        print("{:.3f} {:.3f}".format(round(x,3),round(y,3)))
Buggy code:
import sys
#from me.io import dup_file_stdin

#@dup_file_stdin
def solve():
    for line in sys.stdin:
        a,b,c,d,e,f=map(float,line.split(' '))
        print("{:.3f} {:.3f}".format((c*e-b*f)/(a*e-b*d),(c*d-a*f)/(b*d-a*e)))
solve()

Fixed code:
import sys
#from me.io import dup_file_stdin

#@dup_file_stdin
def solve():
    for line in sys.stdin:
        a,b,c,d,e,f=map(float,line.split(' '))
        print("{:.3f} {:.3f}".format((c*e-b*f)/(a*e-b*d)+0,(c*d-a*f)/(b*d-a*e)+0))
solve()
Buggy code:
import sys


def det(mat):
  t = 1 / (mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0])
  a = t * mat[1][1]
  b = t * -1 * mat[0][1]
  c = t * -1 * mat[1][0]
  d = t * mat[0][0]
  return [[a, b], [c, d]]


for line in sys.stdin:
  try:
    a, b, c, d, e, f = [int(i) for i in line.split()]
    A = [[a, b], [d, e]]
    P = [c, f]
    detA = det(A)
    print("%lf %lf" % (detA[0][0] * P[0] + detA[0][1] * P[1], detA[1][0] * P[0] + detA[1][1] * P[1]))
  except:
    break

Fixed code:
import sys


def det(mat):
  t = 1 / (mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0])
  a = t * mat[1][1]
  b = t * -1 * mat[0][1]
  c = t * -1 * mat[1][0]
  d = t * mat[0][0]
  return [[a, b], [c, d]]


for line in sys.stdin:
  try:
    a, b, c, d, e, f = [int(i) for i in line.split()]
    A = [[a, b], [d, e]]
    P = [c, f]
    detA = det(A)
    print("%.3lf %.3lf" % (detA[0][0] * P[0] + detA[0][1] * P[1], detA[1][0] * P[0] + detA[1][1] * P[1]))
  except:
    break
Buggy code:
import math

def my_round(x,d=0):
    p = 10 ** d
    return float(math.floor((x * p) + math.copysign(0.5, x))) / p

class Equation():
    def __init__(self, a, b, c, d, e, f):
        self.a = a
        self.b = b
        self.c = c
        self.d = d
        self.e = e
        self.f = f

    def calc(self):
        temp = (self.a * self.e - self.b * self.d)
        temp_a = (self.c * self.e - self.b * self.f)
        temp_b = (self.a * self.f - self.c * self.d)
        try:
            x = round(temp_a / temp, 4)
            if x < 0.0:
                x *= -1
        except ZeroDivisionError:
            x = round(temp_a / 1.0, 4)

        try:
            y = round(temp_b / temp, 4)
            if x < 0.1:
                x *= -1
        except:
            y = round(temp_b / 1.0, 4)


        return x, y


    def print(self):
        ans = self.calc()
        print("{0:.3f} {1:.3f}".format(ans[0], ans[1]))


def main():
    data = []

    while 1:
        try:
            n = input().split()

            a = float(n[0])
            b = float(n[1])
            c = float(n[2])
            d = float(n[3])
            e = float(n[4])
            f = float(n[5])

            data.append(Equation(a, b, c, d, e, f))

        except EOFError:
            break

    for num in data:
        num.print()

if __name__ == "__main__":
    main()

Fixed code:
import math

def my_round(x,d=0):
    p = 10 ** d
    return float(math.floor((x * p) + math.copysign(0.5, x))) / p

class Equation():
    def __init__(self, a, b, c, d, e, f):
        self.a = a
        self.b = b
        self.c = c
        self.d = d
        self.e = e
        self.f = f

    def calc(self):
        temp = (self.a * self.e - self.b * self.d)
        temp_a = (self.c * self.e - self.b * self.f)
        temp_b = (self.a * self.f - self.c * self.d)
        try:
            x = round(temp_a / temp+0., 3)
        except ZeroDivisionError:
            x = round(temp_a / 1.0, 4)

        try:
            y = round(temp_b / temp+0., 3)
        except:
            y = round(temp_b / 1.0, 4)


        return x, y


    def print(self):
        ans = self.calc()
        print("{0:.3f} {1:.3f}".format(ans[0], ans[1]))


def main():
    data = []

    while 1:
        try:
            n = input().split()

            a = float(n[0])
            b = float(n[1])
            c = float(n[2])
            d = float(n[3])
            e = float(n[4])
            f = float(n[5])

            data.append(Equation(a, b, c, d, e, f))

        except EOFError:
            break

    for num in data:
        num.print()

if __name__ == "__main__":
    main()
Buggy code:
import sys
for e in sys.stdin:
 a,b,c,d,e,f=map(int,e.split())
 print("%-.4f %-.4f"%((c*e-b*f)/(a*e-b*d)+0,(c*d-a*f)/(b*d-a*e)+0))


Fixed code:
import sys
for e in sys.stdin:
 a,b,c,d,e,f=map(int,e.split())
 print("%.3f %.3f"%((c*e-b*f)/(a*e-b*d)+0,(c*d-a*f)/(b*d-a*e)+0))
Buggy code:
import sys
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    x = (c * e - b * f) / (a * e - b * d)
    y = (c * d - a * f) / (b * d - a * e)
    x = abs(x) if abs(x) < 10e-4 else x
    y = abs(y) if abs(y) < 10e-4 else y
    print("{:.3f} {:.3f}".format(x, y)


Fixed code:
import sys
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    x = (c * e - b * f) / (a * e - b * d)
    y = (c * d - a * f) / (b * d - a * e)
    x = abs(x) if abs(x) < 10e-4 else x
    y = abs(y) if abs(y) < 10e-4 else y
    print("{:.3f} {:.3f}".format(x, y))
Buggy code:
def main():
    p = [float(x) for x in input().split()]
    x = (p[4]*p[2]-p[1]*p[5])/(p[0]*p[4]-p[1]*p[3])
    y = (p[2]-p[0]*x)/p[1]
    if abs(x)<1e-4:
        x=0.0
    if abs(y)<1e-4:
        y=0.0
    print("{:.3f} {:.3f}".format(x,y))

main()


Fixed code:
def main():
    while 1:
        try:
            p = [float(x) for x in input().split()]
            x = (p[4]*p[2]-p[1]*p[5])/(p[0]*p[4]-p[1]*p[3])
            y = (p[2]-p[0]*x)/p[1]
        except:
            break
        if abs(x)<1e-4:
            x=0.0
        if abs(y)<1e-4:
            y=0.0
        print("{:.3f} {:.3f}".format(x,y))

main()
Buggy code:
while True:
    try:
        line = input()
    except:
        break
    a,b,c,d,e,f = map(int, line.strip().split())
    z = a * e - b * d
    x = (c * e - b * f) / z
    y = (a * f - c * d) / z
    print('{:.3f} {:.3f}'.format(x, y))

Fixed code:
while True:
    try:
        line = input()
    except:
        break
    a,b,c,d,e,f = map(int, line.strip().split())
    z = a * e - b * d
    x = c * e - b * f
    if x: x = x / z
    y = a * f - c * d
    if y: y = y / z
    print('{:.3f} {:.3f}'.format(x, y))
Buggy code:
while True:
    try:
        a,b,c,d,e,f = map(int, input().split())
        x = (c*e - b*f)/(a*e - b*d)
        y = (a*f - c*d)/(a*e - b*d)
        print('{0:.3f} {0:.3f}'.format(x,y))
    except EOFError : break


Fixed code:
while True:
    try:
        a, b, c, d, e, f = map(int,input().split())
        x = (b*f - e*c) / (b*d - a*e)
        y = (a*f - c*d) / (a*e - b*d)
        if x == -0.000:
            x = 0
            
        print('{:.3f}'.format(x), '{:.3f}'.format(y))
    except:
        break
Buggy code:
while True:
    try:
        a,b,c,d,e,f = map(int, input().split())
        g = (a*e - b*d) 
        x = (c*e - b*f)
        y = (a*f - c*d)
        print('{0:.3f}'.format(x/g+0.0001) +' {0:.3f}'.format(y/0.0001))
              
    except EOFError: break


Fixed code:
while True:
    try:
        a,b,c,d,e,f=map(int, input().split())
        
        y=(a*f-d*c)/(a*e-d*b)
        x=(-b*y+c)/a
        
        print("{:.3f} {:.3f}".format(x,y))
    
    except EOFError:
        break
Buggy code:
while True:
    try:
        (a, b, e, c, d, f) = map(float, input().split())

        D = a * d - b * c
        x = (d * e - b * f) / D
        y = (a * f - c * e) / D

        if D == 0:
            x = 0.0
            y = 0.0

        print("{0:.3f} {1:.3f}".format(x, y))

    except EOFError:
        break




Fixed code:
while True:
    try:
        a,b,c,d,e,f=map(float,input().split())
    except:
        break
    x=(b*f-c*e)/(b*d-a*e)
    (c*d-a*f)/(b*d-a*e)
    y=(c-a*x)/b
    if x==-0:
        x=0
    if y==-0:
        y=0
    print("{:.3f} {:.3f}".format(x,y))
Buggy code:
while True:
    try:
        a, b, c, d, e, f = map(float, input().split())
        x = (c*e - b*f)/(a*e - b*d)
        y = (a*f - c*d)/(a*e - b*d)
        print("{:.3f} {:.3f}".format(x, y))
    except:
        break


Fixed code:
while True :
    try :
        a, b, c, d, e, f = map(float, input().split())
        
        x = (c * e - b * f) / (a * e - b * d)
        y = (c * d - a * f) / (b * d - a * e)
        
        if x == -0 :
            x = 0
        if y == -0 :
            y = 0
            
        print(f"{x:.3f} {y:.3f}")
        
    except :
        break
Buggy code:
import sys

for line in sys.stdin.readlines():
    a, b, c, d, e, f  = map(float, line.strip().split())
    x = (e*c - b*f)/(a*e - b*d)
    y = (c - a*x)/b
    print "{0:.3f}".format(x),
    print "{0:.3f}".format(y)

Fixed code:
import sys
for line in sys.stdin.readlines():
    a, b, c, d, e, f = map(float, line.split())
    x = (c * e - b * f)/(a * e - b * d) 
    y = (c * d - a * f)/(b * d - a * e)
    
    if ((c * e - b * f == 0) | (a * e - b * d == 0)):
        x = 0
    if ((c * d - a * f == 0) | (b * d - a * e == 0)):
        y = 0
    
    print('{:.3f}'.format(x), '{:.3f}'.format(y))
Buggy code:
import sys

while True:
	line = sys.stdin.readline()
	if line is '':
		break
	
	(a, b, e, c, d, f) = map(float, line.split())
	
	D = a * d - b * c
	x = (d * e - b * f) / D
	y = (a * f - c * e) / D
	
	print("{0:.3f} {1:.3f}".format(x, y))

Fixed code:
import sys
 
while True:
    line = sys.stdin.readline()
    if line is '':
        break
     
    (a, b, e, c, d, f) = map(float, line.split())
     
    D = a * d - b * c
    x = (d * e - b * f) / D
    y = (a * f - c * e) / D
     
    if abs(x) < 1e-4:
        x = 0.0
    if abs(y) < 1e-4:
        y = 0.0
     
    print("{0:.3f} {1:.3f}".format(x, y))
Buggy code:
while True:
    try:
        a, b, c, d, e, f = map(float, input().split())
        det = e*a - b*d
        if det !=0:
            x = (e*c - b*f)/det
            y = (f*a - c*d)/det
        print("{:.3f} {:.3f)".format(x+0,y+0))
    except EOFError:
        break

Fixed code:
while True:
  try:
    a,b,c,d,e,f=map(float,input().split())

    if (a*e-b*d)!=0:
      x=(c*e-f*b)/(a*e-b*d)
      if b!=0:
        y=(c-a*x)/b
      elif e!=0:
        y=(f-d*x)/e
    elif (b*d-e*a)!=0:
      y=(c*d-f*a)/(b*d-e*a)
      if a!=0:
        x=(c-b*y)/a
      elif d!=0:
        x=(f-e*y)/d
    if x==-0:
      x=x+0.0
    if y==-0:
      y=y+0.0
    print(f"{x:.3f}",f"{y:.3f}")
  except EOFError:
    break
Buggy code:
while True:
    try:
        a,b,c,d,e,f = [int(x) for x in input().split()]
        x = (c*e-b*f)/(a*e-b*d)
        y = (c*d-a*f)/(b*d-a*e)
        print('{:.3f},{:.3f}'.format(x,y))
    except:
        break



Fixed code:
while True:
    try:
        a,b,c,d,e,f = [int(x) for x in input().split()]
        x = (c*e - b*f)/(a*e - b*d)
        y = (c*d - a*f)/(b*d - a*e)
        if(x == 0): x = 0
        if(y == 0): y = 0

        print("{0:.3f} {1:.3f}".format(x,y))
        
    except:
        break
Buggy code:
while True:
    try:
        a,b,c,d,e,f = map(int, input().split())
        x = (c*e - b*f)/(a*e - b*d)
        y = (a*f - c*d)/(a*e - b*d)
        print('{0:.3f}'.format(x) +' {0:.3f}'.format(y))
              
    except EOFError: break


Fixed code:
while True:
    try:
        a, b, c, d, e, f = map(float, input().split())
        x = (e * c - f * b) / (e * a - d * b) + 0
        y = (d * c - f * a) / (d * b - e * a) + 0
        print('{0:.3f} {1:.3f}'.format(x, y))
    except EOFError:
        break
Buggy code:
while True:
    try:
        a, b, c, d, e, f = map(float, input().split())
        x = (c*e - b*f)/(a*e - b*d)
        y = (f*a - c*d)/(a*e - d*b)
        print( "{0:.3f} {1:.3f}".format(x,y))
    except:
        break

Fixed code:
while True:
	try:
		a,b,c,d,e,f=list(map(float,input().split()))
		x=float((b*f-c*e)/(b*d-a*e))
		y=float((c*d-a*f)/(b*d-a*e))
		if x==-0.000:
			x=0.000
		if y==-0.000:
			y=0.000
		print("{0:.3f} {1:.3f}".format(x,y))
	except:
		break
Buggy code:
while True:
        try:
            a,b,c,d,e,f=map(float,input().split(" "))
            z=a*e-b*d
            if(z!=0):
                x=(c*e-b*f)/z
                y=(a*f-c*d)/z
            print("{:.3f} {:.3f}".format(x,y))
        except:
            break

Fixed code:
while True:
    try:
        a, b, c, d, e, f = map(float, input().split())
        n = a*e - b*d
        if n != 0:
            x = (c*e - b*f) / n
            y = (a*f - c*d) / n
        print('{:.3f} {:.3f}'.format(x+0, y+0))
    except:
        break
Buggy code:
while True:
	try:
		a,b,c,d,e,f = map(float,raw_input().split())
		x = (e*c-b*f) / (e*a-b*d)
		y = (c*d-a*f) / (b*d-e*a)
		print '%.3f %.3f' % (x,y)
	except EOFError:
		break

Fixed code:
while(True):
    try:
        a,b,c,d,e,f = map(float, input().split())
        y = (a*f-c*d)/(a*e-b*d)
        x = (c-b*y)/a
        print("%.3f %.3f"%(x,y))
    except:
        break
Buggy code:
while 1:
    try:
        a, b, c, d, e, f = map(float, input().split())
        det = e*a - b*d
        x = (e*c - b*f)/det
        y = (f*a - c*d)/det
        if x == 0:x=0
        if y==0:y=0
        print("{0:.3f} {1:.3f)".format(x,y))
    except:
        break
    

Fixed code:
while 1:
    try:
        a,b,c,d,e,f = map(float, input().split(" "))
        det = a*e-b*d
        x = (c*e-b*f)/det
        y = (a*f-c*d)/det
        if abs(x) < 0.0001:
            x = 0.0
        if abs(y) < 0.0001:
            y = 0.0
        print("{0:.3f}".format(x),"{0:.3f}".format(y))
    except:
        break
Buggy code:
while True:
  try:
    a,b,c,d,e,f=map(float,raw_input().split())
    y=(d*c-a*f)*1.0/(d*b-a*e)
    x=(b*c-e*f)*1.0/(a*e-b*d)
    print "%.3f %.3f"%(x,y)
  except:break

Fixed code:
while True:
    try:
        a, b, c, d, e, f = map(float, input().split())
        y = (a*f - c*d) / (a*e - b*d)
        x = (c - b*y) / a
        print ("%0.3f %0.3f" % (x, y))
    except:
        break
Buggy code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
l = [x//400 if x//400 <= 7 else 8 for x in a]
p = [0]*8
for i in l:
    if i < 8:
        p[i] = 1
if p.count(0) == 8:
    pmin = 1
    pmax = pmin + min(l.count(8)-1,p.count(0)-1)
else:
    pmin = sum(p) if sum(p) != 0 else 1
    pmax = pmin + min(l.count(8),p.count(0))
print(l)
print(p)
print(pmin, pmax)

Fixed code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
l = [x//400 if x//400 <= 7 else 8 for x in a]
p = [0]*8
for i in l:
    if i < 8:
        p[i] = 1
pmin = sum(p) if sum(p) != 0 else 1
pmax = sum(p) + l.count(8)
print(pmin, pmax)
Buggy code:
n = int(input())
lst = list(map(int, input().split()))
count = {"gray":0,"brown":0,"green":0,"lightblue":0,"blue":0,"yellow":0,"orange":0,"red":0}
free = 0

for i in lst:
    if i<400:
        count["gray"]+=1
    elif i<800:
        count["brown"]+=1
    elif i<1200:
        count["green"]+=1
    elif i<1600:
        count["lightblue"]+=1
    elif i<2000:
        count["blue"]+=1
    elif i<2400:
        count["yellow"]+=1
    elif i<2800:
        count["orange"]+=1
    elif i<3200:
        count["red"]+=1
    else:
        free+=1

ans = 0
for i in count.values():
    if i!=0:
        ans+=1

print(ans, max(ans+free,8))


Fixed code:
n = int(input())
lst = list(map(int, input().split()))
count = {"gray":0,"brown":0,"green":0,"lightblue":0,"blue":0,"yellow":0,"orange":0,"red":0}
free = 0

for i in lst:
    if i<400:
        count["gray"]+=1
    elif i<800:
        count["brown"]+=1
    elif i<1200:
        count["green"]+=1
    elif i<1600:
        count["lightblue"]+=1
    elif i<2000:
        count["blue"]+=1
    elif i<2400:
        count["yellow"]+=1
    elif i<2800:
        count["orange"]+=1
    elif i<3200:
        count["red"]+=1
    else:
        free+=1

ans = 0
for i in count.values():
    if i!=0:
        ans+=1

print(max(ans,1), ans+free)
Buggy code:
l=[0]*13
input()
for i in input().split():
  l[int(i)//400]+=1
r=sum([1 for a in l[:8] if a > 0])
print(max(1,r,r+sum(l[8:])

Fixed code:
l=[0]*13
input()
for i in input().split():
  l[int(i)//400]+=1
r=sum([1 for a in l[:8] if a > 0])
print(max(1,r),r+sum(l[8:]))
Buggy code:
n = int(input())
a_input=list(map(int,input().split()))

rate_li=[0]*9
top_coder=0
for a in a_input:
    rate_li[min(a//400,8)]+=1
print(rate_li)
min_ = sum(i!=0 for i in rate_li[:8])
print(max(min_,1),min_+rate_li[-1])

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

rate_li=[0]*9
top_coder=0
for a in a_input:
    rate_li[min(a//400,8)]+=1
#print(rate_li)
min_ = sum(i!=0 for i in rate_li[:8])
print(max(min_,1),min_+rate_li[-1])
Buggy code:
# -*- coding: utf-8 -*-

n=int(input())
a=list(map(int, input().split()))
a.sort()
d=[0 for _ in range(8)]

flg=False
minim=-1
for i in range(n):
    if a[i]<400:
        d[0]=1
    elif a[i]<800:
        d[1]=1
    elif a[i]<1200:
        d[2]=1
    elif a[i]<1600:
        d[3]=1
    elif a[i]<2000:
        d[4]=1
    elif a[i]<2400:
        d[5]=1
    elif a[i]<2800:
        d[6]=1
    elif a[i]<3200:
        d[7]=1
    else:
        if flg==False:
            minim=sum(d)
            flg=True
        for j in range(n):
            if d[j]==0:
                d[j]=1
                break

if minim==-1:
    minim=sum(d)
print(minim, " ", sum(d))



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

n=int(input())
a=list(map(int, input().split()))
a.sort()
d=[0 for _ in range(8)]

flg=False
minim=-1
for i in range(n):
    if a[i]<400:
        d[0]=1
    elif a[i]<800:
        d[1]=1
    elif a[i]<1200:
        d[2]=1
    elif a[i]<1600:
        d[3]=1
    elif a[i]<2000:
        d[4]=1
    elif a[i]<2400:
        d[5]=1
    elif a[i]<2800:
        d[6]=1
    elif a[i]<3200:
        d[7]=1
    else:
        if flg==False:
            minim=sum(d)
            flg=True
        d[0]+=1

if minim==-1:
    minim=sum(d)
elif minim==0:
    minim=1
print(minim,end=' ')
print(sum(d))
Buggy code:
n=int(input())
A=list(map(int,input().split()))
A=list(map(lambda x:x//400 if x<3200 else 8,A))
n_red=A.count(8)
red_exist=1 if len(n_red) else 0
red_only=1 if red_exist and list(set(A))[0]==8 else 0
n_min=len(set(A)) if not red_exist else len(set(A))-1
print(1 if red_only else n_min,n_min+n_red)


Fixed code:
n=int(input())
A=list(map(int,input().split()))
A=list(map(lambda x:x//400 if x<3200 else 8,A))
n_red=A.count(8)
red_exist=1 if n_red else 0
red_only=1 if red_exist and len(list(set(A)))==1 else 0
n_min=len(set(A)) if not red_exist else len(set(A))-1
print(1 if red_only else n_min,n_min+n_red)
Buggy code:
MAX_COLORS = 8
DIFF_RATE = 400

def solve(a):

    colors = [0]*9

    for i in a:
        num = 0
        tmp = 400
        flag = True
        for j in range(8):
            if i < 0:
                flag = False
                break
            else:
                i -= 400
                num += 1
        if flag:
            colors[num-1] += 1
        else:
            colors[num-1] = 1
    ##print(colors)
    if sum(colors[:8]) == 0:
        print(1,colors[-1])
    else:
        print(sum(colors[:8]),sum(colors[:8])+colors[-1])

def main():
    N = int(input())
    a = list(map(int,input().split()))
    solve(a)

if __name__ == "__main__":
    main()

Fixed code:
def solve(a):
 
    colors = [0]*9
 
    for i in a:
        num = 0
        tmp = 400
        flag = True
        for j in range(9):
            if i < 0:
                flag = False
                break
            else:
                i -= 400
                num += 1
        if flag:
            colors[num-1] += 1
        else:
            colors[num-1] = 1
    if sum(colors[:8]) == 0:
        print(1,colors[-1])
    else:
        print(sum(colors[:8]),sum(colors[:8])+colors[-1])
 
def main():
    N = int(input())
    a = list(map(int,input().split()))
    solve(a)
 
if __name__ == "__main__":
    main()