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)]

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):
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
"""

def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
"""
n ,m= ips()
a= []
b= []
for i in range(n):
    a.append(input())
for i in range(m):
    b.append(input())
left = 0
right =m
for sy in range(n-m+1):
    for sx in range(n-m+1):
        c = []
        for i in range(sy,sy+m):
            c.append(a[i][sx:(sx+m)])
        if c==b:j(1)
j(0)

Solution (Python):

import sys
sys.setrecursionlimit(300000)

YES = "Yes"  
NO = "No"  

def solve(N: int, M: int, A: "List[str]", B: "List[str]"):
    for i in range(N - M + 1):
        for j in range(N - M + 1):
            found = True
            for x in range(M):
                for y in range(M):
                    if A[i + x][j + y] != B[x][y]:
                        found = False
                        break
                if not found:
                    break
            if found:
                print(YES)
                return
    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):
n,m=map(int,input().split())
a=[str(input()) for _ in range(n)]
b=[str(input()) for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        tmp=[]
        for k in range(m):
            tmp.append(a[j+k][i:i+m])
        if tmp==b:
            print("Yes")
            exit()
print("No")

Solution (Python):

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

A = []
B = []

for i in range(N):

    a = input()
    A.append(a)

for i in range(M):

    b = input()
    B.append(b)

if N-M < 0:
    print ("No")

elif N == M:

    flag = True
    for i in range(N):

        for j in range(N):

            if A[i][j] != B[i][j]:

                flag = False

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

else:

    for i in range(N-M+1):

        for j in range(N-M+1):

            flag = True
            for x in range(M):

                for y in range(M):

                    if A[i+x][j+y] != B[x][y]:

                        flag = False

            if flag:
                break
        if flag:
            break

    if flag:
        print("Yes")

    else:
        print("No")

Solution (Python):
import numpy as np

def main():
  n,m = map(int,input().split())
  an = np.array([list(input()) for i in range(n)])
  bm = np.array([list(input()) for i in range(m)])
  
  for i in range(n-m+1):
    for j in range(n-m+1):
      if (an[i:i+m,j:j+m] == bm).all():
        print('Yes')
        exit()
  print('No')
if __name__ == '__main__':
    main()

Solution (Python):
import sys

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):
        for k in range(m):
            if a[i+k][j:j+m] != b[k]:
                break
            if k == m-1:
                print('Yes')
                sys.exit(0)
print('No')

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

i1 = [ input() for i in range(n) ]
i2 = [ input() for i in range(m) ]

for i in range(0, n - m + 1):
    for j in range(0, n - m + 1):
        si = [ x[j:j + m] for x in i1[i:i + m] ]
        if si == i2:
            print("Yes")
            exit(0)
print("No")

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

    for row in range(n - m + 1):
        for index in range(n - m + 1):
            if b == [i[index:index + m] for i in a[row:row + m]]:
                print('Yes')
                return

    print('No')

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    


if __name__ == "__main__":

    main()

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

    for row in range(n - m + 1):
        current_index = 0
        for index in range(n - m + 1):
            current_index = a[row].find(b[0], index)
            if current_index < 0:
                break

            for i in range(m):
                if a[row + i].find(b[i], current_index) != current_index:
                    break
            else:
                print('Yes')
                return

    print('No')


if __name__ == "__main__":

    main()

Solution (Python):
n,m=map(int,input().split())
x='No'
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
def c(i,j):
  global m
  global a
  global b
  for k in range(m):
    for l in range(m):
      if b[k][l]!=a[i+k][j+l]:
        return 0
  return 1
for i in range(n-m+1):
  for j in range(n-m+1):
    if c(i,j)==1:
      x='Yes'
      break
print(x)

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):
        comp = True
        for k in range(m):
            for l in range(m):
                if a[i+k][j+l] != b[k][l]:
                    comp = False
        if comp:
            print("Yes")
            exit(0)
print("No")

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

f = lambda x: 1 if x == "
A = [list(map(f, input())) for _ in range(N)]
B = [list(map(f, input())) for _ in range(M)]

def func():
  for i in range(N-M+1):
    for j in range(N-M+1):
      if all(A[i+k][j+l] == B[k][l] for k in range(M) for l in range(M)):
        return True
  return False

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

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

mat_N = []
for _ in range(N):
    mat_N.append(input())
mat_M = []
for _ in range(M):
    mat_M.append(input())

def chk(y, x):
    for k in range(M):
        if mat_N[y + k][x:M + x] != mat_M[k]:
            return False
    return True

if M <= N:
    for y in range(N-M+1):
        for x in range(N-M+1):
            if chk(y, x):
                print("Yes")
                exit()
print("No")

Solution (Python):
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
A = []
for _ in range(N):
    A.append(list(input()))
    
B = []
for _ in range(M):
    B.append(list(input()))

for dh in range(0,N-M+1):
    for dw in range(0,N-M+1):
        ans = True
        for bh in range(0,M):
            for bw in range(0,M):
                if B[bh][bw] != A[bh+dh][bw+dw]:
                    ans = False
        if ans:
            print("Yes")
            break
    else:
      continue
    break
if ans == False:
    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)])

bl = 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():
      bl = True

answer = 'Yes' if bl else 'No'
print(answer)

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):
    for j in range(N - M + 1):
        flag = True

        for x in range(M):
            if A[j+x][i:i+M] != B[x]:
                flag = False
                break

        if flag == True:
            print('Yes')
            exit()

print('No')

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

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

Solution (Python):
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):
    if b[0] in a[i]:
        p=[]
        for j in range(n-m+1):
            if b[0]==a[i][j:j+m]:
                p.append(j)
        for j in range(1,m):
            for k in p:
                if b[j]!=a[i+j][k:k+m]:
                    p.remove(k)
        if p!=[]:
            print("Yes")
            import sys
            sys.exit()
print("No")

Solution (Python):
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):
    if b[0] in a[i]:
        p=[]
        for j in range(n-m+1):
            if b[0]==a[i][j:j+m]:
                p.append(j)
        for j in range(1,m):
            for k in p:
                if b[j]!=a[i+j][k:k+m]:
                    p.remove(k)
        if p!=[]:
            print("Yes")
            import sys
            sys.exit()
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):
        check = 0
        for ind, s in enumerate(B):
            
            
            if s != A[i + ind][j: j+M]:

                check = 1
        if check == 0:
            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(len(A)-len(B)+1):
    for j in range(len(A)-len(B)+1):
        cond = 1
        for p in range(len(B)):
            for q in range(len(B)):
                if A[i+p][j+q] != B[p][q]:
                    cond = 0
        if cond == 1:
            print("Yes")
            exit()
print("No")

Solution (Python):
n, m = map(int, input().split())
a = []
b = []
flag = False
def check(offset=[0, 0]):
    for i in range(m):
        for j in range(m):
            if a[i + offset[0]][j + offset[1]] != b[i][j]:
                return 1
    return 0

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 check((i,j)) == 0:
            flag = True

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

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

for i in range(n-m+1):
  for j in range(n-m+1):
    for k in range(m):
      if lia[i+k][j:j+m] != lib[k]:
        break
    else:
      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 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 flg:
            ans = 'Yes'
            break
print(ans)

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


for row in range(n-m+1):
    for col in range(n-m+1):
        
        blnOK=True
        for m_row in range(m):
            for m_col in range(m):
                if a_list[row+m_row][col+m_col]!=b_list[m_row][m_col]:
                    blnOK=False
                    break
            if not blnOK:
                break
        if blnOK:
            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)]

F = 0
for i in range(N-M+1):
    for j in range(N-M+1):
        if A[i][j] == B[0][0]:
            F = 1
            for k in range(M):
                for l in range(M):
                    if B[k][l] != A[i+k][j+l]:
                        F = 0
            if F:
                print('Yes')
                quit()
print('No')

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):
        t=True
        for x in range(M):
            if A[i+x][j:j+M]!=B[x]:
                t=False
                break
        if t:
            print("Yes")
            quit()
print("No")

Solution (Python):



N, M = map(int, input().split())
A_list = [input() for i in range(N)]
B_list = [input() for j in range(M)]

for i in range(N - M + 1):
    for j in range(N - M + 1):
        for k in range(M):
            if B_list[k] != A_list[i + k][j:j + M]:
                break
        else:
            print('Yes')
            exit()
else:
    print('No')

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):
        t=True
        for x in range(M):
            if A[i+x][j:j+M]!=B[x]:
                t=False
                break
        if t:
            print("Yes")
            quit()
print("No")

Solution (Python):

n, m = [ int(v) for v in input().split() ]
image = [ input() for i in range(n)]
temp_image = [ input() for i in range(m)]


ans = "No"
for i in range(n-m+1):
    for j in range(n-m+1):
        part_image = [ image[k][j:j+m] for k in range(i,i+m) ]
        if part_image == temp_image:
            ans = "Yes"
print(ans)

Solution (Python):
n,m=map(int,input().split())
al=[input() for _ in range(n)]
bl=[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 bl[k]!=al[i+k][j:j+m]:
                break
        else:
            print('Yes')
            exit()
else:
    print('No')

Solution (Python):
n, m = map(int, input().split())
image = []
template = ''
for i in range(n):
    image.append(input().rstrip())
for i in range(m):
    template += input().rstrip()

for x in range(n - m + 1):
    for y in range(n - m + 1):
        target = ''
        for i in range(m):
            target += ''.join(image[y+i][x:x + m])
        if target == template:
            print('Yes')
            exit()
print('No')

Solution (Python):
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N, M = nl()
A = []
B = []
for i in range(N):
    A.append(s())
for i in range(M):
    B.append(s())

for i in range(N-M+1):
    col = A[i].find(B[0])
    if col >= 0:
        found = True
        for j in range(1, M):
            if A[i+j][col:col+M] != B[j]:
                found = False
                break
        if found:
            print('Yes')
            import sys
            sys.exit()

print('No')

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

for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            test = True
            if (b[k] != a[i+k][j:m+j]):
                test = False
                break
        if(test):
            r = True

if(r):
    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)]
flag = False
for i in range(N - M + 1):
    for j in range(N - M + 1):
        if [r[j: j+M] for r in A[i: i+M]] == B:
            flag = True
            break
    if flag:
        break
print('Yes' if flag else '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())

for i in range(N-M+1):
    for j in range(N-M+1):
        tmp = [A[i+k][j:j+M] for k in range(M)]
        if tmp == B:
            print('Yes')
            exit()
print('No')

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

if A == B:
    print('Yes')
    exit()

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

print('No')

Solution (Python):
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n , m = MI()
a = []
b = []
for i in range(n):
    a.append(IS())
for i in range(m):
    b.append(IS())
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')
                exit()
print('No')

Solution (Python):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
flag = 'No'
for i in range(n - m + 1):
    for j in range(n - m + 1):
        flag = 'Yes'
        for r in range(m):
            for c in range(m):
                if a[i+r][j+c] != b[r][c]:
                    flag = 'No'
                    break
        if flag == 'Yes':
            print(flag)
            quit()
print(flag)

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())
flag=0
for i in range(n-m+1):
  for j in range(n-m+1):
    cnt=0
    for h in range(m):
      if b[h]==a[i+h][j:j+m]:
        cnt+=1
    if cnt==m:
      flag=1
      break
if flag==0:
  print("No")
else:
  print("Yes")

Solution (Python):
N, M = map(int, input().split())
A = []
B = []
flag = False
for i in range(N):
    A.append(input())
for k in range(M):
    B.append(input())
    
for i in range(N-M+1):   
    for k in range(N-M+1):   
        S = []
        for j in range(i, i+M):   
            S.append(A[j][k : k+M])
        if S == B:
            flag = True
if flag:
    print("Yes")
else:
    print("No")

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

if n == 1 and m == 1:
    if dat_a[0][0] == dat_b[0][0]:
        t = True
    else:
        t = False

for i in range(n - m + 1):
    for j in range(n - m + 1):
        for k in range(m):
            
            if dat_a[i + k][j : j + m] != dat_b[k]:
                t = False
                break
            t = True
        if t:
            break
    if t:
        break

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

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


def m():

    def is_match(x, y):
        for i in range(M):
            for j in range(M):
                if A[x+i][y+j] == B[i][j]:
                    pass
                else:
                    return False
        return True

    for x in range(N-M+1):
        for y in range(N-M+1):
            if is_match(x, y):
                return 'Yes'
            else:
                continue
    return 'No'


print(m())

Solution (Python):
N, M = [int(i) for i in 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):
        flag = True
        for r in range(M):
            for c in range(M):
                if A[i + r][j + c] != B[r][c]:
                   flag = False
                   break
        if flag:
            print("Yes")
            quit()
print("No")

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

for i in range(m):
    b+=[input()]
ans='No'
if n==m:
    ans='Yes'

else:
    for i in range(n-m):
        for j in range(n-m):
            for k in range(m):
                if a[i+k][j:j+m]!=b[k]:
                    break
            else:
                ans='Yes'
            if ans=='Yes':
                break
        if ans=='Yes':
            break

   
print(ans)

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)])

bl = 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():
      bl = True

answer = 'Yes' if bl else 'No'
print(answer)

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):
        if a[i][j] == b[0][0]:
            cnt = 0
            for k in range(m):
                if a[i+k][j:j+m] == b[k]: cnt+=1
            if cnt == m:
                print("Yes")
                exit()
print("No")

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

pic1=[]
pic2=[]

for i in range(n):
    pic1.append(input())

for j in range(m):
    pic2.append(input())




ans="No"

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 pic1[i+k][j+l]!=pic2[k][l]:
                    flag=False

            if not flag:
                break
        if flag:
            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 h in range(N - M + 1):
    for i in range(N - M + 1):
        count = 0
        for j in range(M):
            if A[i + j][h:M + h] == B[j]:
                count += 1

                if count == M:
                    ans = 'Yes'

print(ans)

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

A = []
B = []

for _ in range(N):
	A.append(input())

for _ in range(M):
	B.append(input())

judge = False
	
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:
				judge = True

if judge:
	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):
        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='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)]
ans = "Yes"
for i in range(n):
    for j in range(m):
        if b[j] not in a[i]:
            ans = "No"
print(ans)

Solution (Python):
import sys

import numpy as np
import itertools

N, M = list(map(int, sys.stdin.readline().split()))
A = np.array([list(sys.stdin.readline().rstrip()) for _ in range(N)]) == "
B = np.array([list(sys.stdin.readline().rstrip()) for _ in range(M)]) == "

ok = False
for i, j in itertools.product(range(len(A) - len(B) + 1), repeat=2):
    ok |= (A[i: i + len(B), j: j + len(B)] == B).all()

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

Solution (Python):
import sys

import numpy as np

N, M = list(map(int, sys.stdin.readline().split()))
A = np.array([list(sys.stdin.readline().rstrip()) for _ in range(N)]) == '
B = np.array([list(sys.stdin.readline().rstrip()) for _ in range(M)]) == '
size = len(B)

ok = False
for i in range(len(A) - size + 1):
    for j in range(len(A) - size + 1):
        ok |= (A[i:i + size, j:j + size] == B).all()
if ok:
    print('Yes')
else:
    print('No')

Solution (Python):
import itertools
n, m = [int(i) for i in input().split()]
a = [input() for i in range(n)]
b = [input() for i in range(m)]
ans = 0
for i, j in itertools.product(range(n - m + 1), repeat = 2):
    if b == [a[i + _][j:j + m] for _ in range(m)]:
        ans = 1
print(["No", "Yes"][ans])

Solution (Python):
n, m = [int(i) for i in 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):
        a_dash = [a[i+_][j:j+m] for _ in range(m)]
        if b == a_dash:
            print("Yes")
            exit()
else:
    print("No")

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

tg = [input() for _ in range(N)]


tmpl = [input() for _ in range(M)]


for i in range(0,N-M+1):
  for j in range(0,N-M+1):
    if tmpl[0] == tg[i][j:j+M]:
      if N == 1:
        print('Yes')
        exit()
      for k in range(1,M):
        if tmpl[k] != tg[i+k][j:j+M]: break
      else:
        print('Yes')
        exit()
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 = 0

for i in range(n):
    for j in range(n):
        if i+m-1 <= n-1 and j+m-1 <= n-1:
            lili = [['aaa']*m for k in range(m)]
            for h in range(m):
                for w in range(m):
                    
                    
                    lili[h][w] = a[i+h][j+w]

            if b == lili:
                ans += 1

print('Yes' if ans >= 1 else 'No')

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

A = []
B = []
for n in range(N):
    A.append(str(input()))
for m in range(M):
    B.append(str(input()))

count = 0
for i in range(len(B)):
    if B[i] in A[i]:
        count += 1
    else:
        count += 0

if count == len(B):
    print('Yes')
else:
    print('No')

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

Solution (Python):


def solve():
    N, M = list(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 i in range(N-M+1):
        for j in range(N-M+1):
            if A[i][j] == B[0][0]:
                is_contained = True
                for k in range(0, M):
                    for l in range(0, M):
                        if A[i+k][j+l] != B[k][l]:
                            is_contained = False
                            break
                    if not is_contained: break
                if is_contained:
                    print("Yes")
                    return
    print("No")


if __name__ == "__main__":
    solve()

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):
        flag = True
        for k in range(m):
            for l in range(m):
                if a[i+k][j+l] != b[k][l]:
                    flag = False
            if not flag:
                break
        if flag:
            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 - 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 not flag:
                break
        if flag:
            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):
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l]!=B[k][l]:
                    break
            else:
                continue
            break
        else:
            print('Yes')
            exit()
print('No')

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


ans = 'No'

for c in range(n-m+1):
    for d in range(n-m+1):
        C = [a[d+e][c:c+m] for e in range(m)]
        if C == b:
            ans = 'Yes'
    
print(ans)

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


ans = 'No'
for c in range(n-m+1):
    for d in range(n-m+1):
        flag = 0
        for e in range(m):
            if a[d+e][c:c+m] != b[e]:
                flag = 1
        if flag == 0:
            ans = 'Yes'

print(ans)