Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

A = [[0]]*(N+1)
A[N] = str("a")*50
B = [[0]]*M

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

judge = False 

if M==1:
    for j in range(M):
        for i in range(N):
            for k in range(N):
                if B[j]==A[i][k]:
                    judge = True


count = 0   
for i in range(N-M+1):
    for j in range(M):
        if B[j]==A[i][i:i+M] and B[j+1]==A[i+1][i:i+M]:
            count += 1
            
            if count == M - 1:
                judge = True
                break
            
if judge == True:
    print("Yes")
else:
    print("No")

Fixed submission:
N,M = map(int,input().split())

A = [[0]]*N
B = [[0]]*M

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

judge = False 

#行同士で比較していく
for k in range(N-M+1):
    for i in range(N-M+1):
        count = 0
        for j in range(M):
            if B[j]==A[j+i][k:k+M]:
                count += 1
                
                if count == M:
                    judge = True
                    break
            
if judge == True:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

A = [[0]]*(N+1)
A[N] = str("a")*50
B = [[0]]*M

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

judge = False 
count = 0   
for i in range(N-M+1):
    for j in range(M):
        if B[j]==A[i][i:i+M] and B[j+1]==A[i+1][i:i+M]:
            count += 1
            
            if count == M - 1:
                judge = True
                break
if judge == True:
    print("Yes")
else:
    print("No")

Fixed submission:
N,M = map(int,input().split())

A = [[0]]*N
B = [[0]]*M

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

judge = False 

#行同士で比較していく
for k in range(N-M+1):
    for i in range(N-M+1):
        count = 0
        for j in range(M):
            if B[j]==A[j+i][k:k+M]:
                count += 1
                
                if count == M:
                    judge = True
                    break
            
if judge == True:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

A = [[0]]*(N+1)
B = [[0]]*M

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

judge = False 
count = 0   
for i in range(N-M+1):
    for j in range(M):
        if B[j]==A[i][i:i+M] and B[j+1]==A[i+1][i:i+M]:
            count += 1
            
            if count == M - 1:
                judge = True
                break
if judge == True:
    print("Yes")
else:
    print("No")

Fixed submission:
N,M = map(int,input().split())

A = [[0]]*N
B = [[0]]*M

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

judge = False 

#行同士で比較していく
for k in range(N-M+1):
    for i in range(N-M+1):
        count = 0
        for j in range(M):
            if B[j]==A[j+i][k:k+M]:
                count += 1
                
                if count == M:
                    judge = True
                    break
            
if judge == True:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

A = [[0]]*(N+1)
B = [[0]]*M

for i in range(N):
    A[i] = input()
for j in range(M):
    B[j] = input()
 
count = 0   
for i in range(N-M+1):
    for j in range(M):
        if B[j]==A[i][i:i+M] and B[j+1]==A[i+1][i:i+M]:
            count += 1
            
            if count == M - 1:
                print("Yes")
                break
if count != M-1 or count==0:
    print("No")

Fixed submission:
N,M = map(int,input().split())

A = [[0]]*N
B = [[0]]*M

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

judge = False 

#行同士で比較していく
for k in range(N-M+1):
    for i in range(N-M+1):
        count = 0
        for j in range(M):
            if B[j]==A[j+i][k:k+M]:
                count += 1
                
                if count == M:
                    judge = True
                    break
            
if judge == True:
    print("Yes")
else:
    print("No")