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_l=[]
b_l=[]
for i in range(N):
    a_l.append(list(input()))
for i in range(M):
    b_l.extend(input())
count=0
for t in range (N-M+1):
    for k in range(N-M+1):
        tmp=[]
        for i in range(M):
            for j in range(M):
                tmp.append(a_l[t+i][k+j])
        if tmp == b_l:
            break
    if tmp == b_l:
        print('Yes')
        count=1
        break
    else:
        continue
if count==0:
    print('No')

Solution (Python):
n,m = map(int,input().split())
A = [input() for i in range(n)]
B = [input() for i in range(m)]
ans = "No"

for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if B[k] != A[k+i][j:j+m]:
                break
            if k == m-1 and B[k] == A[k+i][j:j+m]:
                ans = "Yes"
                
print(ans)

Solution (Python):
import sys

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

A = [list(sys.stdin.readline().strip()) for _ in range(N)]
B = [list(sys.stdin.readline().strip()) for _ in range(M)]


def check(y, x):
    for i in range(y, y + M):
        if A[i][x:x + M] != B[i - y]:
            return False
    return True

if N == M:
    print("Yes") if check(0, 0) else print("No")
else:
    for i in range(N - M):
        for j in range(N - M):
            if A[i][j] == B[0][0]:
                if check(i, j):
                    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)]
be_included = False

for i in range(N - M + 1):
    for j in range(N - M + 1):
        tmp = [A[k][j:j+M] for k in range(i, i + M)]
        if tmp == B:
            be_included = True
            break
    if be_included:
        break

if be_included:
    print('Yes')
else:
    print('No')

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

for y in range(n-m+1):
    for x in range(n-m+1):
        aa=[a[i][x:x+m] for i in range(y,y+m)]
        if aa==b:
            ok=True
            break
    if ok:
        break
if ok:
    print("Yes")
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'
 
for i in range(N-M+1):
    for j in range(N-M+1):
        cnt=0
        if A[i][j:j+M] ==B[0]:
            for k in range(1,M):
                if A[i+k][j:j+M] == B[k]:
                    cnt+=1
            if cnt==M-1:
                ans='Yes'
                
print(ans)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N, M = map(int, readline().split())
    A = []
    B = []
    for _ in range(N):
        A.append(readline().decode('utf-8').strip())
    for _ in range(M):
        B.append(readline().decode('utf-8').strip())
    AH = N
    AW = len(A[0])
    BH = M
    BW = len(B[0])
    ans = 'No'
    for i in range(AH-BH+1):
        for j in range(AW-BW+1):
            if A[i][j:j+BW] == B[0]:
                for h in range(BH):
                    if A[i+h][j:j+BW] == B[h]:
                        continue
                    else:
                        break
                else:
                    ans = 'Yes'
    print(ans)

if __name__ == '__main__':
    main()

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

for i in range(N-M+1):
    for j in range(N-M+1):
        cnt=0
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l]==B[k][l]:
                    cnt+=1
                    if cnt==M**2:
                        clear=True
                        flag=True
                        break
                else:
                    flag=True
                    break
            if flag:
                break
        if clear:
            break
        else:
            flag=False
            cnt=0
    if clear:
        break

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

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

a = []
for i in range(n):
	s = input()
	a.append(s)
b = []
for i in range(m):
	t = input()
	b.append(t)

for i in range(n-m+1):
	for j in range(n-m+1):
		flg = False
		for k in range(i,i+m):
			for l in range(j,j+m):
				if a[k][l] != b[k-i][l-j]:
					flg = True
					break
			if flg:
				break
		if flg == False:
			print ("Yes")
			exit()
print ("No")

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, m = na()
a = nsn(n)
b = nsn(m)

ans = False
for i in range(n):
    for j in range(n):
        if i + m - 1 >= n or j + m - 1 >= n:
            continue
        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:
            ans = True

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

Solution (Python):
import sys

readline = sys.stdin.readline

def main():
    N, M = map(int, readline().split())
    n = []
    for _ in range(N):
        n.append(list(readline()[:-1]))
    m = []
    for _ in range(M):
        m.append(list(readline()[:-1]))

    s = N - M
    if s == 0:
        if n == m:
            flag = True
        else:
            flag = False

    for i in range(s):
        for j in range(s):
            flag = True
            for k in range(M):
                if n[i+k][j:j+M] != m[k]:
                    flag = False
                    break
            if flag:
                break
        if flag:
            break
    if flag:
        print('Yes')
    else:
        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)]
flag=0
for i in range(n-m+1):
    for j in range(n-m+1):
        flag=0
        for k1 in range(m):
            for k2 in range(m):
                if A[i+k1][j+k2]!=B[k1][k2]:
                    flag=1
                    break
            else:
                continue
            if flag==1:
                break
        else:
            print('Yes')
            exit()
else:
    print('No')

Solution (Python):
import numpy as np


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

    As_arr = np.array(As)
    Bs_arr = np.array(Bs)
    for i in range(n-m+1):
        for j in range(n-m+1):
            xs, xe = i, i+m
            ys, ye = j, j+m
            if np.all(As_arr[ys:ye, xs:xe] == Bs_arr):
                print('Yes')
                exit()
    print('No')


if __name__ == "__main__":
    main()

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

amat=[]
for _ in range(N):
  amat.append([x=="." for x in input()])
bmat=[]
for _ in range(M):
  bmat.append([x=="." for x in input()])



for i in range(N-M+1):
  for j in range(N-M+1):
    isTemplate=True
    for k1 in range(M):
      for k2 in range(M):
        if amat[k1+i][k2+j]!=bmat[k1][k2]:
          isTemplate=False
          break
      if not isTemplate:
        break
    else:
      print("Yes")
      sys.exit(0)
else:
  print("No")

Solution (Python):
import numpy as np
n, m = map(int, input().split())
a = []
for _ in range(n):
    a.append(list(input()))
a = np.array(a)
b = []
for _ in range(m):
    b.append(list(input()))
b = np.array(b)
for dy in range(n-m+1):
    for dx in range(n-m+1):
        if (a[dy:m+dy, dx:m+dx]==b).all():
            print('Yes')
            break
    else:
        continue
    break
else:
    print('No')

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

N, M = map(int, input().split())
A = [0]*N
B = [0]*M

for i in range(N):
	A[i] = input()
for i in range(M):
	B[i] = input()

ans = False
for sy in range(N-M+1):
	for sx in range(N-M+1):
		flag = True
		for iy in range(M):
			if B[iy] != A[sy+iy][sx:sx+M]:
				flag = False
				break
		if flag:
			ans = True
			break

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

Solution (Python):

"""
Created on Thu May 14 17:06:47 2020

@author: shinba
"""
import sys

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

for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if A[j+k][i:i+m] == B[k]:
                continue
            else:
                break
        else:
            print("Yes")
            sys.exit()
else:
    print("No")

Solution (Python):
if __name__ == '__main__':
  n, m = map(int, input().split())
  a_lst = []
  for i in range(n):
    a_lst.append(input())
  b_lst = []
  for i in range(m):
    b_lst.append(input())
  for j in range(n-m+1):
    for k in range(n-m+1):
      flag = 0
      for l in range(m):
        if a_lst[k+l][j:j+m] != b_lst[l]:
          flag = 1
          break
      if flag == 0:
        break
    if flag == 0:
      break
  if flag == 0:
    print("Yes")
  else:
    print("No")

Solution (Python):
from itertools import product

N, M = map(int, input().split(' '))
image = [tuple(input()) for _ in range(N)]
template = [tuple(input()) for _ in range(M)]


def is_matched(template, image, offset_y, offset_x):
    for y, x in product(range(M), range(M)):
        if template[y][x] != image[offset_y + y][offset_x + x]:
            return False
    return True


for y, x in product(range(N - M + 1), range(N - M + 1)):
    if is_matched(template, image, y, x):
        print('Yes')
        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'

for i in range(N-M+1):
    for j in range(N-M+1):
        cnt=0
        if A[i][j:j+M] ==B[0]:
            for k in range(1,M):
                if A[i+k][j:j+M] == B[k]:
                    cnt+=1
            if cnt==M-1:
                ans='Yes'
                
print(ans)

Solution (Python):
N, M = [int(i) for i in input().split()]
AA = []
for _ in range(N):
    AA.append(input())
BB = []
for _ in range(M):
    BB.append(input())

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

print("No")

Solution (Python):
import numpy as np
N, M = map(int, input().split())
A = np.array([int(input().replace("
B = "".join(str(int(input().replace("
mask = (1 << M) - 1
for _ in range(N - M + 1):
    if B in "".join(str(a) for a in A & mask):
        print("Yes")
        break
    A >>= 1
else:
    print("No")

Solution (Python):
n,m = map(int,input().split())
a_list = []
for i in range(n):
  a_list.append(input())
b_list = []  
for i in range(m):
  b_list.append(input())
move = n - m + 1
ans = "No"
for i in range(move):
  for j in range(move):
    check = True
    for k  in range(m):
      for l in range(m):
        if a_list[i + k][j + l] != b_list[k][l] :
          check = False
    if check == True:
      ans = "Yes"
print(ans)

Solution (Python):
import sys
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):
        flg = False
        for k in range(m):
            if flg:
                break
            for l in range(m):
                if b[k][l] != a[i + k][j + l]:
                    flg = True
                    break
        
        if flg:
            pass
        else:
            print('Yes')
            sys.exit()

print('No')

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
a = [readline().rstrip().decode() for _ in range(n)]
b = [readline().rstrip().decode() for _ in range(m)]
print('Yes' if any([aa[x:x + m] for aa in a[y:y + m]] == b for y in range(n - m + 1) for x in range(n - m + 1)) else 'No')

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
a = [readline().rstrip().decode() for _ in range(n)]
b = [readline().rstrip().decode() for _ in range(m)]
for y in range(n - m + 1):
    for x in range(n - m + 1):
        if [aa[x:x + m] for aa in a[y:y + m]] == b:
            print('Yes')
            exit()
print('No')

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
a = [readline().rstrip().decode() for _ in range(n)]
b = [readline().rstrip().decode() for _ in range(m)]
for y in range(n - m + 1):
    for x in range(n - m + 1):
        flag = True
        for i in range(m):
            for j in range(m):
                if a[i + y][j + x] != b[i][j]:
                    flag = False
                    break
            if not flag:
                break
        if flag:
            print('Yes')
            exit()
print('No')

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

ans='No'
i=0
while i+M<=N:
    j=0
    while j+M<=N:
        k=0
        count=0
        while k<M:
            if A[j+k][i:i+M]==B[k]:
                count+=1
            else:
                break
            if count==M:
                ans='Yes'
            k+=1
        j+=1
    i+=1

print(ans)

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

flag=0
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:
      flag=1
print('Yes' if flag==1 else 'No')

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

for i in range(n-m+1):
    for j in range(n-m+1):
        cut = []
        for k in range(m):
            cut.append(As[j+k][i:i+m])
        
        if cut == Bs:
            print("Yes")
            exit()
print("No")

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

ans = 'No'
for i in range(N-M+1):
  for j in range(N-M+1):
    sbstr = ''
    for k in range(M):
      sbstr += ''.join(A[i+k][j:j+M]) 
    if B == sbstr:
      ans = 'Yes'

print(ans)

Solution (Python):
N, M = map(int, input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]
def check(dx, dy):
    cut_A = [[] for _ in range(M)]
    for i in range(dx, dx + M):
        for j in range(dy, dy + M):
            cut_A[i-dx].append(A[i][j])
    return cut_A == B

for dx in range(N-M+1):
    for dy in range(N-M+1):
        if check(dx, dy):
            print("Yes")
            exit()
print("No")

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

for i in range(n):
    a[i] = input()
for i in range(m):
    b[i] = input()
    
f=0
for i in range(n-m+1):
    for j in range(n-m+1):
        acut = [aa[i:i+m] for aa in a[j:j+m]]

        if acut==b:
            f=1
            break
    if f==1: break
print(f*"Yes"+(1-f)*"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):
    for j in range(N):
        flg = True
        for k in range(M):
            for l in range(M):
                try:
                    if A[i+k][j+l] != B[k][l]:
                        flg = False
                except IndexError:
                    flg = False
        if flg:
            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)]

for i in range(N):
    for j in range(N):
        flg = True
        for k in range(M):
            for l in range(M):
                try:
                    if A[i+k][j+l] != B[k][l]:
                        flg = False
                except IndexError:
                    flg = False
        if flg:
            print("Yes")
            exit()

print("No")

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

nl = [list(input()) for _ in range(n)]

ml = [list(input()) for _ in range(m)]



for i in range (0,1+n-m):
    for j in range (0,1+n-m):
        if nl[i][j] ==ml[0][0]:
            flag = 1
            for k in range(0,m):
                for l in range(0,m):
                    if nl[i+k][j+l] !=ml[k][l]:
                        flag = 0
            if flag ==1:
                print("Yes")
                exit() 
print("No")

Solution (Python):
import sys
readline = sys.stdin.readline

def main():
    N, M = map(int, readline().rstrip().split())
    A = [readline().rstrip() for _ in range(N)]
    B = [readline().rstrip() for _ in range(M)]
    if A == B:
        print('Yes')
        return
    for h in range(N-M):
        for w in range(N-M):
            a = [l[w:w+M] for l in A[h:h+M]]
            if a == B:
                print('Yes')
                return

    print('No')

if __name__ == '__main__':
    main()

Solution (Python):
n,m = map(int, input().split())
A = []
for _ in range(n):
  A.append(list(input()))
B = []
for _ in range(m):
  B.append(list(input()))
  
ans = 'No'
for r in range(0, n-m+1):
  for c in range(0, n-m+1):
    row = 0
    while A[r+row][c:c+m] == B[row]:
      row += 1
      if row > m-1:
        ans = 'Yes'
        break

print(ans)

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

flg = False
for y in range(N-M+1):
  for x in range(N-M+1):
    res = True
    for i in range(M):
      if A[y+i][x+i:x+i+M] != B[i][i:i+M]: res = False
    if res: flg = True
    if flg: break
  if flg: break

print("Yes" if flg else "No")

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

res = "No"

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(1,M):
                if A[i+k][j:j+M] == B[k]:
                    pass
                else:
                    break
            else:
                res = "Yes"
                break

print(res)

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

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
      if(k==M-1):
        res="Yes"
          
print(res)

Solution (Python):
def main():
    N, M = map(int, input().split())
    A, B = ['']*N, ['']*M
    for i in range(N):
        A[i] = input()
    for i in range(M):
        B[i] = input()
    ans = False
    len_a = len(A[0])
    len_b = len(B[0])
    for i in range(N - M + 1):
        for j in range(len_a - len_b + 1):
            match = True
            for k in range(M):
                a = A[i + k]
                b = B[k]
                if a[j:j+len_b] != b:
                    match = False
            if match:
                ans = True
                break
        if ans:
            break
    print('Yes' if ans else 'No')

if __name__ == '__main__':
    main()

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

for i in range(N-M+1):
    if B[0] in A[i]:
        for j in range(N-M+1):
            flag = True
            for k in range(M):
                if B[k] != A[i+k][j:j+M]:
                    flag = False
                    break
            if flag:
                print('Yes')
                exit()
print('No')
exit()

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

for dy in range(n-m+1):
    for dx in range(n-m+1):
        flag = True
        for row in range(m):
            for col in range(m):
                if b[row][col] != a[dy+row][dx+col]:
                    flag = False
        if flag:
            print("Yes")
            exit()
print("No")

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

n,m = map(int,input().split())
li = [input() for i in range(n)]
li2 = [input() for i in range(m)]

d = []
for i in range( n - m + 1):
    for j in range( n - m + 1):
        koho = []
        for k in range(m):
            c = ""
            for l in range(m):
                c += li[i+k][j+l]
            koho.append(c)
        if koho == li2:
            print("Yes")
            sys.exit()
print("No")

Solution (Python):
def judge(A,B,n,m):
    C = []
    for i in range(n-m+1):
        for j in range(n-m+1):
            C = [A[i+k][j:m+j] for k in range(m)]
            if B == C:
                return True
    return False

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

    if judge(A,B,N,M):
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Solution (Python):
n,m = map(int,input().split())
A = [list(input()) for _ in range(n)]
B = [list(input()) for _ in range(m)]
ans = False
for i in range(n-m+1):
    for j in range(n-m+1):
        flg = True
        for e, k in enumerate(range(m)):
            if A[i+e][j:j+m] != B[k]:
                flg = False
        if flg:
            ans = True
            break
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)]
for i in range(n-m+1):
  for p in range(n-m+1):
    for c in range(m):
      if B[c] != A[p+c][i:i+m]:
        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):
        flg = True
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l] != B[k][l]:
                    flg = False
        if flg:
            ans = 'Yes'
print(ans)

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

cnt=0
Yes=False
for i in nl:
    if(ml[0] in i):
        idx = i.find(ml[0])
        cnt2=cnt+1
        if m==1:
            Yes = True
            break
        for j in range(1,m):
            if cnt2>n-1:
                break
            elif(not ml[j]==nl[cnt2][idx:idx+m]):
                break
            elif(j==m-1):
                Yes = True
                break
            cnt2+=1
    if(Yes):
        break
    cnt+=1
if Yes:
    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)]
for i in range(n-m+1):
    for j in range(n-m+1):
        flag = True
        if a[i][j] == b[0][0]:
            for k in range(m):
                for l in range(m):
                    if a[i+k][j+l] != b[k][l]:
                        flag = False
                        break
                if not flag:
                    break
        else:
            flag = False
        if flag:
            break
    if flag:
        break
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
import numpy as np

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

A = np.array([list(input()) for _ in range(N)])
B = np.array([list(input()) for _ in range(M)])

T = N - M + 1

for i in range(T):
    for j in range(T):
        if np.sum(A[i:i+M, j:j+M] == B) == M ** 2:
            print('Yes')
            exit(0)
print('No')

Solution (Python):
I = lambda: map(int, input().rstrip().split())
n, m = I()
a = []
b = []
for i in range(n):
    a += [input()]
for i in range(m):
    b += [input()]
flag = 0
for i in range(n - m + 1):
    if flag == 1:
        break
    for j in range(n - m + 1):
        temp = 1
        for k in range(m):
            if temp == 0:
                break
            for l in range(m):
                if a[k + i][l + j] != b[k][l]:
                    temp = 0
                    break
        if temp:
            flag = 1
            break
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
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()))
for i in range(n - m + 1):
  for j in range(n - m + 1):
    if [c[j:j+m] for c in a[i:i+m]] == b:
      print('Yes')
      sys.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):
    flag1 = False
    for j in range(N-M+1):
        flag = True
        for k in range(M):
            if A[i+k][j:j+M] != B[k]:
                flag = False
                break
        if flag:
            ans = 'Yes'
            flag1 = True
            break
    if flag1:
        break
    
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





n,m=mii()

mata=[]
matb=[]

for i in range(n):
    arra=list(ss())
    mata.append(arra)
for i in range(m):
    arrb=list(ss())
    matb.append(arrb)
ans=False

for i in range(n-m+1):
    for j in range(n-m+1):
        chk=0
        for p in range(m):
            for q in range(m):
                if mata[p+i][q+j]==matb[p][q]:
                    chk+=1

        if chk==m*m:
            ans=True
        
if ans:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7


n,m=MI()
picla=[]
picsm=[]
for i in range(n):
    picla.append(input().rstrip())
for i in range(m):
    picsm.append(input().rstrip())
for i in range(n-m+1):
    for j in range(n-m+1):
        count=0
        for k in range(m):
            '''print(picla[i+k][j:j+m],end=" ")
            print(picsm[k])'''
            if picla[i+k][j:j+m]==picsm[k]:
                count+=1
        if count==m:
            print("Yes")
            sys.exit()
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)])
for i in range(N):
    for j in range(N):
        check = A[i:i+M,j:j+M]
        if check.shape != (M,M):
            continue
        if (check==B).all():
            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())

res=0
for i in range(0,n-m+1):
  for k in range(0,n-m+1):
    keep=0
    for j in range(i,i+m):    
      if b[j-i] in a[j][k:k+m]:
        keep+=1
      if keep==m:
        print("Yes")
        res=1
        break
  if res==1:
    break
if res==0:
  print("No")