Buggy python submission (verdict: Runtime Error):
n = int(input())
red = []
blue = []

for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    

for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    
red_sort = list(reversed(sorted(red, key=lambda y: y[1])))
blue_sort = sorted(blue, key=lambda x: x[0])

# print(red_sort)
# [[1, 3], [2, 0], [3, 1]]
# print(blue_sort)
# [[4, 2], [0, 4], [5, 5]]

pair = []
for blue_point in blue_sort:
    x_blue = blue_point[0]
    y_blue = blue_point[1]
    
    for red_point in red_sort:
        x_red = red_point[0]
        y_red = red_point[1]
        
        if x_red<x_blue and y_red<y_blue:
            if not (red point in pair) and not (red point in pair):
                pair.append(red_point)
                pair.append(blue_point)
    
print(len(pair) // 2)

Fixed submission:
n = int(input())
red = []
blue = []

for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    

for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    
red_sort = list(reversed(sorted(red, key=lambda y: y[1])))
blue_sort = sorted(blue, key=lambda x: x[0])

# print(red_sort)
# [[1, 3], [2, 0], [3, 1]]
# print(blue_sort)
# [[4, 2], [0, 4], [5, 5]]

pair = []
for blue_point in blue_sort:
    x_blue = blue_point[0]
    y_blue = blue_point[1]
    
    for red_point in red_sort:
        x_red = red_point[0]
        y_red = red_point[1]
        
        if x_red<x_blue and y_red<y_blue:
            if not (red_point in pair) and not (blue_point in pair):
                pair.append(red_point)
                pair.append(blue_point)
    
print(len(pair) // 2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
red = []
red_x = []
blue = []
blue_y = []
for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    red_x.append(a)
    
for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    blue_y.append(d)

count = 0    
for i in range(n):
    p = max(red_x)
    s = min(blue_y)
    q = 0
    r = 0
    jjj = 0
    kkk = 0
    for j in range(len(red)):
        if red[j][0] == p:
            q = red[j][1]
            jjj = j
    for k in range(len(blue)):
        if blue[k][1] == s:
            r = blue[k][0]
            kkk = k
            
    if p < r and q < s:
        count = count + 1 
        red_x.remove(p)
        blue_y.remove(s)
        red.remove(red[jjj][0])
        blue.remove(blue[kkk][1])


    else:
        None
        
print(count)

Fixed submission:
n = int(input())
red = []
blue = []

for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    

for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    
red_sort = list(reversed(sorted(red, key=lambda y: y[1])))
blue_sort = sorted(blue, key=lambda x: x[0])

# print(red_sort)
# [[1, 3], [2, 0], [3, 1]]
# print(blue_sort)
# [[4, 2], [0, 4], [5, 5]]

pair = []
for blue_point in blue_sort:
    x_blue = blue_point[0]
    y_blue = blue_point[1]
    
    for red_point in red_sort:
        x_red = red_point[0]
        y_red = red_point[1]
        
        if x_red<x_blue and y_red<y_blue:
            if not (red_point in pair) and not (blue_point in pair):
                pair.append(red_point)
                pair.append(blue_point)
    
print(len(pair) // 2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
red = []
red_x = []
blue = []
blue_y = []
for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    red_x.append(a)
    
for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    blue_y.append(d)

count = 0    
for i in range(n):
    p = max(red_x)
    s = min(blue_y)
    q = 0
    r = 0
    jjj = 0
    kkk = 0
    for j in range(n):
        if red[j][0] == p:
            q = red[j][1]
            jjj = j
    for k in range(n):
        if blue[k][1] == s:
            r = blue[k][0]
            kkk = k
            
    if p < r and q < s:
        count = count + 1 
        red_x.remove(p)
        blue_y.remove(s)
        red.remove(red[jjj][0])
        blue.remove(blue[kkk][1])


    else:
        None
        
print(count)

Fixed submission:
n = int(input())
red = []
blue = []

for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    

for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    
red_sort = list(reversed(sorted(red, key=lambda y: y[1])))
blue_sort = sorted(blue, key=lambda x: x[0])

# print(red_sort)
# [[1, 3], [2, 0], [3, 1]]
# print(blue_sort)
# [[4, 2], [0, 4], [5, 5]]

pair = []
for blue_point in blue_sort:
    x_blue = blue_point[0]
    y_blue = blue_point[1]
    
    for red_point in red_sort:
        x_red = red_point[0]
        y_red = red_point[1]
        
        if x_red<x_blue and y_red<y_blue:
            if not (red_point in pair) and not (blue_point in pair):
                pair.append(red_point)
                pair.append(blue_point)
    
print(len(pair) // 2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
red = []
red_x = []
blue = []
blue_y = []
for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    red_x.append(a)
    
for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    blue_y.append(d)

count = 0    
for i in range(n):
    p = max(red_x)
    s = min(blue_y)
    q = 0
    r = 0
    jjj = 0
    kkk = 0
    for j in range(n):
        if red[j][0] == p:
            q = red[j][1]
            jjj = j
    for k in range(n):
        if blue[k][1] == s:
            r = blue[k][0]
            kkk = k
            
    if p < r and q < s:
        count = count + 1 
        red_x.remove(p)
        blue_y.remove(s)
        red.remove(red[jjj])
        blue.remove(blue[kkk])


    else:
        None
        
print(count)

Fixed submission:
n = int(input())
red = []
blue = []

for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    

for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    
red_sort = list(reversed(sorted(red, key=lambda y: y[1])))
blue_sort = sorted(blue, key=lambda x: x[0])

# print(red_sort)
# [[1, 3], [2, 0], [3, 1]]
# print(blue_sort)
# [[4, 2], [0, 4], [5, 5]]

pair = []
for blue_point in blue_sort:
    x_blue = blue_point[0]
    y_blue = blue_point[1]
    
    for red_point in red_sort:
        x_red = red_point[0]
        y_red = red_point[1]
        
        if x_red<x_blue and y_red<y_blue:
            if not (red_point in pair) and not (blue_point in pair):
                pair.append(red_point)
                pair.append(blue_point)
    
print(len(pair) // 2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
red = []
red_x = []
blue = []
blue_y = []
for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    red_x.append(a)
    
for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    blue_y.append(d)

count = 0    
for i in range(n):
    p = max(red_x)
    s = min(blue_y)
    q = 0
    r = 0
    jjj = 0
    kkk = 0
    for j in range(n):
        if red[j][0] == p:
            q = red[j][1]
            jjj = j
    for k in range(n):
        if blue[k][1] == s:
            r = blue[k][0]
            kkk = k
            
    if p < r and q < s:
        count = count + 1 
        red_x.remove(p)
        blue_y.remove(s)
        red.remove(red[jjj])
        blue.remove(ble[kkk])


    else:
        None
        
print(count)

Fixed submission:
n = int(input())
red = []
blue = []

for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    

for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    
red_sort = list(reversed(sorted(red, key=lambda y: y[1])))
blue_sort = sorted(blue, key=lambda x: x[0])

# print(red_sort)
# [[1, 3], [2, 0], [3, 1]]
# print(blue_sort)
# [[4, 2], [0, 4], [5, 5]]

pair = []
for blue_point in blue_sort:
    x_blue = blue_point[0]
    y_blue = blue_point[1]
    
    for red_point in red_sort:
        x_red = red_point[0]
        y_red = red_point[1]
        
        if x_red<x_blue and y_red<y_blue:
            if not (red_point in pair) and not (blue_point in pair):
                pair.append(red_point)
                pair.append(blue_point)
    
print(len(pair) // 2)

Buggy python submission (verdict: Runtime Error):
n  = int(input())
red = []
red_x = []
blue = []
blue_y = []
for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    red_x.append(a)
    
for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    blue_y.append(d)

count = 0    
for i in range(n):
    p = max(red_x)
    s = min(blue_y)
    q = 0
    r = 0
    jjj = 0
    kkk = 0
    for j in range(n):
        if red[j][0] == p:
            q = red[j][1]
            jjj = j
    for k in range(n):
        if blue[k][1] == s:
            r = blue[k][0]
            kkk = k
            
    if p < r and q < s:
        count = count + 1 
        red_x.remove(p)
        blue_y.remove(s)
        red.remove(red[jjj])
        blue.remove(ble[kkk])


    else:
        None
        
print(count)

Fixed submission:
n = int(input())
red = []
blue = []

for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    

for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    
red_sort = list(reversed(sorted(red, key=lambda y: y[1])))
blue_sort = sorted(blue, key=lambda x: x[0])

# print(red_sort)
# [[1, 3], [2, 0], [3, 1]]
# print(blue_sort)
# [[4, 2], [0, 4], [5, 5]]

pair = []
for blue_point in blue_sort:
    x_blue = blue_point[0]
    y_blue = blue_point[1]
    
    for red_point in red_sort:
        x_red = red_point[0]
        y_red = red_point[1]
        
        if x_red<x_blue and y_red<y_blue:
            if not (red_point in pair) and not (blue_point in pair):
                pair.append(red_point)
                pair.append(blue_point)
    
print(len(pair) // 2)

Buggy python submission (verdict: Runtime Error):
 n  = int(input())
red = []
red_x = []
blue = []
blue_y = []
for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    red_x.append(a)
    
for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    blue_y.append(d)

count = 0    
for i in range(n):
    p = max(red_x)
    red_x.remove(p)
    s = min(blue_y)
    blue_y.remove(s)
    q = 0
    r = 0
    for j in range(n):
        if red[j][0] == p:
            q = red[j][1]
            red[j][0] = -1
            red[j][1] = -1
    for k in range(n):
        if blue[k][1] == s:
            r = blue[k][0]
            blue[k][0] = -1
            blue[k][1] = -1
            
    if p < r and q < s:
        count = count + 1 
    else:
        None
        
print(count)

Fixed submission:
n = int(input())
red = []
blue = []

for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    

for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    
red_sort = list(reversed(sorted(red, key=lambda y: y[1])))
blue_sort = sorted(blue, key=lambda x: x[0])

# print(red_sort)
# [[1, 3], [2, 0], [3, 1]]
# print(blue_sort)
# [[4, 2], [0, 4], [5, 5]]

pair = []
for blue_point in blue_sort:
    x_blue = blue_point[0]
    y_blue = blue_point[1]
    
    for red_point in red_sort:
        x_red = red_point[0]
        y_red = red_point[1]
        
        if x_red<x_blue and y_red<y_blue:
            if not (red_point in pair) and not (blue_point in pair):
                pair.append(red_point)
                pair.append(blue_point)
    
print(len(pair) // 2)

Buggy python submission (verdict: Runtime Error):
n  = int(input())
red = []
red_x = []
blue = []
blue_y = []
for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    red_x.append(x)
    
for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    blue_y.append(d)

count = 0    
for i in range(n):
    p = max(red_x)
    red_x.remove(p)
    s = max(blue_y)
    blue_y.remove(s)
    q = 0
    r = 0
    for j in range(n):
        if red[j][0] == p:
            q = red[j][1]
            red[j][0] = -1
            red[j][1] = -1
    for k in range(n):
        if blue[k][1] == s:
            r = blue[k][0]
            blue[k][0] = -1
            blue[k][1] = -1
            
    if p < r and q < s:
        count = count + 1
    else:
        None
            
    
            


Fixed submission:
n = int(input())
red = []
blue = []

for i in range(n):
    a, b = map(int,input().split())
    red.append([a,b])
    

for i in range(n):
    c, d = map(int,input().split())
    blue.append([c,d])
    
red_sort = list(reversed(sorted(red, key=lambda y: y[1])))
blue_sort = sorted(blue, key=lambda x: x[0])

# print(red_sort)
# [[1, 3], [2, 0], [3, 1]]
# print(blue_sort)
# [[4, 2], [0, 4], [5, 5]]

pair = []
for blue_point in blue_sort:
    x_blue = blue_point[0]
    y_blue = blue_point[1]
    
    for red_point in red_sort:
        x_red = red_point[0]
        y_red = red_point[1]
        
        if x_red<x_blue and y_red<y_blue:
            if not (red_point in pair) and not (blue_point in pair):
                pair.append(red_point)
                pair.append(blue_point)
    
print(len(pair) // 2)