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

mc = n-m+1
ans = False
for ai in range(0, mc):
  if(ans):
    break
  ind = [x.start() for x in re.finditer(b[0], a[ai])]
  for i in ind:
    if(ans):
      break
    for bi in range(0, mc):
      print(bi,a[ai+bi+1][i:i+m], b[bi+1])
      if(a[ai+bi+1][i:i+m] != b[bi+1]):
        break
      if(bi==mc-1):
        ans = True
if(ans):
  print('Yes')
else:
  print('No')

Fixed submission:
import re
n,m = map(int, input().split())
a = [input().strip() for i in range(n)]
b = [input().strip() for i in range(m)]

mc = n-m+1
ans = False
for ai in range(0, mc):
  if(ans):
    break
  ind = [x.start() for x in re.finditer(b[0], a[ai])]
  if(m==1)and(len(ind)>0):
    ans=True
    break  
  for i in ind:
    if(ans):
      break
    for bi in range(1, m):
      if(a[ai+bi][i:i+m] != b[bi]):
        break
      if(bi==m-1):
        ans = True
        break
if(ans):
  print('Yes')
else:
  print('No')

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

mc = n-m+1
tb = [[0]*mc]*mc
ans = False
for ai in range(0, mc):
  if(ans):
    break
  ind = [x.start() for x in re.finditer(b[0], a[ai])]
  for i in ind:
    if(ans):
      break
    for bi in range(1, mc):
      if(a[ai+bi][i:i+m] != b[bi]):
        break
      if(bi==mc-1):
        ans = True
if(ans):
  print('Yes')
else:
  print('No')

Fixed submission:
import re
n,m = map(int, input().split())
a = [input().strip() for i in range(n)]
b = [input().strip() for i in range(m)]

mc = n-m+1
ans = False
for ai in range(0, mc):
  if(ans):
    break
  ind = [x.start() for x in re.finditer(b[0], a[ai])]
  if(m==1)and(len(ind)>0):
    ans=True
    break  
  for i in ind:
    if(ans):
      break
    for bi in range(1, m):
      if(a[ai+bi][i:i+m] != b[bi]):
        break
      if(bi==m-1):
        ans = True
        break
if(ans):
  print('Yes')
else:
  print('No')

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

mc = n-m+1
tb = [[0]*mc]*mc
ans = False
for ai in range(0, mc):
  if(ans):
    break
  ind = [m.start() for m in re.finditer(b[0], a[ai])]
  for i in ind:
    if(ans):
      break
    for bi in range(1, mc):
      if(a[ai+bi][i:i+m] != b[bi]):
        break
      if(bi==mc-1):
        ans = True
if(ans):
  print('Yes')
else:
  print('No')

Fixed submission:
import re
n,m = map(int, input().split())
a = [input().strip() for i in range(n)]
b = [input().strip() for i in range(m)]

mc = n-m+1
ans = False
for ai in range(0, mc):
  if(ans):
    break
  ind = [x.start() for x in re.finditer(b[0], a[ai])]
  if(m==1)and(len(ind)>0):
    ans=True
    break  
  for i in ind:
    if(ans):
      break
    for bi in range(1, m):
      if(a[ai+bi][i:i+m] != b[bi]):
        break
      if(bi==m-1):
        ans = True
        break
if(ans):
  print('Yes')
else:
  print('No')

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

mc = n-m+1
tb = [[0]*mc]*mc
ans = False
for ai in range(0, mc):
  if(ans):
    break
  ind = [m.start() for m in re.finditer(b[0], a[ai])]
  for i in ind:
    if(ans):
      break
    for bi in range(1, mc):
      if(a[ai+bi][i:i+mc] != b[bi]):
        break
      if(bi==mc-1):
        ans = True
if(ans):
  print('Yes')
else:
  print('No')

Fixed submission:
import re
n,m = map(int, input().split())
a = [input().strip() for i in range(n)]
b = [input().strip() for i in range(m)]

mc = n-m+1
ans = False
for ai in range(0, mc):
  if(ans):
    break
  ind = [x.start() for x in re.finditer(b[0], a[ai])]
  if(m==1)and(len(ind)>0):
    ans=True
    break  
  for i in ind:
    if(ans):
      break
    for bi in range(1, m):
      if(a[ai+bi][i:i+m] != b[bi]):
        break
      if(bi==m-1):
        ans = True
        break
if(ans):
  print('Yes')
else:
  print('No')