CodeEff/ECCO huggingface dataset:
# Original solution
def linearSearch(key, list, N):
    list[N] = key
    i = 0
    while list[i] != key:
        i += 1
    return int(i != N)


N1 = int(eval(input()))
arr1 = [int(n) for n in input().split()] + [0]
N2 = int(eval(input()))
arr2 = [int(n) for n in input().split()]

print((sum([linearSearch(key, arr1, N1) for key in arr2])))



# Optimized solution
def linearSearch(key, list):
    for e in list:
        if key == e:
            return 1
    return 0


N1 = int(eval(input()))
arr1 = [int(n) for n in input().split()]
N2 = int(eval(input()))
arr2 = [int(n) for n in input().split()]

print((sum([linearSearch(key, arr1) for key in arr2])))
# Original solution
def main():
    N = int(eval(input()))
    S = [int(_) for _ in input().split()]
    Q = int(eval(input()))
    T = [int(_) for _ in input().split()]

    ans = 0

    for t in T:
        for s in S:
            if s == t:
                ans += 1
                break

    print(ans)

main()



# Optimized solution
import sys

# Set max recursion limit
sys.setrecursionlimit(1000000)


def li_input():
    return [int(_) for _ in input().split()]


def main():
    n = int(eval(input()))
    S = li_input()
    q = int(eval(input()))
    T = li_input()

    ans = 0

    for t in T:
        if t in S:
            ans += 1

    print(ans)


main()
# Original solution
n = int(eval(input()))
li1 = list(map(int,input().split()))
m = int(eval(input()))
li2 = list(map(int,input().split()))
cnt = 0

for i in li2:
	if i in li1:
		cnt +=1
print(cnt)

# Optimized solution
n = int(eval(input()))
S = set(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))

sum = 0

for i in T:
    if i in S:
        sum +=1
        
print(sum)
# Original solution
import sys

ERROR_INPUT = 'input is invalid'
ERROR_INPUT_NOT_UNIQUE = 'input is not unique'


def main():
    S = get_input1()
    T = get_input2()

    count = 0
    for t in T:
        for s in S:
            if t == s:
                count += 1
                break

    print(count)


def get_input1():
    n = int(eval(input()))
    if n > 10000:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        li.append(x)

    return li


def get_input2():
    n = int(eval(input()))
    if n > 500:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        elif int(x) in li:
            print(ERROR_INPUT_NOT_UNIQUE)
            sys.exit(1)
        li.append(x)

    return li


main()

# Optimized solution
import sys

ERROR_INPUT = 'input is invalid'
ERROR_INPUT_NOT_UNIQUE = 'input is not unique'


def main():
    S = get_input1()
    T = get_input2()

    count = 0
    for t in T:
        if t in S:
            count += 1

    print(count)


def get_input1():
    n = int(eval(input()))
    if n > 10000:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        li.append(x)

    return li


def get_input2():
    n = int(eval(input()))
    if n > 500:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        elif int(x) in li:
            print(ERROR_INPUT_NOT_UNIQUE)
            sys.exit(1)
        li.append(x)

    return li


main()
# Original solution
import sys

n = int(sys.stdin.readline())
s = [int(x) for x in sys.stdin.readline().split()]
q = int(sys.stdin.readline())
t = [int(x) for x in sys.stdin.readline().split()]
cnt = 0

for i in t:
    if i in s:
        cnt += 1

print(cnt)

# Optimized solution
import sys

n = sys.stdin.readline()
s = sys.stdin.readline().split()
q = sys.stdin.readline()
t = sys.stdin.readline().split()
cnt = 0

for i in t:
    if i in s:
        cnt += 1

print(cnt)
# Original solution
n = int(eval(input()))
s = input().split()
q = int(eval(input()))
t = input().split()
cont = 0
for i in t:
    for o in s:
        if i == o:
            cont +=1
            break

print(cont)

# Optimized solution
n = int(eval(input()))
s = set(input().split())
q = int(eval(input()))
t = set(input().split())

print((len(s & t)))
# Original solution

def LinearSearch(n, S, t):
    """ ????????????????????¢????????? """
    S.append(t)
    i = 0

    while S[i] != t:
        i += 1

    if i == n:
        return -1
    else:
        return i

n = int(eval(input()))
S = [int(s) for s in input().split()]

q = int(eval(input()))
T = [int(t) for t in input().split()]

cnt = 0

for t in T:
    if LinearSearch(n, S[:], t) != -1:
        cnt += 1

print(cnt)

# Optimized solution

def LinearSearch1(S, n, t):
    for i in range(n):
        if S[i] == t:
            return i
            break
    else:
        return -1

"""
def LinearSearch2(S, n, t):
    S.append(t)
    i = 0

    while S[i] != t:
        i += 1

    S.pop()
    if i == n:
        return -1
    else:
        return i
"""

n = int(eval(input()))
S = [int(s) for s in input().split()]

q = int(eval(input()))
T = {int(t) for t in input().split()}

ans = sum(LinearSearch1(S, n, t) >= 0 for t in T)

print(ans)
# Original solution
#coding:utf-8
#1_4_A
def isFound(array, x):
    """ linear search """
    array.append(x)
    i = 0
    while array[i] != x:
        i += 1
    if i == len(array)-1:
        return False
    return True

n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
count = 0

for i in range(q):
    if isFound(S, T[i]):
        count += 1

print(count)

# Optimized solution
#coding:utf-8
#1_4_A
n = int(eval(input()))
S = set(map(int, input().split()))
q = int(eval(input()))
T = set(map(int, input().split()))

print((len(S & T)))
# Original solution
a, b = list(map(int, input().split()))
res = a - 2*b
if res < 0:
    res = 0
print(res)

# Optimized solution
a,b = list(map(int, input().split()))
res = a - b - b
print((0 if res < 0 else res))
# Original solution
A,B=input().split()
A,B=[int(A),int(B)]
if(A >= 2*B):
  print((A-2*B))
else:
  print((0))

# Optimized solution
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    A,B=list(map(int,readline().split()))

    C=max(0,A-B*2)
    print(C)
if __name__=="__main__":
    main()
# Original solution
a,b=list(map(int, input().split()))

print((max(a-2*b,0)))

# Optimized solution
a,b = list(map(int,input().split()))
print((max(0,a-b*2)))
# Original solution
a,b= list(map(int,input().split()))
r = a-b*2
if r <= 0:
    print((0))
else:
    print(r)

# Optimized solution
A,B=list(map(int,input().split()))
ans=A-B*2
print((ans if ans>=0 else 0))
# Original solution
a,b = list(map(int,input().split()))

if b * 2 >= a:
    print((0))
else:
    print((a-2*b))
    

# Optimized solution
a,b = list(map(int,input().split()))

print((max(0,a-2*b)))
'''
if b * 2 >= a:
    print(0)
else:
    print(a-2*b)
'''
# Original solution
A, B = list(map(int, input().split()))
print((A - 2 * B if A - 2 * B > 0 else 0))


# Optimized solution
A,B = list(map(int, input().split()))
print((max(0, A-2*B)))
# Original solution
a, b = list(map(int, input().split()))

ans = a - b * 2
if ans < 0:
    ans = 0

print (ans)



# Optimized solution
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))

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

ans = a - b * 2

if (ans >= 0):
    print(ans)
else:
    print((0))
# Original solution
"""
author : halo2halo
date : 19,Oct,2019
"""

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

A, B = list(map(int, readline().split()))
print((max(A-2*B, 0)))


# Optimized solution
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B = list(map(int, readline().split()))
S=A-2*B
print((S if S>0 else 0))
# Original solution
a,b = list(map(int,input().split()))
c = 2*b
d = a-c
if d > 0:
 print(d)
elif d <= 0:
 print((0))

# Optimized solution
a,b = list(map(int,input().split()))
if a-2*b > 0:
 print((a-2*b))
else: 
 print((0))
# Original solution
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    a, b = list(map(int, input().split()))
    print((max(0, a - 2 * b)))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


# Optimized solution
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    a, b = list(map(int, input().split()))
    if a - 2 * b >= 0:
        print((a - 2 * b))
    else:
        print((0))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
# Original solution
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# input=lambda :sys.stdin.readline().rstrip()
def resolve():
    a,b=list(map(int,input().split()))
    print((max(0,a-2*b)))
resolve()

# Optimized solution
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    a,b=list(map(int,input().split()))
    print((max(0,a-2*b)))
resolve()
# Original solution
a,b = list(map(int,input().split()))
print((max(0,a-2*b)))

# Optimized solution
A,B = list(map(int,input().split()))

print((max(0,A-2*B)))
# Original solution
a,b=list(map(int,input().split()))
if 0>a-(2*b):
    print((0))
else:
    print((a-(2*b)))


# Optimized solution
a,b=list(map(int,input().split()))
if a<2*b:
  print((0))
else:
  print((a-(2*b)))
# Original solution
a,b=list(map(int,input().split()))
if a<2*b:
  print((0))
else:
  print((a-(2*b)))

# Optimized solution
a,b=list(map(int,input().split()))
print((max(0,a-2*b)))
# Original solution
import sys
input = sys.stdin.readline

a, b = [int(x) for x in input().split()]
if 2*b >= a:
    print((0))
else:
    print((a - 2*b))

# Optimized solution
import sys
input = lambda : sys.stdin.readline().rstrip()

a, b = list(map(int, input().split()))
print((max(0, a - 2*b)))
# Original solution
A, B = list(map(int, input().split()))

if A <= B * 2:
    print('0')
else:
    print((A - 2 * B))



# Optimized solution
A, B = list(map(int, input().split()))

print((max(0, A - 2 * B)))
# Original solution
a, b = list(map(int, input().split()))
if a < b * 2:
    print((0))
else:
    print((a-(b*2)))


# Optimized solution
a, b = list(map(int, input().split()))
if a < (b*2):
    print((0))
else:
    print((a-(b*2)))
# Original solution
A,B = list(map(int,input().split()))
x = A-B-B
print((max(0,x)))

# Optimized solution
A,B = list(map(int,input().split()))
print((max(0, A-B-B)))
# Original solution
a, b = list(map(int, input().split()))
if a > b*2:
  print((a - b*2))
else:
  print((0))

# Optimized solution
a, b = list(map(int, input().split()))
print((max(0, a-b*2)))
# Original solution
A, B = list(map(int, input().split()))
space = A - B * 2
if space < 0:
    space = 0
print(space)

# Optimized solution
a, b = list(map(int, input().split()))
ans = max(a - 2 * b, 0)
print(ans)
# Original solution
A, B = list(map(int, input().split()))

print((max(0, A - 2*B)))


# Optimized solution
a,b=list(map(int,input().split()))
print((max(0,a-b-b)))
# Original solution
a,b=list(map(int,input().split()))
d=a-2*b
print((d if d>0 else 0))

# Optimized solution
a,b=list(map(int,input().split()))
print((max(0,a-b*2)))
# Original solution
a,b=list(map(int,input().split()))
print((max(0,a-b*2)))

# Optimized solution
a, b = list(map(int, input().split()))
print((max(0, a-2*b)))
# Original solution
N = int(eval(input()))
H = int(eval(input()))
W = int(eval(input()))
print(((N-H+1)*(N-W+1)))

# Optimized solution
N = int(eval(input()))
H = int(eval(input()))
W = int(eval(input()))

print(((N-W+1)*(N-H+1)))
# Original solution
N = int(eval(input()))
H = int(eval(input()))
W = int(eval(input()))
print(((N+1-H)*(N+1-W)))

# Optimized solution
n = int(eval(input()))
h = int(eval(input()))
w = int(eval(input()))
print(((n+1-h)*(n+1-w)))
# Original solution
n=int(eval(input()))
m=int(eval(input()))
h=int(eval(input()))
print(((n-m+1)*(n-h+1)))

# Optimized solution
n,h,w = [int(eval(input())) for _ in range(3)]
print(((n-h+1)*(n-w+1)))
# Original solution
row = [True] * 8
col = [True] * 8
dpos = [True] * 15
dneg = [True] * 15


board = [['.', '.', '.', '.', '.', '.', '.', '.'] for i in range(8)]

import sys

file_input = sys.stdin

k = int(file_input.readline())

for line in file_input:
    r, c = map(int, line.split())
    row[r] = "INIT"
    col[c] = "INIT"
    dpos[r + c] = False
    dneg[r + (7 - c)] = False
    board[r][c] = 'Q'

def dfs(i = 0):
    if i == 8:
        for line in board:
            print(*line, sep='')
        return
    if row[i] == "INIT":
        dfs(i + 1)
    elif row[i]:
        for j in range(8):
            if col[j] == "INIT":
                pass
            elif col[j] and dpos[i + j] and dneg[i + (7 - j)]:
                row[i] = False
                col[j] = False
                dpos[i + j] = False
                dneg[i + (7 - j)] = False
                board[i][j] = 'Q'
                dfs(i + 1)
                row[i] = True
                col[j] = True
                dpos[i + j] = True
                dneg[i + (7 - j)] = True
                board[i][j] = '.'

dfs()


# Optimized solution
row = [False] * 8
col = [False] * 8
dpos = [False] * 15
dneg = [False] * 15


board = [['.', '.', '.', '.', '.', '.', '.', '.'] for i in range(8)]

import sys

file_input = sys.stdin

k = int(file_input.readline())

for line in file_input:
    r, c = list(map(int, line.split()))
    row[r] = True
    col[c] = True
    dpos[r + c] = True
    dneg[r - c + 7] = True
    board[r][c] = 'Q'

def dfs(i = 0):
    if i == 8:
        for line in board:
            print((''.join(line)))
    elif row[i]:
        dfs(i + 1)
    else:
        for j in range(8):
            if col[j] or dpos[i + j] or dneg[i - j + 7]:
                continue
            row[i] = True
            col[j] = True
            dpos[i + j] = True
            dneg[i - j + 7] = True
            board[i][j] = 'Q'
            dfs(i + 1)
            row[i] = False
            col[j] = False
            dpos[i + j] = False
            dneg[i - j + 7] = False
            board[i][j] = '.'

dfs()
# Original solution
import sys;

def putQueen(i, row, col, dpos, dneq):
    if(i == 8):
        global finding
        if(finding == 0):
            return
        finding = 0
        printBoard(row[0:])
    

    for j in range(8):
        if i in myset:
            putQueen(i+1,row[0:], col[0:], dpos[0:], dneq[0:])
            continue
        if(col[j] == 1 or dpos[i+j] == 1 or dneq[i-j+7] == 1):
            continue
        row[i] = j
        col[j] = dpos[i+j] = dneq[i-j+7] = 1
        putQueen(i+1,row[0:], col[0:], dpos[0:], dneq[0:])
        col[j] = dpos[i+j] = dneq[i-j+7] = 0

def printBoard(row):
    for k in range(8):
        if(row[k] == 0):
            print("Q.......")
        elif(row[k] == 1):
            print(".Q......")
        elif(row[k] == 2):
            print("..Q.....")
        elif(row[k] == 3):
            print("...Q....")
        elif(row[k] == 4):
            print("....Q...")
        elif(row[k] == 5):
            print(".....Q..")
        elif(row[k] == 6):
            print("......Q.")
        else:
            print(".......Q")

n = (int)(eval(input()));
row = [0 for i in range(8)]
col = [0 for i in range(8)]
dpos = [0 for i in range(15)]
dneq = [0 for i in range(15)]

myset = set()

for i in range(n):
    r,c = list(map(int, input().split()));
    myset.add(r)
    row[r] = c
    col[c] = 1
    dpos[r+c] = 1
    dneq[r-c+7] = 1

finding = 1

putQueen(0,row, col, dpos, dneq)



# Optimized solution
import sys;

def putQueen(i, row, col, dpos, dneq):
    global finding
    if(finding == 0):
        return
        
    if(i == 8):
        finding = 0
        printBoard(row[0:])
        return
    

    for j in range(8):
        if i in myset:
            putQueen(i+1,row[0:], col[0:], dpos[0:], dneq[0:])
            continue
        if(col[j] == 1 or dpos[i+j] == 1 or dneq[i-j+7] == 1):
            continue
        row[i] = j
        col[j] = dpos[i+j] = dneq[i-j+7] = 1
        putQueen(i+1,row[0:], col[0:], dpos[0:], dneq[0:])
        col[j] = dpos[i+j] = dneq[i-j+7] = 0

def printBoard(row):
    for k in range(8):
        if(row[k] == 0):
            print("Q.......")
        elif(row[k] == 1):
            print(".Q......")
        elif(row[k] == 2):
            print("..Q.....")
        elif(row[k] == 3):
            print("...Q....")
        elif(row[k] == 4):
            print("....Q...")
        elif(row[k] == 5):
            print(".....Q..")
        elif(row[k] == 6):
            print("......Q.")
        else:
            print(".......Q")

n = (int)(eval(input()));
row = [0 for i in range(8)]
col = [0 for i in range(8)]
dpos = [0 for i in range(15)]
dneq = [0 for i in range(15)]

myset = set()

for i in range(n):
    r,c = list(map(int, input().split()));
    myset.add(r)
    row[r] = c
    col[c] = 1
    dpos[r+c] = 1
    dneq[r-c+7] = 1

finding = 1

putQueen(0,row, col, dpos, dneq)
# Original solution
import itertools
N, Q, row, col = eval(input()), [], list(range(8)), list(range(8))
for _ in range(N):
    r, c = list(map(int, input().split()))
    Q.append((r, c))
    row.remove(r)
    col.remove(c)
for l in itertools.permutations(col):
    queen = Q + list(zip(row, l))
    if not any(any((r1 != r2 or c1 != c2) and (r1 == r2 or c1 == c2 or r1 + c1 == r2 + c2 or r1 - c1 == r2 - c2) for r2, c2 in queen) for r1, c1 in queen):
        print('\n'.join(''.join('Q' if (r, c) in queen else '.' for c in range(8)) for r in range(8)))
        break

# Optimized solution
import itertools
N, Q, row, col = eval(input()), [], list(range(8)), list(range(8))
for _ in range(N):
    r, c = list(map(int, input().split()))
    Q.append((r, c))
    row.remove(r)
    col.remove(c)
for l in itertools.permutations(col):
    queen = Q + list(zip(row, l))
    if not any((r1 != r2 or c1 != c2) and (r1 == r2 or c1 == c2 or r1 + c1 == r2 + c2 or r1 - c1 == r2 - c2) for r2, c2 in queen for r1, c1 in queen):
        print('\n'.join(''.join('Q' if (r, c) in queen else '.' for c in range(8)) for r in range(8)))
        break
# Original solution
from sys import stdin
N = 8
FREE = -1
NOT_FREE = 1
row = [FREE] * N
col = [FREE] * N
dpos = [FREE] * (2 * N - 1)
dneg = [FREE] * (2 * N - 1)
X = [[False] * N for _ in range(N)]
n = int(stdin.readline())
for _ in range(0, n):
    r, c = list(map(int, stdin.readline().split()))
    X[r][c] = True
def printBoard():
    for i in range(0, N):
        for j in range(0, N):
            if X[i][j] != 0 and row[i] != j: return
    for i in range(0, N):
        print((''.join(('Q' if row[i] == j else '.' for j in range(N)))))
def recursive(i):
    if i == N:
        printBoard()
        return
    for j in range(0, N):
        if (NOT_FREE == col[j] or
            NOT_FREE == dpos[i + j] or
            NOT_FREE == dneg[i - j + N - 1]): continue
        row[i] = j
        col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE
        recursive(i + 1)
        row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE
recursive(0)

# Optimized solution
from sys import stdin
N = 8
FREE = -1
NOT_FREE = 1
row = [FREE] * N
col = [FREE] * N
dpos = [FREE] * (2 * N - 1)
dneg = [FREE] * (2 * N - 1)
X = [[False] * N for _ in range(N)]
n = int(stdin.readline())
for _ in range(0, n):
    r, c = list(map(int, stdin.readline().split()))
    X[r][c] = True
def printBoard():
    for i in range(0, N):
        for j in range(0, N):
            if X[i][j] != 0 and row[i] != j: return
    for i in range(0, N):
        print(("." * row[i] + "Q" + "." * (8 - row[i] - 1)))
def recursive(i):
    if i == N:
        printBoard()
        return
    for j in range(0, N):
        if (NOT_FREE == col[j] or
            NOT_FREE == dpos[i + j] or
            NOT_FREE == dneg[i - j + N - 1]): continue
        row[i] = j
        col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE
        recursive(i + 1)
        row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE
recursive(0)
# Original solution
from sys import stdin
N = 8
FREE = -1
NOT_FREE = 1
row = [FREE] * N
col = [FREE] * N
dpos = [FREE] * (2 * N - 1)
dneg = [FREE] * (2 * N - 1)
X = [[False] * N for _ in range(N)]
n = int(stdin.readline())
for _ in range(0, n):
    r, c = list(map(int, stdin.readline().split()))
    X[r][c] = True
def printBoard():
    for i in range(0, N):
        for j in range(0, N):
            if X[i][j] != 0 and row[i] != j: return
    for i in range(0, N):
        print(("." * row[i] + "Q" + "." * (8 - row[i] - 1)))
def recursive(i):
    if i == N:
        printBoard()
        return
    for j in range(0, N):
        if (NOT_FREE == col[j] or
            NOT_FREE == dpos[i + j] or
            NOT_FREE == dneg[i - j + N - 1]): continue
        row[i] = j
        col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE
        recursive(i + 1)
        row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE
recursive(0)

# Optimized solution
from sys import stdin
from itertools import permutations as per
def check(queen):
    for r1, c1 in queen:
        if not all((r1 == r2 and c1 == c2) or (r1 + c1 != r2 + c2 and r1 - c1 != r2 - c2) for r2, c2 in queen):
            return False
    return True
k = int(stdin.readline())
R, C = [[i for i in range(8)] for _ in range(2)]
q = []
for _ in range(k):
    r, c = list(map(int, stdin.readline().split()))
    q.append((r, c))
    R.remove(r)
    C.remove(c)
for l in per(C):
    q_tmp = q[:] + [(r, c) for r, c in zip(R, l)]
    if check(q_tmp):
        for i, j in sorted(q_tmp):
            print(("." * j + "Q" + "." * (8 - j - 1)))
        break