Harryxun/stf_run huggingface dataset:
import math
x1, y1, x2, y2 = [int(i) for i in raw_input().split()]
print math.sqrt(abs(x1 - x2) ** 2 + abs(y1 - y2) ** 2)

### FIXED CODE ###

import math
x1, y1, x2, y2 = [float(i) for i in raw_input().split()]
print math.sqrt(abs(x1 - x2) ** 2 + abs(y1 - y2) ** 2)
import sys
input=sys.stdin.readline

n,m=map(int,input().split())
g=[list(map(int,input().split())) for _ in range(n)]
c=[list(map(int,input().split())) for _ in range(m)]

for i in g:
    a,b=i[0],i[1]
    dis=10**10
    ind=1
    for j in range(m):
        x,y=c[j][0],c[j][1]
        now=abs(a-x)+abs(b-y)
        if now<dis:
            dis=now
            ind=j+1
    print(ind)import sys
input=sys.stdin.readline

n,m=map(int,input().split())
g=[list(map(int,input().split())) for _ in range(n)]
c=[list(map(int,input().split())) for _ in range(m)]

for i in g:
    a,b=i[0],i[1]
    dis=10**10
    ind=1
    for j in range(m):
        x,y=c[j][0],c[j][1]
        now=abs(a-x)+abs(b-y)
        if now<dis:
            dis=now
            ind=j+1
    print(ind)

### FIXED CODE ###

import sys
input=sys.stdin.readline

n,m=map(int,input().split())
g=[list(map(int,input().split())) for _ in range(n)]
c=[list(map(int,input().split())) for _ in range(m)]

for i in g:
    a,b=i[0],i[1]
    dis=10**10
    ind=1
    for j in range(m):
        x,y=c[j][0],c[j][1]
        now=abs(a-x)+abs(b-y)
        if now<dis:
            dis=now
            ind=j+1
    print(ind)
for i in range(1, 101):
    if a%i==0 and b%i==0:
        cnt += 1
    if cnt == k:
        print(i)
        break

### FIXED CODE ###

a, b, k = map(int, input().split())
cnt = 0
for i in reversed(range(1, 101)):
    if a%i==0 and b%i==0:
        cnt += 1
        if cnt == k:
            print(i)
            break
n=int(input())
d=int(input())

d1=d*2+1
print((n+d1-1)/d1)

### FIXED CODE ###

n,d=list(map(int, input().split()))
 
d1=d*2+1
print(int((n+d1-1)/d1))
import sys

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

sys.setrecursionlimit(M+1)

v_neighbor = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    v_neighbor[a-1].append(b-1)
    v_neighbor[b-1].append(a-1)


v_visit = [False for _ in range(N)]

def search(n):
    count = 0
    for n_ in set(v_neighbor[n]):
        if not v_visit[n_]:
            v_visit[n_] = True
            count += 1
            count += search(n_)
    return count

res = 1
for i in range(N):
    if v_visit[i]:
        continue
    search_res = search(i)
    res = max(res, search_res)


print(res)


### FIXED CODE ###

import sys

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

sys.setrecursionlimit(10**7)

v_neighbor = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    v_neighbor[a-1].append(b-1)
    v_neighbor[b-1].append(a-1)


v_visit = [False for _ in range(N)]

def search(n):
    count = 0
    for n_ in set(v_neighbor[n]):
        if not v_visit[n_]:
            v_visit[n_] = True
            count += 1
            count += search(n_)
    return count

res = 1
for i in range(N):
    if v_visit[i]:
        continue
    search_res = search(i)
    res = max(res, search_res)


print(res)
import numpy as np
s = input()
t = input()

dp = [[0] * (len(s)+1) for _ in range(len(t)+1)]
for i in range(1, len(t)+1):
    ti = t[i-1]
    dp[i] = dp[i-1]
    for j in range(1, len(s)+1):
        if ti == s[j-1]:
            dp[i][j] = dp[i][j-1] + 1
        else:
            if dp[i][j-1] >= dp[i][j]:
                dp[i][j] = dp[i][j-1]
ans = ''
sl = len(s)
tl = len(t)
while sl > 0 and tl > 0:
    if s[sl-1] == t[tl-1]:
        sl -= 1
        tl -= 1
        ans = s[sl] + ans
        continue

    if dp[tl][sl] == dp[tl][sl-1]:
        sl -= 1
    elif dp[tl][sl] == dp[tl-1][sl]:
        tl -= 1
print(ans)


### FIXED CODE ###

s = input()
t = input()
dp = [[0] * (len(s)+1) for _ in range(len(t)+1)]
for i in range(1, len(t)+1):
    ti = t[i-1]
    dp[i] = dp[i-1][:]
    for j in range(1, len(s)+1):
        if ti == s[j-1]:
            dp[i][j] = dp[i-1][j-1] + 1
        else:
            dp[i][j] = max(dp[i][j-1], dp[i-1][j])

ans = ''
sl = len(s)
tl = len(t)
while sl > 0 and tl > 0:
    if s[sl-1] == t[tl-1]:
        sl -= 1
        tl -= 1
        ans = s[sl] + ans
        continue
    if dp[tl][sl] == dp[tl][sl-1]:
        sl -= 1
    elif dp[tl][sl] == dp[tl-1][sl]:
        tl -= 1
print(ans)
n,*p = map(int,open().read().split())
ans = 0
for i in range(n):
    if i+1 != p[i]:
        ans += 1
print('YES' if ans == 2 else 'NO')

### FIXED CODE ###

n,*p = map(int,open(0).read().split())
ans = 0
for i in range(n):
    if i+1 != p[i]:
        ans += 1
print('YES' if ans == 2 or ans == 0 else 'NO')
phrases = map(int, input().split())
phrases.sort(reverse=True)

if phrases == [7,5,5]:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

phrases = input().split()
phrases.sort(reverse=True)

if phrases == ['7', '5', '5']:
  print('YES')
else:
  print('NO')
s=input()
n=len(s)
n1=(n-1)/2
n2=(n+1)/2
s1=s[0:n1]
s2=s[n2:n]
if s==s[::-1] and s1==s1[::-1] and s2==s2[::-1]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s=input()
n=len(s)
s1=s[0:(n-1)//2]
s2=s[(n+1)//2:n]
if s==s[::-1] and s1==s1[::-1] and s2==s2[::-1]:
  print("Yes")
else:
  print("No")
N=int(input())
l1=list(map(int,input().split()))
l2=[]
l3=[]
for i in range(N-1):
  if l1[i]<l1[i+1]:
    l2.append(i)
l2.append(N)
for i in range(len(l2)-1):
  if l2[i+1]-l2[i] >= 2:
    l3.append(l2[i+1]-l2[i]-2)
print(max(l3))

### FIXED CODE ###

N=int(input())
l1=list(map(int,input().split()))
l1.append(max(l1)+1)
l2=[-1]
l3=[]
for i in range(N):
  if l1[i]<l1[i+1]:
    l2.append(i)
for i in range(len(l2)-1):
  if l2[i+1]-l2[i] >= 2:
    l3.append(l2[i+1]-l2[i]-1)
print(max(l3) if l3 else 0)
def g(S):
    N=len(S)
    if palindrome(S)==True and palindrome(S[((N+3)//2)-1])==True and palindrome(S[(N-1)//2])==True:
        return "Yes"
    else:
        return "No"
S=input()
print(g(S))

### FIXED CODE ###

def palindrome(S):
    N=len(S)
    for i in range(N):
        if S[i]!=S[N-i-1]:
            return False
    return True
def g(S):
    N=len(S)
    if palindrome(S)==True and palindrome(S[(((N+3)//2)-1):])==True and palindrome(S[:((N-1)//2)])==True:
        return "Yes"
    else:
        return "No"
S=input()
print(g(S))
import math
print(math.ceil(int(input())/2)

### FIXED CODE ###

import math
print(math.ceil(int(input())/2))
while 1:
  x,y = map(int,row_input().split())
  if x==0 and y==0:
    break
  else:
    n=[x,y]
    n.sort()
    print n[0],n[1]
 

### FIXED CODE ###

while 1:
  x,y = map(int,raw_input().split())
  if x==0 and y==0:
    break
  else:
    n=[x,y]
    n.sort()
    print n[0],n[1]
H, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])

dp = [0] * (H + 1)
for h in range(1, H + 1):
    dp[h] = min([dp[h - a] + b for a, b in AB])

print(dp[-1])


### FIXED CODE ###

H, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])

dp = [0] * (H + 1)
for h in range(1, H + 1):
    dp[h] = min([dp[max(h - a, 0)] + b for a, b in AB])

print(dp[-1])
n=int(input())
s=[int(input()) for k in range(n)]
s.sort()
s.reverse()
sum=0
for i in range(n):
    if i%2==0:
        sum+=s[i]
    else:
        sum-=s[i]
print(int(sum))
        





### FIXED CODE ###

n=int(input())
a=int(input())
if n<500:
    if a<n:
        print("No")
    else:
        print("Yes")
else:
    m=n%500
    if a<m:
        print("No")
    else:
        print("Yes")
s = input()

s.replave(",", " ")

print(s)

### FIXED CODE ###

s = input()

print(s.replace(",", " "))
[N,K] = list(map(int,input().split()))
A = list(map(int,input().split()))

A.sort()

X = A[:(N-K+1)]
Y = A[(K-1):]
Y.sort(reverse=True)
output = 0
Z = len(X)
C = 1
l=K
r=1
for i in range(Z):
    output += (Y[-1*(i+1)]-X[-1*(i+1)])*C
    if output >= 10**9+7:
        output = output % (10**9+7)
    C = int(C*l/r)
    l+=1
    r+=1
print(output)

### FIXED CODE ###

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

A.sort()

MAXN = 10**5+10
p = 10**9+7
MOD = p
f = [1]
for i in range(MAXN):
    f.append(f[-1] * (i+1) % MOD)
def nCr(n, r, mod=MOD):
    return f[n] * pow(f[r], mod-2, mod) * pow(f[n-r], mod-2, mod) % mod

MA = 0
for i in range(N-K+1):
    MA = (MA + A[N-1-i]*nCr(N-1-i,K-1))%p

MI = 0
for i in range(N-K+1):
    MI = (MI + A[i]*nCr(N-1-i,K-1))%p

out = MA-MI
if out<0:
    out += p
print(out)
N = int(input())
a = [N-2**i for i in range(0,7) if N-2**i > 0]
min_index = a.index(min(a))
print(2**min_index)

### FIXED CODE ###

N = int(input())
a = [N-2**i for i in range(0,7) if N-2**i >= 0]
min_index = a.index(min(a))
print(2**min_index)
from heapq import *
from itertools import accumulate as ac
n,c=map(int,input().split())
a=sorted([list(map(int,input().split()))for i in range(n)])
b=[[]for i in range(c+1)]
for i,j,h in a:
    if len(b[h])>0:
        if b[h][-1][1]==i:
            b[h][-1][1]=j
    else:
        b[h].append([i,j])
s=[0]*(2*10**5+2)
for i in b:
    for h,w in i:
        s[2*h-1]+=1
        s[2*w+1]-=1
print(max(list(ac(s))))

### FIXED CODE ###

n,a,b=map(int,input().split())
print(min(n*a,b))
ef insert_sort(A, n, g, cnt):
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j -= g
            cnt += 1
        A[j+g] = v
    return cnt
 
def shellSort(A, n):
    cnt = 0
    G = []; h = 0
    while h <= n:
        if 3 * h + 1 <= n:
            h = 3 * h + 1
            G.append(h)
        else: break
    G = sorted(G, reverse=True)
    m = len(G)
    for i in range(m):
        cnt = insert_sort(A, n, G[i], cnt)
    return m, cnt, G
 
A = []
n = int(input())
for i in range(n):
    A.append(int(input()))
 
m, cnt, G = shellSort(A, n)
print(m)
for i in range(m):
    if i == m - 1:
        print(G[i])
    else:
        print(G[i], end=" ")
print(cnt)
for i in A:
    print(i)


### FIXED CODE ###

import sys


def print_A(A):
    for i in range(len(A)):
        sys.stdout.write(str(A[i]))
        if i!= len(A) -1:
            sys.stdout.write(' ')
    print()


def insertionSort(A,n,g):
    cnt = 0
    for i in range(g,n):
        v = A[i]
        j = i - g
        while (j>=0) and (A[j] > v):
            A[j + g] = A[j]
            j -= g
            cnt +=1
        A[j + g] = v
    return cnt

def shellSort(A,n,G):
    cnt = 0
    for i in range(len(G)):
        cnt += insertionSort(A,n,G[i])
    return cnt
        

def get_gap(n):
    G = []
    h = 1
    cnt = 1
    while h <= n:
        G.append(h)
        h = 3*h + 1
        cnt +=1
    if len(G) == 0: G.append(1)
    return list(reversed(G))


n = int(input())
A = [0] * n
for i in range(n):
    A[i] = int(input())
    
G = get_gap(n)
m = len(G)
cnt = shellSort(A,n,G)

print(m)
print_A(G)
print(cnt)
for i in range(n):
    print(A[i])
#B
s = input()
n = len(s)
for i in range(n):
    for j in range(i,n):
        if all('ACGT'.count(c) == 1 for c in s[i:j+1]):
            ans = max(ans, j - i + 1)
print(ans)

### FIXED CODE ###

#B
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i,n):
        if all('ACGT'.count(c) == 1 for c in s[i:j+1]):
            ans = max(ans, j - i + 1)
print(ans)
s=input()

list = list(s)
cnt=0
if list(0) == 'R' and list(1) == 'R' and list(2)=='R':
    print(3)
elif list(0)=='R' and list(1) == 'R'and list(2)!='R':
    print(2)
elif list(0)=='R' and list(1) != 'R'and list(2)!='R':
    print(1)
elif list(0)=='R' and list(1) != 'R'and list(2)=='R':
    print(1)
elif list(0)!='R' and list(1) == 'R' and list(2)=='R':
    print(2)
elif list(0)!='R' and list(1) != 'R' and list(2)=='R':
    print(1)
elif list(0)!='R' and list(1) == 'R' and list(2)!='R':
    print(1)
else:
    print(0)

### FIXED CODE ###

s=input()

list = list(s)
cnt=0
if list[0] == 'R' and list[1] == 'R' and list[2]=='R':
    print(3)
elif list[0]=='R' and list[1] == 'R'and list[2]!='R':
    print(2)
elif list[0]=='R' and list[1] != 'R'and list[2]!='R':
    print(1)
elif list[0]=='R' and list[1] != 'R'and list[2]=='R':
    print(1)
elif list[0]!='R' and list[1] == 'R' and list[2]=='R':
    print(2)
elif list[0]!='R' and list[1] != 'R' and list[2]=='R':
    print(1)
elif list[0]!='R' and list[1] == 'R' and list[2]!='R':
    print(1)
else:
    print(0)
N = input()
sum_digit = 0
for i in range(len(N)):
  sum_digit += N[i]
if N%sum_digit == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = input()
sum_digit = 0
for i in range(len(N)):
  sum_digit += int(N[i])
if int(N)%sum_digit == 0:
  print('Yes')
else:
  print('No')
class abc_168:
    
    def __init__(self):
        pass
    
    def A(self):
       N=int(input())
       hon=[2,4,5,7,9]
       pon=[0,1,6,8]
       bon=[3]
       
       ans=N%100
       ans=ans%10
       
       if ans in hon:print("hon")
       elif ans in pon:print("pon")
       else :print("bon")
    
    def B(self):
        K=int(input())
        S=input()
        
        if len(S)<=K:print(S)
        else:
            ans=S[0:K]+"..."
            print(ans)
        
    def C(self):
        ABHM=list(map(int,input().split()))
        cos=[]
        for i in range(361):cos.append(math.cos(math.radians(i)))
        
        if ABHM[2]==0:ABHM[2]=12
        if ABHM[3]==0:ABHM[3]=60
        
        radi=int(((abs(ABHM[2]-(ABHM[3]/5))*5)-(ABHM[3]%5))*6)
        #print(abs(ABHM[2]-(ABHM[3]/5)))
        #print(radi)
        ans=(ABHM[0]**2)+(ABHM[1]**2)-(2*ABHM[0]*ABHM[1]*math.cos(math.radians(radi)))
        #print(cos[radi])
        #print(ans)
        print(math.sqrt(ans))
        
        
            
    def D(self):
        pass
        
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_168()
    obj.C()

### FIXED CODE ###

import math

class abc_168:
    
    def __init__(self):
        pass
    
    def A(self):
       N=int(input())
       hon=[2,4,5,7,9]
       pon=[0,1,6,8]
       bon=[3]
       
       ans=N%100
       ans=ans%10
       
       if ans in hon:print("hon")
       elif ans in pon:print("pon")
       else :print("bon")
    
    def B(self):
        K=int(input())
        S=input()
        
        if len(S)<=K:print(S)
        else:
            ans=S[0:K]+"..."
            print(ans)
        
    def C(self):
        ABHM=list(map(int,input().split()))
        
        radi=abs((ABHM[2]*5)+((ABHM[3]*5)/60)-ABHM[3])*6
        #print(radi)
        ans=(ABHM[0]**2)+(ABHM[1]**2)-(2*ABHM[0]*ABHM[1]*math.cos(math.radians(radi)))
        print(math.sqrt(ans))
            
    def D(self):
        pass
        
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_168()
    obj.C()
result = "{:}{:}".format(T, S)

print(result)

### FIXED CODE ###

S, T = input().split()

result = T + S

print(result)
N = int(input())
ans = 0
for _ in range(N):
    l, r = map(int, input().split())
    ans += (r - l) + 1
print(ans)


### FIXED CODE ###

print("Yes" if "9" in input() else "No")
import sys

N, K = map(int, input().split())
candles = list(map(int, input().split()))

tmp = sys.maxsize

for i in range(K):
    minNum = candles[i]
    maxNum = candles[i+K-1]
    if maxNum < 0:
        ans = minNum
    elif (minNum < 0) and (0 <= maxNum):
        if abs(minNum) <= abs(maxNum):
            ans = 2*abs(minNum) + maxNum
        else:
            ans = 2*maxNum + abs(minNum)
    elif 0 <= minNum:
        ans = maxNum
    tmp = min(tmp,ans)

print(tmp)

### FIXED CODE ###

import sys

N, K = map(int, input().split())
candles = list(map(int, input().split()))

ans = sys.maxsize

for i in range(N-K+1):
    minNum = candles[i]
    maxNum = candles[i+K-1]
    l = abs(minNum) + abs(minNum - maxNum)
    r = abs(maxNum) + abs(maxNum - minNum)
    ans = min(ans, min(l, r))

print(ans)
import numpy as np
N,K = map(int,input().split())
A = list(map(int,input().split()))


diff = []
npA = np.array(A)
lenA = len(A)
for a in A:
    temp = list(np.array([a for i in range(lenA)]) - npA)
    diff.append(temp)

D = np.array(diff)

upD = np.triu(D,k=1)

upC = np.count_nonzero(upD>0)

ans = int(K*(2*upC) - dwC)
print(ans%(1000000007))

### FIXED CODE ###

import numpy as np
N,K = map(int,input().split())
A = list(map(int,input().split()))


diff = []
npA = np.array(A)
lenA = len(A)
for a in A:
    temp = list(np.array([a for i in range(lenA)]) - npA)
    diff.append(temp)

D = np.array(diff)

upD = np.triu(D,k=1)

upC = np.count_nonzero(upD>0)
dwC = np.count_nonzero(upD<0)

ans = (K*(K+1)//2)*upC + ((K-1)*K//2)*dwC
print(ans%(1000000007))
N = int(raw_input())
a = map(int, raw_input().split(" ")[-2:])

c1 = 0
c2 = 0

for ai in a:
    if ai % 2 != 0:
        c1 += 1
    elif ai % 4 == 0:
        c2 += 1
if c1 <= c2:
    print "Yes" if(c1 <= c2)
elif c1 - 1 == c2 and N == c1 + c2
    print "Yes"
else:
    b = 4/0
    print "No"


### FIXED CODE ###

N = int(raw_input())
a = [int(i[-2:])for i in raw_input().split(" ")]

c1 = 0
c2 = 0

for ai in a:
    if ai % 2 != 0:
        c1 += 1
    elif ai % 4 == 0:
        c2 += 1
if c1 <= c2:
    print "Yes"
elif c1 - 1 == c2 and N == c1 + c2:
    print "Yes"
else:
    print "No"
a=int(input())
S=(N+1)*N/2
print(S)

### FIXED CODE ###

N=int(input())
S=(N+1)*N//2
print(S)
s = input()
for i in range(len(s)):
  if i & 1 == 0:
    if s[i] != 'h':
      break
  else:
    if s[i] != 'i':
      break
else:
  if len(s) & 1 == 0:
    print('Yes')
  	exit()
print('No')

### FIXED CODE ###

s = input()
for i in range(len(s)):
  if i & 1 == 0:
    if s[i] != 'h':
      break
  else:
    if s[i] != 'i':
      break
else:
  if len(s) & 1 == 0:
    print('Yes')
    exit()
print('No')
import collections

N = int(input())
a = list(map(int,input().split()))
a = collections.Counter(a)

value, count = list(a.keys()), list(a.values())

if len(value)<3:
    if len(value)==1
        if sum(a)==0:
            print('Yes')
        else:
            print('No')

    if len(value)==2
        if 0 in value:
            if count[0]==N/3 or count[1]==N/3:
                print('Yes')

if len(value)>=3:
    if count[0]+count[1]+count[2] != N:
        print('No')

    elif value[0]^value[1]^value[2] != 0:
        print('No')

    elif count[0]==count[1]==count[2]:
        print('Yes')

    else:
        print('No')


### FIXED CODE ###

import collections

N = int(input())
a = list(map(int,input().split()))
a = collections.Counter(a)

value, count = list(a.keys()), list(a.values())

if len(value)<3:
    if len(value)==1:
        if sum(a)==0:
            print('Yes')
        else:
            print('No')

    if len(value)==2:
        if 0 in value:
            if count[0]==N/3 or count[1]==N/3:
                print('Yes')
            else:
                print('No')

        else:
            print('No')

if len(value)>=3:
    if count[0]+count[1]+count[2] == N:
        if value[0]^value[1]^value[2] == 0:
            if count[0]==count[1]==count[2]:
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    else:
        print('No')
N = int(input())
A = [0]
A.extend(list(map(int, input().split())))

buka_num = [0]

for i in range(1, N+1):
  tmp_A = A[i:]
	buka_num.append(tmp_A.count(i))

print(buka_num, sep='¥n')

### FIXED CODE ###

import collections
N = int(input())
A = [0]
A.extend(list(map(int, input().split())))
c = collections.Counter(A)
buka_num = []

for i in range(1,N):
    buka_num.append(c[i])
    
buka_num.append(0)
for ele in buka_num:
    print(ele)
class Node:
	elm = None
	next = None
	prev = None

class MyQueue:
	head = tail = None
	def enq(self, x):
		n = Node()
		n.elm = x
		if self.head == None:
			self.head = self.tail = n
		else:
			self.tail.next = n
			n.prev = self.tail
			self.tail = n

	def deq(self):
		if self.head == None:
			return None
		x = self.head.elm
		self.head = self.head.next
		if self.head: self.head.prev = None
		return x

	def pop(self):
		if self.tail == None:
			return None
		x = self.tail.elm
		self.tail = self.tail.prev
		if self.tail: self.tail.next = None
		return x

class MyList:
	head = tail = None
	lookup = {}

	def insert(self, x):
		n = Node()
		n.elm = x
		if self.head == None:
			self.head = self.tail = n
		else:
			n.next = self.head
			self.head.prev = n
			self.head = n
		if not x in self.lookup:
			self.lookup[x] = MyQueue()
		self.lookup[x].enq(n)

	def delete(self, x):
		n = self.lookup[x].deq()
		self.__delete_node(n)

	def deleteFirst(self):
		self.lookup[self.head.elm].deq()
		self.__delete_node(self.head)

	def deleteLast(self):
		self.lookup[self.tail.elm].pop()
		self.__delete_node(self.tail)

	def __delete_node(self, n):
		if n == None: 
			return
		if n == self.head:
			self.head = n.next
		if n == self.tail:
			self.tail = n.prev
		if n.prev:
			n.prev.next = n.next
		if n.next:
			n.next.prev = n.prev

	def __traverse(self):
		n = self.head
		while n:
			yield n.elm
			n = n.next

	def __str__(self):
		return " ".join([str(s) for s in self.__traverse()])

myList = MyList()
n = int(raw_input())
for _ in xrange(n):
	line = raw_input()
	if line[0]=='i':
		myList.insert(int(line[7:]))
	elif line[6]=='F':
		myList.deleteFirst()
	elif line[6]=='L':
		myList.deleteLast()
	else:
		myList.delete(int(line[7:]))
print myList

### FIXED CODE ###

class MyList:
	head = tail = None

	def insert(self, x):
		n = [x, None, None]
		if self.head == None:
			self.head = self.tail = n
		else:
			n[2] = self.head
			self.head[1] = n
			self.head = n

	def delete(self, x):
		n = self.head
		while n and n[0] != x:
			n = n[2]
		if n: 
			self.__delete_node(n)

	def deleteFirst(self):
		self.__delete_node(self.head)

	def deleteLast(self):
		self.__delete_node(self.tail)

	def __delete_node(self, n):
		if n == self.head:
			self.head = n[2]
		if n == self.tail:
			self.tail = n[1]
		if n[1]:
			n[1][2] = n[2]
		if n[2]:
			n[2][1] = n[1]

	def print_all(self):
		n = self.head
		while n:
			print n[0],
			n = n[2]

myList = MyList()
n = int(raw_input())
for _ in xrange(n):
	line = raw_input()
	if line[0]=='i':
		myList.insert(line[7:])
	elif line[6]=='F':
		myList.deleteFirst()
	elif line[6]=='L':
		myList.deleteLast()
	else:
		myList.delete(line[7:])
myList.print_all()
#the program is to find the nearest number which is not included in N, and if more than 1 number, it will take the smallest one

#we will declare the x and n integer
x, n = map(int, input().split())

#declare the pi
p = list(map(int, input().split()))


for a in range(x + 1):
for b in [-1, +1]:
result = X + b * a
if p.count(result) == 0:
print(result)


### FIXED CODE ###

x, n = map(int, input().split())
p = list(map(int, input().split()))

check = 1000000
ans = 0

N = list(range(102))

for i in range(1, 101):
    if i in p:
        N.remove(i)

for i in range(len(N)):
    if check > abs(N[i]-x):
        check = abs(N[i]-x)
        ans = N[i]
print(ans)
n = int(input()) 
row = input().split()
max = row[0]
min = row[0]

for j in range(n-1):
    for i in range(n-1):
        if(row[j] < row[i+1]):
            max = row[i+1]


    for i in range(n-1):
        if(min > row[n-1]):
            min = row[n-1]


print (int(max)-int(min))
    



### FIXED CODE ###

n = int(input())

if (n%2 == 0):
    print(n)
else:
    print(2*n)
n=int(input())
a=[]
b=[]
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(n):
    b.append(list(map(int,input().split())))
c=[[] for i in range(n)]
for bi in range(n):
    for ai in range(n):
        if a[ai][0]<b[bi][0] and a[ai][1]<b[bi][1]:
            c[bi].append(a[ai])
z=[]
cin=0
for i in range(n):
    if len(c[i])>0:
        cin+=1
        z+=c[i]
print(min(cin,len(set(z))))

### FIXED CODE ###

n=int(input())
a=[]
for i in range(n):
    a.append(list(map(int,input().split())))
b=[]
for i in range(n):
    b.append(list(map(int,input().split())))
b.sort()
a=sorted(a,key=lambda x: -x[1])
ans=0
vb=[]
for i in range(n):
    for j in range(n):
        if not j in vb:
            if a[i][0]<b[j][0] and a[i][1]<b[j][1]:
                vb.append(j)
                ans+=1
                break
print(ans)