Buggy python submission (verdict: Runtime Error):
n = int(input())
red_point_list = [[int(j) for j in input().split()] for i in range(n)]
blue_point_list = [[int(j) for j in input().split()] for i in range(n)]

count = 0
memo = []

def func(red_points, blue_points, count):
    
    if len(red_points) == 0:
        memo.append(count)
    else:
        a = red_points[0][0]
        b = red_points[0][1]
        x = 0
        for i, p in enumerate(blue_points):
            if a < p[0] and b < p[1]:
                new_red_points = red_points[1:]
                new_blue_points = blue_points.copy()
                new_blue_points.pop(i)
                new_count = count + 1
                x += 1
                func(new_red_points, new_blue_points, new_count)
        if x == 0:
            new_red_points = red_points[1:]
            new_blue_points = blue_points.copy()
            func(new_red_points, new_blue_points, count)


func(red_point_list, blue_point_list, count)
print(max(memo))


Fixed submission:
n = int(input())
red_point_list = [[int(j) for j in input().split()] for i in range(n)]
blue_point_list = [[int(j) for j in input().split()] for i in range(n)]

count = 0
for c, d in sorted(blue_point_list, key=lambda x: x[0]):
    tmp_index = 0
    tmp_y = -1
    for i, p in enumerate(red_point_list):
        if c > p[0] and d > p[1]:
            if p[1] >= tmp_y:
                tmp_index = i
                tmp_y = p[1]

    if tmp_y > -1:
        count += 1
        red_point_list.pop(tmp_index)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
red_point_list = [[int(j) for j in input().split()] for i in range(n)]
blue_point_list = [[int(j) for j in input().split()] for i in range(n)]

px = red_point_list[0][0]
py = red_point_list[0][1]

tmp = []
for i, p in enumerate(blue_point_list):
    if px < p[0] and py < p[1]:
        new_blue_points = blue_point_list.copy()
        new_blue_points.pop(i)
        tmp.append((1, new_blue_points))

if len(tmp) == 0:
    tmp = [(0, blue_point_list)]

for a, b in red_point_list[1:]:
    new_tmp = []
    for count, blue_points in tmp:
        for i, p in enumerate(blue_points):
            if a < p[0] and b < p[1]:
                new_blue_points = blue_points.copy()
                new_blue_points.pop(i)
                new_tmp.append((count+1, new_blue_points))
            else:
                new_tmp.append((count, blue_points))
    tmp = new_tmp

print(max(tmp, key=lambda x: x[0])[0])


Fixed submission:
n = int(input())
red_point_list = [[int(j) for j in input().split()] for i in range(n)]
blue_point_list = [[int(j) for j in input().split()] for i in range(n)]

count = 0
for c, d in sorted(blue_point_list, key=lambda x: x[0]):
    tmp_index = 0
    tmp_y = -1
    for i, p in enumerate(red_point_list):
        if c > p[0] and d > p[1]:
            if p[1] >= tmp_y:
                tmp_index = i
                tmp_y = p[1]

    if tmp_y > -1:
        count += 1
        red_point_list.pop(tmp_index)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
red_point_list = [[int(j) for j in input().split()] for i in range(n)]
blue_point_list = [[int(j) for j in input().split()] for i in range(n)]

count = 0
memo = []

def func(red_points, blue_points, count):
    
    if len(red_points) == 0:
        memo.append(count)
    else:
        a = red_points[0][0]
        b = red_points[0][1]
        x = 0
        for i, p in enumerate(blue_points):
            if a < p[0] and b < p[1]:
                new_red_points = red_points[1:]
                new_blue_points = blue_points.copy()
                new_blue_points.pop(i)
                new_count = count + 1
                x += 1
                func(new_red_points, new_blue_points, new_count)
        if x == 0:
            new_red_points = red_points[1:]
            new_blue_points = blue_points.copy()
            func(new_red_points, new_blue_points, count)


func(red_point_list, blue_point_list, count)
print(max(memo))


Fixed submission:
n = int(input())
red_point_list = [[int(j) for j in input().split()] for i in range(n)]
blue_point_list = [[int(j) for j in input().split()] for i in range(n)]

count = 0
for c, d in sorted(blue_point_list, key=lambda x: x[0]):
    tmp_index = 0
    tmp_y = -1
    for i, p in enumerate(red_point_list):
        if c > p[0] and d > p[1]:
            if p[1] >= tmp_y:
                tmp_index = i
                tmp_y = p[1]

    if tmp_y > -1:
        count += 1
        red_point_list.pop(tmp_index)

print(count)