Buggy python submission (verdict: Runtime Error):
[n,m] = [int(i) for i in input().split()]
a = []
b = []
for i in range(n):
  a.append(input())
for i in range(m):
  b.append(input())
cnt = 0
flag = "No"
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]:
          cnt += 1
    if cnt == m ** 2:
      flag = "Yes"
    else:
      cnt = 0
print(flag)
      

Fixed submission:
[n,m] = [int(i) for i in input().split()]
a = []
b = []
for i in range(n):
    a.append(input())
for i in range(m):
    b.append(input())
cnt = 0
flag = "No"
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]:
                    cnt += 1

        if cnt == m ** 2:
            flag = "Yes"
        else:
            cnt = 0
print(flag)

Buggy python submission (verdict: Runtime Error):
[n,m] = [int(i) for i in input().split()]
a = []
b = []
for i in range(n):
  a.append(input())
for i in range(m):
  b.append(input())
cnt = 0
flag = "No"
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]:
          cnt += 1
    if cnt == m ** 2:
      flag = "Yes"
    else:
      cnt = 0
print(flag)
      

Fixed submission:
[n,m] = [int(i) for i in input().split()]
a = []
b = []
for i in range(n):
    a.append(input())
for i in range(m):
    b.append(input())
cnt = 0
flag = "No"
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]:
                    cnt += 1

        if cnt == m ** 2:
            flag = "Yes"
        else:
            cnt = 0
print(flag)

Buggy python submission (verdict: Runtime Error):
[n,m] = [int(i) for i in input().split()]
a = []
n = []
for i in range(n):
  a.append(input())
for i in range(m):
  b.append(input())

#0,0からm,mまでの全てについて、合致するかどうかを全てのパターンでみる
#2*2だとして、3*3なら4個、4*4なら9個
#→差+1個あると考えて良さそう
ok = 1
for i in range(m):
  for j in range(m):
    for k in range(n - m):
      for l in range(n - m):
        if a[i+k][j+l] != b[i][j]:
          ok = 0

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

Fixed submission:
[n,m] = [int(i) for i in input().split()]
a = []
b = []
for i in range(n):
    a.append(input())
for i in range(m):
    b.append(input())
cnt = 0
flag = "No"
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]:
                    cnt += 1

        if cnt == m ** 2:
            flag = "Yes"
        else:
            cnt = 0
print(flag)

Buggy python submission (verdict: Runtime Error):
[n,m]=[int(i) for i in input().split()]
a=[]
b=""
c=[]
d=""
e=1
#a箱,c箱にそれぞれの画像を用意
for i in range(n):
    b=b+str(input().split())
a.append(b)
for i in range(m):
    d=d+str(input().split())
c.append(d)
print(c)
print(d)
#照合
for i in range(n):
    for j in range(m):
        f=c[j].find(a[i])
        if f!=-1:
            for k in range(m):
                e=e*(a[f:f+m]!=c[f:f+m])
if e==0:
    print("Yes")
else:
    print("No")


Fixed submission:
[n,m] = [int(i) for i in input().split()]
a = []
b = []
for i in range(n):
    a.append(input())
for i in range(m):
    b.append(input())
cnt = 0
flag = "No"
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]:
                    cnt += 1

        if cnt == m ** 2:
            flag = "Yes"
        else:
            cnt = 0
print(flag)