Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
d = {}
for i in range(n):
    temp = [0 for i in range(26)]
    s = input()
    for c in s:
        t = ord(c)-97
        temp[t]+=1
    for i in range(26):
        temp[i] = str(temp[i])
    txt = ",".join(temp)
    if txt not in d:
        d[txt] = 1
    else:
        d[txt] += 1
ans = 0
for k in d:
    if d[k] != 1:
        ans += d[k]*(d[k]-1)/2
print(int(ans))


Fixed submission:
n = int(input())

d = {}


class mod_comb_perm:
    def __init__(self,n,mod):
        self.mod = mod
        self.fact = [1 for i in range(n)]
        for i in range(2,n+1):
            self.fact[i-1] = (self.fact[i-2]*i)%mod

    def expo(self,x,n):
        if n == 2:
            return (x * x) % self.mod
        elif n % 2 == 1:
            return (self.expo(x, n - 1) * x) % self.mod
        else:
            temp = self.expo(x, n // 2) % self.mod
            return (temp * temp) % self.mod
    def comb(self,n,k):
        a = (self.fact[n]*self.expo(self.fact[k],self.mod-2))%self.mod
        return (a*self.expo(self.fact[n-k],self.mod-2))%self.mod
    def invm(self,x):
        return (self.expo(self.fact[x],self.mod-2))%self.mod
    def perm(self,n,k):
        return (self.fact[n]*self.expo(self.fact[n-k],self.mod-2))%self.mod


# com = mod_comb_perm(10**5,10**18+3)
d = {}
for i in range(n):
    temp = [0 for i in range(26)]
    s = input()
    for c in s:
        t = ord(c)-97
        temp[t]+=1
    for i in range(26):
        temp[i] = str(temp[i])
    txt = ",".join(temp)
    if txt not in d:
        d[txt] = 1
    else:
        d[txt] += 1
ans = 0
# print(d)
for k in d:
    if d[k] != 1:
        ans += d[k]*(d[k]-1)/2
print(int(ans))
Buggy python submission (verdict: Runtime Error):
import numpy as np





n = int(input())
arr = list(map(int,input().split()))
arr = np.array(arr)
A = np.zeros((n,n))

for i in range(n-1):
    A[i][i] = 0.5
    A[i][i+1] = 0.5
A[n-1][n-1] = 0.5
A[n-1][0] = 0.5

# print(A)
ans = np.linalg.solve(A, arr)

for i in range(n-1):
    print(int(ans[i]),end=" ")

print(int(ans[n-1]))





Fixed submission:
import numpy as np





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


#
# if n <= 3:
#     ans = np.linalg.solve(A, arr)
#
#     for i in range(n - 1):
#         print(int(ans[i]), end=" ")
#
#     print(int(ans[n - 1]))
# else:

odd = 0
eq = 0
all = [0,0]

for i in range(n):
    if i % 2 == 0:
        eq += arr[i]
        all.append(eq)
    else:
        odd += arr[i]
        all.append(odd)


ans = [0 for i in range(n)]

base = eq-odd
base2 = odd-eq+2*arr[0]
for i in range(n):
    if i %2 ==  0:
        ans[i] = base
        if i == n-1:
            break
        base -= 2*arr[i]
        base += 2* arr[i+1]


    if i %2 ==  1:
        ans[i] =base2
        base2 -= 2*arr[i]
        base2 += 2*arr[i+1]



for i in range(n-1):
    print(ans[i],end=" ")
print(ans[-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np


def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n - r] % mod


mod = 10 ** 9 + 7  # 出力の制限
N = 10 ** 4
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)


n = int(input())
arr = list(map(int,input().split()))
arr = np.array(arr)
A = np.zeros((n,n))

for i in range(n):
    A[i][i] = 0.5
    A[i][i-1] = 0.5

ans = np.linalg.solve(A, arr)

for i in range(n-1):
    print(int(ans[i-1]),end=" ")

print(int(ans[n-1]))





Fixed submission:
import numpy as np





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


#
# if n <= 3:
#     ans = np.linalg.solve(A, arr)
#
#     for i in range(n - 1):
#         print(int(ans[i]), end=" ")
#
#     print(int(ans[n - 1]))
# else:

odd = 0
eq = 0
all = [0,0]

for i in range(n):
    if i % 2 == 0:
        eq += arr[i]
        all.append(eq)
    else:
        odd += arr[i]
        all.append(odd)


ans = [0 for i in range(n)]

base = eq-odd
base2 = odd-eq+2*arr[0]
for i in range(n):
    if i %2 ==  0:
        ans[i] = base
        if i == n-1:
            break
        base -= 2*arr[i]
        base += 2* arr[i+1]


    if i %2 ==  1:
        ans[i] =base2
        base2 -= 2*arr[i]
        base2 += 2*arr[i+1]



for i in range(n-1):
    print(ans[i],end=" ")
print(ans[-1])
Buggy python submission (verdict: Runtime Error):
n,a,b,c,d = map(int,input().split())
s = input()

can_reach = True
bef = False
for i in range(a,c):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

bef = False
for i in range(b,d):
    if s[i] == "#":
        if bef == True:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

if can_reach:
    if c < d:
        print("Yes")
    else:
        can_over = False
        bef1 = False
        bef2 = False
        for i in range(b-1,c+1):
            if s[i] == ".":
                if bef1:
                    if bef2:
                        can_over = True
                    else:
                        bef2 = True
                else:
                    bef1 = True
            else:
                bef1 = False
                bef2 = False
        if can_over:
            print("Yes")
        else:
            print("No")
else:
    print("No")





Fixed submission:
import copy
N,A,B,C,D = map(int,input().split())
S = input()

for i in range(A,max(C,D)-1):
    if S[i:i+2] == "##":
        print("No")
        exit(0)

if C > D:
    flag = False
    for i in range(B-1,D):
        if S[i-1:i + 2] == "...":
            flag = True
            break

    if flag == False:
        print("No")
        exit(0)

print("Yes")
Buggy python submission (verdict: Runtime Error):
class uf_tree():

    def __init__(self,n):
        self.n = n
        self.par = [i for i in range(n)]

    def indep(self):
        dep =0
        for i in range(self.n):
            if i == self.par[i]:
                dep += 1

        return dep

    def unite(self,child,mas):
        if self.root(child) == self.root(mas):
            return
        else:
            self.par[self.root(child)] = self.root(self.mas)

    def root(self,i):
        if self.par[i] == i:
            return i
        else:
            self.par[i] = self.root(self.par[i])
            return self.par[i]

    def same(self,x,y):
        if self.root(x) == self.root(y):
            return True
        else:
            return False



n,m = map(int,input().split())
uf = uf_tree(n+1)
for i in range(m):
    x,y,z = map(int,input().split())
    uf.unite(x,y)

print(uf.indep()-1)


Fixed submission:
class UnionFind():
    '''UnionFind木'''

    def __init__(self, n):
        self.data = [-1] * n

    def unite(self, x, y):
        '''x と y を結合'''
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.data[x] < self.data[y]:
            x, y = y, x  # swap
        self.data[x] += self.data[y]
        self.data[y] = x

    def find(self, x):
        '''ノード x の親を返す'''
        if self.data[x] < 0:
            return x
        self.data[x] = self.find(self.data[x])
        return self.data[x]

    def same(self, x, y):
        '''x と y が同じグループに属するか判定'''
        return self.find(x) == self.find(y)

    def size(self, x):
        '''x を含むグループのノード数を返す'''
        return self.data[self.find(x)]
    def indep(self):
        dep = 0
        for i in range(len(self.data)):
            if self.data[i] < 0:
                dep += 1
        return dep


n,m = map(int,input().split())
uf = UnionFind(n+1)
for i in range(m):
    x,y,z = map(int,input().split())
    uf.unite(x,y)

print(uf.indep()-1)
Buggy python submission (verdict: Runtime Error):
def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)


def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g








def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)


def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g

n = int(input())

a = list(map(int,input().split()))
b = a[1:-1]
m = max(b)
base = 0

for i in range(n):
    base += abs(a[i])

kouho1 = base
if a[0] > 0:
    kouho1 -=a[0]*2
kouho2 = base

if a[-1] > 0:
    kouho2 -= a[-1]*2

kouho3 = base
if m < 0:
    kouho3 += m*2


l = [kouho1,kouho2,kouho3]
print(max(l))




Fixed submission:
import numpy as np
n = int(input())
arr = list(map(int,input().split()))

odd = 0

for a in arr:
    if a < 0:
        odd += 1

if odd %2 == 0:
    print(np.sum(np.abs(arr)))
else:
    # print(np.sum(np.abs(arr)))
    # print(np.min(np.abs(arr)))
    print(np.sum(np.abs(arr))-2*np.min(np.abs(arr)))
Buggy python submission (verdict: Runtime Error):
import numpy as np

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

print(np.gcd.reduce(a))

Fixed submission:
def gcd_core(a,b):
    if b == 0:
        return a
    else:
        return gcd_core(b,a%b)

def gcd(arr):
    g = gcd_core(arr[0],arr[1])
    for i in range(2,len(arr)):
        g = gcd_core(g,arr[i])
    return g

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

print(gcd(a))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n,m = map(int,input().split())

edges = {}
ins = [0 for i in range(n)]
for i in range(n+m-1):
    a,b = map(int,input().split())
    if a not in edges:
        edges[a] = [b]
    else:
        edges[a].append(b)
    ins[b-1] += 1

# print(root.pop())

root = -1
for i in range(n):
    if ins[i] == 0:
        root = i+1
        break
que = deque()
que.append(root)
parent = [0 for i in range(n)]
while True:
    p = que.popleft()
    if p in edges:
        nex = edges[p]
    else:
        nex = []
    for n in nex:
        parent[n-1] = p
        que.append(n)
    if len(que) == 0:
        break

for p in parent:
    print(p)



Fixed submission:
from collections import deque

n,m = map(int,input().split())

edges = {}
ins = [0 for i in range(n)]
for i in range(n+m-1):
    a,b = map(int,input().split())
    if a not in edges:
        edges[a] = [b]
    else:
        edges[a].append(b)
    ins[b-1] += 1

# print(root.pop())

root = -1
for i in range(n):
    if ins[i] == 0:
        root = i+1
        break
que = deque()
que.append(root)
parent = [0 for i in range(n)]
pbuf = [[] for i in range(n)]
counts = [0 for i in range(n)]
while True:
    p = que.popleft()
    if p in edges:
        nex = edges[p]
        edges.pop(p)
    else:
        nex = []
    for n in nex:
        counts[n-1] += 1
        if counts[n-1] == ins[n-1]:
            parent[n-1] = p
            que.append(n)
    if len(que) == 0:
        break

for p in parent:
    print(p)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n,m = map(int,input().split())

edges = {}
root = set([i+1 for i in range(n)])
for i in range(n+m-1):
    a,b = map(int,input().split())
    if a not in edges:
        edges[a] = [b]
    else:
        edges[a].append(b)
    root.discard(b)

# print(root.pop())

root = root.pop()
que = deque()
que.append(root)
parent = [0 for i in range(n)]
while True:
    p = que.popleft()
    if p in edges:
        nex = edges[p]
    else:
        nex = []
    for n in nex:
        parent[n-1] = p
        que.append(n)
    if len(que) == 0:
        break

for p in parent:
    print(p)



Fixed submission:
from collections import deque

n,m = map(int,input().split())

edges = {}
ins = [0 for i in range(n)]
for i in range(n+m-1):
    a,b = map(int,input().split())
    if a not in edges:
        edges[a] = [b]
    else:
        edges[a].append(b)
    ins[b-1] += 1

# print(root.pop())

root = -1
for i in range(n):
    if ins[i] == 0:
        root = i+1
        break
que = deque()
que.append(root)
parent = [0 for i in range(n)]
pbuf = [[] for i in range(n)]
counts = [0 for i in range(n)]
while True:
    p = que.popleft()
    if p in edges:
        nex = edges[p]
        edges.pop(p)
    else:
        nex = []
    for n in nex:
        counts[n-1] += 1
        if counts[n-1] == ins[n-1]:
            parent[n-1] = p
            que.append(n)
    if len(que) == 0:
        break

for p in parent:
    print(p)
Buggy python submission (verdict: Runtime Error):
x = int(input())
if x in [3,5,7]
    print("YES")
else:
    print("NO")

Fixed submission:
x = int(input())
if x in [3,5,7]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
print(list(map(int,input().split()))[0]%list(map(int,input().split()))[1])

Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

A.sort()

arr = []
arr.append(A[0])
arr.append(A[-1])
Atop = 1
Abtm = len(A) - 2
ans = arr[-1]-arr[0]
for i in range(len(A)-2):
    (Ai, ai) = (Atop, 0)
    if abs(A[Atop]-arr[-1]) > abs(A[Ai]-arr[ai]):
        (Ai, ai) = (Atop, -1)
    if abs(A[Abtm]-arr[0]) > abs(A[Ai]-arr[ai]):
        (Ai, ai) = (Abtm, 0)
    if abs(A[Abtm]-arr[-1]) > abs(A[Ai]-arr[ai]):
        (Ai, ai) = (Abtm, -1)

    #print('A[Ai]: ', A[Ai])
    #print(arr)
    ans += abs(A[Ai]-arr[ai])
    if ai == -1:
        arr[-1] = A[Ai]
    else:
        arr[0] = A[Ai]

    if Ai == Atop:
        Atop += 1
    else:
        Abtm -= 1


print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

max = m//n
lis = []


for i in range(int(m**0.5)):
    if m%i == 0:
        lis.append(i)

lis = lis[::-1]

if m%n == 0:
    print(max)
else:
    for line in lis:
        if line > max:
            continue
        else:
            if lis%n == 0:
                print(lis)
                break





Fixed submission:
n,m = map(int,input().split())

max = m//n
lis = []


for i in range(int(m**0.5)):
    if i != 0 and m%i == 0:
        lis.append(i)
l = len(lis)
for i in range(l):
    if m/lis[i] != lis[i]:
        lis.append(m//lis[i])

lis.sort()
lis = lis[::-1]

if m%n == 0:
    print(max)
else:
    for line in lis:
        if line > max:
            continue
        else:
            if m/line > n:
                print(line)
                break

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

max = m//n

if m%n == 0:
    print(max)
else:
    for i in range(max):
        if m%(max-i) == 0:
            print(max-i)
            break





Fixed submission:
n,m = map(int,input().split())

max = m//n
lis = []


for i in range(int(m**0.5)):
    if i != 0 and m%i == 0:
        lis.append(i)
l = len(lis)
for i in range(l):
    if m/lis[i] != lis[i]:
        lis.append(m//lis[i])

lis.sort()
lis = lis[::-1]

if m%n == 0:
    print(max)
else:
    for line in lis:
        if line > max:
            continue
        else:
            if m/line > n:
                print(line)
                break
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

num1 = 0

for c in s:
    if c == "1":
        num1 += 1
    else:
        break

nex = s[num1]

if k <= num1:
    print(1)
else:
    print(nex)

Fixed submission:
s = input()
k = int(input())

num1 = 0

for c in s:
    if c == "1":
        num1 += 1
    else:
        break

if num1 == len(s):
    nex = s[num1-1]
else:
    nex = s[num1]
if k <= num1:
    print(1)
else:
    print(nex)
Buggy python submission (verdict: Runtime Error):
print(list(map(int,input().split()))[0]%list(map(int,input().split()))[1])

Fixed submission:
m,k = map(int,input().split())
if m%k==0:
  print(0)
else:
  print(1)

Buggy python submission (verdict: Runtime Error):
print(int(list(input.split())[0]) %int(list(input.split())[1]))

Fixed submission:
m,k = map(int,input().split())
if m%k==0:
  print(0)
else:
  print(1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

i = 2
while True:
    if i%2 == 0 and i %N == 0:
        break
    i+=1

print(i)

Fixed submission:
n = int(input())

if n %2 == 0:
    print(n)
else:
    print(n*2)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M = map(int,input().split())
arr = np.array([list(map(int,input().split())) for x in range(N)])

xsort = arr[np.argsort(arr[:,0])]
ysort = arr[np.argsort(arr[:,1])]
zsort = arr[np.argsort(arr[:,2])]




temp = [xsort,ysort,zsort]
out = 0
for temptemp in temp:
    value = [[[0, 0, 0, 0] for y in range(M + 1)] for x in range(N + 1)]
    arr = temptemp
    for i in range(N):
        for j in range(M):
            temp = [value[i][j][0]+arr[i][0],value[i][j][1]+arr[i][1],value[i][j][2]+arr[i][2]]
            temp2 = sum(map(abs,temp))
            if temp2 > value[i][j+1][3]:
                value[i+1][j+1][0] = value[i][j][0] + arr[i][0]
                value[i + 1][j + 1][1]=value[i][j][1] + arr[i][1]
                value[i + 1][j + 1][2]=value[i][j][2] + arr[i][2]
                value[i + 1][j + 1][3] = temp2
            else:
                value[i + 1][j + 1][0] = value[i][j+1][0]
                value[i + 1][j + 1][1] = value[i][j+1][1]
                value[i + 1][j + 1][2] = value[i][j+1][2]
                value[i + 1][j + 1][3] = value[i][j+1][3]
    if value[N][M][3] > out:
        out = value[N][M][3]



print(out)



Fixed submission:
n,m = map(int,input().split())

arr = []

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

def tobin(x, n):
    return format(x, 'b').zfill(n)

ans = 0
for i in range(8):
    temp = tobin(i,3)
    buf = [0 for i in range(n)]
    for i in range(3):
        for j in range(n):
            if temp[i] == "0":
                buf[j] += -arr[j][i]
            else:
                buf[j] += arr[j][i]
    buf.sort(key=lambda x:-x)
    temp = 0
    for i in range(m):
        temp += buf[i]
    if temp > ans:
        ans = temp
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b = map(int,input().split())

ans = 0
for i in range(1,13):
    if i <= a and i <= b:
        ans += 1

print(ans)

Fixed submission:
import numpy as np
a,b = map(int,input().split())
ans = 0
for i in range(1,13):
    if i < a:
        ans += 1
    elif i == a:
        if i <= b:
            ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
arr = []
for i in range(n):
    a = list(map(ord,list(input())))
    arr.append(a)

import numpy as np
# print(np.array(arr))

ans = 0

for i in range(n):
    ok = True
    for j in range(n):
        for k in range(n):
            if j == k:
                continue
            l = j + i
            if l > n-1:
                l = l-n
                
            m = k + i
            if m > n-1:
                m = m-n
            # print(l,k,i)
            # print(arr[l][k],arr[k][l])
            if arr[l][k] != arr[m][j]:
                ok = False
                break

    # print("####")
    if ok:
        ans += n



print(ans)

Fixed submission:
n = int(input())
arr = []
for i in range(n):
    a = list(map(ord,list(input())))
    arr.append(a)


ans = 0

for i in range(n):
    ok = True
    for j in range(n):
        for k in range(n):
            if j == k:
                continue
            l = j + i
            if l > n-1:
                l = l-n

            m = k + i
            if m > n-1:
                m = m-n
            # print(l,k,i)
            # print(arr[l][k],arr[k][l])
            if arr[l][k] != arr[m][j]:
                ok = False
                break

    # print("####")
    if ok:
        ans += n



print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = []
for i in range(n):
    a = list(map(ord,list(input())))
    arr.append(a)

import numpy as np
# print(np.array(arr))

ans = 0

for i in range(n):
    ok = True
    for j in range(n):
        for k in range(n):
            if j == k:
                continue
            l = j + i
            if l > n-1:
                l = l-n
            m = k + i
            if m > n-1:
                m = m-n
            # print(l,k,i)
            # print(arr[l][k],arr[k][l])
            if arr[l][k] != arr[m][j]:
                ok = False
                break

    # print("####")
    if ok:
        ans += n



print(ans)

Fixed submission:
n = int(input())
arr = []
for i in range(n):
    a = list(map(ord,list(input())))
    arr.append(a)


ans = 0

for i in range(n):
    ok = True
    for j in range(n):
        for k in range(n):
            if j == k:
                continue
            l = j + i
            if l > n-1:
                l = l-n

            m = k + i
            if m > n-1:
                m = m-n
            # print(l,k,i)
            # print(arr[l][k],arr[k][l])
            if arr[l][k] != arr[m][j]:
                ok = False
                break

    # print("####")
    if ok:
        ans += n



print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
r = []
b = []

for i in range(n):
    x,y = map(int,input().split())
    r.append([x,y])

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



r.sort(key=lambda x:[x[0],-x[1]])
b.sort(key=lambda x:[x[0],-x[1]])

r2 = r.copy()
b2 = b.copy()

r2.sort(key=lambda x:[x[1],-x[0]])
b2.sort(key=lambda x:[x[1],-x[0]])
# print(r)
# print(b)

ans = 0
for i in range(n):
    x,y = b[i][0],b[i][1]
    # print(x,y)
    tar = 0
    flag = False
    for j in range(len(r)):
        if r[j][0] < x and r[j][1] < y:
            flag = True
            tar = j
    if flag:
        ans += 1
        r.pop(tar)


ans2 = 0

for i in range(n):
    x,y = b2[i][0],b2[i][1]
    # print(x,y)
    tar = 0
    flag = False
    for j in range(len(r)):
        if r2[j][0] < x and r2[j][1] < y:
            flag = True
            tar = j
    if flag:
        ans2 += 1
        r2.pop(tar)

print(max(ans,ans2))

Fixed submission:
import numpy as np

n = int(input())
r = []
b = []

for i in range(n):
    x,y = map(int,input().split())
    r.append([x,y])

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



r.sort(key=lambda x:[x[0],x[1]])
b.sort(key=lambda x:[x[1],x[0]])


ans = 0
for i in range(n):
    x,y = b[i][0],b[i][1]
    tar = 0
    flag = False
    # print(r)
    # print(b)
    for j in range(len(r)):
        if r[j][0] < x and r[j][1] < y:
            flag = True
            tar = j
    if flag:
        ans += 1
        r.pop(tar)

print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
r = []
b = []

for i in range(n):
    x,y = map(int,input().split())
    r.append([x,y])

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



r.sort(key=lambda x:[x[0],x[1]])
b.sort(key=lambda x:[x[0],x[1]])

r2 = r.copy()
b2 = b.copy()

r2.sort(key=lambda x:[x[1],x[0]])
b2.sort(key=lambda x:[x[1],x[0]])
# print(r)
# print(b)

ans = 0
for i in range(n):
    x,y = b[i][0],b[i][1]
    # print(x,y)
    tar = 0
    flag = False
    for j in range(len(r)):
        if r[j][0] < x and r[j][1] < y:
            flag = True
            tar = j
    if flag:
        ans += 1
        r.pop(tar)


ans2 = 0

for i in range(n):
    x,y = b2[i][0],b2[i][1]
    # print(x,y)
    tar = 0
    flag = False
    for j in range(len(r)):
        if r2[j][0] < x and r2[j][1] < y:
            flag = True
            tar = j
    if flag:
        ans2 += 1
        r2.pop(tar)

print(max(ans,ans2))

Fixed submission:
import numpy as np

n = int(input())
r = []
b = []

for i in range(n):
    x,y = map(int,input().split())
    r.append([x,y])

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



r.sort(key=lambda x:[x[0],x[1]])
b.sort(key=lambda x:[x[1],x[0]])


ans = 0
for i in range(n):
    x,y = b[i][0],b[i][1]
    tar = 0
    flag = False
    # print(r)
    # print(b)
    for j in range(len(r)):
        if r[j][0] < x and r[j][1] < y:
            flag = True
            tar = j
    if flag:
        ans += 1
        r.pop(tar)

print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
ct = {}

if ct[1] == ct[2] and (ct[0]==ct[1] or ct[2]==ct[3]):
  print("Yes")
else:
  print("No")

Fixed submission:
ct = input()


if ct[1] == ct[2] and (ct[0]==ct[1] or ct[2]==ct[3]):
  print("Yes")
else:
  print("No")