peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())

out = ""
s1 = input()
s = [list(input()) for _ in range(n-1)]

for i in s1:
    if all([i in x for x in s]):
        out += i
        for j in s:
            j.remove(i)


print("".join(sorted(out)))
# Judge status: Accepted
S=input()
l=list(S)
l.sort()

if(l[0]=="a")and(l[1]=="b")and(l[2]=="c"):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
L1 = input().split()
L2 = input().split()
H, N = int(L1[0]), int(L1[1])

d = 0
for i in L2:
    d += int(i)

if d < H:
    print("NO")
else:
    print("YES")
# Judge status: Accepted
X=int(input())
for i in range(1,X+1):
    tmp=(1+i)*i/2
    if(tmp>=X):
        ans=i
        break
print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
print(a*b//2)
# Judge status: Wrong Answer
a,b = map(int,input().split())
if abs(a-b) < 2:
  print(a+b)
else:
  print(2*max(a,b) + 1)
# Judge status: Accepted
w, a, b = map(int, input().split())
ans = max(a, b) - min(a, b) - w
print(max(ans, 0))
# Judge status: Wrong Answer
n, x = map(int, input().split())
lis = list(map(int, input().split()))

if n == 1:
    print(abs(lis[0] - x))
    exit()

lis.append(x)
lis = sorted(lis)

ans = 10**9 + 7

for i in range(n-1):
    ans = min(ans, abs(lis[i+1] - lis[i]))

print(ans)
# Judge status: Accepted
n, q = list(map(int, input().split()))

s = list(input())

a = [0] * (n+1)

for i in range(1, n):
    if s[i-1] == "A" and s[i] == "C":
        a[i+1] = a[i] + 1
    else:
        a[i+1] = a[i]

for j in range(q):
    l, r = list(map(int, input().split()))
    print(a[r] - a[l])
# Judge status: Wrong Answer
#import matplotlib.pyplot as plt

def main():
    a,b,n = map(int,input().split())
    mx = 0
    for x in range(0,min(a+1,n+1)):
        left = int(a*x/b)
        right = a * int(x/b)
        print("x=",x,"floor(Ax/B)=",int(a*x//b),"A*floor(x/B)=",a * int(x // b),"answer=",left-right)
        #right.append(a * int(x/b))

        mx = max(left-right,mx)
    print(mx)


    #plt.plot(list(range(len(right))),right,label="test")


if __name__ == '__main__':
    main()
# Judge status: Accepted
n,m = map(int,input().split())

ans = 0

if 2*n >= m:
    ans = m//2
else:
    ans = n
    m = m - 2 * n
    ans += m//4


print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
c=(a+b)/2
if c==int(c):
  print(int(c))
else:
  print("IMPOSSIBLE")
# Judge status: Accepted
from collections import Counter
n=int(input())
s=Counter(input())
for i in range(n-1):
    s&=Counter(input())
print(''.join(sorted(s.elements())))
# Judge status: Wrong Answer
x,a,b=map(int,raw_input().split())
if a-x < b-x:
  print "A"
elif a-x > b-x:
  print "B"
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())

ans = "U"*(ty-sy)
ans += "R"*(tx-sx)
ans += "D"*(ty-sy)
ans += "L"*(tx-sx)

ans += "L"
ans += "U"*(ty-sy+1)
ans += "R"*(tx-sx+1)
ans += "DR"
ans += "D"*(ty-sy+1)
ans += "L"*(tx-sx+1)
ans += "U"

print(ans)
# Judge status: Accepted
ABCD = input()
n = len(ABCD)
for i in range(1<<(n-1)):
  s = int(ABCD[0])
  for j in range(n-1):
    if i>>j & 1:  # T: +, F: -
      s += int(ABCD[j+1])
    else:
      s -= int(ABCD[j+1])
  if s == 7:
    break
r = [ABCD[0]]
for k in range(n-1):
  if i>>k & 1:
    r.append('+')
  else:
    r.append('-')
  r.append(ABCD[k+1])
print('{}=7'.format(''.join(r)))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 0
mod = 10**9+7
for i in range(60):
  j = 1<<i
  cnt = sum((k & j) >> i for k in a)
  ans += (cnt*(n-cnt))<<i
  ans%= mod
print(ans)
# Judge status: Accepted
t = str(input())
t_bara = list(t)

for i in range(len(t_bara)):
    if t_bara[i] == "?":
        t_bara[i]= t_bara[i].replace("?","D")

print(''.join(t_bara))
# Judge status: Accepted
n, k = map(int, input().split())
ab = []
for i in range(n):
  a, b = map(int, input().split())
  ab.append([a, b])
ab.sort()
for a, b in ab:
  k -= b
  if k <= 0:
    break
print(a)
# 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.sort()
B.sort()
if N % 2 == 0:
    n = N // 2
    print(B[n] + B[n - 1] - A[n] - A[n - 1] + 1)
else:
    n = N // 2
    print((B[n] - A[n] + 1))
# Judge status: Accepted
s = str(input())
print(s[0:3])
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))
A = sorted(A)
from bisect import bisect_left
ans = 0
for i in range(1, A[-1]+1):
  cnt = bisect_left(A, i+2) - bisect_left(A, i-1)
  ans = max(ans, cnt)
  #print(i, cnt)
print(ans)
# Judge status: Wrong Answer
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    N,=pin()
    A=tupin()
    
    from fractions import gcd

    temp=A[0]
    for i in range(N-1):
          temp=gcd(temp,A[i])
    print(temp)
#%%submit!
resolve()
# Judge status: Accepted
#!/usr/bin/env python3

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

ans = 0
if (b-a)%2 == 0:
    ans = (b-a)//2
else:
    if a-1 >= n-b:
        ans = n + (1-a-b)//2
    else:
        ans = (a+b)//2

print(int(ans))
# Judge status: Accepted
"""
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)

N = int(readline())
S = [int(x) - ord('A') for x in readline().rstrip()]
S = [(x + N)%26 for x in S]

ans = ''.join(chr(x+ord('A')) for x in S)
print(ans)
# Judge status: Wrong Answer
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

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

c=0

for i in range(0,n):
  if i!=a and i!=b:
    c+=combinations_count(n, i)

print(c%((10**9)+7))
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
cnt = 0
if a == b and b == c:
  print(-1)
  exit()
while cnt >= 0:
  if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
    print(cnt)
    exit()
  else:
    a1 = (b + c) // 2
    b1 = (a + c) // 2
    c1 = (a + b) // 2
    a = a1
    b = b1
    c = c1
    cnt += 1
print(cnt)
# Judge status: Accepted
A = int(input())
B = int(input())

l = [1, 2, 3]
l.remove(A)
l.remove(B)
print(int(l[0]))
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
ans=1
if 0 in A:
    print(0);exit()
for i in range(n):
    ans*=A[i]
    if ans>10**18:
        print(-1);exit()
print(ans)
# Judge status: Wrong Answer
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [input() for _ in range(n)]

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

l.sort()
print(l[2]*10+l[1]-l[0])
# Judge status: Accepted
#!/usr/bin/env python3
x = int(input())
a = int((x * 2)**0.5)
while a * (a + 1) // 2 > x:
    a -= 1
print(a + (a * (a + 1) // 2 != x))
# Judge status: Wrong Answer
a=input()
n=['Sunny','Cloudy','Rainy']
if a==n[2]:
  print(n[0])
else:
  print(n[2-n.index(a)])
# Judge status: Accepted
import sys
readline = sys.stdin.readline

N = readline().strip()

l = len(N)
d = 0
for i in range(l):
  d += int(N[i])

if d%9 == 0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s = input()
n = len(s)

a = [0] * (n + 1)

for i in range(n):
    if s[i] == '<':
        a[i + 1] = max(a[i + 1], a[i] + 1)
for i in range(n - 1, -1, -1):
    if s[i] == '>':
        a[i] = max(a[i], a[i + 1] + 1)

print(sum(a))
# Judge status: Accepted
A = []
for i in range(0, 3):
  a = input().split(' ')
  for j in a:
    A.append(int(j))

# print(A)
N = int(input())

for i in range(0, N):
  data = int(input())
  if data in A:
    A[A.index(data)] = 0

if sum(A[0:3]) == 0 \
or sum(A[3:6]) == 0 \
or sum(A[6:9]) == 0 \
or A[0] + A[4] + A[8] == 0 \
or A[2] + A[4] + A[6] == 0 \
or A[0] + A[3] + A[6] == 0 \
or A[1] + A[4] + A[7] == 0 \
or A[2] + A[5] + A[8] == 0: 
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
A,B,M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
min = A[0]+B[0]
for i in range(M):
  x,y,c = [int(i) for i in input().split()]
  buf = A[x-1]+B[y-1]-c
  print(A[x-1],B[y-1],c)
  if buf<min:
    min = buf
print(min)
# Judge status: Accepted
N = int(input())
A = map(int, input().split())

ni = 0
yon = 0
hoka = 0

for a in A:
    if a % 4 == 0:
        yon += 1
    elif a % 2 == 0:
        ni += 1
    else:
        hoka += 1

if ni > 0:
    if yon >= hoka:
        print("Yes")
    else:
        print("No")
else:
    if yon >= hoka-1:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted

from itertools import accumulate
N = int(input())
A = list(map(int, input().split()))
B = list(accumulate(A))
mod = 10**9+7
ans = 0
sumA = sum(A)

for i in range(N-1):
    ans += A[i] * (sumA-B[i]) % mod
    ans = ans%mod
    
print(ans)
# Judge status: Accepted
N = int(input())
Cac = 0
Cwa = 0
Ctle = 0
Cre = 0
for cnt in range(N):
    Si = input()
    if Si == 'AC':
        Cac = Cac + 1
    elif Si == 'WA':
        Cwa = Cwa + 1
    elif Si == 'TLE':
        Ctle = Ctle + 1
    elif Si == 'RE':
        Cre = Cre + 1

print('AC', 'x', Cac)
print('WA', 'x', Cwa)
print('TLE', 'x', Ctle)
print('RE', 'x', Cre)
# Judge status: Accepted
a=input()
b=input()
if(a[0]==b[2] and a[1]==b[1] and a[2]==b[0]):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
A,B,K=map(int,input().split())

x=A-K
if x<0:
    y=B+x
    A=0
    if y<0:
        B=0
    else:
        B=B+x
else:
    A=A-K

print('{} {}'.format(A,B))
# Judge status: Accepted
W, a, b = map(int, input().split())

if b < a:
    print(a - (b + W))
elif a + W < b:
    print(b - (a + W))
else:
    print(0)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

color = [False for _ in range(8)]
x = 0
for a in A:
    if a >= 3200:
        x += 1
    else:
        tmp = a // 400
        color[tmp] = True

ans = color.count(True)
if ans == 0:
    print(1, ans + x)
else:
    print(ans, ans + x)
# Judge status: Wrong Answer
N = int(input())
S = int(input())
L = N % 500
if L < S:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,m=map(int,input().split())
a=[list(input())for i in range(n)]
b=[list(input()) for i in range(m)]

def judge(i,j):
    for k in range(m):
        for l in range(m):
            if b[k][l]!=a[i+k][j+l]:
                return False
    return True

for i in range(n-m+1):
    for j in range(n-m+1):
        if judge(i,j):
            print('Yes')
            exit()
print('No')
# Judge status: Wrong Answer
import collections
n = int(input())
s = [str(input()) for _ in range(n)]
m = int(input())
t = [str(input()) for _ in range(m)]
s = collections.Counter(s)
t = collections.Counter(t)

for k, j in t.items():
    if k in s:
        s[k] -= j

values, counts = zip(*s.most_common())
print(counts[0])
# Judge status: Accepted
import math
N=int(input())
L=[]
tmp=[]
t=1
for i in range (N):
	t=t*(i+1)
	x,y=map(int,input().split())
	L.append([x,y])
for i in range(N-1):
	for j in range(i+1,N):
		z=math.sqrt((L[i][0]-L[j][0])**2+(L[i][1]-L[j][1])**2)
		tmp.append(z)
print((sum(tmp))*2/N)
# Judge status: Wrong Answer
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    """
    sum[Al,,,Ar] = Sの部分和がちょうどK個。
    """
    n, k, s = map(int, input().split())
    if n == k:
        r = [s] * k
    else:
        if s != 1:
            r = [s] * (k - 1) + [s - 1] * 1 + [1] * 1 + [1000000000] * (n - k)
        else:
            r = [1] * k + [1000000000] * (n - k)
    print(*r, sep=' ')

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
print ("yes" if len(set(input()))==3 else "No")
# Judge status: Accepted
s=input()
ia=None
iz=None
for i,c in enumerate(s):
  if ia==None and c=="A":
    ia=i
  if c=="Z":
    iz=i
print(iz-ia+1)
# Judge status: Accepted
S = input()

print('yes' if len(S) == len(set(S)) else 'no')
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

ma = max(A)
Er = [0 for _ in range(ma + 5)]

for i in range(N):
    temp = A[i]
    if Er[temp] != 2:
        a = 0
        while(1):
            a += 1
            tt = a * temp
            if tt >= ma + 5:
                break
            Er[tt] += 1
        
ans = 0
for i in range(N):
    temp = A[i]
    if Er[temp] == 1:  ans += 1
        
print(ans)
# Judge status: Accepted
n = int(input())
s = str(input())
x = 0
lst = [0]
for i in range(len(s)):
    if s[i]=='I':
        x += 1
    else:
        x -= 1
    lst.append(x)
print(max(lst))
# Judge status: Wrong Answer
X,Y = list(map(int,input().split()))
if X == 1 and Y ==1:
  print(1)
  exit()
if X == 1:
  X = 2
A = Y//X
B = A//2
num = 0
ans = 0
for i in range(1,10000000):
    num += 2**i
    if num > B:
        ans = i+1
        break
if X*(2**ans) <= Y:
    ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
l = [i+a[i] for i in range(n)]
r = [j-a[j] for j in range(n)]
import collections
cl = collections.Counter(l)
cr = collections.Counter(r)
ans = 0
for i in cl.keys():
    if i in cr.keys():
        ans += cl[i]*cr[i]
print(ans)
# Judge status: Wrong Answer
import math

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

if K == 0:
  print(int(max(A)))
  exit()

if N == 1:
  print(math.ceil(A[0]/K))
  exit()


min_A = 0
max_A = max(A)

while( max_A - min_A > 1):
  now = (min_A + max_A) / 2
  temp = 0
  for i in A:
    temp += (i // now)
  if temp > K:
    min_A = now
  else:
    max_A = now
print(math.ceil((min_A + max_A)/2))
# Judge status: Accepted
H, N = map(int, input().split())
magic = [list(map(int, input().split())) for _ in range(N)]


max_magic = 0
for a, _ in magic:
    max_magic = max(max_magic, a)

amount = H + 1
dp = [0] * (amount + max_magic)
dp[0] = 0

ret = float('inf')

for amt in range(1, amount + max_magic):
    t = [dp[amt - a] + b if amt - a >= 0 else float('inf') for a, b in magic]

    dp[amt] = min(t)

    if amt >= H:
        ret = min(dp[amt], ret)

print(ret)
# Judge status: Accepted
a, b = map(int,input().split())

if a % 2 !=0 and b % 2!=0:
    print('Odd')
else:
    print('Even')
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline

N = int(readline())
H = list(map(int, readline().split()))

if N == 1:
    print(0)
    exit()

dp = [0] * N

for i in range(N-2, -1, -1):
    if H[i] >= H[i+1]:
        dp[i] = 1 + dp[i+1]

print(max(dp))
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
total_vote = 0
result = True
for a in A:
    total_vote += a
for m in range(M):
    if A[m] < (total_vote/(4*M)):
        result = False
if result:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
boin=["a","i","u","e","o"]
if input() in boin:
    print("vowel")
else:
    print("consonant")
# 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,c = map(int,input().split())
s = set([a,b,c])
print(len(s))
# Judge status: Wrong Answer
n = int(input())

def dfs(nn):
  if n == nn:
    print("".join(ans))
    return 
  
  for i in ["a", "b", "c"]:
    ans[nn] = i
    dfs(nn+1)

ans = ["0" for i in range(n)]
dfs(0)
# Judge status: Accepted
n, k = map(int, input().split())

a = []

for i in range(k):
    d = int(input())
    temp = [k for k in map(int, input().split())]
    for j in range(d):
        a.append(temp[j])



a = set(a)

print(len(set(range(1,n+1)) - a))
# Judge status: Accepted
X = int(input())
if X >= 30:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,m=map(int,input().split())

yakusuu=[]
import math
for i in range(1,int(math.sqrt(m)+1)):
  if m%i==0:
    yakusuu.append(i)
    yakusuu.append(m//i)
yakusuu.sort()
for num in yakusuu:
  if num>=n:
    print(m//num)
    exit()
# Judge status: Wrong Answer
from operator import itemgetter
N,M=map(int,input().split())
py=[list(map(int,input().split())) for _ in range(M)]
py.sort(key=itemgetter(1))
pre={}
#print(dp)
for i in range(M):
    if py[i][0] not in pre.keys():    
        pre[py[i][0]]=1
    else:
        pre[py[i][0]]+=1
    print(str(py[i][0]).rjust(6,"0")+str(pre[py[i][0]]).rjust(6,"0"))

#print(p)
#print(y)
#print(dp)
# Judge status: Accepted
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]

num_l=[1 for i in range(n)]
bit_l=[1]+[0 for i in range(n-1)]

for x,y in l:
  x-=1
  y-=1
  if bit_l[x]==1 and num_l[x]==1:
    bit_l[x]=0
    bit_l[y]=1
    num_l[x]-=1
    num_l[y]+=1
  elif bit_l[x]==1 and num_l[x]>=2:
    bit_l[y]=1
    num_l[x]-=1
    num_l[y]+=1
  else:
    num_l[x]-=1
    num_l[y]+=1

print(bit_l.count(1))
# Judge status: Accepted
n = int(input())
ans = []
now = n
cou = 1
if n == 0:
    print(0)
    exit()
while True:
    if now == 0:
        break
    if now % (2**cou) == 2**(cou-1):
        ans.append(1)
        now -= (-2)**(cou-1)
    elif now % (2**cou) == 0:
        ans.append(0)
    cou += 1

for i in reversed(range(len(ans))):
    print(ans[i],end="")
print()
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

# 切り上げ
print((h+a-1)//a)
# Judge status: Wrong Answer
print("暑いのか…？")
x=input()
x=int(x)
if -40<=x and x<=40:
    if x>=30:
        print('これは意外っ！猛暑っ！！')
    elif x<30:
        print('やれやれだぜ')
    else:
        print("さては究極生命体だな！！？")
# Judge status: Accepted
s = list(input())
print(len(s) - abs(s.count("1")-s.count("0")))
# Judge status: Wrong Answer
import sys
in1 = sys.stdin.readlines()

#in1 = ['5 15']

K, S = map(int, in1[0].split())

RC = 0
for idx1 in range(K + 1):
    for idx2 in range(K + 1):
        if S - idx1 - idx2 <= K:
            RC += 1

print(RC)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
def abs(x):
    if x>=0:
        return x
    else:
        return x*(-1)
B=[]
for i in range(N):
  B.append(A[i]-i-1)
B.sort()
if N%2==0:
  b=(B[N//2]+B[N//2-1])//2
else:
  b=B[N//2-1]
sad=0
for j in range(N):
  sad=sad+abs(B[j]-b)
print(sad)
# Judge status: Wrong Answer
n = int(input())

a = []
b = []

for i in range(n):
    A, B = [int(i) for i in input().split()]
    a.append(A)
    b.append(B)

works = []

for i in range(n):
    works.append((b[i], a[i]))

works.sort()

t = 0

for b, a in works:
    t += a
    if t > b:
        print('No')
        break

print("Yes")
# Judge status: Accepted
def main():
  n, mods = 0, [1]+[0]*2019
  d = 1
  for i, j in enumerate(reversed(input())):
    # n = (n+int(j)*pow(10, i, 2019))%2019
    n = (n+int(j)*d)%2019
    d=d*10%2019
    mods[n] += 1
  print(sum([i*(i-1)//2 for i in mods]))
main()
# Judge status: Wrong Answer
n, m, x, y = map(int, input().split())
xx = list(map(int, input().split()))
yy = list(map(int, input().split()))
print([x]+xx)
xxx = max(xx + [x])
yyy = min(yy + [y])
if xxx < yyy:
    print("No War")
else:
    print("War")
# Judge status: Wrong Answer
A,B,C=map(int,input().split(" "))
print(C-(A-B))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

A1 = set(A)
A1 = list(A1)
list(A1).sort()

for i in A1:
    print(A.count(i))

for i in range(N-len(A1)):
    print(0)
# Judge status: Wrong Answer
def resolve():
    A, B, C, K= map(int, input().split())

    if A < K:
        if B < (K-A):
            print(A - (K-A-B))
        else:
            print(A)
    else:
        print(A)

if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
def isBatch(s):
    for i in range(len(s)//2):
        if s[i] != s[-i-1]:
            return False
    return True

def main():
    s = input()
    condtion1 = (len(s) - 1) // 2
    condtion2 = (len(s) + 3) // 2
    flag = False
    for i, j in [(1, condtion1), (condtion2, len(s))]:
        if isBatch(s[i-1:j]):
            flag = True
        else:
            flag = False
    if flag:print("Yes")
    else: print("No")

if __name__ == "__main__":
    main()
# Judge status: Accepted
n, m = map(int, input().split())
a = [input() for i in range(n)]
b = "".join([input() for i in range(m)])
ans = "No"
for i in range(n-m+1):
    for j in range(n-m+1):
        s = ""
        for k in range(m):
            s+=a[i+k][j:j+m]
        if s==b:
            ans = "Yes"
print(ans)
# Judge status: Wrong Answer
n,k = map(int,input().split())
a = list(map(int,input().split()))

t = 1
tl = [1]
ts = {1}
for i in range(len(a)):

    t = a[t-1]
    if t in ts:
        break
    else:
        tl.append(t)
        ts.add(t)

tl2 = tl[tl.index(t):len(tl)]

print(tl)
print(tl2)

if k < len(tl):
    ans = tl[k]
else:
    k = k - (len(tl) - len(tl2))
    j = k % len(tl2)
    ans = tl2[j]

print(ans)
# Judge status: Wrong Answer
n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
a,b = y[n//2],y[n//2-1]

for xi in x:
    if xi == a:
        print(b)
    else:
        print(a)
# Judge status: Wrong Answer
import math
A,B,C = map(int,input().split())

if B/A>C:
    print(C)
elif B/A<C:
    print(math.floor(B/A))
# Judge status: Accepted
from collections import Counter

a, b, ab, x, y = map(int, input().split())

if a+b >= ab*2:
    if x < y:
        less, more = x, y
        cost_l, cost_m = a, b
    else:
        less, more = y, x
        cost_l, cost_m = b, a
    
    cost = less*ab*2
    more -= less
    less = 0

    if cost_m < ab * 2:
        cost += more*cost_m
    else:
        cost += more*ab*2

    print(cost)
else:
    print(a*x+b*y)
# Judge status: Wrong Answer
n,t = map(int, input().split())
y = 10**5
c = [list(map(int,input().split())) for i in range(n)]
for i in range(n):
    if c[i][1]<t:
        y=min(y,c[i][0])
if y != 10**5:
    print(y)
else:
    print("TLE")
# Judge status: Accepted
def main():
    x = int(input())

    tmp = 100
    for i in range(1,10**10):
        tmp = int(tmp*1.01)
        if tmp >= x:
            print(i)
            return


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
d=Counter(a)
ans=0
for k, v in d.items():
    if v != k:
        ans+=min(v, abs(k-v))
print(ans)
# Judge status: Accepted

A = int(input())
B = int(input())

for i in range(1, 4):
    if i != A and i != B:
        print(i)
        break
# Judge status: Accepted
n = int(input())

s = input()
cnt = s.count('R') * s.count('G') * s.count('B')

for i in range(n):
    for j in range(n):
        if 0 <= i - j <= i and 0 <= i + j <= n-1:
            x1, x2, x3 = s[i - j], s[i], s[i + j]
            if x1 != x2 and x1 != x3 and x2 != x3:
                cnt -= 1
print(cnt)
# Judge status: Wrong Answer
N = int(input())
A = int(input())

if (N%500) < A:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
W, H, N = map(int, sys.stdin.readline().split(" "))
Map = [list(map(int,sys.stdin.readline().split(" "))) for i in range(N)]
L = 0
R = W
B = 0
T = H

for i in Map:
  if i[2] == 1:
    l = i[0]
    L = max(L, l)
  if i[2] == 2:
    r = i[0]
    R = min(R, r)
  if i[2] == 3:
    b = i[0]
    B = max(B, b)
  if i[2] == 4:
    t = i[0]
    T = min(T, t)
    
print((R - L) * (T - B))
# Judge status: Accepted
alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
n = int(input())
ans = []
a = 0
for num in range(1, 12):
  a += 26 ** num
  if n <= a:
    n -= (a - 26 ** num)
    break

for i in range(num, 0, -1):
  for j in range(26):
    if n <= 26 ** (i-1) * (j+1):
      n -= 26 ** (i-1) * j
      ans.append(alpha[j])
      break

print("".join(ans))
# Judge status: Wrong Answer
# print('input >>')
N = input()
N = reversed(N)
ans = 0
nxt = False
for n in N:
    i_n = int(n) + nxt
    if i_n % 10 >= 6:
        ans += 10 - i_n % 10
        nxt = True
    else:
        ans += i_n % 10
        nxt = False
    # print(N, ans)
 
# print('-----output-----')
print(ans)