Buggy python submission (verdict: Runtime Error):
N = int(input())

red_points = [[int(i) for i in input().split()] for j in range(N)]

blue_points = [[int(i) for i in input().split()] for j in range(N)]

red_points.sort()
blue_points.sort()
count = 0
distance = 9999
for blue_point in blue_points:
    for red_point in red_points:
        if (blue_point[0] > red_point[0]) and (blue_point[1] > red_point[1]):
            if blue_point[1] - red_point[1] < distance:
                distance = blue_point[1] - red_point[1]
                tmp = red_point
    if tmp in red_points:
        red_points.remove(tmp)
        tmp.clear()
        count = count + 1
    distance = 9999
print(count)


Fixed submission:
N = int(input())

red_points = [[int(i) for i in input().split()] for j in range(N)]

blue_points = [[int(i) for i in input().split()] for j in range(N)]

red_points.sort()
blue_points.sort()
count = 0
distance = 9999
for blue_point in blue_points:
    tmp = [i for i in red_points if blue_point[0] > i[0] and blue_point[1] > i[1]]
    if tmp:
        for j in tmp:
            if (blue_point[1] - j[1]) < distance:
                distance = blue_point[1] - j[1]
                min_red = j
        count = count + 1
        red_points.remove(min_red)
        distance = 9999

print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())

red_points = [[int(i) for i in input().split()] for j in range(N)]

blue_points = [[int(i) for i in input().split()] for j in range(N)]

red_points.sort()
blue_points.sort()
count = 0
distance = 9999
for blue_point in blue_points:
    for red_point in red_points:
        if blue_point[0] > red_point[0]:
            if blue_point[1] > red_point[1]:
                if blue_point[1] - red_point[1] < distance:
                    distance = blue_point[1] - red_point[1]
                    tmp = red_point
        else:
            distance = 9999
            break
    if tmp in red_points:
        red_points.remove(tmp)
        count = count + 1
    distance = 9999
print(count)


Fixed submission:
N = int(input())

red_points = [[int(i) for i in input().split()] for j in range(N)]

blue_points = [[int(i) for i in input().split()] for j in range(N)]

red_points.sort()
blue_points.sort()
count = 0
distance = 9999
for blue_point in blue_points:
    tmp = [i for i in red_points if blue_point[0] > i[0] and blue_point[1] > i[1]]
    if tmp:
        for j in tmp:
            if (blue_point[1] - j[1]) < distance:
                distance = blue_point[1] - j[1]
                min_red = j
        count = count + 1
        red_points.remove(min_red)
        distance = 9999

print(count)

Buggy python submission (verdict: Runtime Error):
red_points.sort()
blue_points.sort()
count = 0
distance = 9999
for blue_point in blue_points:
    for red_point in red_points:
        if blue_point[0] > red_point[0]:
            if blue_point[1] > red_point[1]:
                if blue_point[1] - red_point[1] < distance:
                    distance = blue_point[1] - red_point[1]
                    tmp = red_point
        else:
            distance = 9999
            break
    print(tmp, blue_point)
    print(red_points)
    if tmp in red_points:
        red_points.remove(tmp)
        count = count + 1
    distance = 9999
print(count)

Fixed submission:
N = int(input())

red_points = [[int(i) for i in input().split()] for j in range(N)]

blue_points = [[int(i) for i in input().split()] for j in range(N)]

red_points.sort()
blue_points.sort()
count = 0
distance = 9999
for blue_point in blue_points:
    tmp = [i for i in red_points if blue_point[0] > i[0] and blue_point[1] > i[1]]
    if tmp:
        for j in tmp:
            if (blue_point[1] - j[1]) < distance:
                distance = blue_point[1] - j[1]
                min_red = j
        count = count + 1
        red_points.remove(min_red)
        distance = 9999

print(count)