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

for _ in range(N):
    A_list.append(list(input()))
for _ in range(M):
    B_list.append(list(input()))
  
match_list =[]
for i in range(N-M+1):
    for j in range(N-M+1):
        if B_list[0] == A_list[i][j:(j+M)]:
            match_list.append([i, j])
        else:
            pass

whole_flag = 0
for k in match_list:
    flag =0
    for l in range(M):
        if A_list[k[0]+l][k[1]:k[1]+M] ==B_list[k[0]+l]:
            flag += 1
        else:
            break
            
    if flag == M:
        print("Yes")
        whole_flag += 1
        
if whole_flag == 0:
    print("No")

Fixed submission:
N, M = map(int, input().split())
A_list = []
B_list = []
for _ in range(N):
    A_list.append(list(input()))
for _ in range(M):
    B_list.append(list(input()))
    

whole_flag = 0
for i in range(N-M+1):
    for j in range(N-M+1):
        flag = 0
        for k in range(M):
            if B_list[k] == A_list[i+k][j:j+M]:
                flag += 1
            else:
                pass
        if flag == M:
            whole_flag += 1
            
if whole_flag == 0:
    print("No")
else:
    print("Yes")

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

for _ in range(N):
    A_list.append(list(input()))
for _ in range(M):
    B_list.append(list(input()))
  
match_list =[]
for i in range(N-M+1):
    for j in range(N-M+1):
        if B_list[0] == A_list[i][j:(j+M)]:
            match_list.append([i, j])
        else:
            pass

flag =0
for k in match_list:
    flag =0
    for l in range(M):
        if A_list[k[0]+l][k[1]:k[1]+M] ==B_list[k[0]+l]:
            flag += 1
        else:
            break
    
    if flag == M:
        print("Yes")
        break
    
    if flag == M:
        print("Yes")
        break

Fixed submission:
N, M = map(int, input().split())
A_list = []
B_list = []
for _ in range(N):
    A_list.append(list(input()))
for _ in range(M):
    B_list.append(list(input()))
    

whole_flag = 0
for i in range(N-M+1):
    for j in range(N-M+1):
        flag = 0
        for k in range(M):
            if B_list[k] == A_list[i+k][j:j+M]:
                flag += 1
            else:
                pass
        if flag == M:
            whole_flag += 1
            
if whole_flag == 0:
    print("No")
else:
    print("Yes")

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

for _ in range(N):
    A_list.append(list(input()))
for _ in range(M):
    B_list.append(list(input()))
  
match_list =[]
for i in range(N-M+1):
    for j in range(N-M+1):
        if B_list[0] == A_list[i][j:(j+M)]:
            match_list.append([i, j])
        else:
            pass

flag =0
for k in match_list:
    flag =0
    for l in range(M):
        print(A_list[k[0]+l][k[1]:k[1]+M])
        print(B_list[k[0]+l])
        
        if A_list[k[0]+l][k[1]:k[1]+M] ==B_list[k[0]+l]:
            flag += 1
        else:
            break
    
    if flag == M:
        print("Yes")
        break

Fixed submission:
N, M = map(int, input().split())
A_list = []
B_list = []
for _ in range(N):
    A_list.append(list(input()))
for _ in range(M):
    B_list.append(list(input()))
    

whole_flag = 0
for i in range(N-M+1):
    for j in range(N-M+1):
        flag = 0
        for k in range(M):
            if B_list[k] == A_list[i+k][j:j+M]:
                flag += 1
            else:
                pass
        if flag == M:
            whole_flag += 1
            
if whole_flag == 0:
    print("No")
else:
    print("Yes")