Harryxun/stf_run huggingface dataset:
import bisect

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""
ans = 10**100

for i in range(k+1):
    if x[idx] == 0 and idx - k + 1 > 0:
        ans = min(ans,x[idx-k+1])
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

print(ans)

### FIXED CODE ###

import bisect

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""
ans = 10**100


for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

if idx == n:
    ans = -x[-k]

print(ans)
import math

a, b, c, d = map(int, input().split())
gcd = math.gcd(c, d)
lcm = c * d / gcd

lower = (a-1) // c + (a-1) // d - (a-1) // lcm
upper = b // c + b // d - b // lcm

print(int(b - (a-1) - (upper - lower)))

### FIXED CODE ###

a,b,c,d=map(int,input().split())
def Euclid(x,y):
    while x != 0:
        z=x
        x=y%x
        y=z
    return y
l = c*d//(Euclid(c,d))
print((b- b//c - b//d + b//l) - ((a-1)- (a-1)//c - (a-1)//d + (a-1)//l))
N   =   int(input())
L   =   int(input())
a   =   []
for i in range(N):
    a.append(input())
for ele in sorted(a): 
    print(ele, end = '')

### FIXED CODE ###

n, l = map(int, input().strip().split())
s_list = [input() for _ in range(n)]
s_list.sort()
 
for s in s_list:
    print(s, end='')
print()
s = input()
t = input()
if t.startswich(s):
  print('Yes')
else:
  print('No')
  

### FIXED CODE ###

s = input()
t = input()
if t.startswith(s):
  print('Yes')
else:
  print('No')
def d(n):
  while n%2 == 0:
    n /= 2
    ans += 1
  return ans

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

print(ans)
    

### FIXED CODE ###

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

K = 0
while all(a%2 == 0 for a in A):
  A = [a/2 for a in A]
  K += 1
  
print(K)
n,k = map(int,input().split())
d = list(input().split())
ans = n
while True:
    flag = False
    for i in d:
        if flag :break
        if i in str(ans):
            x = len(str(n)) - str(n).index(i) - 1
            ans += 10**x
            flag = True
    if flag:continue
    print(ans)
    exit(0)


### FIXED CODE ###

n,k = map(int,input().split())
d = list(input().split())
ans = n
while True:
    flag = False
    for i in d:
        if flag :break
        if i in str(ans):
            ans += 1
            flag = True
    if flag:continue
    break
print(ans)
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a = int(input())

b = prime_factorize(a)

c = 10**10
d = 10**10
for i in range(len(b)):
    if i % 2 == 0:
        c *= b[i]
    else:
        d *= b[i]

print(c + d - 2)


### FIXED CODE ###

a = list(map(int, input().split()))
if 1<=a[0] and a[0]<=9:
    if 1<=a[1] and a[1]<=9:
        print(a[0]*a[1])
    else:
        print(-1)
else:
    print(-1)
from math import gcd
MAX = 10**6

sieve = [i for i in range(MAX+1)]

p = 2
while p * p <= MAX:
    if sieve[p] == p:
        for i in range(p*2, MAX+1, p):
            if sieve[i] == i:
                sieve[i] = p
    p += 1


N = int(input())
A = list(map(int, input().split()))
pf = []

for a in A:
    tmp = set()
    b = a
    while b != 1:
        tmp.add(sieve[b])
        b //= sieve[b]
    pf.append(tmp)


soin = [0] * (10 ** 6 + 1)
for f in pf:
    for n in f:
        soin[n] += 1

if max(soin[2:]) <= 1:
    print('pairwise coprime')
    exit()


setwise = a[0]

for a in A:
    setwise = gcd(setwise, a)
    
if setwise == 1:
    print('setwise coprime')
else:
    print('not coprime')

### FIXED CODE ###

#!/usr/bin/env python3

import sys
from math import gcd
from collections import Counter
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = list(map(int, input().split()))

dup = False
dup_key = None
counter = Counter(A)
for key, val in counter.items():
    if val > 1:
        dup = True
        if dup_key is None:
            dup_key = key
        else:
            dup_key = max(dup_key, key)


def max_gcd_pair(S):
    # Assumption 1: S is the list of numbers
    # Assumption 2: There are no duplicates in S
    s = set(S)
    m = max(S)
    res = 1
    i = m
    while i > 0:
        a = i
        cnt = 0
        while a <= m: # a maxed at max of the list
            if a in s:
                cnt += 1
            a += i
        if cnt >= 2:  # we have found the result
            res = i
            break
        i = i - 1
    return res


pair = max_gcd_pair(A)
if dup:
    pair *= dup_key

if pair == 1:
    print('pairwise coprime')
    sys.exit()


setw = A[0]
for j in range(N):
    setw = gcd(setw, A[j])
if setw == 1:
    print('setwise coprime')
else:
    print('not coprime')
n,m = map(int,input().split())
H = [[0 for _ in range(n)] for _ in range(n) ]

for _ in range(m):
    a, b = map(int,input().split())
    edge_list.append([a-1,b-1])
    H[a-1][b-1] = 1
    H[b-1][a-1] = 1
    
l = [0 for _ in range(n)]
ans = 0

def dfs(node,visited):
    global ans
    if visited.count(0) == 0:
        ans += 1 
        return 0
    else:
        visited[node] = 1
        for node_,edge_ in enumerate(H[node]):
            if edge_ == 1 and visited[node_] != 1:
                visited[node_] = 1
                visited[node] = 1
                dfs(node_,visited)
                visited[node_] = 0                
dfs(0,l)
print(ans)


### FIXED CODE ###

#!/usr/bin/python
# -*- Coding: utf-8 -*-
n,m = map(int,input().split())

H = [[0 for _ in range(n)] for _ in range(n) ]

edge_list = []

for _ in range(m):
    a, b = map(int,input().split())
    edge_list.append([a-1,b-1])
    H[a-1][b-1] = 1
    H[b-1][a-1] = 1
    
l = [0 for _ in range(n)]
ans = 0
l[0] = 1

def dfs(node,x):
    global ans
    if x.count(0) == 0:
        ans += 1 
        return 0


    else:
        visited = x
        visited[node] = 1
        for node_,edge_ in enumerate(H[node]):
            if edge_ == 1 and visited[node_] != 1:
                visited[node_] = 1
                visited[node] = 1
                dfs(node_,visited)
                visited[node_] = 0
                #頂点iをここで未訪問にすることが一番重要！！！！！



dfs(0,l)
print(ans)
import sys
from itertools import permutations

while True:
	n = input()
	k = input()
	if n == k == 0:
		sys.exit(0)
	nums = [raw_input().strip() for i in xrange(n)]
	result = set(["".join(p) for p in permutations(nums, k)])
	print(len(result))

### FIXED CODE ###

import sys
from itertools import permutations
 
def main():
	while True:
		line = raw_input()
		if line == "0 0": break
		n = int(line)
		k = input()
		nums = [raw_input().strip() for i in xrange(n)]
		result = set(["".join(p) for p in permutations(nums, k)])
		print (len(result))

if __name__ == '__main__':
	sys.exit(main())
n=int(input())
min=2*(10**5)
cnt=0

for i in map(int,input().split())
    if min>=i:min=i
    cnt+=1

print(cnt)

### FIXED CODE ###

n=int(input())
min=2*(10**5)
cnt=0

for i in map(int,input().split()):
    if min>=i:
         min=i
         cnt+=1

print(cnt)
A = int(input())
B = int(input())

if A >= 13:
	print(B)
    
elif 6 <= A <= 12:
	print(B//2)

else:
	print(0)

### FIXED CODE ###

A,B = map(int,input().split())

if A >= 13:
	print(B)
    
elif 6 <= A <= 12:
	print(B // 2)

else:
	print(0)
rom bisect import bisect
R = 1000000
p = [1]*R
p[0] = p[1] = 0
p[4::2] = [0]*len(p[4::2])
for i in xrange(3,int(R**0.5)+1,2):
    if p[i]:
        p[i*i::i] = [0]*len(p[i*i::i])
prime = [i for i in xrange(2,R) if p[i]]
while True:
    try:print bisect(prime,input())
    except:break

### FIXED CODE ###

import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])
S = input()
K = int(input())
flg = True
for i in range(K):
    if 100 < i:
        break
    if S[i] != '1':
        flg = False
if flg:
    print('1')
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
print('1')

### FIXED CODE ###

S = input()
K = int(input())
flg = True
for i in range(K):
    if len(S) <= i:
        break
    if S[i] != '1':
        flg = False
if flg:
    print('1')
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
print('1')
a = sorted(list(map(int,input()split())))
print(a[2] - a[0])

### FIXED CODE ###

a = sorted(list(map(int,input().split())))
print(a[2] - a[0])
A,B,C = map(int,input())
num_list = [A,B,C]
 list_s = sorted(num_list)
if A % 2 == 1 and B % 2 == 1 and C % 2 == 1:
    print(list_s[0]*list_s[1])
else:
    print(0)

    

### FIXED CODE ###

A,B,C = map(int,input().split(' '))
num_list = [A,B,C]
list_s = sorted(num_list)
if A % 2 == 1 and B % 2 == 1 and C % 2 == 1:
    print(list_s[0]*list_s[1])
else:
    print(0)
from itertools import accumulate


N=int(input())
A=list(map(int,input().split()))
sums=list(accumulate([0]+A))
def nCr(n,r):
    a=factorial(n)
    b=factorial(n-r)
    c=factorial(r)
    return int(a//(b*c))
dic=defaultdict(int)
for i in sums:
    dic[i]+=1
ans=0
for i in dic.keys():
    if dic[i]>=2:
        ans+=nCr(dic[i],2)
print(ans)


### FIXED CODE ###

from math import factorial
from math import sqrt
from math import ceil
from itertools import permutations
from heapq import *
from collections import defaultdict
from copy import deepcopy
from math import log
from itertools import accumulate


N=int(input())
A=list(map(int,input().split()))
sums=list(accumulate([0]+A))
def nCr(n,r):
    a=factorial(n)
    b=factorial(n-r)
    c=factorial(r)
    return int(a//(b*c))
dic=defaultdict(int)
for i in sums:
    dic[i]+=1
ans=0
for i in dic.keys():
    if dic[i]>=2:
        ans+=nCr(dic[i],2)
print(ans)
a,b,c,d=map(int,input().split())
if c/b=>a/d or  c//b=a//d:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a,b,c,d=map(int,input().split())
if c%b==0:
    c=c-1
if a%d==0:
    a=a-1
if  c//b==a//d:
    print("Yes")
elif c/b<a/d:
    print("Yes")
else:
    print("No")
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
for i in range(n):
    a[i]=[a[i],i]
for i in range(1,23):
    if 2**i>=n:
        num=i
        break
num2=2**(num-1)
ans=num2
ans2=0
for i in range(num):
    num3=0
    num4=a[ans-1][0]
    for j in range(ans,n):
        num3+=-(a[j][0]//-num4)-1
    num2=num2//2
    if num4>=k:
        ans=max(ans-num2,1)
        ans2=num3
    else:
        ans=min(ans+num2,n-1)
k-=ans2
num5=a[ans-1][0]
ans3=[0]*n
for i in range(ans,n):
    num6=-(a[i][0]//-num5)
    a[i][0]=a[i][0]/num6
    ans3[i]=num6
a.sort()
for i in range(k):
    ans3[a[-1][1]]+=1
    a[-1]/=ans3[a[-1][1]]
    a.sort()
print(-(a[-1][0])//-1)


### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
for i in range(1,31):
    if 2**i>=a[-1]+1:
        num=i
        break
ans=2**(num-1)
num1=2**(num-1)
l1=[]
for i in range(num+1):
    cnt=0
    for j in range(n):
        cnt+=-(a[j]//-ans)-1
    num1=num1//2
    if cnt>k:
        ans=min(a[-1],ans+num1)
    else:
        l1.append(ans)
        ans=max(1,ans-num1)
print(min(l1))
n = int(input())
ai = [int(i) for i in input().split()]

li = [0]*(10**6+1)

for i in range(1,n):
    if ai[i] >= 2*10**5:
        continue
    li[ai[i]-i+5*10**5] += 1

ans = 0

for i in range(1,n):
    #print(i)
    ans += li[-ai[i-1]-(i-1)+5*10**5]
    if i == n:
        #print(i,i,i)
        break
    if ai[i] < 2*10**5:
        li[ai[i]-i+5*10**5] -= 1
        
print(ans)

### FIXED CODE ###

n = int(input())
ai = [int(i) for i in input().split()]

li = [0]*(10**6+1)

for i in range(1,n):
    if ai[i] >= 2*10**5:
        continue
    li[ai[i]-i+5*10**5] += 1

ans = 0

for i in range(1,n):
    if ai[i-1] >= 2*10**5:
        continue
    #print(i)
    ans += li[-ai[i-1]-(i-1)+5*10**5]
    if i == n:
        #print(i,i,i)
        break
    if ai[i] < 2*10**5:
        li[ai[i]-i+5*10**5] -= 1
        
print(ans)
a1,a2,a3=map(int, input().split()) 
if a+b+c >= 22:
  print("bust")
else:
  print("win")

### FIXED CODE ###

a1,a2,a3=map(int, input().split()) 

if a1+a2+a3>=22:
    print("bust")
else:
    print("win")
import math


def check(a):
    for i, v in enumerate(a):
        if v != i + 1:
            return False
        else:
            if i == len(a) - 1:
                return True


while True:
    n = int(raw_input())
    if n == 0:
        break

    a = map(int, raw_input().split())
    if sum(a) != (lambda s: s * (s + 1) // 2)(int(math.sqrt(sum(a) * 2))):
        print -1
    else:
        c = 0
        while not check(a):
            c += 1
            a = [x - 1 for x in a if x - 1 != 0].append(len(a))
            if c == 10000:
                c = -1
                break

        print c

### FIXED CODE ###

import math


def check(a):
    for i, v in enumerate(a):
        if v != i + 1:
            return False
        else:
            if i == len(a) - 1:
                return True


while True:
    n = int(raw_input())
    if n == 0:
        break

    a = map(int, raw_input().split())
    if sum(a) != (lambda s: s * (s + 1) // 2)(int(math.sqrt(sum(a) * 2))):
        print -1
    else:
        c = 0
        while not check(a):
            c += 1
            a = [x - 1 for x in a if x - 1 != 0] + [len(a)]
            if c == 10000:
                c = -1
                break

        print c
A,B,C=map(input().strip())
can=(A-B)
if (C-can)>0:
    print(C-can)
else:
    print(0)


### FIXED CODE ###

A,B,C=map(int,input().split())
can=(A-B)
if (C-can)>0:
    print(C-can)
else:
    print(0)
h, w = map(int, input().split())
a = ["#"*(w+2)] + ["#" + input() + "#" for i in h] + ["#"*(w+2)]
for s in a:
  print(s)



### FIXED CODE ###

h, w = map(int, input().split())
a = ["#"*(w+2)] + ["#" + input() + "#" for i in range(h)] + ["#"*(w+2)]
for s in a:
  print(s)
def main():
    from math import ceil
    n = int(input())
    a, b = 1, 1
    for _ in range(n):
        i, j = map(int, input().split())
        x = max((a + s - 1) // s, (b + t - 1) // t)
        a, b = x * i, x * j
    print(a + b)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from math import ceil
    n = int(input())
    a, b = 1, 1
    for _ in range(n):
        i, j = map(int, input().split())
        x = max((a + i - 1) // i, (b + j - 1) // j)
        a, b = x * i, x * j
    print(a + b)


if __name__ == '__main__':
    main()
s=int(input())
e_list=list(map(int,input().split())
e_dic={}
for i in range(s):
  e_dic[i]+=1
for j in e_dic.items
 print(e_dic[j].item)
            

### FIXED CODE ###

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

ans=[0]*n

for i in l:
    ans[i-1]+=1

for j in ans:
    print(j)
h,w=map(int,input().split())
c=[list(map(int,input().split())) for _ in range(h)]
for i in range(h):
  print(c[i])
  print(c[i])

### FIXED CODE ###

h,w=map(int,input().split())
c=[input() for _ in range(h)]
for i in range(h):
  print(c[i])
  print(c[i])
a = input()
b = input()

if b <3200:
  print("red")
else:
  print(a)

### FIXED CODE ###

a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print("red")
from collections import deque
n, m = map(int, input().split())

adj_list = [[] for i in range(n)]

for i in range(m):
  _, __ = map(int, input().split())
  _ -= 1
  __ -= 1
  adj_list[_].append(__)
  adj_list[__].append(_)
  
distance = [None for i in range(n)]
updated_from = [None for i in range(n)]

newly_visited = deque([0])
distance[0] = 0

while len(newly_visited) > 0:
  now = newly_visited.popleft()
  for i in adj_list[now]:
    if distance[i] is not None: continue
    newly_visited.append(i)
    distance[i] = distance[now] + 1
    updated_from[i] = now

# i に到達できてれば distance[i] ==（0 から i までの距離）
# i に到達できてなければ distance[i] == None   
    
"""
print(distance)

for i in range(n):
  # i から 0 に行く経路を求める
  now = i
  path = [now]
  while now != 0:
    now = updated_from[now]
    path.append(now)
  print(i, path) 
"""

print("Yes")
for i in range(n):
  print(updated_from[i] + 1)




### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())

adj_list = [[] for i in range(n)]

for i in range(m):
  _, __ = map(int, input().split())
  _ -= 1
  __ -= 1
  adj_list[_].append(__)
  adj_list[__].append(_)
  
distance = [None for i in range(n)]
updated_from = [None for i in range(n)]

newly_visited = deque([0])
distance[0] = 0

while len(newly_visited) > 0:
  now = newly_visited.popleft()
  for i in adj_list[now]:
    if distance[i] is not None: continue
    newly_visited.append(i)
    distance[i] = distance[now] + 1
    updated_from[i] = now

# i に到達できてれば distance[i] ==（0 から i までの距離）
# i に到達できてなければ distance[i] == None   
    
"""
print(distance)

for i in range(n):
  # i から 0 に行く経路を求める
  now = i
  path = [now]
  while now != 0:
    now = updated_from[now]
    path.append(now)
  print(i, path) 
"""

print("Yes")
for i in range(1, n):
  print(updated_from[i] + 1)
import math
a,b,x = map(int,input().split())
tan = a**3/(2*(a**2*b-x))
if tan<=(a/b):
    tan = 2*x/(b**2*a)
rad = math.atan(tan)
deg= 90-math.degrees(rad)
print(deg)

### FIXED CODE ###

import math
import sys
a,b,x = map(int,input().split())
if a*a*b == x:
    print(0)
    sys.exit()
tan = a**3/(2*(a**2*b-x))
if tan<=(a/b):
    tan = 2*x/(b**2*a)
rad = math.atan(tan)
deg= 90- (rad * 180/math.pi)
print(deg)
n,m =map(int,imput().split())
print((n-1)*(m-1))

### FIXED CODE ###

n,m =map(int,input().split())
print((n-1)*(m-1))
s = input().strip()
n = len(s)

ans = 0
for i, c in enumerate(s):
  ld, rd = i, n - i - 1
  if c == '1':
  	ans = min(ans, max(lr, rd))
print(ans)

### FIXED CODE ###

s = input().strip()
n = len(s)

ansone, anszero = n, n
for i, c in enumerate(s):
    ld, rd = i, n - i - 1
    if c == '1':
        ansone = min(ansone, max(ld, rd))
    else:
        anszero = min(anszero, max(ld, rd))
print(max(ansone, anszero))
N, M = map(int, input().split())

nodes, checks = [], []
for i in range(N):
    nodes.append(map(int, input().split()))
for j in range(M):
    checks.append(map(int, input().split()))

for i in range(N):
    argMin, distMin = None, float('inf')
    for j in range(M):
        dist = abs(nodes[i][0] - checks[j][0]) + abs(nodes[i][1] - checks[j][1])
        if dist < distMin: argMin, distMin = j, dist
    print(j)

### FIXED CODE ###

N, M = map(int, input().split())

nodes, checks = [], []
for i in range(N):
    nodes.append(list(map(int, input().split())))

for j in range(M):
    checks.append(list(map(int, input().split())))

for i in range(N):
    argMin, distMin = None, float('inf')
    for j in range(M):
        dist = abs(nodes[i][0] - checks[j][0]) + abs(nodes[i][1] - checks[j][1])
        if dist < distMin: argMin, distMin = j, dist
    print(argMin + 1)
N, M = map(int, input().split())

a = []
for _ in range(M):
    a.append(int(input()))

val = [0,1]
j = 0
for i in range(1, N + 1):
    ans = val[0] + val[1]
    val[0] = val[1]
    val[1] = ans
    if i == a[j]:
        val[1] = 0
        if len(a) - 1 != j:
            j += 1

print(ans%(10**9+7))

### FIXED CODE ###

N, M = map(int, input().split())

a = []
for _ in range(M):
    a.append(int(input()))

val = [0,1]
for i in range(1, N + 1):
    ans = val[-2] + val[-1]
    val.append(ans)
    if len(a) > 0:
        if i == a[0]:
            val[-1] = 0
            a.pop(0)

print(ans % (10**9 +7))
N=number=int(input())
X_list=list(map(int, input().split()))

for i in range(1,100):
    sum_pow=0
    for j in range(N):
        sum_pow+=(X_list[j]-i)**2
    if i==X_min:
        min_pow=sum_pow
    if min_pow>sum_pow:
        min_pow=sum_pow
print(min_pow)

### FIXED CODE ###

N=number=int(input())
X_list=list(map(int, input().split()))
min_pow=0
if N==1:
    print("0")
else:
    X_min=min(X_list)
    X_max=max(X_list)
    for i in range(X_min,X_max):
        sum_pow=0
        for j in range(N):
            sum_pow+=(X_list[j]-i)**2
        if i==X_min:
            min_pow=sum_pow
        if min_pow>sum_pow:
            min_pow=sum_pow
    print(min_pow)
n = int(input())  
red_li = [list(map(int, input().split())) for _ in range(n)]
blue_li = [list(map(int, input().split())) for _ in range(n)]
ans = 0
red_li.sort(reverse = True, key = lambda x : (x[0], x[1]))
blue_li.sort( key = lambda x : (x[0], x[1]))

def count(red, blue, used_red, used_blue):
    used_red = []
    used_blue = []
    for i in red:
        if i in used_red:
            continue
        for j in blue:
            if j in used_blue:
                continue
            if i[0] < j[0] and i[1] < j[1]:
                used_red.append(i)
                used_blue.append(j)
                break
    return len(used_red)

ans = count(red_li, blue_li)
red_li.sort(reverse = True,key = lambda x : (x[1], x[0]))
blue_li.sort( key = lambda x : (x[1], x[0]))
ans = max(ans, count(red_li, blue_li))
red_li.sort(reverse = True,key = lambda x : (x[1], x[0]))
blue_li.sort( key = lambda x : (x[0], x[1]))
ans = max(ans, count(red_li, blue_li))
red_li.sort(reverse = True,key = lambda x : (x[0], x[1]))
blue_li.sort( key = lambda x : (x[1], x[0]))
ans = max(ans, count(red_li, blue_li))
print(ans)

### FIXED CODE ###

n = int(input())  
red_li = [list(map(int, input().split())) for _ in range(n)]
blue_li = [list(map(int, input().split())) for _ in range(n)]
ans = 0
red_li.sort(reverse = True, key = lambda x : (x[0], x[1]))
blue_li.sort( key = lambda x : (x[0], x[1]))

def count(red, blue):
    used_red = []
    used_blue = []
    for i in red:
        if i in used_red:
            continue
        for j in blue:
            if j in used_blue:
                continue
            if i[0] < j[0] and i[1] < j[1]:
                used_red.append(i)
                used_blue.append(j)
                break
    return len(used_red)

ans = count(red_li, blue_li)
red_li.sort(reverse = True,key = lambda x : (x[1], x[0]))
blue_li.sort( key = lambda x : (x[1], x[0]))
ans = max(ans, count(red_li, blue_li))
red_li.sort(reverse = True,key = lambda x : (x[1], x[0]))
blue_li.sort( key = lambda x : (x[0], x[1]))
ans = max(ans, count(red_li, blue_li))
red_li.sort(reverse = True,key = lambda x : (x[0], x[1]))
blue_li.sort( key = lambda x : (x[1], x[0]))
ans = max(ans, count(red_li, blue_li))
print(ans)
N = int(input())
A = list(map(int,input().split()))

res = 0
for i,a in enumerate(A):
  idx = i+1
  if idx%2==1 and a%2==1:
    res += 1

print(res

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))

res = 0
for i,a in enumerate(A):
  idx = i+1
  if idx%2==1 and a%2==1:
    res += 1

print(res)