Problem:
 Score : 200 points    Problem Statement You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels. A pixel is the smallest element of an image, and in this problem it is a square of size 1×1 . Also, the given images are binary images, and the color of each pixel is either white or black.  In the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel. The image A is given as N strings A_1,...,A_N . The j -th character in the string A_i corresponds to the pixel at the i -th row and j -th column of the image A  (1≦i,j≦N) . Similarly, the template image B is given as M strings B_1,...,B_M . The j -th character in the string B_i corresponds to the pixel at the i -th row and j -th column of the template image B  (1≦i,j≦M) .  Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.      Constraints  1≦M≦N≦50   A_i is a string of length N consisting of # and . .  B_i is a string of length M consisting of # and . .         Input The input is given from Standard Input in the following format:  N  M  A_1  A_2  :  A_N  B_1  B_2  :  B_M       Output Print Yes if the template image B is contained in the image A . Print No otherwise.        Sample Input 1 3 2
#.#
.#.
#.#
#.
.#      Sample Output 1 Yes  The template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A . Thus, the output should be Yes .       Sample Input 2 4 1
....
....
....
....
#      Sample Output 2 No  The template image B , composed of a black pixel, is not contained in the image A composed of white pixels.

Solution (Python):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

def main():

    for i in range(n-m+1):
        for j in range(n-m+1):
            if match(i, j):
                print("Yes")
                exit()
    
    print("No")

def match(x, y):
    for i in range(m):
        for j in range(m):
            if (a[x+i][y+j] != b[i][j]):
                return False

    return True

if __name__ == "__main__":
    main()

Solution (Python):
n, m = list(map(int, input().split()))
a = [input() for i in range(n)]
b = [input() for i in range(m)]

flag = False
for i in range(n-m+1):
    for k in range(n-m+1):
        part = []
        for j in range(m):
            part.append(a[k+j][i:i+m])
        if b == part:
            flag = True

if flag:
    print("Yes")
else:
    print("No")

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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


def match(x, y):
    for i in range(m):
        for j in range(m):
            if (a[y + i][x + j] != b[i][j]):
                return False
    return True


for i in range(n - m + 1):
    for j in range(n - m + 1):
        if (a[i][j] == b[0][0] and match(i, j)):
            print("Yes")
            exit(0)
print("No")

Solution (Python):
import sys

def hantei(x,y,m):
    for h in range(m):
        if A[h+y][x:x+m]!=B[h]:
            return False
    else:
        return True
            
n,m =map(int,input().split())
A=[]
B=[]
for i in range(n):
    A.append(input())
for j in range(m):
    B.append(input())  

for y in range(n-m+1):
    for x in range(n-m+1):
        if hantei(x,y,m):
            print("Yes")
            sys.exit()
        else: continue
print("No")

Solution (Python):
n, m = map(int, input().split())
a = []
for _ in range(n):
    a.append(input())

b = []
for _ in range(m):
    b.append(input())

for sy in range(n):
    for sx in range(n):
        
        if sy + m - 1 >= n or sx + m - 1 >= n:
            break

        ok = True
        for y in range(m):
            for x in range(m):
                if a[sy + y][sx + x] != b[y][x]:
                    ok = False
        if ok:
            print('Yes')
            exit()
print('No')

Solution (Python):
n,m = map(int,input().split())
N = []
for _ in range(n):
  N.append(input())
M = []
for _ in range(m):
  M.append(input())
for i in range(n-m+1):
  for j in range(n-m+1):
    for k in range(m):
      if M[k] != N[i+k][j:j+m]:
        break
    else:
      print('Yes')
      break
  else:
    continue
  break
else:
  print('No')

Solution (Python):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
ans = 'No'
def match(i, j):
  for k in range(M):
    for l in range(M):
      if A[i+k][j+l] != B[k][l]:
        return False
  return True
for i in range(N-M+1):
  for j in range(N-M+1):
    if match(i, j):
      ans = 'Yes'
      break
print(ans)

Solution (Python):
n, m = map(int, input().split())
a = [list(input()) for _ in range(n)]
b = [list(input()) for _ in range(m)]
for i in range(n - m + 1):
    for j in range(n - m + 1):
        bb = True
        for k in range(i, i + m):
            for l in range(j, j + m):
                if a[k][l] != b[k-i][l-j]:
                    bb = False
        if bb:
            print("Yes")
            exit()
print("No")

Solution (Python):
n,m=map(int,input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]

r=any([r[j:j+m] for r in a[i:i+m]]==b for i in range(n-m+1) for j in range(n-m+1))

print('Yes' if r else 'No')

Solution (Python):
n,m=map(int,input().split())
a=[]
b=[]
for i in range(n):
    a.append(list(str(input())))
for i in range(m):
    b.append(list(str(input())))
f2=True
for y in range(n-m+1):
    for x in range(n-m+1):
        f=True
        for dy in range(m):
            for dx in range(m):
                if b[dy][dx]!=a[y+dy][x+dx]:
                    f=False
        if f:
             f2=False
print("YNeos"[f2::2])

Solution (Python):
n,m = map(int, input().rstrip().split())
x = list()
y = list()

for i in range(n):
    x.append(input().rstrip())
for i in range(m):
    y.append(input().rstrip())

for i in range(n-m+1):
    for j in range(n-m+1):
        z = True
        for k in range(m):
            for l in range(m):
                if x[i+k][j+l] != y[k][l]:
                    z = False
                    break
            if not z: break
        if z:
            print("Yes")
            exit()
print("No")

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

ans = "No"
for x in range(0,n-m+1):
    for y in range(0,n-m+1):
        bina = True
        for i in range(m):
            for j in range(m):
                if a[x+i][y+j] != b[i][j]:
                    bina = False
        if bina:
            ans = "Yes"

print(ans)

Solution (Python):
n,m = map(int,input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]
for i in range(n-m+1):
  for j in range(n-m+1):
    count = 0
    for x in range(m):
      for y in range(m):
        if b[x][y]!=a[i+x][j+y]:
          break
        else:
          count += 1
    if count == m**2:
      print('Yes')
      exit()
print('No')

Solution (Python):
def solve():
    N, M = map(int, input().split())
    A = []
    B = []
 
    for i in range(N):
        A.append(input())
    for i in range(M):
        B.append(input())
 
    for i in range(N - M + 1):
        for j in range(N - M + 1):
            for k in range(M):
                s1 = A[i + k][j:j + M]
                s2 = B[k]
                if s1 != s2:
                    break
            else:
                print('Yes')
                return None
 
    print('No')
 
if __name__ == '__main__':
    solve()

Solution (Python):
N, M = [int(x) for x in input().split()]

A = [None]*N
for i in range(N):
    A[i] = input()

B = [None]*M
for i in range(M):
    B[i] = input()

def check():
    for x in range(N-M+1):
        for y in range(N-M+1):
            match = True
            for r in range(M):
                if not all(A[r+x][c+y] == B[r][c] for c in range(M)):
                    match = False
                    break
            if match:
                return "Yes"

    return "No"
print(check())

Solution (Python):
import itertools
N,M = map(int, input().strip().split(' '))
A = [input().strip() for _ in range(N)]
B = [input().strip() for _ in range(M)]
for i,j in itertools.product(range(N-M+1), repeat=2):
  if sum(A[y+i][j:j+M] == B[y] for y in range(M)) == M:
    print('Yes')
    exit()
print('No')

Solution (Python):



def main():
    n, m = map(int, input().split())
    a = [list(input()) for _ in range(n)]
    b = [list(input()) for _ in range(m)]

    for i in range(n - m + 1):
        for j in range(n - m + 1):
            count = 0

            for k in range(i, i + m):
                for l in range(j, j + m):
                    if a[k][l] == b[k - i][l - j]:
                        count += 1

            if count == m ** 2:
                print('Yes')
                exit()

    print('No')


if __name__ == '__main__':
    main()

Solution (Python):
import sys
N, M = map(int, input().split())
aLst = list(input() for i in range(N))
bLst = list(input() for i in range(M))
ans = False
cnt = 0
for j in range(N - M + 1):
    for k in range(N - M + 1):
        if aLst[j][k:k + M] == bLst[0]:
            cnt += 1
            for l in range(1, M):
                if aLst[j + l][k:k + M] == bLst[l]:
                    cnt += 1
                else:
                    break

            if cnt == M:
                print('Yes')
                sys.exit()
            cnt = 0

print('No')

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

for i in range(n-m+1):
	for j in range(n-m+1):
		cnt=0
		for x in range(m):
			for y in range(m):
				if b[x][y]!=a[i+x][j+y]:
					break
				else:
					cnt+=1
		if cnt==m**2:
			print("Yes")
			exit()
print("No")

Solution (Python):
N,M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

def is_match(i, j):
  
  for xb in range(M):
    for yb in range(M):
      xa = xb+i
      ya = yb+j
      
      if B[xb][yb] != A[xa][ya]:
        return False
  return True


for i in range(N-M+1):
  for j in range(N-M+1):
    
    if is_match(i, j):
      print("Yes")
      exit()
print("No")

Solution (Python):
N, M = map(int, input().split())
photo_a = [list(input()) for _ in range(N)]
photo_b = [list(input()) for _ in range(M)]

for i in range(N):
  if i + M > N:
    break
  for j in range(N):
    if j + M > N:
      break
    same = True
    for k in range(i, i+M):
      for l in range(j, j+M):
        if photo_a[k][l] != photo_b[k-i][l-j]:
          same = False
          break
      else:
        continue
      break
    if same:
      print('Yes')
      exit()
print('No')

Solution (Python):

n, m = [int(el) for el in input().split(' ')]
A = [list(input()) for i in range(n)]
B = [list(input()) for i in range(m)]

def compute():

    for i in range(n-m+1):
        for j in range(n-m+1):
            sub_A = [a[j:j+m] for a in A[i:i+m]]
            if sub_A == B:
                return('Yes')
    else:
        return('No')

print(compute())

Solution (Python):
def main():
    N, M = map(int, input().split())
    A = [input() for _ in range(N)]
    B = [input() for _ in range(M)]
    for i in range(N):
        for j in range(N):
            f = True
            for k in range(M):
                for l in range(M):
                    if i + k >= N or j + l >= N:
                        f = False
                        break
                    if A[i + k][j + l] != B[k][l]:
                        f = False
                        break
                if f is False:
                    break
            if f is True:
                print('Yes')
                exit()
    print('No')


main()

Solution (Python):
n,m = list(map(int,input().split()))
import numpy as np
A = np.zeros([n,n]).astype(np.int)
B = np.zeros([m,m]).astype(np.int)
for i in range(n):
    A[i,:] = [1 if s == '
for i in range(m):
    B[i,:] = [1 if s == '





ans = 0
for i in range(0,n-m+1):
    for j in range(0,n-m+1):
        if (A[i:i+m,j:j+m] == B).all():
            ans = 1
            break

if ans:
    print("Yes")
else:
    print("No")

Solution (Python):
n, m = list(map(int, input().split()))

a_list_list = []

for i in range(0, n):
    a_list_list.append(input().split()[0])

b_list_list = []

for i in range(0, m):
    b_list_list.append(input().split()[0])

def is_match(source_list_list, b_list_list, source_start_x):

    for k in range(len(b_list_list)):
        for l in range(len(b_list_list[0])):
            if source_list_list[k][source_start_x + l] != b_list_list[k][l]:
                return False

    return True







is_ok = False



for j in range(0, n-m+1):
    target_a_list_list = a_list_list[j:j+m]
    for i in range(0, n-m+1):
        
        if is_match(target_a_list_list, b_list_list, i):
            is_ok = True
            break
    if is_ok:
        break

ans = 'Yes' if is_ok else 'No'

print(ans)

Solution (Python):
import sys

def resolve():
    N, M = map(int, input().split())
    A = []
    for i in range(N):
        A.append(input())
    B = []
    for i in range(M):
        B.append(input())

    for i in range(N - M + 1):
        for j in range(N - M + 1):
            for k in range(M):
                if B[k] != A[i+k][j:j+M]:
                    break
                if k == M-1:
                    print('Yes')
                    return

    print('No')

if __name__ == "__main__":
    resolve()

Solution (Python):
n,m = map(int,input().split())
ann = [str(input()) for i in range(n)]
bmm = [str(input()) for i in range(m)]
for y in range (n-m+1):
    for x in range(n-m+1):
        
        flag = True
        for i in range(m):
            if bmm[i] != ann[y+i][x:x+m]:
                flag = False
        if flag == True:
            break
    if flag == True:
      break
if flag == True:
    print('Yes')
else:
    print('No')

Solution (Python):

import sys, math, fractions, itertools

YES = "Yes"  
NO = "No"  

def solve(N: int, M: int, A: "List[str]", B: "List[str]"):
    f = False
    for i in range(N-M+1):
        for j in range(N-M+1):
            flag = True
            for k in range(M):
                for l in range(M):
                    if A[i+k][j+l] != B[k][l]:
                        flag = False
            if flag:
                f = True
    if f:
        print('Yes')
    else:
        print('No')
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    M = int(next(tokens))  
    A = [ next(tokens) for _ in range(N) ]  
    B = [ next(tokens) for _ in range(M) ]  
    solve(N, M, A, B)

if __name__ == '__main__':
    main()

Solution (Python):
def match(x,y):
    ret = True
    for i in range(m):
        for j in range(m):
            if A[y+i][x+j] != B[i][j]:
                ret = False
    return ret


n,m = map(int,input().split())
A = []
for i in range(n):
    A.append(list(input()))
B = []
for i in range(m):
    B.append(list(input()))

flg = False
for i in range(n-m+1):
    for j in range(n-m+1):
        if match(i,j):
            flg = True
print('Yes' if flg else 'No')

Solution (Python):
N,M=[int(x) for x in input().split()]
An=[input() for _ in range(N)]
Bn=[input() for _ in range(M)]
ans='No'
for i in range(N-M+1):
  for c in range(N-M+1):
    for r in range(M):
      if An[i+r][c:c+M]!=Bn[r]:
        break
    else:
      ans='Yes'
    if ans=='Yes':
      break
  if ans=='Yes':
    break
print(ans)

Solution (Python):
n, m = map(int, input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]

def Check(x, y):
    flag = True
    for i in range(m):
        for j in range(m):
            if a[i + y][j + x] != b[i][j]: flag = False
    return flag

ans=False
for i in range(n - m + 1):
    for j in range(n - m + 1):
        if Check(i, j): ans = True
print('Yes' if ans else 'No')

Solution (Python):
N, M = map(int, input().split())
a = [input() for _ in range(N)]
b = [input() for _ in range(M)]

exists = []
for i in range(0, len(a)):
  exists.append([i, a[i].find(b[0])])

for x, y in exists:
  ari = []
  for i in range(0, len(b)):
    if x+i < len(a):
      ari.append(a[x+i][y:y+M])
  if "".join(ari) == "".join(b):
    print("Yes")
    exit()

print("No")

Solution (Python):
N, M = map(int, input().split())

a = []
for x in range(0, N):
  a.append(input())

b = []
for x in range(0, M):
  b.append(input())

exists = []
for i in range(0, len(a)):
  exists.append([i, a[i].find(b[0])])

for x, y in exists:
  ari = []
  for i in range(0, len(b)):
    if x+i < len(a):
      ari.append(a[x+i][y:y+M])
  if "".join(ari) == "".join(b):
    print("Yes")
    exit()

print("No")

Solution (Python):
import numpy as np
n,m = list(map(int, input().split()))
tmp_a = [list(input()) for _ in range(n)]
tmp_b = [list(input()) for _ in range(m)]

a = np.array(tmp_a)
b = np.array(tmp_b)

for a_i in range(n - m + 1):
	for a_j in range(n - m + 1):
		if((a[a_i:a_i + m, a_j:a_j + m] == b).all()):
			print("Yes")
			exit()
print("No")

Solution (Python):
def solve(n, m, a, b):
  for i in range(n - m + 1):
    for j in range(n - m + 1):
      if [row[j:j+m] for row in a[i:i+m]] == b:
        return True
  return False

n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
print('Yes' if solve(n, m, a, b) else 'No')

Solution (Python):
N, M = list(map(int, input().split()))
A = [list(input()) for i in range(N)]
B = [list(input()) for i in range(M)]

for i in range(N - M + 1):
  for j in range(N - M + 1):
    for x in range(M):
      for y in range(M):
        if A[i + x][j + y] != B[x][y]:
          break
      else:
        continue
      break
    else:
      print("Yes")
      exit()
print("No")

Solution (Python):
N,M=map(int,input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]
ans="No"
for i in range(N-M+1):
  for j in range(N-M+1):
    if [a[j:j+M] for a in A[i:i+M]]==B:    
      ans="Yes"
print(ans)

Solution (Python):
n, m = map(int, input().split())
A = [0] * n
B = [0] * m
for i in range(n):
    A[i] = list(input())
for i in range(m):
    B[i] = list(input())

check = 0


for k in range(n-m+1):
    if check == m:
        break
    C = A[k:k+m]
    for i in range(n-m+1):
        if check == m:
            break
        check = 0
        for j in range(m): 
            if C[j][i:i+m] == B[j]:
                check += 1   
            if check == m:
                print('Yes')  
         


if check != m:
    print('No')

Solution (Python):
n, m = map(int, input().split())

a = []
b = []

for i in range(n):
    a.append(list(input()))
for i in range(m):
    b.append(list(input()))



for s_h in range(n - m + 1):
    for s_w in range(n - m + 1):
        flag = True
        for i in range(m):
            for j in range(m):
                if a[s_h + i][s_w + j] != b[i][j]:
                    flag = False
                    break
            if not flag:
                break
        if flag:
            print("Yes")
            break
    if flag:
        break
if not flag:
    print("No")

Solution (Python):
a, b = map(int, input().split())
c = []
d = []
for i in range(a):
    c.append(list(input()))
for i in range(b):
    d.append(list(input()))
for i in range(a - b + 1):
    for j in range(a - b + 1):
        e = True
        for k in range(i, i + b):
            for l in range(j, j + b):
                if c[k][l] != d[k-i][l-j] and e:
                    e = not e
        if e:
            print("Yes")
            exit()
print("No")

Solution (Python):
n, m = map(int, input().split())
a = []
for i in range(n):
    a.append(list(input()))
b = []
for i in range(m):
    b.append(list(input()))
flag = False
for i in range(n - m + 1):
    for j in range(n - m + 1):
        flag2 = True
        for k in range(m):
            if b[k] != a[k + i][j:j + m]:
                flag2 = False
                break
        if flag2 == True:
            flag = True
            break
    if flag == True:
        break
if flag == True:
    print("Yes")
else:
    print("No")

Solution (Python):

import sys
def main():
    num_a, num_b = map(int, input().split())
    data_a = [list(input()) for i in range(num_a)]
    data_b = [list(input()) for i in range(num_b)]

    for i in range(num_a - num_b + 1):
        for j in range(num_a - num_b + 1):
            ok_flg = 1
            for k in range(num_b):
                for l in range(num_b):
                    
                    if data_b[k][l] != data_a[k + i][l + j]:
                        ok_flg = 0
                        break
            if ok_flg:
                print('Yes')
                sys.exit()

    print('No')



if __name__ == '__main__':
    main()

Solution (Python):
n, m = map(int, input().split())
li1 = []
li2 = []
for i in range(n):
	li1.append(input())
for j in range(m):
	li2.append(input())
k = 0	
for i in range(n - m + 1):
	for j in range(n - m + 1):
		x = i
		for k in range(m):
			if li1[x].find(li2[k], j) != j:
				break
			if k == m-1:
				print("Yes")
				exit()
			x += 1
print("No")

Solution (Python):
import numpy as np

N,M = map(int,input().split())
A = np.array([list(input()) for i in range(N)])
B = np.array([list(input()) for i in range(M)])
f = False

for i in range(N-M+1):
  for j in range(N-M+1):
    if (A[i:i+M,j:j+M]==B).all():
      f = True

if f:
  print("Yes")
else:
  print("No")

Solution (Python):
N, M = map(int, input().split())
A = [list(input()) for i in range(N)]
B = [list(input()) for i in range(M)]
ans = 'No'
for i in range(N - M + 1):
    for j in range(N - M + 1):
        count = 0
        for row in range(M):
            for col in range(M):
                if B[row][col] == A[i + row][j + col]:
                    count += 1
        if count == M * M:
            ans = 'Yes'

print(ans)

Solution (Python):
N,M = map(int,input().split())
img_a = [list(input()) for _ in range(N)]
img_b = [list(input()) for _ in range(M)]
ans = "No"

for i in range(N-M+1):
    for j in range(N-M+1):
        cnt = 0
        for row in range(M):
            for col in range(M):
                if img_b[row][col] == img_a[i+row][j+col]:
                    cnt += 1
        if cnt == M*M:
            ans ="Yes"

print(ans)

Solution (Python):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
for i in range(n-m+1):
  for j in range(n-m+1):
    new = [a[k][j:j+m] for k in range(i, i+m)]
    if new == b:
      print("Yes")
      exit()
print("No")

Solution (Python):
N,M = map(int,input().split())

A = []
B = []

for i in range(N):
    A.append(input())
for j in range(M):
    B.append(input())


for i in range(N - M + 1):
    for j in range(N - M + 1):
        l = 0
        i1 = i
        for l in range(M):
            
            if A[i1].find(B[l],j) != j:
                break   
            if l == M-1:
                print("Yes")
                exit()
            i1 +=1

print("No")

Solution (Python):
N, M = map(int, input().split())
A = []
for i in range(0, N):
	A.append(input())
B = []
for i in range(0, M):
	B.append(input())
flag1 = False
for i in range(0, N-M+1):
	for j in range(0, N-M+1):
		flag2 = True
		for p in range(0, M):
			for q in range(0, M):
				if A[i+p][j+q] != B[p][q]:
					flag2 = False
					break
			if not flag2:
				break
		if flag2:
			flag1 = True
			break
	if flag1:
		break
if flag1:
	print('Yes')
else:
	print('No')

Solution (Python):
n,m=map(int,input().split())
i1=[input() for _ in range(n)]
i2=[input() for _ in range(m)]
ans="No"
for i in range(n-m+1):
    for j in range(n-m+1):
        count=0
        for k in range(m):
            if i1[i+k][j:m+j]==i2[k]:
                count+=1
                if count==m:
                    ans="Yes"
print(ans)

Solution (Python):
import sys
n, m = map(int, input().split())
a_list = [input() for _ in range(n)]
b_list = [input() for _ in range(m)]

for i in range(n-m+1):
    for j in range(n-m+1):
        new_list = [a_list[k][j:j+m] for k in range(i,i+m)]
        if(new_list == b_list):
            print('Yes')
            sys.exit()
print('No')

Solution (Python):
N, M = map(int, input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]

for i in range(N - M + 1):
    for j in range(N - M + 1):
        for k in range(M):
            if A[i+k][j:j+M] != B[k][:]:
                break
        else:
            print("Yes")
            exit()

print("No")

Solution (Python):
a, b = map(int, input().split())
c = [list(input())for _ in range(a)]
d = [list(input())for _ in range(b)]
for i in range(a - b + 1):
    for j in range(a - b + 1):
        e = True
        for k in range(i, i + b):
            for l in range(j, j + b):
                if c[k][l] != d[k-i][l-j] and e:
                    e = not e
        if e:
            print("Yes")
            exit()
print("No")

Solution (Python):
N, M = map(int, input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]

def is_same(si, sj, A, B):
     for i in range(M):
          for j in range(M):
               if A[si+i][sj+j] != B[i][j]:
                    return False
     return True

def main():
     for i in range(N-M+1):
          for j in range(N-M+1):
               if is_same(i,j, A, B):
                    return True
     return False

if main():
     print("Yes")
else:
     print("No")

Solution (Python):


n,m = map(int,input().split())
li_a = [list(input()) for _ in range(n)]
li_b = [list(input()) for _ in range(m)]
 
 
for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if li_a[i+k][j:j+m] != li_b[k][:]:
                break
        else:
            print("Yes")
            exit()
            
print("No")

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    a, b = LI()
    a -= 2
    b -= 2
    a %= 13
    b %= 13
    if a > b:
        print("Alice")
    elif a < b:
        print("Bob")
    else:
        print("Draw")
    return


def B():
    n, m = LI()
    a = SR(n)
    b = SR(m)
    if a == b:
        print("Yes")
        return
    for y in range(n - m):
        for x in range(n - m):
            if a[y][x] == b[0][0]:
                flg = 0
                for yi in range(m):
                    for xi in range(m):
                        if b[yi][xi] == a[y + yi][x + xi]:
                            continue
                        flg = 1
                        break
                    if flg:
                        break
                if flg:
                    continue
                print("Yes")
                return
    print("No")
    return


def C():
    return


def D():
    return


if __name__ == '__main__':
    B()

Solution (Python):
a, b = map(int, input().split())
c = []
d = []
for i in range(a):
    c.append(list(input()))
for i in range(b):
    d.append(list(input()))
for i in range(a-b+1):
    for j in range(a-b+1):
        o = True
        for k in range(i, i+b):
            for l in range(j, j+b):
                if c[k][l] != d[k-i][l-j] and o:
                    o = not o
        if o:
            print("Yes")
            exit()
print("No")

Solution (Python):
N,M=map(int,input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]
arr=[]
for i in range(N-M+1):
	for j in range(N-M+1):
		l=list(map(lambda x:x[j:j+M],A[i:i+M]))
		arr.append(all([l[j]==B[j] for j in range(M)]))
print("Yes" if any(arr) else "No")

Solution (Python):
N, M = map(int, input().split())
A = [0]*N
B = [0]*M
for _ in range(N):
    A[_] = input()
for _ in range(M):
    B[_] = input()

res = 'No'

for r in range(N-M+1):
    for c in range(N-M+1):
        if B == [e[r:r+M:1] for e in A[c:c+M:1]]:
            res = 'Yes'
            break

print(res)

Solution (Python):
n,m=map(int,input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]

for i in range(n-m+1):
    for j in range(n-m+1):
        if b==[a[k][j:j+m] for k in range(i,i+m)]:print('Yes');exit()
        else:pass
print('No')

Solution (Python):
a, b = map(int, input().split())
c = []
d = ""
for i in range(a):
    c.append(list(input()))
for i in range(b):
    d += input()
e = []
for i in range(a-b+1):
    for j in range(a-b+1):
        f = ""
        for k in range(b):
            for l in range(b):
                f += c[i+k][j+l]
        e.append(f)
print("Yes" if d in e else "No")

Solution (Python):
n,m = map(int,input().split())
li_a = [list(input()) for _ in range(n)]
li_b = [list(input()) for _ in range(m)]


for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if li_a[i+k][j:j+m] != li_b[k][:]:
                break
        else:
            print("Yes")
            exit()
            
print("No")

Solution (Python):
n,m=map(int, input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
 
for i in range(n-m+1):
    for j in range(n-m+1):
        ans=True
        for k in range(m):
            for l in range(m):
                if a[i+k][j+l] != b[k][l]:
                    ans=False
        if ans:
            print('Yes')
            exit(0)
 
print('No')

Solution (Python):
def main():
    n,m=map(int,input().split(' '))
    a = []
    b = []
    ans = True
    for i in range(n):
        a.append(list(input()))
    for i in range(m):
        b.append(list(input()))
    for i in range(n-m+1):
        for j in range(n-m+1):
            if a[i][j:j+m] == b[0]:
                for k in range(m):
                    if a[i+k][j:j+m] != b[k]:
                        ans = False
                if ans == True:
                    print('Yes')
                    exit()
                ans = True

    print('No')

if __name__ == '__main__':
    main()

Solution (Python):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

def judge() :
    for i in range(N - M + 1) :
        for j in range(N - M + 1) :
            flg = True
            for k in range(M) :
                for l in range(M) :
                    if A[i+k][j+l] != B[k][l] :
                        flg = False
                        break
                    if not flg :
                        break
            if flg :
                return 'Yes'
                    
    return 'No'
    
print(judge())