peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import math
from collections import defaultdict,deque
from itertools import permutations
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""
t=1
#t=ii()
for _ in range(t):
    n=ii()
    a=ll()
    i=n-1;
    while(i>-1):
        print(a[i],end=" ")
        i-=2
    for i in range(n%2,n,2):
        print(a[i],end=" ")
# Judge status: Wrong Answer
x = input()
ans, count0, count1 = len(x), 0, 0
for i in x:
    if i == 'S' and count1 == 0:
        count0 += 1
    elif i == 'T' and count0 > 0:
        count1 += 1
    else:
       ans -= 2*min(count0, count1)
       if i == 'S':
           count0, count1 = 1, 0
       else:
           count0, count1 = 0, 0
ans -= 2*min(count0, count1)
print(ans)
# Judge status: Accepted
N = int(input())

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

i = 0

for a in A:
    if i + 1 == a:
        i += 1

if i == 0:
    print(-1)
else:
    print(N - i)
# Judge status: Accepted
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    a, b, c = map(int, input().split())
    if ~a&1 or ~b&1 or ~c&1:
        print(0)
    else:
        print(min(a * b, b * c, c * a))
resolve()
# Judge status: Accepted
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [0] * N
dp[0] = 0
for i in range(1,N):
    dp[i] = min([dp[i-j-1] + abs(h[i]-h[i-j-1]) for j in range(min(i,K))])
 
print(dp[-1])
# Judge status: Accepted
import sys

n=int(input())
list=[]
if n==1:
	print(1)
	sys.exit()
list.append(2)
list.append(1)
for i in range(2,87):
	list.append(list[i-1]+list[i-2])
	if n==i:
		print(list[-1])
		sys.exit()
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
x = 0
ans = 0
for cnt,num in enumerate(p):
    if cnt+1 == num:
        if x == 0:
            ans += 1
            x = 1
        else:
            x = 0
        
    else:
        x = 0
print(ans)
# Judge status: Accepted
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


M, N = map(int, input().split())
if M <= 1 and N <= 1:
    print(0)
elif M <= 1:
    print(combinations_count(N, 2))
elif N <= 1:
    print(combinations_count(M, 2))
else:
    print(combinations_count(M, 2) + combinations_count(N, 2))
# Judge status: Accepted
N = int(input())
L = [int(x) for x in input().split()]
L.sort(reverse = True)

if(L[0] >= sum(L[1:])):
    print("No")
else:
    print("Yes")
# Judge status: Accepted
from collections import deque

n,m=map(int,input().split())
graph=[[] for _ in range(n+1)]

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

ans=[-1]*(n+1)
ans[0]=0
ans[1]=0

d=deque()
d.append(1)

while d:
    v=d.popleft()
    for i in graph[v]:
        if ans[i]!=-1:
            continue
        ans[i]=v
        d.append(i)

ans=ans[2:]
print("Yes")
print(*ans,sep="\n")
# Judge status: Wrong Answer
x = int(input())

if x >= 400 and x < 599:
    print('8')
elif x >= 600 and x < 799:
    print('7')
elif x >= 800 and x < 999:
    print('6')
elif x >= 1000 and x < 1199:
    print('5')
elif x >= 1200 and x < 1399:
    print('4')
elif x >= 1400 and x < 1599:
    print('3')
elif x >= 1600 and x < 1799:
    print('2')
elif x >= 1800 and x < 1999:
    print('1')
# Judge status: Accepted

able = list()
for i in range(103):
    able.insert(i, i-1)

X,N = map(int,input().split())
p = list(map(int,input().split()))
for i in range(len(p)):
    able.remove(p[i])

target = 1000
ans = 1000
for i in range(len(able)):
    
    if (target > abs(X - able[i])):
        # if (target == abs(X - able[i])): 
        #     ans = min(target, able[i])
        # else:
        target = abs(X - able[i])
        ans = able[i]
    
    # print(able[i], abs(X - able[i]), ans)

print(ans)
# Judge status: Accepted
N=int(input())
T,A=map(int,input().split())
H=[-1000]+list(map(int,input().split()))


M=10**10
X=0
for i in range(1,N+1):
    B=abs(1000*(T-A)-6*H[i])
    if B<=M:
        M=B
        X=i
print(X)
# Judge status: Wrong Answer
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
if max(b)<=min(c):
    for i in range(min(c)-max(b)):
        if a[2]<max(b)+i<=a[3]:
            print("No War")
            break
        else:print("War")
else:
    print("War")
# Judge status: Wrong Answer
N = int(input())
S = input()
if N % 2 or S[:N//2-1] != S[N//2:]:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
n = int(input())
s = list(input())

r = sum([1 for x in s if x == 'R'])
g = sum([1 for x in s if x == 'G'])
b = sum([1 for x in s if x == 'B'])
ans = r * g * b

for i in range(n):
    for j in range(i + 1, n):
        k = 2 * j - i
        if j < k <= n - 1:
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans -= 1

print(ans)
# Judge status: Accepted
hp_t, attack_t, hp_a, attack_a = map(int, input().split())
def battle(hp_t, attack_t, hp_a, attack_a, p):
    
    if p == 't':
        hp_a -= attack_t
    else:
        hp_t -= attack_a
        
    if hp_t <= 0:
        return 'No'
    elif hp_a <= 0:
        return 'Yes'
    
    return battle(hp_t, attack_t, hp_a, attack_a, 't' if p == 'a' else 'a')
print(battle(hp_t, attack_t, hp_a, attack_a, 't'))
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

ans = [0] * n

for idx, i in enumerate(A):
    ans[i-1] = idx + 1
    
print(' '.join(map(str, ans)))
# Judge status: Wrong Answer
L,R,d = map(int,input().split())
count = 0
for i in range(L,R):
    if i % d == 0:
        count += 1
print(count+1)
# Judge status: Accepted
n = int(input())
# したから計算
if n == 0:
    print(0)
    exit()
ans = ""
digit = 1
while n != 0:
    num = 0
    if n % pow(2, digit):
        num = 1
    ans = str(num) + ans
    n -= num * pow(-2, digit - 1)
    digit += 1
print(ans)
# Judge status: Wrong Answer

input = input()

s_input = input.split()

print(s_input)
x = int(s_input[0]) * -1
a = int(s_input[1])
b = int(s_input[2])

kigenchouka = a - b

if kigenchouka >= 0:
    print("delicioous")
elif kigenchouka > x :
    print("safe")
else:
    print("danger")
# Judge status: Accepted
K = int(input())

if K % 7 == 0:
    L = 9 * K / 7
else:
    L = 9 * K

if L % 2 == 0 or L % 5 == 0:
    print(-1)
else:
    rest = 1
    ans = 0
    while True:
        rest *= 10
        ans += 1
        rest = rest % L
        if rest == 1:
            break
    print(ans)
# Judge status: Wrong Answer
N= int(input())
import numpy as np
arr = np.array([input().split() for _ in range(N)], dtype=np.int8)
dp = np.zeros_like(arr)
for i, arr_ in enumerate(arr):
    for j in range(len(arr_)):
        if i == 0:
            dp[i][j] = arr_[j]
            continue
        for k in range(len(arr_)):
            if j != k:
                dp[i][j] = max(dp[i-1][k] + arr_[j], dp[i][j])
print(np.max(dp[-1]))
#print(dp)
# Judge status: Accepted
a,b,c = list(map(int,input().split()))
answer = (c-a+b)
print(max(0,answer))
# Judge status: Accepted
x = int(input())


def prime(n):
    flag = ''
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            break
    else:
        flag = 'prime_number'

    return(flag)


while(prime(x) != 'prime_number'):
    x += 1

print(x)
# Judge status: Wrong Answer
s = input()
if "N" in s:
  if "S" not in s :
    print("No")
    exit()
if "E" in s:
  if "W" not in s:
    print("no")
    exit()
print("Yes")
# Judge status: Accepted
import sys
n=int(input())
s=[]
for i in range(n):
  s.append(int(input()))
if sum(s)%10!=0:
  print(sum(s))
else:
  s.sort()
  for j in range(n):
    if s[j]%10!=0:
      num=s[j]
      break
    if j==n-1:
      print(0)
      sys.exit()
  print(sum(s)-num)
# Judge status: Accepted
n = int(input())
for i in range(n):
 t,x,y = map(int,input().split())
 if (x+y) > t or (x+y+t) % 2:
  print("No")
  exit()
print("Yes")
# Judge status: Accepted
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    # from collections import deque
    # from collections import Counter
    # import copy
    # import numpy as np
    import math
    # import random
    input = stdin.readline

    x = int(input())
    one_round = 360
    print(int(360//math.gcd(one_round, x)))
# Judge status: Wrong Answer
n = int(input())
  
res = 0
for i in range(n):
  if i % 3 != 0 and i % 5 != 0:
    res += i
print(res)
# Judge status: Accepted
A, B, C, X, Y = map(int, input().split())

a,b,ab = 0, 0, 0

a = X
b = Y
ab = 0

m = a * A + b * B + ab * C
big = max(X,Y)
while ab // 2 <= big:
    ab += 2
    if a > 0:
        a -= 1
    if b > 0:
        b -= 1
    m = min(m, a * A + b * B + ab * C)

print(m)
# Judge status: Accepted
n = int(input())
a = sorted(list(map(int, input().split())))
x = a[0]
for i in range(n - 1):
	x = (x + a[i + 1]) / 2
print(x)
# Judge status: Accepted
s = int(input())
dp = [0]*(2001)
dp[3] = 1
mod = 10**9+7
for i in range(4,s+1):
    dp[i] = (dp[i-1] + dp[i-3]) % mod
print(dp[s])
# Judge status: Accepted
n,k = map(int,input().split())
b = [bi-1 for bi in list(map(int,input().split()))]
a = 0

f = [0]*n
c = 1
for i in range(k):
    if f[a]:
        k %= c-f[a]
        for i in range(k):
            a = b[a]
        print(a+1)
        break
    f[a] = c
    k -= 1
    c += 1
    a = b[a]
else:
    print(a+1)
# Judge status: Accepted
import itertools

n = int(input())
alpha = "abcdefghij"
ans_s = {}
if n == 1:
    print("a")
    exit()

def ans_string(max_num, num, ans):
    if num == 0:
        ans_s[ans] = 1
    else:
        for i in range(max_num + 2):
            ans_string(max(i, max_num), num - 1, ans + alpha[i])
        
ans_string(0, n - 1, "a")
for key, value in ans_s.items():
    print(key)
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
if N < 3:
    print('0')
    exit()
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            if L[i] == L[j] or L[j] == L[k] or L[i] == L[k]:
                continue
            if L[k] < L[i] + L[j]:
                ans += 1
print(ans)
# Judge status: Accepted
n=int(input())
A=[int(i) for i in input().split()]
if len(set(A))==n:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

four = 0
two = 0
odd = 0
for i in A:
    if i%4 == 0:
        four += 1
    elif i%2 == 0:
        two += 1
    else:
        odd += 1
 
if two == 1:
    odd += 1

if odd <= 2*four:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a = int(input())
b = int(input())
ans = [1,2,3]
ans.remove(a)
ans.remove(b)
print(ans[0])
# Judge status: Accepted
N = int(input())
S = input()
for i in range(len(S)):
    a = ord(S[i])+N
    if a > ord('Z'):
        a -= 26
    print(chr(a),end ='')
# Judge status: Wrong Answer
X = int(input())
num_item = int(X // 100)
remain = X - num_item * 100
if remain < num_item * 5:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
a,b = map(int,input().split())
print("Possible" if (a+b)%3 == 0 else "Impossible")
# Judge status: Accepted
A,B = map(int,input().split())
print("Yay!") if A<=8 and B<=8 else print(':(')
# Judge status: Accepted
t=input()
if '9' in t:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
def rec(a):
    dp=[0]*len(a)
    for i in range(len(a)):
        if i==0:
            dp[i]=0
        elif i==1:
            dp[i]=abs(a[i]-a[i-1])
        else:
            dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2])
    return dp[len(a)-1]
n=int(input())
a=[int(i) for i in input().split()]
print(rec(a))
# Judge status: Accepted
import sys
input = sys.stdin.readline

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

AB = [tuple(map(int,input().split())) for i in range(M)]

es = [[] for _ in range(N)]
for a, b in AB:
    es[a-1].append(b-1)
    es[b-1].append(a-1)

ans = [-1] * N
ans[0] = 0

from collections import deque
que = deque([])
que.append(0)

while que:
    s = que.popleft()
    for v in es[s]:
        if ans[v] == -1:
            ans[v] = s+1
            que.append(v)

print("Yes")
print(*ans[1:], sep="\n")
# Judge status: Accepted
n,m = map(int,input().split())
count_list = [0] * n

list = [input() for i in range(m)]

for i in range(m):
    ary = list[i].split()
    count_list[int(ary[0])-1] += 1
    count_list[int(ary[1])-1] += 1

for i in range(n):
  print(count_list[i])
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
s = a[:1]
t = a[1:]
x = sum(s)
y = sum(t)
if x==y:
  ans = 0
else:
  ans = abs(x-y)

for i in range(1,N-1):
  x += a[i]
  y -= a[i]
  if x==y:
    ans = 0
    break
  elif abs(x-y)<ans:
    ans = abs(x-y)
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
if n%2==1:
    tmp = a[::-2]+a[1::2]
else:
    tmp = a[::-2]+a[0::2]

print(' '.join(map(str, tmp)))
# Judge status: Accepted
N = int(input())

a = [int(input()) for i in range(N)]
index=0

for i in range(N):
    next = a[index]
    if next==2:
        count = i+1
        break
    index = next-1
    count = -1

print(count)
# Judge status: Wrong Answer
N = int(input())
ans = 0 
ans_list = list()
skip_list = list()

import math as math
sqrt = math.sqrt(N)
wide = math.ceil(sqrt)
for i in range(3,wide,2):
  if N % i == 0:
    div = i
    ans +=1
    n = 1
    while N % div == 0:
      ans += 1
      N = N/div
      n += 1
      div = div**n
if ans == 0 and N != 0:
  print(1)
else:
  print(ans)
# Judge status: Wrong Answer
from collections import Counter
from sys import maxsize

# input
N = int(input())
S = Counter([input() for i in range(N)])
M = int(input())
T = Counter([input() for j in range(M)])

# check
max_cnt = -maxsize
for s in S.keys():
    cnt = S[s]
    if s in T.keys():
        cnt -= T[s]

    if max_cnt < cnt:
        max_cnt = cnt

print(max_cnt)
# Judge status: Accepted
S = input()
N = len(S)

ans = int(S[0]) + 9 * (N - 1)
if not S[1:] == "9" * (N - 1):
    ans -= 1

print(ans)
# Judge status: Accepted
d = int(input())
if d == 25:
    print("Christmas")
elif d == 24:
    print("Christmas Eve")
elif d == 23:
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")

# n = 25 - int(input())
# print("Christmas" + "Eve" * n)

#かしこい
# Judge status: Wrong Answer
def calc(T, x):
  return T - x * 0.0006

N = int(input())
T, A = map(int, input().split())
L = list(map(int, input().split()))
l = []
for i in L:
  l.append(abs(A - calc(T, i)))

mi = min(l)
print(l.index(mi)+1)
# Judge status: Accepted
import sys
input = sys.stdin.readline
H,N = map(int,input().split())
spells = [list(map(int,input().split())) for i in range(N)]
INF = 10**10
dp = [INF]*(H+1)
dp[0] = 0
for use in spells:
    damage = use[0]
    mp = use[1]
    for i in range(1,H+1):
        dp[i] = min(dp[max(0,i-damage)] + mp, dp[i])
print(dp[-1])
# Judge status: Wrong Answer
n,r=map(int,input().split(" "))
if n >= 10:
    print(r)
else:
    print(r+100*(10*n))
# Judge status: Accepted
def main():
    import sys
    import itertools
    N=int(sys.stdin.readline())
    PL=list(map(int,sys.stdin.readline().split()))
    QL=list(map(int,sys.stdin.readline().split()))

    for i,L in enumerate(itertools.permutations(range(1,N+1))):
        if tuple(L)==tuple(PL):
            a=i
        if tuple(L)==tuple(QL):
            b=i

    print(abs(a-b))
main()
# Judge status: Accepted
abc = list(map(int,input().split()))

if 5 in abc and 7 in abc and abc.count(7)==1:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]
print(max(0, *[S.count(s) - T.count(s) for s in set(S)]))
# Judge status: Accepted
#ABC176 B
N = list(map(int,input()))
n = 0
for i in N:
  n += i

if n % 9 == 0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
S = input()

heads = int(S[:2])
tails = int(S[2:])


def is_month(n):
    return n >= 1 and n <= 12


if is_month(heads) and (not is_month(tails)):
    print("MMYY")
elif (not is_month(heads)) and (not is_month(tails)):
    print("NA")
elif (not is_month(heads)) and is_month(tails):
    print("YYMM")
else:
    print("AMBIGUOUS")
# Judge status: Accepted
N=int(input())
import math
power=math.factorial(N)
print(power%(10**9+7))
# Judge status: Accepted
N = int(input())
ans = 0
a = list(map(int, input().split()))

for i in range(1,N+1):
    if a[i-1] % 2 != 0 and i % 2 != 0:
        ans+=1
print(ans)
# Judge status: Wrong Answer
import numpy as np
N=int(input())
A=list(map(int, input().split()))
mean=0
for i in range(N):
  A[i]-=(i+1)
  mean+=A[i]/(N)
A=np.array(A)

#平均を０に近づけるようにする
mean=round(mean)
def sudness(A):
  sad=0
  for a in A:
    sad+=abs(a)
  return sad

print(sudness(A-mean))
# Judge status: Accepted
x=int(input())
mod=x%11
if mod==0:
    print(x*2//11)
elif mod<=6:
    print((x//11)*2 + 1)
else:
    print((x//11)*2 + 2)
# Judge status: Wrong Answer
x,a,b=map(int,input().split())
print('delicious' if a>b else 'dangerous' if b>a+x else 'safe')
# Judge status: Accepted
n = list(input())
n = list(map(int, n))
print("Yes" if sum(n)%9 == 0 else "No")
# Judge status: Accepted
N = int(input())
l = []
for i in range(25):
    for j in range(25):
        l.append(i * 4 + j * 7)
ans = 'No'
if N in l:
    ans = 'Yes'
print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
li=[[] for i in range(n)]
for i in range(m):
    ai,bi=map(int,input().split())
    li[ai-1].append(bi-1)
    li[bi-1].append(ai-1)
flag=0
for i in range(n):
    if len(li[i])==0:
        flag=1
        break
if flag==1:
    print("No")
else:
    print("Yes")
    for i in range(1,n):
        print(min(li[i])+1)
# Judge status: Accepted
import math, sys
inp = int(input())
var = list(map(int,input().split()))
l = []
for i in range(inp-1):
  a = math.fabs(sum(var[0:i+1]) - sum(var[i+1:inp+1]))
  if a==0:
        print(0)
        sys.exit()
  l.append(a)
l.sort()
print(int(l[0]))
# Judge status: Accepted
import sys
import math
k=int(input())
s=input()

if len(s)<=k:
    print(s)
else:
    s_s=s[:k]
    print(s_s+'...')
# Judge status: Wrong Answer
n,k=map(int,input().split())
a=b=abs(n-k)
ans=n
if n%k==0:
 print("0")
 exit()
while a!=abs(b-k):
 b=abs(b-k)
 if b<ans:
  ans=b
print(ans)
# Judge status: Wrong Answer
n,k,*p=map(int,open(0).read().split())
s=[p[0]]*n
for i in range(1,n):
  s[i]=s[i-1]+p[i]
ans=0
for i in range(n-k):
  ans=max(ans,s[i+k]-s[i])
print((ans+k)/2)
# Judge status: Accepted
a, b = map(int, input().split())

if a <= b:
    print(a)

else:
    print(a-1)
# Judge status: Accepted
n = int(input())
s = input()
for i in s:
    i = ord(i) + n
    if (i > 90):
        d = i - 90
        print(chr(64+d),end = '')
    else:
        print(chr(i),end = '')
# Judge status: Accepted
def solve():
    n = int(input())
    if n <= 599:
        print(8)
    elif n <= 799:
        print(7)
    elif n <= 999:
        print(6)
    elif n <= 1199:
        print(5)
    elif n <= 1399:
        print(4)
    elif n <= 1599:
        print(3)
    elif n <= 1799:
        print(2)
    else:
        print(1)


solve()
# Judge status: Accepted
N, K = [int(_) for _ in input().split()]

scores = []
max_patterns = 0

for dice in range(1, N + 1):
    score = dice
    coin_counts = 0
    while score < K:
        score *= 2
        coin_counts += 1
    patterns = 2 ** coin_counts
    max_patterns = max(patterns, max_patterns)
    lose = patterns - 1
    win = 1
    scores.append((win, lose, patterns))

total_win = 0
total_lose = 0
for win, lose, patterns in scores:
    ratio = max_patterns // patterns
    total_win += win * ratio
    total_lose += lose * ratio

win_ratio = total_win / (total_win + total_lose)
print(win_ratio)
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
print('YES' if A%2==C%2 else 'NO')
# Judge status: Wrong Answer
N, K = [int(n) for n in input().split()]
R, S, P = [int(n) for n in input().split()]
T = input()

scoredict = {'r':R, 's':S, 'p':P}
winning = {'r':'p', 's':'r', 'p':'s'}

picks = []
score = 0
for i in range(N):
    current = T[i]
    pick = winning[current]
    if i - K >= 0 and pick == picks[i-K]:
        pick = current
    else:
        score += scoredict[pick]
    picks.append(pick)

print(score)
# Judge status: Accepted
N, M = map(int, input().split())
H = list(map(int, input().split()))


A_list = []
B_list = []
Remove_list = []

for _ in range(M):
  A, B = map(int, input().split())
  A_list.append(A - 1)
  B_list.append(B - 1)

for A, B in zip(A_list, B_list):
  A_height = H[A]
  B_height = H[B]
  
  if A_height <= B_height:
    Remove_list.append(A)
  
  if B_height <= A_height: 
    Remove_list.append(B)
  
S = set(range(N))
S = S - set(Remove_list)

print(len(S))
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if c<=a+b*2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())
from collections import Counter
cc=Counter()
for _ in range(n):
    cc[input()]+=1
m=int(input())
ans=0
for _ in range(m):
    x=input()
    if cc[x]==0:
        continue
    else:
        cc[x]-=1
for i in cc:
    ans=max(ans,cc[i])
print(ans)
# Judge status: Accepted
X = int(input())

if 30 <= X:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a,b= input().split()
x=int(a*int(b))
y=int(b*int(a))
c=[x,y]
c=sorted(c)
print(c[0])
# Judge status: Accepted
n,m,*ab = map(int, open(0).read().split())

from collections import Counter

c = Counter(ab)

for i in range(1,n+1):
    print(c[i])
# Judge status: Accepted
N,W=map(int,input().split(' '))
w=[0]*N ; v=[0]*N
for i in range(N):
    w[i],v[i]=map(int,input().split(' '))
dp=[[0]*(W+1) for _ in range(N+1)]
for i in range(1,N+1):
    for j in range(1,W+1):
        if j<w[i-1]:
            dp[i][j]=dp[i-1][j]
        else:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1])
print(dp[N][W])
# Judge status: Wrong Answer
K = int(input())

num = 0
cnt = 0
ans = False

for i in range(K):
    num = num*10+7
    cnt += 1
    if num % K == 0:
        print(cnt)
        ans = True

if ans == False:
    print(-1)
# Judge status: Accepted
h, n = map(int, input().split())
a = map(int, input().split())

if sum(a) >= h:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n=int(input())
h=list(map(int,input().split()))[::-1]
ans=[0]*n
for i in range(n-1):
    if h[i]<=h[i+1]:
        ans[i+1]+=ans[i]+1
print(max(ans))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

ans = 0
q = True
while q == True:
    for i in range(n):
        if a[i]%2 == 0:
            a[i] = a[i]//2
        else:
            print(ans)
            q = False
            break
    ans += 1
# Judge status: Wrong Answer
a, b, x = map(int, input().split())
if x == 1:
    print(b - a + 1)
    exit()
if a == b:
    if b % x == 0:
        print(1)
    else:
        print(0)
print(b // x - (a-1) // x)
# Judge status: Accepted
import sys
input = sys.stdin.readline

a, b, c = map(int, input().split())
match = [a, b, c]
cnt = 0

for i in range(3):
    if match[i] == 5:
        cnt += 2
    elif match[i] == 7:
        cnt += 1

if cnt == 5:
    ans = 'YES'
else:
    ans = 'NO'

print(ans)
# Judge status: Wrong Answer
t = ""
s = input()
for i in s:
  if len(t) == 0:
    continue
  elif i == 'B' and len(t) > 0:
    t = t[:-1]
  else:
    t += i
print(t)
# Judge status: Wrong Answer
a,b,c = map(str,input().split())
print(a+b[0]+c)
# Judge status: Accepted
n = int(input())

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

xor = 0
for i in a:
    xor ^= i

for i in a:
    print(xor^i, end=" ")
# Judge status: Accepted
import math
x = int(input())
ans = math.ceil((-1 + math.sqrt(8 * x + 1)) / 2)
print(ans)
# Judge status: Wrong Answer
W,H,N = map(int,input().split())
XYA = [tuple(map(int,input().split())) for _ in range(N)]

xmin = 0
ymin = 0
xmax = W
ymax = H
for x,y,a in XYA:
  if a == 1:
    xmin = x
  elif a == 2:
    xmax = x
  elif a == 3:
    ymin = y
  else:
    ymax = y
#print(xmax,xmin,ymax,ymin)
print(max(xmax-xmin,0)*max(ymax-ymin,0))