peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
from collections import Counter

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

rank = []
C = Counter(D)
numberList = tuple(sorted(C))
MOD = 998244353
if numberList[-1] != len(numberList)-1:
    print(0)
elif C[0] > 1:
    print(0)
else:
    ans = 1
    for i in range(len(numberList)):
        if i > 0:
            ans *= pow(C[i-1], C[i], MOD)
            ans %= MOD
    print(ans % MOD)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)

ans = 0
for i in range(N):
    print
    ans += a[i * 2 + 1]
print(ans)
# Judge status: Wrong Answer
import sys

h, n = map(int, input().split())
magic = []
a_max = 0
for i in range(n):
    a, b = map(int, input().split())
    a_max = max(a, a_max)
    magic.append((a, b))

dp = [float('inf')] * (h + a_max)
dp[0] = 0
for i in range(h):
    for a, b in magic:
        if i + a > h + a_max:
            continue
        dp[i + a] = min(dp[i] + b, dp[i + a])
        print(dp[i + a])

print(min(dp[h:]))
# Judge status: Accepted
N, Y = map(int, input().split())
result = [-1, -1, -1]
# a = 0, 1, ..., N
for a in range(0, N + 1):
    # b = 0, 1, ..., N-a
    for b in range(0, N - a + 1):
        c = N - a - b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            result = [a, b, c]
print(*result)
# Judge status: Accepted
from itertools import permutations

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

perm = list(permutations(range(1, N + 1)))

print(abs(perm.index(P) - perm.index(Q)))
# Judge status: Wrong Answer
import itertools

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

nums = [(i+1) for i in range(m+1)]
ans = 0
for balls in itertools.combinations_with_replacement(nums, n):
    tp = 0
    for i in range(q):
        if balls[sc[i][1]-1]-balls[sc[i][0]-1] == sc[i][2]:
            tp += sc[i][3]
    if tp > ans:
        ans = tp

print(ans)
# Judge status: Accepted
n,l=map(int,input().split())
S=sorted([input() for i in range(n)])
for s in S:
  print(s,end="")
# Judge status: Accepted

D = int(input())

print("Christmas" + " Eve" * (25-D))
# Judge status: Accepted
n,m = map(int, input().split())
a=[]
for _ in range(m):
    a.append(int(input()))

for i in range(m-1):
    if a[i] + 1 == a[i+1]:
        print(0)
        exit()
dp=[0]*(n+1)
dp[0]=1

for i in range(1,n+1):
    if len(a)!=0 and i == a[0]:
        dp[i]=0
        a.pop(0)
        continue
    dp[i]=dp[i-1]+dp[i-2]
    dp[i] = dp[i] % (10**9+7)

print(dp[n] % (10**9+7))
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s = input()
print('x' * len(s))
# Judge status: Accepted
n,T=map(int,input().split())
a=9999
for i in range(n):
    c,t=map(int,input().split())
    if t<=T:a=min(a,c)
print(a if a<9999 else 'TLE')
# Judge status: Accepted
import math
n = int(input())
Min = 10000000000000000
for _ in range(5):
	Min = min(int(input()),Min)

ans = 4
ans += math.ceil(n/Min)
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

def main():
	N = int(input())
	S = input().rstrip()
	T = input().rstrip()

	#N,A,B = map(int,input().split())
	
	for i in range(N):
		if S[i:]==T[:N-i]:
			res = N+i
			break
	else:
		res = 2*N
	
	print(res)
	
main()
# Judge status: Accepted
import sys
s = input()
if 'N' in s:
    if 'S' not in s:
        print('No')
        sys.exit()
if 'W' in s:
    if 'E' not in s:
        print('No')
        sys.exit()
if 'E' in s:
    if 'W' not in s:
        print('No')
        sys.exit()
if 'S' in s:
    if 'N' not in s:
        print('No')
        sys.exit()
print('Yes')
# Judge status: Accepted
n, a, b = map(int, input().split())
if a > b:
    print(0)
elif a == b:
    print(1)
elif n == 1:
    print(0)
else:
    print((n - 2) * (b - a) + 1)
# Judge status: Wrong Answer
n=int(input())
def side(n):
  list_n=list(str(n))
  start=int(list_n[0])
  end=int(list_n[-1])
  return [start,end]
def count_n(i,j):
  s=0
  for i in range(1,n+1):
    if side(i)==[i,j]:
      s+=1
  return s
ans=0
for i in range(0,9):
  for j in range(0,9):
    ans+=count_n(i,j)*count_n(j,i)
print(ans)
# Judge status: Wrong Answer
def resolve():
	n, m = map(int, input().split())
	A = []
	B = []
	ans = False
	for _ in range(n):
		A.append(list(input()))
	for _ in range(m):
		B.append(list(input()))
	for i in range(n):
		for j in range(n):
			if i + m > n or j + m > n:
				continue
			tmp_ans = True
			for k in range(m):
				for l in range(m):
					if A[i+k][j+l] != B[k][l]:
						tmp_ans = False
						break
			ans = tmp_ans


	if ans:
		print('Yes')
	else:
		print('No')
resolve()
# Judge status: Accepted
N = int(input())
res = 0

for i in range(1, N+1):
  count = 0
  for j in range(1, i+1):
    if i % j == 0:
      count += 1
  if count == 8 and i % 2 != 0:
    res += 1
print(res)
# Judge status: Accepted
N, D = map(int, input().split())
ans = 0
for _ in range(N):
    x, y = map(int, input().split())
    if x ** 2 + y ** 2 <= D ** 2:
        ans += 1
print(ans)
# Judge status: Accepted
from itertools import combinations_with_replacement

N, M, Q = map(int, input().split())
input_lst = [list(map(int, input().split())) for _ in range(Q)]

max_score = 0
for pattern in combinations_with_replacement(range(1, M + 1), N):
    score = 0
    for row in input_lst:
        a, b, c, d = row
        if pattern[b - 1] - pattern[a - 1] == c:
            score += d
    if score > max_score:
        max_score = score
print(max_score)
# Judge status: Wrong Answer
s = input()
k = int(input())
ans = ''
for i,v in enumerate(s):
    if k <= 0:
        break
    if ord('z') - ord(v) + 1 <= k:
        k -= ord('z') - ord(v) + 1
        ans += 'a'
    else:
        ans += v
k %= 26
last = chr(ord('a')+(ord(ans[-1])-ord('a')+k)%26)

print(ans[:-1]+last)
# Judge status: Accepted
n=int(input())
l=[0]+[int(input())for i in range(n)]
now=1
for i in range(n+5):
    now=l[now]
    if now==2:print(i+1);break
else:print(-1)
# Judge status: Wrong Answer
N = int(input())
S = [input() for i in range(N)]
 
ac = 0
wa = 0
tle = 0
re = 0
for s in S:
  if s == 'AC': ac += 1
  elif s == 'WA': wa += 1
  elif s == 'TLE': tle += 1
  elif s == 'RE': re += 1

print('AC x ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE × ' + str(re))
# Judge status: Accepted
S = input()
print("Heisei" if S <= "2019/04/30" else "TBD")
# Judge status: Wrong Answer
n, r = map(int, input().split())

if n < 10:
    print(100 * (10 - n))
else:
    print(r)
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
need1 = 0
need2 = 0
for i in range(n):
    s = B[i]-A[i]
    if s < 0:
        need1 -= s
    else:
        need2 += s//2
if need1 > need2:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n, m = map(int, input().split())
l = [0] * m
for i in range(n):
  a = list(map(int, input().split()))
  k = a[0]
  for j in range(k):
    l[a[j + 1] - 1] += 1
ans = 0
for i in l:
  if i == n:
    ans += 1
print(ans)
# Judge status: Accepted
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

a,b = map(int,input().split())
if a + b>=24:
    print(a+b-24)
else:
    print(a + b)
# Judge status: Accepted
s = list(input())
n = len(s); flag= 0
if s == s[::-1]:    flag += 1 ;
start, end = 0, ((n-1)//2)-1
while(end > start and flag == 1):
    if not(s[start] == s[end]):        break;
    start += 1 ; end -= 1
else:    flag += 1
start, end = (n+3)//2 -1, (n-1)
while(end > start and flag == 2):
    if not(s[start] == s[end]):        break;
    start += 1 ; end -= 1
else:    flag += 1
print('Yes' if flag == 3 else 'No')
# Judge status: Accepted
n=int(input())
num=int(n**0.5)
ans=float('inf')
for i in range(1,num+1):
    if n%i==0:
        temp=n//i+i-2
        if ans>temp:ans=temp

print(ans)
# Judge status: Wrong Answer
K,N = map(int, input().split())

if 500*K >= N:
    print("yes")
else:
    print("no")
# Judge status: Wrong Answer
n, c, k = map(int, input().split())
T = [0]*n
for i in range(n):
    T[i] = int(input())
T.sort()
T = [0]+T
mx = 0
jk = 0
ans = 0
for i in range(1, n+1):
    mx += T[i]-T[i-1]
    jk += 1
    if jk>=c:
        ans += 1
        jk = 0
    if mx>k:
        ans += 1
        mx = 0
        jk = 0 
print(ans if jk==0 else ans+1)
# Judge status: Wrong Answer
a,b=map(int,input().split())
n=b-a
m=n*(n+1)/2
print(b-m)
# Judge status: Accepted
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
CSF = tuple(tuple(map(int, input().split())) for _ in range(N - 1))

ans = [0] * N
for i in range(N):
    time = 0
    for j in range(i, N - 1):
        c, s, f = CSF[j]
        d = max(0, time - s)
        ride = (d + f - 1) // f
        time = s + ride * f + c
    ans[i] = time

print(*ans, sep="\n")
# Judge status: Accepted
# 素因数分解
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, b = map(int,input().split())
aa = prime_factorize(a)
bb = prime_factorize(b)
ab = list(set(aa) & set(bb))
ab.sort()
print(len(ab)+1)
# Judge status: Wrong Answer
ans = 0
n = int(input())
a = list(map(int, input().split()))
for i in range(1,n-1):
  if a[i-1] < a[i] < a[i+1]:
    ans += 1
print(ans)
# Judge status: Accepted
x,y,z = list(map(int,input().split()))

x -= z

print(x//(y+z))
# Judge status: Wrong Answer
import collections
N = int(input())
A = list(map(int,input().split()))

#index,h
pp =[]
pm = []
all_set = set()
for i in range(N):

    pp.append(i + A[i])
    pm.append( i - A[i])

count = 0
c = collections.Counter(pp)
print(c)
for i in range(N):
    count += c[pm[i]] 
    print(c[pm[i]])

    #count += pp.count(pm[i])
    #count += pm.count(pp[i])

print(count)
# Judge status: Accepted
n = int(input())
A = []
B = []
for i in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
A.reverse()
B.reverse()
c = 0
for i in range(n):
    A[i] += c
    if A[i] % B[i] != 0:
        c += (B[i] - A[i] % B[i])
        A[i] += c
print(c)
# Judge status: Wrong Answer
N,M,Q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(Q)]

max = 0
a = ['1']*N
b = [str(M)]*N
a = int(''.join(a))
b = int(''.join(b))

for x in range(a,b+1):
	x=str(x)
	tmp_sum=0
	for i in range(Q):
		if int(x[abcd[i][1]-1])-int(x[abcd[i][0]-1])==abcd[i][2]:
			tmp_sum+=abcd[i][3]
	if max<tmp_sum:
		max=tmp_sum
print(max)
# Judge status: Wrong Answer
S=input()
Q=int(input())
query=[list(map(str,input().split())) for _ in range(Q)]

ans=[S]
for q in query:
  if len(q)==1:
    ans=ans[::-1]
  else:
    _,f,c=q
    if f=='1':
      ans.insert(0,c)
    else:
      ans.append(c)
print(*ans,sep='')
# Judge status: Accepted
n = int(input())

s = []
for _ in range(n):
    s.append(input())

it = iter(s)
for p, ne in zip(it, it):
    if p[-1] != ne[0]:
        print("No")
        exit()

if s[-2][-1] != s[-1][0]:
    print("No")
    exit()

if len(set(s)) == n:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
# BFS
from collections import deque

N=int(input())

dp = [-1] * 200005;
q = deque()

g = [1]
a = 6
while a <= 100000:
  g.append(a)
  a *= 6
a = 9
while a <= 100000:
  g.append(a)
  a *= 9
g.sort(reverse=True)

dp[0] = 0
q.append(0)

while len(q) > 0:
  v = q.popleft()
  if v == N: break
  for j in g:
    if dp[v+j] != -1: continue
    if v+j > N: continue
    dp[v+j] = dp[v] + 1
    q.append(v+j)

print(dp[N])
# Judge status: Accepted
S = input()
K = int(input())
ans = 0
for i in range(K):
    if S[i]!="1":
        ans = S[i]
        break
print(1) if ans==0 else print(ans)
# Judge status: Wrong Answer
s = list(input())
t = list(input())
n = len(s)
m = len(t)

tp = 0
for i in range(n):
    if s[i] == t[tp] or s[i] == '?':
        tp += 1
    else:
        tp = 0
    if tp == m:
        s[i-m+1: i+1] = t
        s = ['a' if v == '?' else v for v in s]
        print("".join(s))
        exit()

print("UNRESTORABLE")
# Judge status: Accepted
N, K = map(int, input().split())

import math

print(math.ceil(N / K) - (N // K))
# Judge status: Accepted
x, y = map(int, input().split())
X, Y = 0, 0
l = [4, 6, 9, 11]
if x == 2:
  X = 3
elif x in l:
  X = 2
else:
  X = 1
if y == 2:
  Y = 3
elif y in l:
  Y = 2
else:
  Y = 1
if X == Y:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 0
if 1 not in a:
  ans = -1
else:
  k = 1
  for i in range(n):
    if a[i] == k:
      k += 1
    else:
      ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
min = 10**6
ans = 0
for i in range(n):
    if p[i] <= min:
        min = p[i]
        ans += 1
        # print(i)
print(ans)
# Judge status: Wrong Answer
N = int(input())
S = [input() for _ in range(N)] #N行に1文字入力したい
A = S.count("AC")
B = S.count("WA")
C = S.count("TLE")
D = S.count("RE")
print("AC"+"×" + str(A))
print("WA"+"×" + str(B))
print("TLE"+"×" + str(C))
print("RE"+"×" + str(D))
# Judge status: Wrong Answer
from math import floor

n = int(input())
if n % 2 == 1:
    print(0)
else:
    num = 10
    ans = 0
    while num < n:
        ans += floor(n / num)
        num *= 5
    print(ans)
# Judge status: Wrong Answer
import fractions

N, M = map(int, input().split())
l_in = map(int, input().split())
l_num = []
lcm = 1
for i in l_in:
  if i // 2 not in l_num:
    l_num.append(i // 2)
    lcm = lcm * (i // 2) // fractions.gcd(lcm, i // 2)

d_max = M // lcm
if d_max % 2 == 1:
  d_max += 1

print(d_max // 2)
# Judge status: Accepted
#!/usr/bin/env python3

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

ans = set([])

for i in range(a, min(a+k, b)):
    ans.add(i)

for i in range(max(a, b-k+1), b+1):
    ans.add(i)

for i in sorted(list(ans)):
    print(i)
# Judge status: Accepted
N,M = input().split()

if N==M:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a, b = map(int,input().split(' '))

if ((a * b) % 2 ) == 0:
    print('Even')
else:
    print('Odd')
# Judge status: Accepted
s = input()
r = s[:3]+'8'+s[4:]
print(r)
# Judge status: Accepted
n = int(input())
quo = int(n/1.08)
temp = 0
while temp<= n:
  temp = int(quo*1.08)
  if temp == n:
    print(quo)
    break
  quo = quo+1
if temp > n:
  print(':(')
# Judge status: Accepted
A, B = map(int, open(0).read().split())
if A <= 5:
    print(0)
elif 6 <= A <= 12:
    print(B // 2)
else:
    print(B)
# Judge status: Accepted
S = input()
a = len(S)
z = 0
for i in range(len(S)):
    if S[i] == 'A':
        a = min(a,i)
    if S[i] == 'Z':
        z = max(z,i)
print(z-a+1)
# Judge status: Wrong Answer
l=list(map(int,input().split()))
if l.count(5)==2 and l.count(7)==1 and len(l)==3:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
def main():
    N, A, B = (int(i) for i in input().split())
    if (N == 1 and A != B) or (B - A < 0):
        print(0)
    elif N == 1:
        print(1)
    elif N == 2:
        print(1)
    elif B - A == 1 and N == 3:
        print(B - A + 1)
    else:
        print(2*B - 2*A + 1)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import itertools


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

l = list(itertools.permutations(p))

l.sort()

p_i = 0
q_i = 0

for i in range(len(l)):
    if list(l[i]) == p:
        p_i = i
    elif list(l[i]) == q:
        q_i = i

print(abs(p_i - q_i))
# Judge status: Accepted
S = input()
N = len(S)

tmp1, tmp2 = [], []
flag = 0
for i in range(int((N-1)/2)):
  tmp1.append(S[i])
for i in range(int((N+3)/2)-1,N):
  tmp2.append(S[i])
#print(tmp1, tmp2)
if tmp1 == tmp2:
  flag = 1
  
if flag == 1:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
# ABC-106-C
S = input().rstrip()
K = int(input())


for s in S[:K]:
    if s != '1':
        print(s)
        exit()
print(1)
# Judge status: Accepted
a=input()
b=input()
if b[::-1]==a:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
s = input()
print(["no", "yes"][len(s) == len(set(s))])
# Judge status: Accepted
import sys
read=sys.stdin.read

def main():
  n,h,*ab=map(int,read().split())
  tops=max(ab[0::2])
  tlst=[b for b in ab[1::2] if b>tops]
  tlst.sort(reverse=True)
  i=-1
  t=0
  for i,t in enumerate(tlst):
    h-=t
    if h<=0:
      h=0
      break
  print(h//tops+(h%tops>0)+i+1)

if __name__=='__main__':
  main()
# Judge status: Wrong Answer
T = list(input())

for i in reversed(range(len(T))):
    if T[i] == '?':
        if i == len(T)-1:
            T[i] = 'D'
        else:
            if T[i+1] == 'D':
                T[i] = 'P'
            else:
                T[i] = 'D'
    else:
        continue

print(''.join(T))
# Judge status: Accepted
import heapq
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    N,M = map(int,input().split())
    A = list(map(int,input().split()))
    A = list(map(lambda x: x*(-1),A))

    heapq.heapify(A)

    for _ in range(M):
        max_value = heapq.heappop(A) * (-1)
        heapq.heappush(A,max_value//2 * (-1))

    print(sum(A) * (-1))

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import math
import itertools
#n = int(input())
#n, d = list(input().split())
A, B, X= list(map(int, input().split()))

if A == X or (A < X and A+B > X) :
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
# coding:utf-8
import math
import fractions

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

if K==0:
    print("N")
elif N==0 or N%K==0:
    print("0")
else:
    a=fractions.gcd(N,K)
    N=N%K
    N=int(N/a)
    K=int(K/a)
    mi=N
    t=N
    for i in range(100):
        t=abs(t-K)
        mi=min(mi,t)
    print(mi*a)
# Judge status: Wrong Answer
# -*- coding : utf - 8 -*-

w = input()

for i in range(len(w)):
  if w.count(w[i]) % 2 != 0:
    print("NO")
    exit()
    
print("Yes")
# Judge status: Accepted
A,B = input().split()
C = int(A) * int(B)

print(int(C))
# Judge status: Accepted
from decimal import Decimal
a,b,c=map(Decimal,input().split())
heiho=Decimal(0.5)
A=a**heiho
B=b**heiho
C=c**heiho
if A+B<C:
    print("Yes")
else:
    print("No")
# Judge status: Accepted

L,R,d = map(int,input().split())

count=0
for i in range(L,R+1):
    if i%d==0:
        count+=1
        
print(count)
# Judge status: Wrong Answer
c = [list(map(int, input().split())) for _ in range(3)]
# 回答例を見ると 「各列に対して 行ごとの変化量が等しい」ことが分かる.
# 実際,a_i + b_j = c_ij が成り立つならば
# a_1 = c_11 - b_1 = c_12 - b_2 = c_13 - b_3 が成り立つ.
if c[0][1] - c[0][0] == c[1][1] - c[1][0] == c[2][1] - c[2][0]:
    if c[0][2] - c[0][1] == c[1][2] - c[1][1] == c[2][2] - c[2][1]:
        print('Yes')
print('No')
# Judge status: Accepted
import math
n,d = map(int,input().split())
list_x = [[int(i) for i in input().split()] for _ in range(n)]
count = 0
for i in range(n):
    for j in range(i+1,n):
        sum_ = 0
        for k in range(d):
            sum_ += (list_x[i][k] - list_x[j][k])**2
        if math.sqrt(sum_) ==(math.sqrt(sum_))//1:
            count += 1
print(count)
# Judge status: Wrong Answer
N = int(input())
S = [input() for i in range(N)]

for i in range(N-1):
    for s in S[i+1:]:
        if S[i] == s:
            N -= 1
            break
if N == 1:  
    print(0)
else:
    print(N)
# Judge status: Wrong Answer
x, y = map(int, input().split())

A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]

if x in A:
    x = "A"
if x in B:
    x = "B"
else:
    x = "C"

if y in A:
    y = "A"
if y in B:
    y = "B"
else:
    y = "C"

if x == y:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
l = sorted(set(map(int, input().split())))
n = len(l)
ans = 0
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] > l[k]:
        ans += 1
print(ans)
# Judge status: Wrong Answer
from collections import Counter

S = input()
T = input()

alps_counter_s = Counter()
alps_counter_t = Counter()

for s in S:
  alps_counter_s[s] += 1

for t in T:
  alps_counter_t[t] += 1

if len(alps_counter_s.values()) == len(alps_counter_t.values()):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n1 = int(input())
cnt_dict = {}
for _ in range(n1):
  s = input()
  if s not in cnt_dict:
    cnt_dict[s] = 1
  else:
    cnt_dict[s] += 1
n2 = int(input())
for _ in range(n2):
  s = input()
  if s not in cnt_dict:
    cnt_dict[s] = -1
  else:
    cnt_dict[s] -= 1
print(max(max(cnt_dict.values()),0))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
print(A)

count = 0
for i in A:
    for j in A[count+1:]:
        if i == j:
            print("Yes")
            break
    else:
        count += 1
        continue
    break
else:
    print("No")
# Judge status: Wrong Answer
i, j = map(int, input().split())
MOD = 2019
ans = float("inf")
for x in range(i, min(j+1, i+MOD)):
    for y in range(i+1, min(j+1, i+MOD)):
        ans = min(ans, x%MOD * y%MOD)
print(ans)
# Judge status: Accepted
Sa=list(input())
Sb=list(input())
Sc=list(input())
Sa.append("*")
Sb.append("*")
Sc.append("*")
table=[Sa,Sb,Sc]

#print(table)
#input()
id=0
while True:
    if table[id][0]=="*":
        print(chr(id+65))
        break
    newid=ord(table[id][0])-97
    table[id]=table[id][1:]
    #print(table)
    id=newid
# Judge status: Wrong Answer
S=input()
N=len(S)
for j in range(1,N//2):
    M=N-2*j
    c=0
    for i in range(M//2):
        if S[i]==S[i+M//2]:
            c=c+1
            if c==M//2:
                print(M)
                break
    else:
        continue
# Judge status: Accepted
x,y,_,_,_ = map(int,raw_input().split(' '))

a,b,c = map(int, raw_input().split(' ')),map(int, raw_input().split(' ')),map(int, raw_input().split(' '))
a.sort(key = lambda x:-x)
b.sort(key = lambda x:-x)
c.sort(key = lambda x:-x)
r = a[:x] + b[:y]
r.sort()

i,j = 0,0
while(j < len(c) and i < len(r)):
	if c[j] > r[i]:
		r[i] = c[j]
		i +=1
	else:
		break
	j +=1

print sum(r)
# Judge status: Wrong Answer
A,B = map(int,input().split())
if A >= B:
    print(1)
else:
    B-=A
    A-=1
    print(-(-B//A)+1)
# Judge status: Accepted
K, X = map(int, input().split())
a = []
for i in range(X - K + 1, X + K):
    a.append(i)
print(' '.join(map(str, a)))
# Judge status: Wrong Answer
list_a=list(map(int, input().split()))
result=1
for a in list_a:
  result = result*a
  
if result > 10**18:
  print('-1')
else:
  print(result)
# Judge status: Accepted
N=int(input())
W=[str(input()) for i in range(N)]
def main():
    if len(set(W))!=N:
        return 'No'
    for i in range(N):
        j=i+1
        if i<N-1 and W[i][len(W[i])-1]!=W[j][0]:
            return 'No'
            break
        if i==N-1:
            return 'Yes'
            
print(main())
# Judge status: Wrong Answer
n = int(input())
s = input() #sys.stdin.readlineは最後が改行

ans = 0
tmp = 0
for i in reversed(range(n)):
    if s[i] == '.':
        tmp+=1
    elif s[i] == '#':
        ans += tmp
        tmp = 0

print(ans)
# Judge status: Accepted
import math
h,n = map(int,input().split())


a = [0 for _ in range(n)]
b = [0 for _ in range(n)]
for i in range(n):
    a[i], b[i] = map(int,input().split())

dp = []
for i in range(h + max(a)):
    dp.append(pow(2, 31) - 1)
dp[0] = 0

for i in range(1, len(dp)):
    '''
    tmp = dp[i]
    for j in range(n):
        tmp = min(tmp, dp[max(0, i-a[j])] + b[j])
    dp[i] = tmp
    '''
    dp[i] = min(dp[i - A] + B for A, B in zip(a, b))

print(min(dp[h:]))
# Judge status: Wrong Answer
t=list(input())
a=0
for i in range(len(t)):
    if i+1==len(t) and t[i]=="?":
        
        t[i]="D"
        break
    if t[i]=="?" and t[i-1]=="D":
        t[i]="P"
    elif  t[i]=="?" and t[i-1]=="P":
        t[i]="D"

    
b=""
for i in range(len(t)):
    b+=t[i]
print(b)
# Judge status: Accepted
a,b,c=map(int,input().split())
if (a+b)>=c:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import math
N,M=map(int,input().split())
mylist=list(map(int,input().split()))


while M>0:
    mylist.sort(reverse=True)
    mylist[0]/=2
    M-=1
    
mylist=[math.floor(i) for i in mylist]
print(mylist)
print(sum(mylist))